SlideShare une entreprise Scribd logo
1  sur  6
Télécharger pour lire hors ligne
Securing the Tunnel w/IPsec and Racoon
Now that we have created a network configuration that enables connectivity between the endpoint’s
internal networks, we must encrypt the traffic. Skipping this step would mean that all traffic crossing the
tunnel would be insecure (unless secured by other means). FreeBSD implements IPsec in its kernel, and
along with the security/ipsec-tools port, you can encrypt all traffic that is sent through the tunnel.

Kernel Configuration
IPsec must be configured into the FreeBSD’s kernel configuration file, and he kernel must be rebuilt. I
added the following option and device to my kernel’s configuration file, rebuilt, installed, and rebooted.
options IPSEC
device crypto

#IP security

Security Policies
IPsec security policies must be defined and set to load into the Security Policy Database (SPD). This
enables FreeBSD and racoon to encrypt / decrypt traffic between the two endpoints. The rules can be
defined in a text file, then loaded at boot. I kept my policies in /usr/local/etc/racoon/setkey.conf and the
file contained the following:
Endpoint 1:
flush;
spdflush;
spdadd 172.16.1.0/24 172.16.2.0/24 any -P out ipsecesp/tunnel/192.168.1.1-192.168.2.1/use;
spdadd 172.16.2.0/24 172.16.1.0/24 any -P in ipsecesp/tunnel/192.168.2.1-192.168.1.1/use;
Endpoint 2:
flush;
spdflush;
spdadd 172.16.2.0/24 172.16.1.0/24 any -P out ipsecesp/tunnel/192.168.2.1-192.168.1.1/use;
spdadd 172.16.1.0/24 172.16.2.0/24 any -P in ipsecesp/tunnel/192.168.1.1-192.168.2.1/use;
I added the following to my /etc/rc.conf on each endpoint which tells FreeBSD to enable IPsec and load
the policies into the SPD:
ipsec_enable=”YES”
ipsec_file=”/usr/local/etc/racoon/setkey.conf”
After running /etc/rc.d/ipsec start, I could view the SPD by issuing the setkey -DP command to ensure
the policies were loaded properly.
Configuring Racoon
At this stage, we have IP-IP connectivity configured and tested, IPsec has been compiled into the kernel,
and the IPsec security policy database contains the policies loaded from the setkey.conf file. Now we
must configure the racoon IKE key management daemon. First, you’ll need to make sure your ports are
up to date and install security/ipsec-tools:
cd /usr/ports/security/ipsec-tools
make install clean
After the port installs, you’ll first want to copy the racoon sample configuration file into place, and create
a psk.txt file that will contain the pre-shared key that will be used during racoon’s negotiation process,
and set the owner / permissions appropriately:
cp /usr/local/share/examples/ipsec-tools/racoon.conf.sample /usr/local/etc/racoon/racoon.conf
touch /usr/local/etc/racoon/psk.txt
chownroot:wheel /usr/local/etc/racoon/psk.txt
chmod 600 /usr/local/etc/racoon/psk.txt
Edit the /usr/local/etc/racoon/psk.txt file. It should contain the remote endpoint’s public IP address and a
unique password:
Endpoint 1:
192.168.2.1 SomeMadeUpPassword
Endpoint 2:
192.168.1.1 SomeMadeUpPassword
Next, the racoon.conf file needs to be edited. There are many options to this file, and it’s probably best to
learn all about it via the racoon.conf(5) man page. That being said, the one below is based on a lot of
what I’ve found on the web, and works really nicely for me.
Endpoint 1:
# $KAME: racoon.conf.sample,v 1.28 2002/10/18 14:33:28 itojunExp $
path include “/usr/local/etc/racoon” ;
path pre_shared_key “/usr/local/etc/racoon/psk.txt” ;
log debug;
padding # options are not to be changed
{
maximum_length 20; # maximum padding length
randomize off; # enable randomize length
strict_check off; # enable strict check
exclusive_tail off; # extract last one octet
}
listen # address [port] that racoon will listening on
{
isakmp 192.168.1.1 [500];
}
timer # timing options. change as needed
{
counter 5; # maximum trying count to send
interval 20 sec; # maximum interval to resend
persend 1; # the number of packets per a send
phase1 60 sec;
phase2 25 sec;
}
remote 192.168.2.1 [500]
{
exchange_modeaggressive,main;
doiipsec_doi;
situation identity_only;
lifetime time 8 hour;
initial_contact on;
passive off;
proposal_check obey;
generate_policy off;
proposal {
encryption_algorithm blowfish;
hash_algorithm sha1;
authentication_methodpre_shared_key;
dh_group 5;
}
}
sainfo anonymous
{
pfs_group 5;
lifetime time 12 hour ;
encryption_algorithm blowfish,3des,des;
# authentication_algorithm hmac_md5,hmac_sha1;
authentication_algorithm hmac_sha1;
compression_algorithm deflate ;
}
Endpoint 2:
# $KAME: racoon.conf.sample,v 1.28 2002/10/18 14:33:28 itojunExp $
path include “/usr/local/etc/racoon” ;
path pre_shared_key “/usr/local/etc/racoon/psk.txt” ;
log debug;
padding # options are not to be changed
{
maximum_length 20; # maximum padding length
randomize off; # enable randomize length
strict_check off; # enable strict check
exclusive_tail off; # extract last one octet
}
listen # address [port] that racoon will listening on
{
isakmp 192.168.2.1 [500];
}
timer # timing options. change as needed
{
counter 5; # maximum trying count to send
interval 20 sec; # maximum interval to resend
persend 1; # the number of packets per a send
phase1 60 sec;
phase2 25 sec;
}
remote 192.168.1.1 [500]
{
exchange_modeaggressive,main;
doiipsec_doi;
situation identity_only;
lifetime time 8 hour;
initial_contact on;
passive off;
proposal_check obey;
generate_policy off;
proposal {
encryption_algorithm blowfish;
hash_algorithm sha1;
authentication_methodpre_shared_key;
dh_group 5;
}
}
sainfo anonymous
{
pfs_group 5;
lifetime time 12 hour ;
encryption_algorithm blowfish,3des,des;
# authentication_algorithm hmac_md5,hmac_sha1;
authentication_algorithm hmac_sha1;
compression_algorithm deflate ;
}
Starting Racoon
Now that everything is in place, you’ll want to add racoon to start at boot in /etc/rc.conf, and then start it
on both sides to and check to make sure the negotiation was successful. I found the best way to do this
is to add the configuration lines to each endpoint’s /etc/rc.conf, then start racoon and review the SAD
tables and racoon log files. First add the lines to /etc/rc.conf:
racoon_enable=”yes”
racoon_flags=”-l /var/log/racoon.log”
Start racoon on each host:
/usr/local/etc/rc.d/racoon start
After starting racoon, ping endpoint 2′s internal IP address from endpoint 1, this will get the negotiation
process under way if it’s not already. There are two ways to validate that the negotiation was successful.
The first is to review the /var/log/racoon.log file and check for signs of success. You should see
something like:
2011-11-21 12:15:16: INFO: IPsec-SA established: ESP/Tunnel 192.168.1.1[500]->192.168.2.1[500]
spi=56832670(0x363329e)
The other way is to use setkey to dump the SAD tables, which will only exist if the IPsec negotiation was
successful:
setkey -D
You should see output displaying the encryption algorithms that are being used, as well as other
information.

