******************************
WORKING RELEASES:
CentOS 8.0
Fedora 31
Mint 19.2
Ubuntu 18.04.03 LTS
Ubuntu 19.10
******************************
Before you begin, please make sure you have a working Remote Access environment using one of the Check Point Endpoint Clients (Windows / MacOS).
OfficeMode is not supported with Libreswan, therefore IP Pool NAT is needed (ex. sk39327).
This is a guide to connect a Linux VPN Client based on Libreswan to your Check Point environment, using certificates from the InternalCA.
Beginning with libreswan all certificates are stored in the NSS database, therefore we need all certificates (User and CP GW) in P12.
Linux Mint 19.2
1) Download the ISO Image linuxmint-19.2-cinnamon-64bit.iso which uses libreswan: 3.23 (netkey)
2) After Mint 19.2 Linux was installed, install the latest libreswan binary using
# sudo apt-get install libreswan
3) Initialize the NSS Database
# sudo ipsec initnss
4) check Database by running
# sudo certutil -L -d sql:/var/lib/ipsec/nss
Gateway / SmartCenter
The first step is to export the Check Point VPN Gateway Certificate from the SmartCenter. Also create a local User in SmartDashboard and export the User p12 Certificate.
R80.30 Jumbo Take 191 - Standalone Firewall VPN Object: home-fw VPN Certificate: defaultCert Encryption Domain: 192.168.0.0/24 |
1) Export the Firewall p12 VPN Certificate (home-fw) from the SmartCenter. To check the Certificate name, open the FW object in SmartDashboard - IPSec VPN - Certificate Nickname (usually defaultCert).
Run in CLI (bash) on the SmartCenter:
Usage: export_p12 -obj <network object> -cert <certobj> -file <filename> -passwd <password>
Mgmt# export_p12 -obj home-fw -cert defaultCert -f home-fw.p12 -passwd 123456
A file named "home-fw.p12" will be generated. Copy this over to the Linux VM.
2)
In the User object create a p12 certificate and copy the file over to the Linux VM. For example: soeren.p12
Make sure that this user is part of the Remote Access community, you can check if the connections works with a Check Point VPN Client using Username / PW for example.
Linux Mint 19.2
Now it is time to import the certificates and to do the libreswan config
1)
Both p12 certificates home-fw.p12 and soeren.p12 are imported using the command "ipsec import"
# sudo ipsec import home-fw.p12
# sudo ipsec import soeren.p12
The following command should display all certificates, also the Certificate Nicknames. The Nickname is important for the libreswan configuration later on.
# sudo certutil -L -d sql:/var/lib/ipsec/nss
# sudo certutil -L -d sql:/etc/ipsec.d # Fedora # CentOS
soeren.p12 uses the Certificate Nickname "soeren" and home-fw.p12 uses the Certificate Nickname "defaultCert".
2)
In /etc/ipsec.conf only enable the logging.
# sudo vi /etc/ipsec.conf
# /etc/ipsec.conf - Libreswan IPsec configuration file
#
# Manual: ipsec.conf.5
config setup
# Normally, pluto logs via syslog. If you want to log to a file,
# specify below or to disable logging, eg for embedded systems, use
# the file name /dev/null
# Note: SElinux policies might prevent pluto writing to a log file at
# an unusual location.
logfile=/var/log/pluto.log
#
# Do not enable debug options to debug configuration issues!
#
# plutodebug "all", "none" or a combation from below:
# "raw crypt parsing emitting control controlmore kernel pfkey
# natt x509 dpd dns oppo oppoinfo private".
# Note: "private" is not included with "all", as it can show confidential
# information. It must be specifically specified
# examples:
# plutodebug="control parsing"
# plutodebug="all crypt"
# Again: only enable plutodebug when asked by a developer
# plutodebug=none
#
# NAT-TRAVERSAL support
# exclude networks used on server side by adding %v4:!a.b.c.0/24
# It seems that T-Mobile in the US and Rogers/Fido in Canada are
# using 25/8 as "private" address space on their wireless networks.
# This range has never been announced via BGP (at least up to 2015)
virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12,%v4:25.0.0.0/8,%v4:100.64.0.0/10,%v6:fd00::/8,%v6:fe80::/10
# There is also a lot of information in the manual page, "man ipsec.conf"
#
# It is best to add your IPsec connections as separate files in /etc/ipsec.d/
include /etc/ipsec.d/*.conf
3) Create a new file called "ra.conf" and "ra.secrets" in /etc/ipsec.d/
#sudo touch /etc/ipsec.d/ra.conf
#sudo touch /etc/ipsec.d/ra.secrets
4) edit the /etc/ipsec.d/ra.conf file
#sudo vi /etc/ipsec.d/ra.conf
conn home
# Right side is libreswan - RoadWarrior
right=%defaultroute # or IP address of the Client
rightcert=soeren # Certificate Nickname of the users
rightid=%fromcert # Certificate ID
# Left side is Check Point
left=xxx.xxx.xxx.xxx # put here your Gateway IP Address
leftsubnet=192.168.0.0/24 # put here your company's network range or 0.0.0.0/0 for any
leftcert=defaultCert # Certificate Nickname of the CP GW
leftid=%fromcert # Certificate ID
# config
type=tunnel
keyingtries=3
disablearrivalcheck=no
authby=rsasig
#ike=aes256-sha1;modp1536 # force AES256, SHA1; DH5 in IKE Phase 1
#phase2alg=aes128-sha1 # force AES128, SHA1 in IKE Phase 2
ikelifetime=8h # IKE Lifetime 8h for IKE Phase P1
salifetime=1h # SA Lifetime 1h for IKE Phase P2
pfs=no # No PFS in IKE Phase 2
mtu=1400 # lower MTU size, if not, several Web Sites won't be accessible
ikev2=no # IKEv2 is not supported by Check Point in RemoteAccess
keyexchange=ike
auto=route
5) Start ipsec with systemctl
# systemctl enable ipsec
# systemctl start ipsec
# systemctl status ipsec (to check if ipsec was started successfully)
6) Initiate VPN connection to Check Point Gateway
# sudo ipsec auto --add home
# systemctl restart ipsec
# sudo ipsec auto --up home
Connection from Client was successfully initialized.
7 ) Logs from Check Point GUI
I still need to test DPD (Dead Peer Detection). If the VPN is removed from the CP side, the connection won't be re-established from libreswan.