Friday, 4 September 2015

Junos Pulse Secure SmartConnect with DUO on Linux

I want to use my Fedora 22 laptop to connect to the work VPN but SmartConnect with DUO isn't available for Linux yet. So, until there's a proper client, I got it working using a Windows virtual machine for home working, and I can ditch Windows 8 - great!

There are other ways of doing this, not using a virtual machine, but I wanted to use something with a low risk of breaking if there are any software updates in the future.

This solution is only good for accessing Intranet Web sites and for ssh connections, which is exactly what I need.

Here's what working from home looks like now:
  1. Power on the laptop choosing Fedora boot.
  2. Log in.
  3. Start VirtualBox.
    1. Start the Windows 7 VM without the GUI (headless).
    2. Close VirtualBox.
  4. Start Remote Desktop.
    1. Connect to the Windows 7 VM.
    2. Click the SmartConnect icon to connect to the VPN.
    3. Confirm the connection in the Duo Android App.
    4. Close Remote Desktop.

      The VPN session lasts the whole day.
  1. Start an ssh session to the Windows 7 VM with SOCKS enabled.
    1. Connect to a work server to work from for the day with 'screen'.
  2. Start a Web Browser.
    1. Click the 'Socks Proxy' plugin button.
    2. Log in to Jira, Wiki, etc.
All the Intranet sites work, as do HP iLO and Remote Consoles through the iLO, since all DNS queries go to the SOCKS 4 ssh connection.

Setting it all up on Fedora 22


If they aren't installed already, install VirtualBox and Vagrant.
sudo cat >/etc/yum.repos.d/virtualbox.repo <<EnD
[virtualbox]
name=Fedora $releasever - $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
EnD
sudo dnf install virtualbox vagrant
After installation go to the Web Site and install the VirtualBox Extensions so that virtual machines can be started without a GUI (headless) later.

Get a Windows image from vagrant.

This minimal Windows 7 box has an ssh server, BitVise, already installed as a service and a bash shell, Git Bash, so there's not much to do once it's installed.

mkdir win7 
cd win7
vagrant init ferventcoder/win7pro-x64-nocm-lite
vagrant up --provider virtualbox

Once Vagrant has started, stop it.

vagrant halt

Download Firefox for Windows and put it in the win7 folder.

Google for Firefox and download the 64 bit Windows version then put it in the win7 folder created earlier. This folder is accessible by the virtual machine when it's running so Firefox can be easily installed inside the VM.

Start the Windows 7 virtual machine and configure it.

Start VirtualBox then start the Windows 7 VM that vagrant created.

Click on Network then VBOXSVR and open the share.

Run the 'Firefox Setup...' executable to install it.



Now that it's installed, open Firefox and search for Microsoft Security Essentials then download and install it. This is required for SmartConnect to work - it will complain otherwise.

Use Firefox again to get SmartConnect DUO from your IT department. They will have supplied a Web address to get the client from.

Run SmartConnect with DUO and connect to the corporate VPN.

The Windows installation is very limited, but enough of it works to make it completely usable as a VPN proxy.

Minimise the Windows 7 VM window. We don't need it anymore.

SSH to the Windows 7 VM

The following ssh command connects to the VM with SOCKS 4 enabled on port 1337. Use the password, 'vagrant', when prompted.
ssh -D1337 -p2222 vagrant@127.0.0.1
I use this terminal to connect to other hosts on the corporate network using ssh. A bash terminal is available by typing 'bash', '~/.ssh/authorized_keys' can be used (but tick the 'use authorized_keys file' in BitVise), and public/private keys can be put in '~/.ssh/'.

By default the terminal foreground colour is green. Type 'color 7' to make it white.

Install 'Socks Proxy' in the Firefox Web browser.

Install Socks Proxy from Add Ons and set it up as shown:



Other proxies, such as Foxy Proxy, could be used to selectively choose when the socks proxy is used, but this one is really simple, and it works, although all Web traffic will go through the proxy.

Try connecting to corporate Web sites.

Enable the socks proxy plugin using the toolbar button .

Navigate to corporate Web sites and they should work, even web sites that specify ports to use.



No screen clutter - use a headless Windows 7 VM

Windows 7 can be started in headless mode by pressing the 'shift' key when starting the virtual machine in the VirtualBox GUI. Then Remote Desktop can be used to start/stop the VPN. These are the Remote Desktop settings:



That's it!

2 comments:

  1. Thank you shares this article. I found this article more information of writing. You can try this typing help

    ReplyDelete
  2. This comes in very handy if you are working with critical information and don't want anyone to have access to it. benefit of VPN

    ReplyDelete