SlideShare ist ein Scribd-Unternehmen logo
1 von 6
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.

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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 - Mrinal Wadhwa
Transport Layer Security - Mrinal WadhwaTransport Layer Security - Mrinal Wadhwa
Transport Layer Security - Mrinal Wadhwa
 
Transport Layer Security
Transport Layer SecurityTransport Layer Security
Transport Layer Security
 
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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Kürzlich hochgeladen (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

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.