mirror of https://github.com/OpenIPC/firmware.git
26 lines
679 B
Bash
26 lines
679 B
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
modprobe wireguard
|
|
ip link add dev wg0 type wireguard
|
|
|
|
( echo "#"
|
|
echo "[Interface]"
|
|
echo "PrivateKey = $(fw_printenv -n wg_privkey)"
|
|
# echo "Address = $(fw_printenv -n wg_address)"
|
|
# echo "DNS = $(fw_printenv -n wg_dns)"
|
|
echo
|
|
echo "[Peer]"
|
|
echo "Endpoint = $(fw_printenv -n wg_endpoint)"
|
|
echo "PersistentKeepalive = $(fw_printenv -n wg_alive)"
|
|
echo "PublicKey = $(fw_printenv -n wg_pubkey)"
|
|
echo "PresharedKey = $(fw_printenv -n wg_sharkey)"
|
|
echo "AllowedIPs = $(fw_printenv -n wg_allowed)"
|
|
echo "#"
|
|
) >>/tmp/wireguard.conf
|
|
|
|
wg setconf wg0 /tmp/wireguard.conf
|
|
ip address add dev wg0 $(fw_printenv -n wg_address)
|
|
ip link set up dev wg0
|