I needed to use openconnect from CISCO to be able to logon from my Ubuntu system to someone else’s z/OS system.
This was pretty easy, but understanding some of the under the cover’s bits took a bit of time.
- Use sudo apt install openconnect
- Download the VPNC script from http://www.infradead.org/
- Create the configuration script
- I saved the script as vpnc-script.sh
- Using ls /etc/vpnc showed the directory did not exist. Create it and move the file
- sudo mkdir /etc/vpnc/
- sudo mv vpnc-script.sh /etc/vpnc/
- sudo chmod +x /etc/vpnc/vpnc-script.sh
- You need information from the owners of the vpn server.
- vpn userid
- vpn password
- name of their system
- IP address of their internal system
- tso userid
- tso password
- I created a script (openc.sh), where XXXXX is the short userid, and password is your long userid:
- printf ‘%s’ “password” | sudo openconnect –user=XXXXXX –script=/etc/vpnc/vpnc-script.sh vpn.customer.com
- When you run openc.sh it prompts for your su password on the machine. The print… means you can store the password in the shell script. If you do not specify it, openconnect will prompt you for it.
- Once the connection is made you can use ping 10.66.77.88, or x3270 -model 5 10.66.77.88 to access the system, where 10.66.77.88 is the IP address the owner of the vpn server gave you.
The owner of the vpn server gave me the address of the z/OS machine, my userid and password.
I then used
x3270 -model 5 10.66.77.88 to logon to the system.
I like to hot key to my z/OS sessions. I used Ubuntu “Settings”-> Keyboard shortcuts, and added a shortcut
- name: mvsCust
- Command: wmctrl -a 10.66.77.88
- Hot key: Ctrl + H
The wmctl -a says make the window active which has 10.66.77.88 in the window page title.
When I press Ctrl +H it makes the customers x3270 session the active window.
Change the x3270 colours
I wanted to change the screen colours, to distinguish it from other 3270 sessions. See Making x3270 green screens blue or red, or yellow with green bits.
I had to use SFTP email@example.com to ftp to the remote z/OS system (where colin is my TSO userid).
What happens with openconnect, under the covers.
The handshake has several stages
- Establish a TLS session using the certificate from the server. Once this has completed, any traffic is encrypted. In my case I used the vpn userid and password. The vpn server can be configured to accept certificates instead of userid and password.
- The server sends down configuration information from the vpn server’s configuration. For example
- The IP addresses it supports , such as 10.66.0.0 and netmask 255.255.0.0
- Any changes to the DNS configuration, so it knows to route 10.66.77.78 via the VPN session.
- The “banner” such as “Welcome to mycom.com. Users of this system do so at their own risk”.
- A default domain.
- Which tunnelling device to use – such as tun0.
- How many configuration statements.
- Each set of configuration statements.
- You can see this information by using the -v option on the openconnect command.
- Using the information sent from the the vpn server, the openconnect client creates environment variables.
- The script defined (or defaulted, for example /etc/vpnc/vpnc-script.sh) on the openconnect command is invoked, and it uses these environment variables to manage the ip and dns configuration, changing files like /etc/resolv.conf (the local DNS file).