From 16732a1e5ca3760ecabc7ce0e6991ea551b01486 Mon Sep 17 00:00:00 2001 From: AndreasNefeli Date: Sat, 23 Jan 2021 20:00:54 +0000 Subject: [PATCH] Upload files to '4. VPN' --- 4. VPN/User1.ovpn | 111 ++++++++++++++++++++++++++++++++++++++++ 4. VPN/create_user.sh | 6 +++ 4. VPN/rm_user.sh | 22 ++++++++ 4. VPN/show_vpnUsers.sh | 2 + 4 files changed, 141 insertions(+) create mode 100644 4. VPN/User1.ovpn create mode 100644 4. VPN/create_user.sh create mode 100644 4. VPN/rm_user.sh create mode 100644 4. VPN/show_vpnUsers.sh diff --git a/4. VPN/User1.ovpn b/4. VPN/User1.ovpn new file mode 100644 index 0000000..1a56473 --- /dev/null +++ b/4. VPN/User1.ovpn @@ -0,0 +1,111 @@ + +client +nobind +dev tun +comp-lzo +resolv-retry infinite +keepalive 15 60 + +remote-cert-tls server +remote 192.168.1.13 1194 udp +float + + +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7vVfFrsgkXC5K +zdtvrW1GnhsZ4fFrw1r78Lg9wyMbB40rFCBGWyNaqC72Pjmcdy9NzpRgxUB5Hdc2 +87sapV0DnXlB6zUqrqJp3VZmi2OL/FpLG6pBaFlguvHlrPw5UgRaZirgWgMVLWxx +1YUYdqWLYeVJSIcdUrNKIM9RxijvSaTyAqrdCt4Fnts51AD8vOh3NqzaHmDEavyW +EEo4oFlasCPOxhFvytHxThAChp32xo4lB/d9FXu/yVKcBT1KX7aw620B2Oj/9pXA +2FHlyQAxXmidx0QD2l6DbtGbsDfHPGj/dELokZ6GGX7/tIJR/nE9OlmEMYVWq9sJ +up1Wod1JAgMBAAECggEBAKNCKXTH5FXyL3NvhracCt4RGaItYIME1DcpAx76danI +rFNc4iAsmxb4EDakr/bHkkRIM7HfdoycjY3E791hFfzR0SOoxYhDawtCpiLwbfXK +0j5kZW8Rrj+28ip3frLeBtkR5ZFJ1UpyQM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7FngtIwTJYHbi6Oe7nKw4l7E68NH8agFXCp8PIT4RrxiZSa2yeo +JJs/zya71FbwaAT7laY+EOhsi5qi/HfOKPjnzJ4fpVJIFp6pCtMThs8vXtysHzS/ +k9GW25+xt9bocEqxT4tOjf6I/X26eFKwcvzlAJY6u0SYKwGeNCQLUkx7ppSeswio +JrAQZFPC0yxGUXt2yXlTOn9yb01bxraB/mgrrvBt+oUd9cC409hTPFnsGnlbDUqZ +C00F0mWVH1v2Ouxanqm56pHiXaj5ARA2yw0BITgB/w== +-----END CERTIFICATE----- + +key-direction 1 + +# +# 2048 bit OpenVPN static key +# +-----BEGIN OpenVPN Static key V1----- +de4f6e2397b6c1e496a203dfe8dfcc84 +88ce9721348425790df84143e2f2e737 +8cb7b53984bfee4d0bddfd12061efe82 +ba7af7cfd49f2f99ff1beef5b45c89c0 +800f410a4b1be52635152a9c2ba21f29 +926d49cda539d9e29ebf35bf26ab40e6 +c52bf23397b673a60cacda7e915d3fed +b2ad40d14fb58fcadec029e843868635 +c4c0c2cd3c9d0d4f5f035ea174c39566 +193365c3745eadca33b0743d2d3c67d8 +eff74e57f99df258130782fc5622f76a +5a27af8dff510cbac77054959b98821e +e23cea375d59c16b0e23fab5d8ae3e11 +6da6359ec571122e1bdc3e49a940aeea +d358f93928b6b36eaed8afa5dac160d6 +3a2bbba147ce67bf523724b7ce275389 +-----END OpenVPN Static key V1----- + + diff --git a/4. VPN/create_user.sh b/4. VPN/create_user.sh new file mode 100644 index 0000000..6fa024b --- /dev/null +++ b/4. VPN/create_user.sh @@ -0,0 +1,6 @@ +USERNAME=User1 +vpn_data=$PWD/openvpn-services/ +docker=registry.vlabs.uniwa.gr:5080/myownvpn + +docker run -v $vpn_data:/etc/openvpn --rm -it $docker easyrsa build-client-full $USERNAME nopass +docker run -v $vpn_data:/etc/openvpn --log-driver=none --rm $docker ovpn_getclient $USERNAME > $USERNAME.ovpn diff --git a/4. VPN/rm_user.sh b/4. VPN/rm_user.sh new file mode 100644 index 0000000..ff43444 --- /dev/null +++ b/4. VPN/rm_user.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +CLIENTNAME=test1 +U=$CLIENTNAME + +vpn_data=$PWD/openvpn-services/ +docker=registry.vlabs.uniwa.gr:5080/myownvpn + +rm -f $vpn_data/pki/reqs/$CLIENTNAME.req +rm -f $vpn_data/pki/private/$CLIENTNAME.key +rm -f $vpn_data/pki/issued/$CLIENTNAME.crt +rm -f $vpn_data/server/ccd/$CLIENTNAME +rm -f $vpn_data/ccd/$CLIENTNAME +pem=$(sudo grep "CN=$U$" $vpn_data/pki/index.txt | cut -f4) + +rm -f $vpn_data/pki/certs_by_serial/$pem.pem +sed -i "/CN=$U$/d" $vpn_data/pki/index.txt +echo $pem +docker run -v $vpn_data:/etc/openvpn --log-driver=none --rm -it $docker ovpn_revokeclient $CLIENTNAME remove + +rm -f $vpn_data_user_config/$CLIENTNAME.ovpn +rm -f $vpn_data_user_config1/$CLIENTNAME.ovpn diff --git a/4. VPN/show_vpnUsers.sh b/4. VPN/show_vpnUsers.sh new file mode 100644 index 0000000..5e20b50 --- /dev/null +++ b/4. VPN/show_vpnUsers.sh @@ -0,0 +1,2 @@ +NAME=swarmlab-vpn-services # name of docker service +docker exec -it $NAME ovpn_listclients