Validating Encryption
Before you can sleep at night knowing your VPN is secure, you should run some simple tests to make
sure traffic is being encrypted. tcpdump is a good way to do this. On one endpoint, or both, use tcpdump
to dump the public interface’s traffic and look to make sure you see ESP records:
tcpdump -n -i re0 host 192.168.1.1 and dst 192.168.2.1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on re0, link-type EN10MB (Ethernet), capture size 65535 bytes
18:51:29.800977 IP 192.168.1.1 > 192.168.2.1: ESP(spi=0x0693d993,seq=0×7), length 116
18:51:31.713245 IP 192.168.1.1 > 192.168.2.1: ESP(spi=0x0693d993,seq=0×8), length 116
If encryption isn’t working place, you’ll see something more along the lines of:
18:56:47.315538 IP 192.168.1.1.63035 > 192.168.2.1.22: Flags [F.], seq 0, ack 41, win 913, options
[nop,nop,TSval 160362725 ecr 375854087], length 0
Conclusion
If everything has gone to plane, you should have a secure IPsec VPN tunnel between to FreeBSD
endpoints. Though this setup is slightly more complex, I prefer it over other VPN methods when it’s
relating to a permanent VPN.

Contenu connexe

Tendances

Secure Shell(ssh)
Secure Shell(ssh)Secure Shell(ssh)
Secure Shell(ssh)Pina Parmar
 
