challenge: use wg tunnel
This commit is contained in:
parent
40c8a8db85
commit
b48fcf23dd
@ -78,3 +78,25 @@ files:
|
||||
|
||||
exec login $@
|
||||
mode: "0755"
|
||||
- path: bin/wg-adlin
|
||||
contents: |
|
||||
#!/bin/sh
|
||||
|
||||
privatekey="$(wg genkey)"
|
||||
grep PrivateKey /etc/wireguard/adlin.conf > /dev/null 2> /dev/null && {
|
||||
privatekey="$(grep PrivateKey /etc/wireguard/adlin.conf | head -n 1 | sed -r 's/^.*=\s*(.+)\s*$/\1/')"
|
||||
}
|
||||
publickey="$(echo $privatekey | wg pubkey)"
|
||||
|
||||
umask 077
|
||||
mkdir -p /etc/wireguard
|
||||
cat > /etc/wireguard/adlin.conf <<EOF
|
||||
[Interface]
|
||||
PrivateKey = $privatekey
|
||||
EOF
|
||||
|
||||
curl -f -d @- http://wg.adlin.nemunai.re:81/register <<EOF >> /etc/wireguard/adlin.conf &&
|
||||
{"PubKey": "${publickey}"}
|
||||
EOF
|
||||
echo -e "[\\e[01;32m+] \\e[01;32mSuccess.\\e[0m Tunnel configuration written to \\e[01m/etc/wireguard/adlin.conf\\e[0m; you have to use the address: \\e[01m$(grep Address= /etc/wireguard/adlin.conf | sed -r 's/^.*=(.*)$/\1/')\\e[0m" || echo -e "[\\e[01;31m-\\e[0m] \\e[01;31mFailure\\e[0m"
|
||||
mode: "0755"
|
||||
|
@ -50,7 +50,8 @@ RUN apk add --no-cache --initdb -p /out \
|
||||
tini \
|
||||
ttf-inconsolata \
|
||||
util-linux \
|
||||
util-linux-doc
|
||||
util-linux-doc \
|
||||
wireguard-tools-wg
|
||||
|
||||
RUN makewhatis /out/usr/share/man
|
||||
|
||||
|
Reference in New Issue
Block a user