From 140c0a55f29d24ba271c647c4beabdfdc513e577 Mon Sep 17 00:00:00 2001 From: cse47126 Date: Sun, 24 Jan 2021 11:00:57 +0000 Subject: [PATCH] Upload files to '' --- 3masterLocal.sh | 13 +++++++++++++ 3worker.sh | 6 ++++++ 3workerRemote.sh | 13 +++++++++++++ connect.sh | 1 + create-user.sh | 6 ++++++ 5 files changed, 39 insertions(+) create mode 100644 3masterLocal.sh create mode 100644 3worker.sh create mode 100644 3workerRemote.sh create mode 100644 connect.sh create mode 100644 create-user.sh diff --git a/3masterLocal.sh b/3masterLocal.sh new file mode 100644 index 0000000..e458770 --- /dev/null +++ b/3masterLocal.sh @@ -0,0 +1,13 @@ +sudo apt update +sudo apt upgrade -y +# Installing a terminal browser +sudo apt-get install lynx -y +# Finding out the worker1IP +network=$(ifconfig | grep inet | sed -n 1p | awk "{print \$2}" | cut -f 1-3 -d "." | sed 's/$/.*/') +worker1IP=$(nmap -sP $network | grep worker_1 | awk '{print $NF}' | tr -d '()') +# Local Forwarding +#connecting via ssh to worker1 and asking to forward +#the service (apache) from his 80 port to master's 5000 port +ssh docker@$worker1IP -L 5000:$worker1IP:80 +#after that if we login to master node in a NEW TAB and lynx localhost:5000 +#we' ll see the worker's1 service accessible inside the master node \ No newline at end of file diff --git a/3worker.sh b/3worker.sh new file mode 100644 index 0000000..2beabbe --- /dev/null +++ b/3worker.sh @@ -0,0 +1,6 @@ +sudo apt update +sudo apt upgrade -y +sudo apt-get install apache2 -y +sudo apt-get install lynx -y +sudo service apache2 start + diff --git a/3workerRemote.sh b/3workerRemote.sh new file mode 100644 index 0000000..3d73302 --- /dev/null +++ b/3workerRemote.sh @@ -0,0 +1,13 @@ +sudo apt update +sudo apt upgrade -y +# Installing a terminal browser +sudo apt-get install lynx -y +# Finding out the masterIP +network=$(ifconfig | grep inet | sed -n 1p | awk "{print \$2}" | cut -f 1-3 -d "." | sed 's/$/.*/') +masterIP=$(nmap -sP $network | grep master | awk '{print $NF}' | tr -d '()') +# Giving access to the remote host (master node)via an ssh connection +#(docker@172.19.0.2) to a service running in our (worker's 1) port 80 +#and forwarding it to the remote's host (master node) port 5002 +ssh -R 5002:localhost:80 docker@$masterIP +#now if we lynx localhost:5002 inside the master node +#we' ll see the worker's1 service accessible inside the master node \ No newline at end of file diff --git a/connect.sh b/connect.sh new file mode 100644 index 0000000..20702be --- /dev/null +++ b/connect.sh @@ -0,0 +1 @@ +sudo openvpn --config Athina.ovpn diff --git a/create-user.sh b/create-user.sh new file mode 100644 index 0000000..dc406f5 --- /dev/null +++ b/create-user.sh @@ -0,0 +1,6 @@ +USERNAME=Athina +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