Developing MIPS Exploits to Hack Routers
Developing MIPS Exploits to Hack RoutersDeveloping MIPS Exploits to Hack Routers
Developing MIPS Exploits to Hack RoutersBGA Cyber Security
 
Ssh
SshSsh
Sshgh02
 
Secure shell
Secure shellSecure shell
Secure shellArjun Aj
 
Linux networking commands
Linux networking commandsLinux networking commands
Linux networking commandsSayed Ahmed
 
Server hardening
Server hardeningServer hardening
Server hardeningTeja Babu
 
Ssh (The Secure Shell)
Ssh (The Secure Shell)Ssh (The Secure Shell)
Ssh (The Secure Shell)Mehedi Farazi
 
Offline bruteforce attack on wi fi protected setup
Offline bruteforce attack on wi fi protected setupOffline bruteforce attack on wi fi protected setup
Offline bruteforce attack on wi fi protected setupCyber Security Alliance
 
Importance of SSHFP for Network Devices
Importance of SSHFP for Network DevicesImportance of SSHFP for Network Devices
Importance of SSHFP for Network DevicesAPNIC
 
Importance of sshfp and configuring sshfp for network devices
Importance of sshfp and configuring sshfp for network devicesImportance of sshfp and configuring sshfp for network devices
Importance of sshfp and configuring sshfp for network devicesMuhammad Moinur Rahman
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemCyber Security Alliance
 

Tendances (19)

Cent os 5 ssh
Cent os 5 sshCent os 5 ssh
Cent os 5 ssh
 
Secure Shell(ssh)
Secure Shell(ssh)Secure Shell(ssh)
Secure Shell(ssh)
 
Secure shell protocol
Secure shell protocolSecure shell protocol
Secure shell protocol
 
Developing MIPS Exploits to Hack Routers
Developing MIPS Exploits to Hack RoutersDeveloping MIPS Exploits to Hack Routers
Developing MIPS Exploits to Hack Routers
 
Ssh
SshSsh
Ssh
 
Introduction to SSH & PGP
Introduction to SSH & PGPIntroduction to SSH & PGP
Introduction to SSH & PGP
 
Ssh
SshSsh
Ssh
 
Secure SHell
Secure SHellSecure SHell
Secure SHell
 
Ch6-Computer Security
Ch6-Computer SecurityCh6-Computer Security
Ch6-Computer Security
 
Secure shell
Secure shellSecure shell
Secure shell
 
Linux networking commands
Linux networking commandsLinux networking commands
Linux networking commands
 
Server hardening
Server hardeningServer hardening
Server hardening
 
Intro to SSH
Intro to SSHIntro to SSH
Intro to SSH
 
Ch06b-Computer Security
Ch06b-Computer SecurityCh06b-Computer Security
Ch06b-Computer Security
 
Ssh (The Secure Shell)
Ssh (The Secure Shell)Ssh (The Secure Shell)
Ssh (The Secure Shell)
 
Offline bruteforce attack on wi fi protected setup
Offline bruteforce attack on wi fi protected setupOffline bruteforce attack on wi fi protected setup
Offline bruteforce attack on wi fi protected setup
 
Importance of SSHFP for Network Devices
Importance of SSHFP for Network DevicesImportance of SSHFP for Network Devices
Importance of SSHFP for Network Devices
 
Importance of sshfp and configuring sshfp for network devices
Importance of sshfp and configuring sshfp for network devicesImportance of sshfp and configuring sshfp for network devices
Importance of sshfp and configuring sshfp for network devices
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
 

Similaire à Securing the tunnel with Raccoon

Nat mikrotik
Nat mikrotikNat mikrotik
Nat mikrotiklouisraj
 
Parrot Drones Hijacking
Parrot Drones HijackingParrot Drones Hijacking
Parrot Drones HijackingPriyanka Aash
 
