axustes para openbsd 7.3 en tr4ck.net

This commit is contained in:
Charlie Root 2023-04-25 12:35:54 +02:00
parent 27cab7b65f
commit b278771582
2 changed files with 5 additions and 2 deletions

0
wireguard_client.sh Normal file → Executable file
View File

View File

@ -5,9 +5,10 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
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}"
interface="wg0"
inet_interface="em0"
config_file="/etc/wireguard/${interface}.conf"
pkg_add wireguard-tools
@ -38,9 +39,11 @@ EOF
# pf
cat >> /etc/pf.conf << EOF
# wireguard
pass in on ${interface}
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
sh /etc/netstart ${interface}