This commit is contained in:
Mateusz779 2023-04-13 13:32:21 +02:00
parent ac7c61618a
commit e361606807
2 changed files with 17 additions and 16 deletions

2
app.py
View File

@ -48,7 +48,7 @@ def create_conf_post():
key_length = request.form['key_length'] key_length = request.form['key_length']
folder = utils.generate_random_string(5) folder = utils.generate_random_string(5)
try: try:
os.mkdir(folder) os.mkdir(os.path.join(os.getcwd(), 'configs',folder))
authorized_keys_config = request.form['authorized_keys_config'] authorized_keys_config = request.form['authorized_keys_config']
authorized_keys_file = open(folder+"/authorized_keys","w") authorized_keys_file = open(folder+"/authorized_keys","w")
authorized_keys_file.write(authorized_keys_config) authorized_keys_file.write(authorized_keys_config)

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
echo "Parametry podane do skryptu: $@"
kitcrypto_version="0.0.3" kitcrypto_version="0.0.3"
uvpn3_version="3.0.3" uvpn3_version="3.0.3"
@ -9,17 +10,17 @@ while getopts "a:b:c:d:e:i:k:l:m:n:s:" option
do do
case "${option}" case "${option}"
in in
a)akeys=${OPTARG};; a)akeys=${OPTARG};;
b)build="yes";; b)build="yes";;
c)conf=${OPTARG};; c)conf=${OPTARG};;
d)sshconf=${OPTARG};; d)sshconf=${OPTARG};;
i)ini=${OPTARG};; i)ini=${OPTARG};;
k)key=${OPTARG};; k)key=${OPTARG};;
l)keylen=${OPTARG};; l)keylen=${OPTARG};;
m)msmtp=${OPTARG};; m)msmtp=${OPTARG};;
n)name=${OPTARG};; n)name=${OPTARG};;
s)scripts=${OPTARG};; s)scripts=${OPTARG};;
*)usage;; *)usage;;
esac esac
done done
shift $((OPTIND-1)) shift $((OPTIND-1))
@ -83,10 +84,10 @@ if [ -n "$msmtp" ]; then
fi fi
sed -i '/^private_key/c\private_key uVPN.priv' /tmp/output/vpn/$conf sed -i '/^private_key/c\private_key uVPN.priv' /tmp/output/vpn/$(basename "$conf")
sed -i '/^name/c\name '"$name" /tmp/output/vpn/$conf sed -i '/^name/c\name '"$name" /tmp/output/vpn/$(basename "$conf")
sed -i '/^servers_config/c\servers_config '"$ini" /tmp/output/vpn/$conf sed -i '/^servers_config/c\servers_config '"$(basename "$ini")" /tmp/output/vpn/$(basename "$conf")
sed -i '1s/.*/['"$name"']/' /tmp/output/vpn/$ini sed -i '1s/.*/['"$name"']/' /tmp/output/vpn/$(basename "$ini")
cd /tmp/output cd /tmp/output
mkdir configs mkdir configs