add script
This commit is contained in:
parent
020a67b7e0
commit
6b20a596c1
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
|
/__pycache__
|
||||||
/venv
|
/venv
|
||||||
|
/configs/squash
|
||||||
|
74
configs/create.sh
Executable file
74
configs/create.sh
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
usage() { echo "Usage: [-i <ini config>] [-c <conf file>] [-k <pub server key>] [-l <priv key lenght>] [-n <name>] [-s <dir with scripts>]" 1>&2; exit 1; }
|
||||||
|
|
||||||
|
while getopts "i:c:k:l:n:s:" option
|
||||||
|
do
|
||||||
|
case "${option}"
|
||||||
|
in
|
||||||
|
i)ini=${OPTARG};;
|
||||||
|
c)conf=${OPTARG};;
|
||||||
|
k)key=${OPTARG};;
|
||||||
|
l)keylen=${OPTARG};;
|
||||||
|
n)name=${OPTARG};;
|
||||||
|
s)scripts=${OPTARG};;
|
||||||
|
*)usage;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
CONFIGS=$(pwd)
|
||||||
|
echo "${CONFIGS}"
|
||||||
|
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install cmake make g++ gcc libssl-dev libgmp-dev
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
wget -O uVPN.tar.xz https://opensource.krypto-it.pl/uVPN/uVPN-3.0.3.tar.xz
|
||||||
|
mkdir uVPN
|
||||||
|
tar -xvf uVPN.tar.xz -C uVPN
|
||||||
|
rm uVPN.tar.xz
|
||||||
|
mv uVPN/*/* uVPN/
|
||||||
|
|
||||||
|
wget -O kit-crypto.tar.xz https://opensource.krypto-it.pl/kit-crypto-c/kit-crypto-c-0.0.2.tar.xz
|
||||||
|
mkdir kit-crypto
|
||||||
|
tar -xvf kit-crypto.tar.xz -C kit-crypto
|
||||||
|
rm kit-crypto.tar.xz
|
||||||
|
mv kit-crypto/*/* kit-crypto/
|
||||||
|
cd kit-crypto
|
||||||
|
cmake .
|
||||||
|
make
|
||||||
|
|
||||||
|
mkdir ../uVPN.bin
|
||||||
|
cd ../uVPN.bin
|
||||||
|
cmake ../uVPN -DKIT_CRYPTO_INCLUDES=/tmp/kit-crypto/include -DKIT_CRYPTO_LIB=/tmp/kit-crypto/libkitcryptoc_static.a
|
||||||
|
make
|
||||||
|
mkdir /tmp/output
|
||||||
|
echo $keylen
|
||||||
|
./uVPN_rsagen $keylen > /tmp/output/uVPN.priv
|
||||||
|
head -2 /tmp/output/uVPN.priv > /tmp/output/$name.pub
|
||||||
|
|
||||||
|
mv uVPN3 /tmp/output
|
||||||
|
cd $CONFIGS
|
||||||
|
cp $conf /tmp/output
|
||||||
|
cp $ini /tmp/output
|
||||||
|
cp $key /tmp/output
|
||||||
|
if [ "$scripts" ]; then
|
||||||
|
echo "Podano parametr."
|
||||||
|
cp -r $scripts /tmp/output/
|
||||||
|
fi
|
||||||
|
sed -i '/^private_key/c\private_key uVPN.priv' /tmp/output/$conf
|
||||||
|
sed -i '/^name/c\name '"$name" /tmp/output/$conf
|
||||||
|
sed -i '/^servers_config/c\servers_config '"$ini" /tmp/output/$conf
|
||||||
|
sed -i '1s/.*/['"$name"']/' /tmp/output/$ini
|
||||||
|
|
||||||
|
cd /tmp/output
|
||||||
|
mkdir vpn
|
||||||
|
mv * vpn
|
||||||
|
mkdir $CONFIGS/squash/$name
|
||||||
|
mksquashfs . $CONFIGS/squash/$name.squashfs
|
||||||
|
cp /tmp/output/vpn/$name.pub $CONFIGS/squash/$name
|
||||||
|
|
||||||
|
rm -rf /tmp/kit-crypto
|
||||||
|
rm -rf /tmp/uVPN*
|
||||||
|
rm -rf /tmp/output
|
3
configs/scripts/arpinggw.sh
Executable file
3
configs/scripts/arpinggw.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
ip -s -s neigh flush all dev uvpnT2
|
2
configs/scripts/starttap.sh
Executable file
2
configs/scripts/starttap.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
ifconfig uvpnT2 10.20.0.10 netmask 255.255.255.0 up
|
2
configs/server.pub
Normal file
2
configs/server.pub
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
n=[bc9c87dc47d7d5ab794c2bf1e5903bf4cc123dc68494ff512174227a532e90cf05998ba28639319676550fc0be886051fdd37fe7bfe628fe3d2dba5d55ddb62828304c5b2741c571aa93bee20da613712605ffb03deaa343fd7343f236fc79fa71897d1184640397cb8846da2771809f28b72c64afa37302c71df5b7d070b5119f965f18b81d342676268a1fdc83425a195a7054da6335fb539251dede3a377315d481e782467c70eab3205c7340b720e9eb5143542187609b4f9785b73be4480005317925c5c5ef7a68bb85e93a86f201a222b02bb39040b2dc2c5113c5a5d8c8cb7e42cc3d394dadbca5129104c52614966625aa67a6764b30f3283aaf9cd4be4376b31c2368369c1f25695cd5ba534cce56ec931ca88a40782310243510a0c658f8ea59115480b5e98b682f3663ae48c2b129bd007878bd11610e15f48ca966cb51a8405253a4ef204f45a1cbe4a0c0da81f6f561ba53a80ecf2515326db00c5a6e9f30d347b7fccee9847681ea533a01a93481ae095dba5b8f85129c91692c4cd26bc5092f4d83c3c96fb38a160670bd5f93bbee397e7dde27db3b5ed2a663793bbc5164727432804662d617db61653e30bccd3c80ed5e7b0ce9082b5a71545aa0146b1d2b0a285c8999a9f0de2cf0427bc84b1adb1001687e9cc145f56236551db9be3249655910a4ea14a094818e6904e45ec1445c810e975aad5936d]
|
||||||
|
e=[1d060cd9adc6c61c224e7e8362d254ce08253788ca79ac3bffbe7e279e3cd38a2bab33db47628cb2c83cead0712e1e7dbc049f4439e9c23fc064afe537cfe584cb9c76fabcd9cc99aede807de588291c9c2eda0ab8d616c1c4e4b7be538ce6f919b1afbe20c4e6bb6810c11b80a27e203603d10239af74d2ab24ddfc987f4e129dd08aa9edf55daac92bb0b68877ef89c9474573fe6c70f5a70244d9886cc507f3176d8eb24f0e89c7fdf2131979375c4c7bd772f18a65812b3a8a473ddb2e419e6c73572261dd97fa932ae56d9d04d6c1a8612668e1d72cdf4d341fb528eecf790dfab8adeb20059e9e8374356d4013737cf1dacff7d9904fc5f1e7b66b44a2cddc11da908f22b917335a1788d5782ab9db1e97124216e59d386f9a357dea3495d430c68f30adeeb95e15c54006c055dcdf87000c04300dd2e8c19d229def22635e8d52100bdcb7c095a96487ac09327b71398c3cd13956b4b0e918b6650afeda78edc09963a57275216a69026cddda4704c251270ed0deb0fd06a47ca84ee15ca1af97a2994f01a15cb368117be4a9f3e270eb861e8dea96c6d06e3a9e36f499867f1c3bdd78bcef9bac5afbd41437a61bb93b711c8c314bf0a13ae6bfe9452d0cb992e19a9ab9a6ac3ba19f06279fb741d6db7bc072c936980d0561d02143fd5c35d4222a14727cb061021e21496848abfcad4fe533a3ffca76832129c218b2ea753eb4087dc04b8c92672ff8b55e98792d6bd1af63801f900347c35e37d49ad5176a57e72b441db414d98a04ec5ba30425a72a32162871a1149cdfc3852b8f827f43c976e033e010dd2c3dae441dad8a612c13d0baaeee132e08bea9ad0bc1a191eaee8d66855b24c76169bc870ba8c78c915aa61e7761bf08bb96493255e897f17f7192aceb91bd78abc0a8ceb2de411504387bd30deed45dd02326d88c500e02a81c1b319eabaf68128ffa10b4081972bf142bf101ef409526c0d17274537b6f7f7f95e0153c9eba03153a7bf4c1c3dd0a0efe2b732ce9b520b5e46106f4110502bdbd60c8056e825184b9c32e8961339166124f9391e5a85649c5ea99923615fbc32db72e196135d2338449d21c9f64144fe3c9825632dd4a2803e4182710ebdec80b1bc4b561ec7e4e6cbc8ae1c973a0c101add427b1348ad8dab0b4fec546d9645cc0492c0ec10e822e30659239b08c3ab08c5026643537570d6943544a5843f1ca05db00974e159bfc469dd6370e27bc3bf71364c99807742835e774e7932559e800e2195e2b3273e5a562c67d977f0ed8b0e1029b95d98571ccd760e8cb37238113b4934ce630e30210677b42cd75a39b047d2c34a6463179fc44b963e849d308e7dabf71b02b6c1b7cf587d0babd31d3789104affc87ee1416bb545ad03100b9efb058183457fd2f128b03050cb97c0327acf4614d5c725]
|
17
configs/uVPN.conf
Normal file
17
configs/uVPN.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name laptop
|
||||||
|
listen_addr 0.0.0.0
|
||||||
|
listen_port 1194
|
||||||
|
crypto_workers 2
|
||||||
|
checksum_workers 1
|
||||||
|
tap_name uvpnT2
|
||||||
|
servers_config uVPN.ini
|
||||||
|
private_key chuj
|
||||||
|
log_level 1
|
||||||
|
log_file /dev/stderr
|
||||||
|
pid_file uVPN.pid
|
||||||
|
dict_algorithm avl16
|
||||||
|
perf_counter_dump_file /dev/stdout
|
||||||
|
perf_counter_dump_interval 0
|
||||||
|
onTapCreate scripts/starttap.sh
|
||||||
|
onConnectionEnd scripts/arpinggw.sh
|
||||||
|
onConnect scripts/arpinggw.sh
|
23
configs/uVPN.ini
Normal file
23
configs/uVPN.ini
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[aaa]
|
||||||
|
connect_addr = 127.0.0.1
|
||||||
|
connect_port = 1194
|
||||||
|
cipher = aes:ctr
|
||||||
|
checksum = sha256
|
||||||
|
keepalive = 15 30
|
||||||
|
auto_connect = no
|
||||||
|
allow_new_connect = no
|
||||||
|
try_reconnect_sec = 30
|
||||||
|
public_key = aaa.pub
|
||||||
|
output_auth_method = 5
|
||||||
|
|
||||||
|
[server]
|
||||||
|
connect_addr = 192.168.1.31
|
||||||
|
connect_port = 1194
|
||||||
|
cipher = aes:mixed
|
||||||
|
checksum = sha256
|
||||||
|
keepalive = 15 30
|
||||||
|
auto_connect = yes
|
||||||
|
allow_new_connect = yes
|
||||||
|
try_reconnect_sec = 10
|
||||||
|
public_key = server.pub
|
||||||
|
output_auth_method = 4
|
Loading…
Reference in New Issue
Block a user