I had to test IPSec connection on Linux using strongswan as part of a support case i was working on and i collected a lot of good information on how to get this working. So i thought i would share it with you.
Tested on PANOS 7.1.2, Ubuntu 16.04, Strongswan 5.3.5-1
Install Ubuntu Desktop or CentOS into VMWare environment and then install Strongswan application.
Strongswan can be downloaded from https://www.strongswan.org or as a package from https://launchpad.net/ubuntu/+source/strongswan used in this Lab https://launchpad.net/ubuntu/+source/strongswan/5.3.5-1ubuntu3
Note: If your using the ipsec.secrets file for Xauth you need to make sure "xauth-generic" PLUGIN is installed
If you do not already have a Global Protect gateway configuration, configure it the usual way but enable X-Auth Support and provide a group name and password. I don't want to go into too much detail regarding the other aspects of GP configuration as many guides exist regarding the basics, but i created the gateway (no portal needed for Linux clients) a local user, an auth profile for local database, An IPSec Crypto with all available Encryption options.
For testing create a local user on the PAN, and set an auth profile for Local database.
After installing strongswan you should see the conf file in the /etc/ folder.
Edit ipsec.conf and ipsec.secrets using you favorite linux editor and save changes.
Make sure it formatted the same as below.
conn paloalto # This can be called anything for this example its paloalto.
left=x.x.x.x # Linux Client IP or you can use %defaultroute which will pick up the IP Dynamically)
leftid=@#4c696e7578 #text to Hex 'Linux' Group name. Linux = 4c696e7578
right=x.x.x.x #Remote Auth Server [The Gateway IP]
rightsubnet=0.0.0.0/0 #Access Route - Should match Access Route in Gateway Configuration
xauth_identity=Linux #Username - Local/LDAP
# This file holds shared secrets or RSA private keys for authentication.
# RSA private key for this host, authenticating it to any other host
# which knows the public part.
: PSK **** # **** = Group Name Password
Username : XAUTH "password" # Username name = local user on PAN or LDAP and "password" = password user of user.
Once completed remember to save the changes.
Useful Strongswan Commands:
sudo ipsec start #start service
sudo ipsec stop #stop service, use when editing the conf files prior to restarting
sudo ipsec statusall # status of installed plugin, readiness of ipsec basic config.
sudo nano ipsec.conf / ipsec.secrets # ctrl x to save
[ HASH N(AUTH FAILED) ] This is the PSK entry in ipsec.secrets PSK is incorrect or entry not formatted correctly
no XAuth method found - This reports that no XAuth addon is installed such as auth-generic, xauth-pam etc..
no XAuth password found for 'Username' - Incorrect entry or password for XAuth entries in ipsec.secrets, Make sure there is a space between ': XAUTH' or Group name spelt wrong.
XAuth authentication of 'Username' (Myself) failed - This is the user password in the ipsec.secrets XAuth line.
No XAuth password found for 'Username' - username entry for auth_identity entry in ipsec.conf incorrect
No connection? Remote auth Server IP is incorrect i.e. PAN IP of the gateway in ipsec.conf 'right=' Or Client IP incorrect in the ipsec.conf 'left=' Or gateway not configured / not allow connection or some other general connectivity issue.
Example of Successful connection in Linux terminal:
In my example the username and group name is "Linux" Just to confuse myself 🙂
Notice the port is 500 which means that NAT-T is not used (NAT-T uses port 4500) NAT-T in Strongswan (this version) is automatic. I'm also testing it locally from Linux VM to PAN internally, hense why no public IP seen.
Successful Authentication in runtime information for gateway
Palo Alto System Log Successful Authentication
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!