This commit is contained in:
Peter Galonza 2025-06-24 16:06:59 +03:00 committed by GitHub
commit 81ca956ba9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View file

@ -124,6 +124,7 @@ WireguardConfigurator::ConnectionData WireguardConfigurator::prepareWireguardCon
.toObject() .toObject()
.value(config_key::subnet_address) .value(config_key::subnet_address)
.toString(protocols::wireguard::defaultSubnetAddress)); .toString(protocols::wireguard::defaultSubnetAddress));
lastIp.setAddress(lastIp.toIPv4Address() + 1);
} else { } else {
lastIp = ips.last(); lastIp = ips.last();
} }

View file

@ -9,10 +9,14 @@ echo $WIREGUARD_SERVER_PUBLIC_KEY > /opt/amnezia/awg/wireguard_server_public_key
WIREGUARD_PSK=$(wg genpsk) WIREGUARD_PSK=$(wg genpsk)
echo $WIREGUARD_PSK > /opt/amnezia/awg/wireguard_psk.key echo $WIREGUARD_PSK > /opt/amnezia/awg/wireguard_psk.key
IFS='.' read -r a b c d <<< "$WIREGUARD_SUBNET_IP"
((d++))
WIREGUARD_SERVER_IP="${a}.${b}.${c}.${d}"
cat > /opt/amnezia/awg/wg0.conf <<EOF cat > /opt/amnezia/awg/wg0.conf <<EOF
[Interface] [Interface]
PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY
Address = $AWG_SUBNET_IP/$WIREGUARD_SUBNET_CIDR Address = $AWG_SERVER_IP/$WIREGUARD_SUBNET_CIDR
ListenPort = $AWG_SERVER_PORT ListenPort = $AWG_SERVER_PORT
Jc = $JUNK_PACKET_COUNT Jc = $JUNK_PACKET_COUNT
Jmin = $JUNK_PACKET_MIN_SIZE Jmin = $JUNK_PACKET_MIN_SIZE

View file

@ -9,9 +9,13 @@ echo $WIREGUARD_SERVER_PUBLIC_KEY > /opt/amnezia/wireguard/wireguard_server_publ
WIREGUARD_PSK=$(wg genpsk) WIREGUARD_PSK=$(wg genpsk)
echo $WIREGUARD_PSK > /opt/amnezia/wireguard/wireguard_psk.key echo $WIREGUARD_PSK > /opt/amnezia/wireguard/wireguard_psk.key
IFS='.' read -r a b c d <<< "$WIREGUARD_SUBNET_IP"
((d++))
WIREGUARD_SERVER_IP="${a}.${b}.${c}.${d}"
cat > /opt/amnezia/wireguard/wg0.conf <<EOF cat > /opt/amnezia/wireguard/wg0.conf <<EOF
[Interface] [Interface]
PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY
Address = $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR Address = $WIREGUARD_SERVER_IP/$WIREGUARD_SUBNET_CIDR
ListenPort = $WIREGUARD_SERVER_PORT ListenPort = $WIREGUARD_SERVER_PORT
EOF EOF