ancwrd1 / snx-rs

Open Source Linux Client For Check Point VPN Tunnels
GNU Affero General Public License v3.0
116 stars 8 forks source link
checkpoint client ipsec linux network rust snx vpn

Open Source Linux Client for Check Point VPN Tunnels

This project contains the source code for an unofficial Linux client for Check Point VPN, written in Rust.

Advantages Over the Official SNX Client for Linux

Implemented Features

Limitations

Roadmap

System Requirements

DNS resolver configuration

By default, if systemd-resolved is not detected as a global DNS resolver, snx-rs will fall back to modify the /etc/resolv.conf file directly and DNS servers acquired from the tunnel will be used globally. For better privacy, use the split-tunneling provided by systemd-resolved.

In order to find out whether it is already enabled, check the /etc/resolv.conf file:

readlink /etc/resolv.conf

If it is a symlink pointing to /run/systemd/resolve/stub-resolv.conf then it is already configured on your system. Otherwise follow these steps:

  1. sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
  2. sudo systemctl enable --now systemd-resolved
  3. sudo systemctl restart NetworkManager

Differences between SSL and IPSec tunnels

IPSec is recommended for all connections because of the performance and feature set. However, in certain situations, it might not work (for example because of the corporate firewall policies). In this case the SSL tunnel can be used which is a subject to some limitations.

Note: IPSec requires that IPv6 module is enabled in the kernel.

SSL IPSec
Implementation User-space TCP-encapsulated tunnel via TUN device Kernel-space UDP-encapsulated tunnel via native OS support
Performance Up to 2MB/s Close to plain connection, limited by VPN server capacity
Ports TCP port 443 UDP ports 4500 and 500
Supported authentication types
  • Username/password + MFA codes
  • Certificate
  • Username/password + MFA codes
  • Certificate + MFA codes
  • Certificate from hardware token + MFA codes
  • SAML SSO with browser-based authentication

GUI Usage

Command Line Usage

Check the Configuration Options section for a list of all available options. Options can be specified in the configuration file and the path of the file given via -c /path/to/custom.conf command line parameter.

Alternatively, in standalone mode, they can be specified via the command line of the snx-rs executable.

Before the client can establish a connection, it must know the login (authentication) method to use (--login-type or -o option). To find the supported login types, run it with the -m info parameter:

snx-rs -m info -s remote.acme.com

This command will display the supported login types. Use the vpn_XXX identifier as the login type. If a certificate error is returned, try adding the -X true command line parameter to ignore certificate errors.

Example output (may differ for your server):

Supported tunnel protocols:
        IPSec
        SSL
        L2TP
Available login types:
        vpn_Microsoft_Authenticator (Microsoft Authenticator)
        vpn_Emergency_Access (Emergency Access)
        vpn_Username_Password (Username Password)
        vpn_Azure_Authentication (Azure Authentication)
        vpn (Standard)

There are two ways to use the application:

Certificate validation

The following parameters control certificate validation during TLS and IKE exchanges:

Note that enabling any of the insecure options may compromise the channel security.

Certificate Authentication

The following parameters control certificate-based authentication:

Persistent IPSec session (experimental)

A new ike-persist option will save IPSec session to disk and restore it after the service or computer restarts, it will then attempt to automatically reconnect the tunnel without authentication. This parameter works best in combination with the ike-lifetime option: for example, setting ike-lifetime to 604800 will keep the session for 7 days.

Note that most IPSec servers have shorter IKE duration configured, so it may be terminated earlier. There is also a corresponding GUI switch under "Misc settings" category in the settings dialog.

Automatic channel reconnection will happen when running in the standalone mode, when GUI application starts or when snxctl sends the "connect" command.

Additional Usage Notes

Troubleshooting common problems

Problem Solution
deadline has elapsed Check if the correct login type is specified (one of the vpn_XXX identifiers returned from the "-m info" command).
failed to fill whole buffer This error means the IPSec traffic is intercepted by man-in-the-middle, which could be a router doing packet inspection or an attacker.
Unknown device type Make sure IPv6 protocol is enabled in the Linux kernel and 'xfrm' module can be loaded with sudo modprobe xfrm. IPSec support requires IPv6 to be enabled.
[0020] The user is not defined properly Application failed to negotiate IPSec encryption parameters. Usually it means that Check Point server is misconfigured with the obsolete insecure ciphers.
error sending request for url (https://IP_OR_HOSTNAME/clients/) VPN server certificate is self-signed or untrusted. Use ignore-server-cert parameter to disable all HTTPS certificate checks. Use no-cert-check to only disable hostname validation.

Contributing

Pull requests, bug reports, and suggestions are welcome. This is a hobby project I maintain in my free time.

Before opening a PR, make sure to reformat the sources with the cargo fmt command and run it through the cargo clippy for any warnings.

Building from Sources

The easiest way to build the project is using the distrobox:

Acknowledgements

Special thanks to the cpyvpn project for inspiration around SAML and IKEv1 exchange.

License

Licensed under the GNU Affero General Public License version 3. c