Last active
April 24, 2022 21:22
Revisions
-
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,24 +13,26 @@ export wg_pub=`echo -n $wg_key | wg pubkey` [ -z "$wg_endpoint" ] && export wg_endpoint='example.lo:1337' [ -z "$wg_rng" ] && export wg_rng='10.13.37' [ -z "$wg_dns" ] && export wg_dns='9.9.9.9' export wg_port=`echo -n $wg_endpoint | cut -d : -f 2` cat <<EOD > /etc/wireguard/wg0.conf [Interface] Address = ${wg_rng}.1/24 ListenPort = $wg_port PrivateKey = $wg_key #PublicKey = $wg_pub PostUp = sysctl -w net.ipv4.ip_forward=1 PostUp = sysctl -w net.ipv6.conf.all.forwarding=1 PostUp = sysctl -w net.ipv4.conf.all.rp_filter=1 PostUp = sysctl -w net.ipv4.conf.default.rp_filter=1 PostUp = iptables -I INPUT 1 -i ${wg_eth} -p udp --dport ${wg_port} -j ACCEPT PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o $wg_eth -j MASQUERADE PostUp = ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o $wg_eth -j MASQUERADE PostDown = sysctl -w net.ipv4.ip_forward=0 PostDown = sysctl -w net.ipv6.conf.all.forwarding=0 PostDown = sysctl -w net.ipv4.conf.all.rp_filter=0 PostDown = sysctl -w net.ipv4.conf.default.rp_filter=0 PostDown = iptables -D INPUT -i ${wg_eth} -p udp --dport ${wg_port} -j ACCEPT PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o $wg_eth -j MASQUERADE PostDown = ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o $wg_eth -j MASQUERADE -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,8 @@ modprobe wireguard lsmod | grep wireguard mkdir -p /etc/wireguard wg-quick down wg0 2>&1 >/dev/null export wg_key=`wg genkey` export wg_psk=`wg genkey` export wg_pub=`echo -n $wg_key | wg pubkey` -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export wg_psk=`wg genkey` export wg_pub=`echo -n $wg_key | wg pubkey` [ -z "$wg_eth" ] && export wg_eth='ens3' [ -z "$wg_endpoint" ] && export wg_endpoint='example.lo:1337' [ -z "$wg_rng" ] && export wg_rng='10.13.37' [ -z "$wg_dns" ] && export wg_dns='9.9.9.9' -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash apt-get install wireguard qrencode wireguard-dkms -y modprobe wireguard lsmod | grep wireguard -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 0 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,17 +23,13 @@ PrivateKey = $wg_key PostUp = sysctl -w net.ipv4.ip_forward=1 PostUp = sysctl -w net.ipv6.conf.all.forwarding=1 PostUp = sysctl -w net.ipv4.conf.all.rp_filter=1 PostUp = sysctl -w net.ipv4.conf.default.rp_filter=1 PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o $wg_eth -j MASQUERADE PostUp = ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o $wg_eth -j MASQUERADE PostDown = sysctl -w net.ipv4.ip_forward=0 PostDown = sysctl -w net.ipv6.conf.all.forwarding=0 PostDown = sysctl -w net.ipv4.conf.all.rp_filter=0 PostDown = sysctl -w net.ipv4.conf.default.rp_filter=0 PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o $wg_eth -j MASQUERADE PostDown = ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o $wg_eth -j MASQUERADE -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export wg_pub=`echo -n $wg_key | wg pubkey` [ -z "$wg_eth" ] && export wg_eth='ens3' [ -z "$wg_endpoint" ] && export wg_endpoint='example.lo:1337' [ -z "$wg_rng" ] && export wg_rng='10.13.37.' [ -z "$wg_dns" ] && export wg_dns='9.9.9.9' cat <<EOD > /etc/wireguard/wg0.conf @@ -54,6 +55,7 @@ EOD #PublicKey = $wg_pub_cli PrivateKey = $wg_key_cli Address = ${wg_rng}.$i/32 DNS = $wg_dns [Peer] PublicKey = $wg_pub -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 11 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,13 +20,21 @@ ListenPort = `echo -n $wg_endpoint | cut -d : -f 2` PrivateKey = $wg_key #PublicKey = $wg_pub PostUp = sysctl -w net.ipv4.ip_forward=1 PostUp = sysctl -w net.ipv6.conf.all.forwarding=1 PostUp = sysctl -w net.ipv4.conf.all.rp_filter=1 PostUp = sysctl -w net.ipv6.conf.all.rp_filter=1 PostUp = sysctl -w net.ipv4.conf.default.rp_filter=1 PostUp = sysctl -w net.ipv6.conf.default.rp_filter=1 PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o $wg_eth -j MASQUERADE PostUp = ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o $wg_eth -j MASQUERADE PostDown = sysctl -w net.ipv4.ip_forward=0 PostDown = sysctl -w net.ipv6.conf.all.forwarding=0 PostDown = sysctl -w net.ipv4.conf.all.rp_filter=0 PostDown = sysctl -w net.ipv6.conf.all.rp_filter=0 PostDown = sysctl -w net.ipv4.conf.default.rp_filter=0 PostDown = sysctl -w net.ipv6.conf.default.rp_filter=0 PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o $wg_eth -j MASQUERADE PostDown = ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o $wg_eth -j MASQUERADE EOD @@ -45,7 +53,7 @@ EOD [Interface] #PublicKey = $wg_pub_cli PrivateKey = $wg_key_cli Address = ${wg_rng}.$i/32 [Peer] PublicKey = $wg_pub -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,5 +59,4 @@ done chmod 600 /etc/wireguard/* wg-quick up wg0 systemctl enable wg-quick@wg0 -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 8 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export wg_pub=`echo -n $wg_key | wg pubkey` cat <<EOD > /etc/wireguard/wg0.conf [Interface] Address = ${wg_rng}.1/24 ListenPort = `echo -n $wg_endpoint | cut -d : -f 2` PrivateKey = $wg_key #PublicKey = $wg_pub @@ -32,20 +32,20 @@ EOD for i in `seq 2 3`; do export wg_key_cli=`wg genkey` export wg_pub_cli=`echo -n $wg_key_cli | wg pubkey` cat <<EOD >> /etc/wireguard/wg0.conf [Peer] # Name = Client $i PublicKey = $wg_pub_cli PresharedKey = $wg_psk AllowedIPs = ${wg_rng}.$i/32 PersistentKeepalive = 120 EOD cat <<EOD > /etc/wireguard/wg0-cli$i.conf [Interface] #PublicKey = $wg_pub_cli PrivateKey = $wg_key_cli Address = ${wg_rng}.$i/24 [Peer] PublicKey = $wg_pub @@ -56,5 +56,8 @@ EOD qrencode -t ansiutf8 < /etc/wireguard/wg0-cli$i.conf done chmod 600 /etc/wireguard/* wg-quick up wg0 systemctl enable wg-quick@wg0 wg setconf wg0 /etc/wireguard/wg0.conf -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ modprobe wireguard lsmod | grep wireguard mkdir -p /etc/wireguard wg-quick down wg0 export wg_key=`wg genkey` export wg_psk=`wg genkey` export wg_pub=`echo -n $wg_key | wg pubkey` -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export wg_psk=`wg genkey` export wg_pub=`echo -n $wg_key | wg pubkey` [ -z "$wg_eth" ] && export wg_eth='ens3' [ -z "$wg_endpoint" ] && export wg_endpoint='example.lo:1337' [ -z "$wg_rng" ] && export wg_rng='10.13.37.' cat <<EOD > /etc/wireguard/wg0.conf @@ -35,7 +35,7 @@ for i in `seq 2 3`; do cat <<EOD >> /etc/wireguard/wg0.conf [Peer] # Name = Client $i PublicKey = $wg_pub_cli PresharedKey = $wg_psk AllowedIPs = $wg_rng.$i/32 PersistentKeepalive = 120 -
1mm0rt41PC revised this gist
Apr 24, 2022 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,15 @@ #!/bin/bash apt install wireguard qrencode wireguard-dkms modprobe wireguard lsmod | grep wireguard mkdir -p /etc/wireguard export wg_key=`wg genkey` export wg_psk=`wg genkey` export wg_pub=`echo -n $wg_key | wg pubkey` [ -z "$wg_eth" ] && export wg_eth='ens3' [ -z "$wg_endpoint" ] && export wg_endpoint='example.lo:1337' [ -z "$wg_rng" ] && export wg_rng='10.13.37' cat <<EOD > /etc/wireguard/wg0.conf @@ -52,4 +55,5 @@ EOD qrencode -t ansiutf8 < /etc/wireguard/wg0-cli$i.conf done wg-quick up wg0 systemctl enable wg-quick@wg0 -
1mm0rt41PC created this gist
Apr 24, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ #!/bin/bash apt install wireguard qrencode mkdir -p /etc/wireguard export wg_key=`wg genkey` export wg_psk=`wg genkey` export wg_pub=`echo -n $wg_key | wg pubkey` [ -z "$wg_eth" ] && export wg_eth='ens3' [ -z "$wg_endpoint" ] && export wg_endpoint='example.lo:1337' [ -z "$wg_rng" ] && export wg_rng='10.13.37.' cat <<EOD > /etc/wireguard/wg0.conf [Interface] Address = $wg_rng.1/24 ListenPort = `echo -n $wg_endpoint | cut -d : -f 2` PrivateKey = $wg_key #PublicKey = $wg_pub PostUp = sysctl -w net.ipv4.ip_forward=1 PostUp = sysctl -w net.ipv4.conf.all.rp_filter=1 PostUp = sysctl -w net.ipv4.conf.default.rp_filter=1 PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o $wg_eth -j MASQUERADE PostDown = sysctl -w net.ipv4.ip_forward=0 PostDown = sysctl -w net.ipv4.conf.all.rp_filter=0 PostDown = sysctl -w net.ipv4.conf.default.rp_filter=0 PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o $wg_eth -j MASQUERADE EOD for i in `seq 2 3`; do export wg_key_cli=`wg genkey` export wg_pub_cli=`echo -n $wg_key | wg pubkey` cat <<EOD >> /etc/wireguard/wg0.conf [Peer] # Name = Client $i PublicKey = $wg_key_cli PresharedKey = $wg_psk AllowedIPs = $wg_rng.$i/32 PersistentKeepalive = 120 EOD cat <<EOD > /etc/wireguard/wg0-cli$i.conf [Interface] #PublicKey = $wg_pub_cli PrivateKey = $wg_key_cli Address = $wg_rng.$i/24 [Peer] PublicKey = $wg_pub PresharedKey = $wg_psk AllowedIPs = 0.0.0.0/0 Endpoint = $wg_endpoint EOD qrencode -t ansiutf8 < /etc/wireguard/wg0-cli$i.conf done wg-quick up wg0