Upload files
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
24
init.sh
Normal file
24
init.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
find /etc/amnezia/amneziawg -mindepth 1 -delete
|
||||
COUNTER=0
|
||||
for s in $(find /config -name "*.conf")
|
||||
do
|
||||
if test -f ${s}
|
||||
then
|
||||
COUNTER=$(( COUNTER + 1 ))
|
||||
basename=$(basename ${s})
|
||||
name=${basename%.conf}
|
||||
echo awg interface "${name}" will be created from config file "${basename}"
|
||||
cp ${s} /etc/amnezia/amneziawg/${name}.conf
|
||||
chmod 600 /etc/amnezia/amneziawg/${name}.conf
|
||||
awg-quick up ${name}
|
||||
iptables -A FORWARD -i ${name} -j ACCEPT
|
||||
iptables -A FORWARD -o ${name} -j ACCEPT
|
||||
iptables -A FORWARD -i ${name} -o ${name} -j ACCEPT
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $COUNTER -lt 1 ]]
|
||||
then
|
||||
echo "There are no config files in the /config folder"
|
||||
fi
|
||||
Reference in New Issue
Block a user