axustes para openbsd 7.3 en tr4ck.net
This commit is contained in:
parent
27cab7b65f
commit
b278771582
0
wireguard_client.sh
Normal file → Executable file
0
wireguard_client.sh
Normal file → Executable file
@ -5,9 +5,10 @@ if [ "$(id -u)" -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
random_digits=$(LC_ALL=C tr -dc 0-9 </dev/urandom | head -c 4)
|
random_digits=$(echo $RANDOM | cut -c 2-)
|
||||||
server_port="5${random_digits}"
|
server_port="5${random_digits}"
|
||||||
interface="wg0"
|
interface="wg0"
|
||||||
|
inet_interface="em0"
|
||||||
config_file="/etc/wireguard/${interface}.conf"
|
config_file="/etc/wireguard/${interface}.conf"
|
||||||
|
|
||||||
pkg_add wireguard-tools
|
pkg_add wireguard-tools
|
||||||
@ -38,9 +39,11 @@ EOF
|
|||||||
|
|
||||||
# pf
|
# pf
|
||||||
cat >> /etc/pf.conf << EOF
|
cat >> /etc/pf.conf << EOF
|
||||||
|
|
||||||
|
# wireguard
|
||||||
pass in on ${interface}
|
pass in on ${interface}
|
||||||
pass in inet proto udp from any to any port ${server_port}
|
pass in inet proto udp from any to any port ${server_port}
|
||||||
pass out on egress inet from (${interface}:network) nat-to (vio0:0)
|
pass out on egress inet from (${interface}:network) nat-to (${inet_interface}:0)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sh /etc/netstart ${interface}
|
sh /etc/netstart ${interface}
|
||||||
|
Loading…
Reference in New Issue
Block a user