diff --git a/app.py b/app.py index 94c05ce..9c17152 100644 --- a/app.py +++ b/app.py @@ -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) diff --git a/configs/create.sh b/configs/create.sh index abf3553..50144dc 100755 --- a/configs/create.sh +++ b/configs/create.sh @@ -4,9 +4,9 @@ echo "Parametry podane do skryptu: $@" kitcrypto_version="0.0.3" uvpn3_version="3.0.3" -usage() { echo "Usage: [-a ] [-b add executable to output] [-c ] [-d ] [-i ] [-k ] [-l ] [-m ] [-n ] [-o ] [-p ]" 1>&2; exit 1; } +usage() { echo "Usage: [-a ] [-b add executable to output] [-c ] [-d ] [-i ] [-k ] [-l ] [-m ] [-n ] [-o ] [-p ] [-s ]" 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") diff --git a/configs/scripts/arpinggw.sh b/configs/scripts/arpinggw.sh index 6efb4a4..5efe353 100755 --- a/configs/scripts/arpinggw.sh +++ b/configs/scripts/arpinggw.sh @@ -1,3 +1,2 @@ -#!/bin/sh - -ip -s -s neigh flush all dev $TAP +#!/bin/bash +ip -s -s neigh flush all dev $TAP \ No newline at end of file diff --git a/configs/scripts/starttap.sh b/configs/scripts/starttap.sh index 5b570f4..079c68f 100755 --- a/configs/scripts/starttap.sh +++ b/configs/scripts/starttap.sh @@ -1,2 +1,2 @@ -#!/bin/sh -ifconfig $TAP 10.20.0.10 netmask 255.255.255.0 up \ No newline at end of file +#!/bin/bash +ifconfig $TAP ip netmask 255.255.255.0 up \ No newline at end of file