Converting your linux Box in security Gateway Part – 2 (Looking inside VPN)
Converting your linux Box in security Gateway Part – 2 (Looking inside VPN)Converting your linux Box in security Gateway Part – 2 (Looking inside VPN)
Converting your linux Box in security Gateway Part – 2 (Looking inside VPN)n|u - The Open Security Community
 
26.1.7 lab snort and firewall rules
26.1.7 lab   snort and firewall rules26.1.7 lab   snort and firewall rules
26.1.7 lab snort and firewall rulesFreddy Buenaño
 
How to Use GSM/3G/4G in Embedded Linux Systems
How to Use GSM/3G/4G in Embedded Linux SystemsHow to Use GSM/3G/4G in Embedded Linux Systems
How to Use GSM/3G/4G in Embedded Linux SystemsToradex
 
Securing Windows Remote Desktop With Copssh
Securing Windows Remote Desktop With CopsshSecuring Windows Remote Desktop With Copssh
Securing Windows Remote Desktop With CopsshCrismer La Pignola
 
SREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
SREcon Europe 2016 - Full-mesh IPsec network at Hosted GraphiteSREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
SREcon Europe 2016 - Full-mesh IPsec network at Hosted GraphiteHostedGraphite
 
Transport Layer Security - Mrinal Wadhwa
Transport Layer Security - Mrinal WadhwaTransport Layer Security - Mrinal Wadhwa
Transport Layer Security - Mrinal WadhwaMrinal Wadhwa
 
Cracking CTFs The Sysbypass CTF
Cracking CTFs The Sysbypass CTFCracking CTFs The Sysbypass CTF
Cracking CTFs The Sysbypass CTFRiyaz Walikar
 
DevSecCon London 2018: Get rid of these TLS certificates
DevSecCon London 2018: Get rid of these TLS certificatesDevSecCon London 2018: Get rid of these TLS certificates
DevSecCon London 2018: Get rid of these TLS certificatesDevSecCon
 
7 hands on
7 hands on7 hands on
7 hands onvideos
 
FPC for the Masses - CoRIIN 2018
FPC for the Masses - CoRIIN 2018FPC for the Masses - CoRIIN 2018
FPC for the Masses - CoRIIN 2018Xavier Mertens
 
Install websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bitsInstall websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bitsManuel Vega
 
R server and spark
R server and sparkR server and spark
R server and sparkBAINIDA
 

Similaire à Securing the tunnel with Raccoon (20)

Nat mikrotik
Nat mikrotikNat mikrotik
Nat mikrotik
 
Parrot Drones Hijacking
Parrot Drones HijackingParrot Drones Hijacking
Parrot Drones Hijacking
 
Converting your linux Box in security Gateway Part – 2 (Looking inside VPN)
Converting your linux Box in security Gateway Part – 2 (Looking inside VPN)Converting your linux Box in security Gateway Part – 2 (Looking inside VPN)
Converting your linux Box in security Gateway Part – 2 (Looking inside VPN)
 
26.1.7 lab snort and firewall rules
26.1.7 lab   snort and firewall rules26.1.7 lab   snort and firewall rules
26.1.7 lab snort and firewall rules
 
Lan to lan vpn
Lan to lan vpnLan to lan vpn
Lan to lan vpn
 
How to Use GSM/3G/4G in Embedded Linux Systems
How to Use GSM/3G/4G in Embedded Linux SystemsHow to Use GSM/3G/4G in Embedded Linux Systems
How to Use GSM/3G/4G in Embedded Linux Systems
 
Securing Windows Remote Desktop With Copssh
Securing Windows Remote Desktop With CopsshSecuring Windows Remote Desktop With Copssh
Securing Windows Remote Desktop With Copssh
 
SREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
SREcon Europe 2016 - Full-mesh IPsec network at Hosted GraphiteSREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
SREcon Europe 2016 - Full-mesh IPsec network at Hosted Graphite
 
Transport Layer Security
Transport Layer SecurityTransport Layer Security
Transport Layer Security
 
Transport Layer Security - Mrinal Wadhwa
Transport Layer Security - Mrinal WadhwaTransport Layer Security - Mrinal Wadhwa
Transport Layer Security - Mrinal Wadhwa
 
Cracking CTFs The Sysbypass CTF
Cracking CTFs The Sysbypass CTFCracking CTFs The Sysbypass CTF
Cracking CTFs The Sysbypass CTF
 
