I managed to connect a Ubuntu 12.04 to the corporate network through a SSG5. My environment:
SSG5:
Considerations & some conclusions:
On Ubuntu 14.04, ssh through IPSEC freezes when command outputs longer text. Solution is to adjust MTU of the Ubuntu outgoing interface to lower. In my case 1300.
Commands (effect does not survive reboot):
sudo ip link set wlan0 mtu 1300
ip a s
Someone's real experience, which I followed but simplified his configuration to only what is needed:
http://www.bluetrait.com/archive/2006/09/27/racoon-to-netscreen-vpn-dialup/
In fact this one is clearer:
http://www.prolixium.com/netscreenlinux
ScreenOS Reference Guide Volume 5: VPN
A very detailed guide to connect an OpenBSD to ScreenOS. Although OpenBSD uses a different IPSEC implementation, this Guide helps if I want to later work on a certificate authentication solution. It tells, at least, (1) Screen require CRL to authenticate (2) details for making certificates that work with ScreenOS (3) confirmation of the ScreenOS certificate request type 0 problem that I encountered
http://dl.packetstormsecurity.net/defcon10/dc10-eldridge-mobilevpn/obsd_ns_vpn.html
Man pages:
racoon.conf: http://netbsd.gw.com/cgi-bin/man-cgi?racoon.conf+5+NetBSD-current
setkey: http://www.freebsd.org/cgi/man.cgi?query=setkey&sektion=8
Ubuntu:
SSG5 Set Up
Refer to ScreenOS manual "Site-to-Site VPN Configurations / Policy-Based Site-to-Site VPN, AutoKey IKE", the steps are numbered according to the manual but some configurations changed to make things work:
1. Interfaces: set up DMZ and Untrust interfaces and addresses, done
2. Addresses: set up named addresses for ease of reference, done
3. VPNs -> AutoKey Advanced -> Gateway -> new
VPNs -> AutoKey IKE -> new
4. Route: just setting default gateway in normal way, routing for VPN is not required in this policy based setting; done already
5. Policy:
Ubuntu Set Up
(1) Install necessary software
sudo apt-get install racoon ipsec-tools
On racoon configuration screen, select "direct" as advised.
(2) on EC2 management, set up security group rule to open UDP port 500 and 4500
(3) set up pre-shared-key, edit /etc/racoon/psk.txt, add the key (identical with the one given to server)
202.8.93.18 anything-you-want
(4) Set up security policy, edit /etc/ipsec-tools.conf as follows
flush;
spdflush;
spdadd 10.1.1.1/32 192.1.1.0/24 any -P out ipsec
esp/tunnel/10.1.1.1-200.1.1.1/require;
spdadd 192.1.1.0/24 10.1.1.1/32 any -P in ipsec
esp/tunnel/200.1.1.1-10.1.1.1/require;
This sets up secure policy for traffics, i.e. for incoming traffic checking if policy is conformed and for outgoing traffic act according to policy;
First set of address / range pairs is source / destination selector to match the packet to be inspected. Note addresses of the private (encapsulated) communication is used.
Then the policy part also include source/destination addresses of the end points of the tunnel. In this case, the private IP of Ubuntu (which behind NAT) is used since Ubuntu sees this as the end point. On the other end, public IP is used as SSG5 sits on Internet.
Refer to setkey manual for further details.
Execute the file:
sudo /usr/sbin/setkey -f /etc/ipsec-tools.conf
(5) Set up racoon, edit /etc/racoon/racoon.conf as follows (note this is for fixed IP!)
log notify;
path pre_shared_key "/etc/racoon/psk.txt";
path certificate "/etc/racoon/certs";
remote 200.1.1.1{
exchange_mode main;
nat_traversal on;
my_identifier address 180.1.1.1;
proposal {
encryption_algorithm 3des;
hash_algorithm sha1;
authentication_method pre_shared_key;
dh_group modp1024;
}
}
sainfo address 10.1.1.1/32 any address 192.1.1.0/24 any {
pfs_group modp1024;
encryption_algorithm 3des;
authentication_algorithm hmac_sha1;
compression_algorithm deflate;
}
The "remote" clause is for IKE phase 1, gateway identified by remote address, note the exchange mode, identification and proposal needs to match the settings on ScreenOS. NAT traversal should be on. "dh_group modp1024" corresponds to DH group "g2".
The "sainfo" clause is for phase 2, also the parameters need to match the ScreenOS phase 2 setting ("Standard" in this example).
Refer to racoon.conf manual page for further details.
SSG5 Set Up
Refer to ScreenOS manual "Dial-up VPN / Dial-up / Policy based dial-up VPN, AutoKey IKE".
1. Interfaces: set up DMZ and Untrust interfaces and addresses, done
2. Addresses: set up named addresses for ease of reference, done
3. Objects -> Users -> Local -> New
4. VPNs -> AutoKey Advanced -> Gateway -> new
VPNs -> AutoKey IKE -> new
4. Route: just setting default gateway in normal way, routing for VPN is not required in this policy based setting; done already
5. Policy (untrust -> DMZ):
Ubuntu Set Up
(1) - (4) : see above
Note: although default psk.txt has user fqdn sample, still the IP address designation works... not the user fqdn
(5) Set up racoon, edit /etc/racoon/racoon.conf as follows
Note: usage of "anonymous" for one or both addresses. Since I'm using dynamically assigned addresses it's convenient for me to use it for at least source address.
log notify;
path pre_shared_key "/etc/racoon/psk.txt";
path certificate "/etc/racoon/certs";
remote 200.1.1.1{
exchange_mode aggressive;
nat_traversal on;
my_identifier user_fqdn "any.email@that.you.like";
proposal {
encryption_algorithm 3des;
hash_algorithm sha1;
authentication_method pre_shared_key;
dh_group modp1024;
}
}
sainfo anonymous address 192.1.1.0/24 any {
pfs_group modp1024;
encryption_algorithm 3des;
authentication_algorithm hmac_sha1;
compression_algorithm deflate;
}
A simple script to deal with dynamic IP
Someone contributed some scripts for dealing with this:
http://nhaggin.freeshell.org/wireless-vpn-howto/ar01s06.html
Start racoon in foreground with command "sudo /usr/sbin/racoon -F -f /etc/racoon/racoon.conf"; now ping the remote gateway "ping 192.1.1.1" and then another machine in the remote LAN.
If things don't work, check
If foreground testing is successful, start the daemon.
sudo service racoon start
If start fail, check if another racoon process is running and "killall racoon" if it exists.