Apart from one other individual attempting to write a similar, albeit more complicated script in python to achieve much the same result, after scouring the net, I’ve been stumped for some basic information, never mind an example of a similar script.
I am using a VPN service that offers a way to configure a VPN tunnel within an SSL wrapper. (the point of this is to avoid DPI)
To begin the processes, you have to open two terminals with superuser rights, in my case Konsole. In one you enter
*** sudo stunnel <SSL Vendor config file.ssl>,
then upon successful completion, into the other terminal you enter
***sudo openvpn <SSL vendor config file.opvn>
***Once both processes have completed, both terminals remain open, neither of which return to a command prompt, so you close them both and the SSL over VPN simply runs.
I have managed to write two scripts, that initiated from the command line achieve the desired result. And here, I am stuck in neutral.
Writing a script and entering it into a terminal window is no faster than simply entering the commands at the command line manually, but it was a learning exercise for me. The goal is to write a script that I can click on, that will open a terminal window with root privileges, launch a script to initiate Stunnel and upon completion, open the next terminal window, launch the next script to initiate OpenVPN. Stunnel must successfully complete before OpenVPN can begin to connect. The windows need to remain open to confirm the processes have successfully completed. If a means is available for the computer to confirm success, optionally the terminals could be automatically closed.
This is what I have managed to cobble together myself with KWrite:
$ cat go.sh
#! /bin/sh
export PATH=$PATH:bin
cd /home/user/vpnconfigrepo
sudo stunnel <VendorConfigfile.ssl>
and then:
$ cat go2.sh
#! /bin/sh
export PATH=$PATH:bin
cd /home/user/vpnconfigrepo
sudo openvpn <VendorConfigFile.ovpn>
If one script could achieve all this then great, but if I could even get these two scripts to actually open up a terminal and visibly, in succession, enter the commands to be run, it would be great. But I have yet to be able to get a script to run without entering it first into the command line. This shouldn’t be that hard should it?
Appreciate your input, thanks.
OpenSUSE Leap 42.1