DevSecCon London 2018: Get rid of these TLS certificates
DevSecCon London 2018: Get rid of these TLS certificatesDevSecCon London 2018: Get rid of these TLS certificates
DevSecCon London 2018: Get rid of these TLS certificates
 
7 hands on
7 hands on7 hands on
7 hands on
 
FPC for the Masses - CoRIIN 2018
FPC for the Masses - CoRIIN 2018FPC for the Masses - CoRIIN 2018
FPC for the Masses - CoRIIN 2018
 
Presentación1
Presentación1Presentación1
Presentación1
 
linux installation.pdf
linux installation.pdflinux installation.pdf
linux installation.pdf
 
Cracking CTFs - Sysbypass CTF Walkthrough
Cracking CTFs - Sysbypass CTF WalkthroughCracking CTFs - Sysbypass CTF Walkthrough
Cracking CTFs - Sysbypass CTF Walkthrough
 
Install websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bitsInstall websphere message broker 8 RHEL 6 64 bits
Install websphere message broker 8 RHEL 6 64 bits
 
R server and spark
R server and sparkR server and spark
R server and spark
 
Rac on NFS
Rac on NFSRac on NFS
Rac on NFS
 

Plus de Gloria Stoilova

How to estimate in scrum
How to estimate in scrumHow to estimate in scrum
How to estimate in scrumGloria Stoilova
 
Introducing agile-software-deveopment-with-scrum
Introducing agile-software-deveopment-with-scrumIntroducing agile-software-deveopment-with-scrum
Introducing agile-software-deveopment-with-scrumGloria Stoilova
 
Agile QA and Testing process
Agile QA and Testing processAgile QA and Testing process
Agile QA and Testing processGloria Stoilova
 
Agile deveopment-with-scrum
Agile deveopment-with-scrumAgile deveopment-with-scrum
Agile deveopment-with-scrumGloria Stoilova
 
101-Cross cultural communication
101-Cross cultural communication101-Cross cultural communication
101-Cross cultural communicationGloria Stoilova
 
All hands meeting - introductory
All hands meeting - introductoryAll hands meeting - introductory
All hands meeting - introductoryGloria Stoilova
 
Password Strength Policy Query
Password Strength Policy QueryPassword Strength Policy Query
Password Strength Policy QueryGloria Stoilova
 

Plus de Gloria Stoilova (10)

How to estimate in scrum
How to estimate in scrumHow to estimate in scrum
How to estimate in scrum
 
Introducing agile-software-deveopment-with-scrum
Introducing agile-software-deveopment-with-scrumIntroducing agile-software-deveopment-with-scrum
Introducing agile-software-deveopment-with-scrum
 
Agile QA and Testing process
Agile QA and Testing processAgile QA and Testing process
Agile QA and Testing process
 
Agile deveopment-with-scrum
Agile deveopment-with-scrumAgile deveopment-with-scrum
Agile deveopment-with-scrum
 
E mail communication
E mail communicationE mail communication
E mail communication
 
Communication skills
Communication skillsCommunication skills
Communication skills
 
101-Cross cultural communication
101-Cross cultural communication101-Cross cultural communication
101-Cross cultural communication
 
All hands meeting - introductory
All hands meeting - introductoryAll hands meeting - introductory
All hands meeting - introductory
 
Password Strength Policy Query
Password Strength Policy QueryPassword Strength Policy Query
Password Strength Policy Query
 
How to write use cases
How to write use casesHow to write use cases
How to write use cases
 

Dernier

Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfChristalin Nelson
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
 
The role of Geography in climate education: science and active citizenship
The role of Geography in climate education: science and active citizenshipThe role of Geography in climate education: science and active citizenship
The role of Geography in climate education: science and active citizenshipKarl Donert
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...HetalPathak10
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfChristalin Nelson
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPCeline George
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...Nguyen Thanh Tu Collection
 

Dernier (20)

Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdf
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
 
The role of Geography in climate education: science and active citizenship
The role of Geography in climate education: science and active citizenshipThe role of Geography in climate education: science and active citizenship
The role of Geography in climate education: science and active citizenship
 
