poprawienie bugu

This commit is contained in:
Mateusz779 2023-04-25 11:01:37 +02:00
parent 991df4330d
commit b293dc5090
4 changed files with 13 additions and 21 deletions

3
app.py
View File

@ -108,11 +108,12 @@ def create_conf_post():
sshd_config_path = os.path.join(os.getcwd(), 'configs', "sshd_config")
sendmail_path = os.path.join(os.getcwd(), 'configs', "sendmail.sh")
msmtp_conf = os.path.join(os.getcwd(), 'configs', "msmtprc")
scripts = os.path.join(os.getcwd(), 'configs', "scripts")
subprocess.run([script_path, "-i "+ini_path, "-c "+conf_path,
"-k "+pub_path, "-l "+key_length, "-n"+config_name,
"-p "+ip, "-a "+authorized_keys_path, "-d "+sshd_config_path,
"-m "+sendmail_path, "-o "+msmtp_conf," > /dev/null 2>&1 "])
"-m "+sendmail_path, "-o "+msmtp_conf, "-s "+scripts," > /dev/null 2>&1 "])
if os.path.exists(folder):
shutil.rmtree(folder)

View File

@ -4,9 +4,9 @@ echo "Parametry podane do skryptu: $@"
kitcrypto_version="0.0.3"
uvpn3_version="3.0.3"
usage() { echo "Usage: [-a <root ssh authorized_keys>] [-b add executable to output] [-c <conf file>] [-d <sshd_config>] [-i <ini config>] [-k <pub server key>] [-l <priv key lenght>] [-m <msmtp script>] [-n <name>] [-o <config for msmtp>] [-p <vpn ipaddress>]" 1>&2; exit 1; }
usage() { echo "Usage: [-a <root ssh authorized_keys>] [-b add executable to output] [-c <conf file>] [-d <sshd_config>] [-i <ini config>] [-k <pub server key>] [-l <priv key lenght>] [-m <msmtp script>] [-n <name>] [-o <config for msmtp>] [-p <vpn ipaddress>] [-s <scripts folder>]" 1>&2; exit 1; }
while getopts "a:b:c:d:e:i:k:l:m:n:o:p:" option
while getopts "a:b:c:d:e:i:k:l:m:n:o:p:s:" option
do
case "${option}"
in
@ -21,6 +21,7 @@ do
n)name=${OPTARG};;
o)msmtp_conf=${OPTARG};;
p)ip=${OPTARG};;
s)scripts=${OPTARG};;
*)usage;;
esac
done
@ -85,20 +86,11 @@ if [ -n "$msmtp_conf" ]; then
cp $msmtp_conf /tmp/output/msmtp
fi
mkdir /tmp/output/vpn/scripts
if [ -n "$scripts" ]; then
cp $scripts /tmp/output/vpn
fi
echo '#!/bin/bash
printenv >> /tmp/starttap
echo "$TAP" >> /tmp/starttap
ifconfig $TAP '$ip' netmask 255.255.255.0 up >> /tmp/starttap' > /tmp/output/vpn/scripts/starttap.sh
echo '#!/bin/bash
printenv
echo "$TAP"
ip -s -s neigh flush all dev $TAP' > /tmp/output/vpn/scripts/arpinggw.sh
chmod +x /tmp/output/vpn/scripts/starttap.sh
chmod +x /tmp/output/vpn/scripts/arpinggw.sh
sed 's/ip/$ip/g' /tmp/output/vpn/scripts/starttap.sh
sed -i '/^private_key/c\private_key uVPN.priv' /tmp/output/vpn/$(basename "$conf")
sed -i '/^tap_name/c\tap_name uvpnT2' /tmp/output/vpn/$(basename "$conf")

View File

@ -1,3 +1,2 @@
#!/bin/sh
#!/bin/bash
ip -s -s neigh flush all dev $TAP

View File

@ -1,2 +1,2 @@
#!/bin/sh
ifconfig $TAP 10.20.0.10 netmask 255.255.255.0 up
#!/bin/bash
ifconfig $TAP ip netmask 255.255.255.0 up