2024-05-11 15:46:59 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Create a new wireguard client
|
|
|
|
|
|
|
|
client_name="ipad tina"
|
|
|
|
client_ip=10.100.0.9
|
2024-05-12 09:32:04 +02:00
|
|
|
private_key=$(wg genkey)
|
|
|
|
public_key=$(echo "$private_key" | wg pubkey)
|
2024-05-11 15:46:59 +02:00
|
|
|
|
2024-05-12 09:32:04 +02:00
|
|
|
cat <<EOF >client.conf
|
2024-05-11 15:46:59 +02:00
|
|
|
[Interface]
|
|
|
|
Address = ${client_ip}/32
|
|
|
|
MTU = 1280
|
|
|
|
ListenPort = 51820
|
|
|
|
PrivateKey = ${private_key}
|
|
|
|
|
|
|
|
[Peer]
|
|
|
|
PublicKey = uWR93xJe5oEbX3DsAYpOS9CuSg1VmXEQxJzdlJpe3DU=
|
|
|
|
Endpoint = ingolf-wagner.de:51820
|
|
|
|
AllowedIPs = 10.100.0.1/24
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat <<EOF
|
|
|
|
## nixos configuration:
|
|
|
|
|
|
|
|
{
|
|
|
|
# ${client_name}
|
|
|
|
publicKey = "${public_key}";
|
|
|
|
allowedIPs = [ "${client_ip}/32" ];
|
|
|
|
}
|
|
|
|
|
|
|
|
## client configuration
|
|
|
|
|
|
|
|
is in ./client.conf
|
|
|
|
|
|
|
|
### QR Code
|
|
|
|
|
|
|
|
for quick configuration
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2024-05-12 09:32:04 +02:00
|
|
|
qrencode -t ansiutf8 <client.conf
|