CARNAVAL COM MAGIA E EUFORIA _
CARNAVAL COM MAGIA E EUFORIA            _CARNAVAL COM MAGIA E EUFORIA            _
CARNAVAL COM MAGIA E EUFORIA _
 
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
Satirical Depths - A Study of Gabriel Okara's Poem - 'You Laughed and Laughed...
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdf
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERP
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
 

Securing the tunnel with Raccoon

  • 1. Securing the Tunnel w/IPsec and Racoon Now that we have created a network configuration that enables connectivity between the endpoint’s internal networks, we must encrypt the traffic. Skipping this step would mean that all traffic crossing the tunnel would be insecure (unless secured by other means). FreeBSD implements IPsec in its kernel, and along with the security/ipsec-tools port, you can encrypt all traffic that is sent through the tunnel. Kernel Configuration IPsec must be configured into the FreeBSD’s kernel configuration file, and he kernel must be rebuilt. I added the following option and device to my kernel’s configuration file, rebuilt, installed, and rebooted. options IPSEC device crypto #IP security Security Policies IPsec security policies must be defined and set to load into the Security Policy Database (SPD). This enables FreeBSD and racoon to encrypt / decrypt traffic between the two endpoints. The rules can be defined in a text file, then loaded at boot. I kept my policies in /usr/local/etc/racoon/setkey.conf and the file contained the following: Endpoint 1: flush; spdflush; spdadd 172.16.1.0/24 172.16.2.0/24 any -P out ipsecesp/tunnel/192.168.1.1-192.168.2.1/use; spdadd 172.16.2.0/24 172.16.1.0/24 any -P in ipsecesp/tunnel/192.168.2.1-192.168.1.1/use; Endpoint 2: flush; spdflush; spdadd 172.16.2.0/24 172.16.1.0/24 any -P out ipsecesp/tunnel/192.168.2.1-192.168.1.1/use; spdadd 172.16.1.0/24 172.16.2.0/24 any -P in ipsecesp/tunnel/192.168.1.1-192.168.2.1/use; I added the following to my /etc/rc.conf on each endpoint which tells FreeBSD to enable IPsec and load the policies into the SPD: ipsec_enable=”YES” ipsec_file=”/usr/local/etc/racoon/setkey.conf” After running /etc/rc.d/ipsec start, I could view the SPD by issuing the setkey -DP command to ensure the policies were loaded properly.
  • 2. Configuring Racoon At this stage, we have IP-IP connectivity configured and tested, IPsec has been compiled into the kernel, and the IPsec security policy database contains the policies loaded from the setkey.conf file. Now we must configure the racoon IKE key management daemon. First, you’ll need to make sure your ports are up to date and install security/ipsec-tools: cd /usr/ports/security/ipsec-tools make install clean After the port installs, you’ll first want to copy the racoon sample configuration file into place, and create a psk.txt file that will contain the pre-shared key that will be used during racoon’s negotiation process, and set the owner / permissions appropriately: cp /usr/local/share/examples/ipsec-tools/racoon.conf.sample /usr/local/etc/racoon/racoon.conf touch /usr/local/etc/racoon/psk.txt chownroot:wheel /usr/local/etc/racoon/psk.txt chmod 600 /usr/local/etc/racoon/psk.txt Edit the /usr/local/etc/racoon/psk.txt file. It should contain the remote endpoint’s public IP address and a unique password: Endpoint 1: 192.168.2.1 SomeMadeUpPassword Endpoint 2: 192.168.1.1 SomeMadeUpPassword Next, the racoon.conf file needs to be edited. There are many options to this file, and it’s probably best to learn all about it via the racoon.conf(5) man page. That being said, the one below is based on a lot of what I’ve found on the web, and works really nicely for me. Endpoint 1: # $KAME: racoon.conf.sample,v 1.28 2002/10/18 14:33:28 itojunExp $ path include “/usr/local/etc/racoon” ; path pre_shared_key “/usr/local/etc/racoon/psk.txt” ; log debug; padding # options are not to be changed { maximum_length 20; # maximum padding length randomize off; # enable randomize length strict_check off; # enable strict check exclusive_tail off; # extract last one octet } listen # address [port] that racoon will listening on { isakmp 192.168.1.1 [500]; }
  • 3. timer # timing options. change as needed { counter 5; # maximum trying count to send interval 20 sec; # maximum interval to resend persend 1; # the number of packets per a send phase1 60 sec; phase2 25 sec; } remote 192.168.2.1 [500] { exchange_modeaggressive,main; doiipsec_doi; situation identity_only; lifetime time 8 hour; initial_contact on; passive off; proposal_check obey; generate_policy off; proposal { encryption_algorithm blowfish; hash_algorithm sha1; authentication_methodpre_shared_key; dh_group 5; } } sainfo anonymous { pfs_group 5; lifetime time 12 hour ; encryption_algorithm blowfish,3des,des; # authentication_algorithm hmac_md5,hmac_sha1; authentication_algorithm hmac_sha1; compression_algorithm deflate ; } Endpoint 2: # $KAME: racoon.conf.sample,v 1.28 2002/10/18 14:33:28 itojunExp $ path include “/usr/local/etc/racoon” ; path pre_shared_key “/usr/local/etc/racoon/psk.txt” ; log debug; padding # options are not to be changed { maximum_length 20; # maximum padding length randomize off; # enable randomize length strict_check off; # enable strict check
  • 4. exclusive_tail off; # extract last one octet } listen # address [port] that racoon will listening on { isakmp 192.168.2.1 [500]; } timer # timing options. change as needed { counter 5; # maximum trying count to send interval 20 sec; # maximum interval to resend persend 1; # the number of packets per a send phase1 60 sec; phase2 25 sec; } remote 192.168.1.1 [500] { exchange_modeaggressive,main; doiipsec_doi; situation identity_only; lifetime time 8 hour; initial_contact on; passive off; proposal_check obey; generate_policy off; proposal { encryption_algorithm blowfish; hash_algorithm sha1; authentication_methodpre_shared_key; dh_group 5; } } sainfo anonymous { pfs_group 5; lifetime time 12 hour ; encryption_algorithm blowfish,3des,des; # authentication_algorithm hmac_md5,hmac_sha1; authentication_algorithm hmac_sha1; compression_algorithm deflate ; }
  • 5. Starting Racoon Now that everything is in place, you’ll want to add racoon to start at boot in /etc/rc.conf, and then start it on both sides to and check to make sure the negotiation was successful. I found the best way to do this is to add the configuration lines to each endpoint’s /etc/rc.conf, then start racoon and review the SAD tables and racoon log files. First add the lines to /etc/rc.conf: racoon_enable=”yes” racoon_flags=”-l /var/log/racoon.log” Start racoon on each host: /usr/local/etc/rc.d/racoon start After starting racoon, ping endpoint 2′s internal IP address from endpoint 1, this will get the negotiation process under way if it’s not already. There are two ways to validate that the negotiation was successful. The first is to review the /var/log/racoon.log file and check for signs of success. You should see something like: 2011-11-21 12:15:16: INFO: IPsec-SA established: ESP/Tunnel 192.168.1.1[500]->192.168.2.1[500] spi=56832670(0x363329e) The other way is to use setkey to dump the SAD tables, which will only exist if the IPsec negotiation was successful: setkey -D You should see output displaying the encryption algorithms that are being used, as well as other information. Validating Encryption Before you can sleep at night knowing your VPN is secure, you should run some simple tests to make sure traffic is being encrypted. tcpdump is a good way to do this. On one endpoint, or both, use tcpdump to dump the public interface’s traffic and look to make sure you see ESP records: tcpdump -n -i re0 host 192.168.1.1 and dst 192.168.2.1 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on re0, link-type EN10MB (Ethernet), capture size 65535 bytes 18:51:29.800977 IP 192.168.1.1 > 192.168.2.1: ESP(spi=0x0693d993,seq=0×7), length 116 18:51:31.713245 IP 192.168.1.1 > 192.168.2.1: ESP(spi=0x0693d993,seq=0×8), length 116 If encryption isn’t working place, you’ll see something more along the lines of: 18:56:47.315538 IP 192.168.1.1.63035 > 192.168.2.1.22: Flags [F.], seq 0, ack 41, win 913, options [nop,nop,TSval 160362725 ecr 375854087], length 0
  • 6. Conclusion If everything has gone to plane, you should have a secure IPsec VPN tunnel between to FreeBSD endpoints. Though this setup is slightly more complex, I prefer it over other VPN methods when it’s relating to a permanent VPN.