Introduction and Implementation of IPSec VPN Principle

4.94 Download
Note: To prevent users from installing apk files from outside, Google Play has now added a warning when installing apks & mods. PlayProtect will tell you the file is harmful. Simply, just click “Install anyway (unsafe)”.
Grand Theft Auto V / GTA 5 v2.00 APK + MOD (Beta)

Information

NameIntroduction and Implementation of IPSec VPN Principle
Category
IPSec VPN is currently the most widely used and most secure VPN. From personal mobile phones to tablet computers to routers and corporate firewalls, IPSec VPNs can be easily created to protect users’ data security and prevent data from being hijacked and sniffed. The principle of IPSec VPN and the troubleshooting of common problems are crucial for operation and maintenance and developers. will provide you with an introduction and implementation of IPSec VPN principles.



The full name of IPSec is Internet Protocol Security, which is a set of open network security protocols formulated by (Internet Engineering Task Force). It is not a separate protocol, but a collection of protocols and services that provide security for IP networks, including:

1.IKE (Internet Key Exchange Internet Key Exchange Protocol)

2.ESP (encapsulating security payload)

3. AH (Authentication Header authentication header protocol, can not go through NAT, basically not used)

IKE Internet Key Exchange

There are v1 and v2 versions of the IKE protocol. At present, we mainly use the v1 version. The v1 version is an application layer protocol based on UDP500 and 4500 (used by NAT) port numbers. The main function of the IKE protocol is to exchange the SA (Security Association) at both ends of the IPSec peer. SA generally includes:

1. Which protocol to use (AH, ESP or a combination of both)

2. The encapsulation mode of the protocol (transmission mode and tunnel mode)

3. Authentication algorithm (MD5, SHA-1)

4. Encryption algorithm (DES, 3DES and AES128, aes256) symmetric encryption, used to encrypt data

5. pfsgroup (diffie-hellman group) modp1024, modp1536, modp2048 asymmetric encryption, used for secure key exchange

6. The shared key to protect data in a specific stream and the life cycle of the key, etc.

The negotiation process of the IKEv1 version is divided into two stages.



The first stage is called IKE (ISAKMP) SA. The negotiated SA is used in the second stage. At this stage, there are two negotiation modes. The main mode is generally used in use, which is relatively safe.

main mode, safe, but requires 6 packets

Aggressive (aggressive mode), only 4 data packets are required, because it is not safe and easy to be cracked by brute force, generally not used

The second stage is called IPSec SA. The negotiated SA is used to encrypt user data streams.

Encapsulation protocol (security protocol)

There are two IPSec encapsulation protocols:

1. AH (Authentication Header) authentication header protocol, the protocol number is 51. The working principle is to add an AH packet header after the standard IP header of each data packet, which is basically not used.

2. ESP (encapsulating security payload), the protocol number is 50. The working principle is to add an ESP header after the standard IP header of each data packet, and add an ESP tail (ESP Tail and ESP Auth data) after the data packet.

*Different from AH, ESP encrypts the payload in the data and then encapsulates it in a data packet to ensure data confidentiality, but ESP does not protect the content of the IP header.

Package mode

There are also two IPSec encapsulation modes. In actual use, the two parties negotiate the encapsulation protocol and encapsulation mode and use them together:

1. Transmission mode (host-to-host transport mode), in the transmission mode, the AH header or ESP header is inserted between the IP header and the transport layer protocol header to protect the TCP/UDP/ICMP load. The transmission mode does not change the message header and is basically not used.



2. Tunneling mode (tunneling mode), in tunneling mode, the integrity verification scope of the AH protocol is the entire IP message including the newly added IP header. The integrity check part of the ESP protocol verification message includes the ESP header, the original IP header, the transport layer protocol header, data, and the ESP trailer, but does not include the new IP header, so the ESP protocol cannot guarantee the security of the new IP header. The encryption part of ESP includes the original IP header, transport layer protocol header, data and ESP tail.



IPSec implementation-control plane

The above are all the definitions and specifications of the IPSec protocol. Specific to the realization of IPSec in the Linux system, there are mainly various swans (openswan, strongswan, libreswan). These applications are responsible for negotiating the encryption algorithm, encryption method, and tunnel mode of the two parties. , Routing strategy. And sent to the data plane through the xfrm kernel interface call of linux.

IPSec implementation-data plane

IPSec has two data planes on Linux. At present, the XFRM framework of the second Linux kernel is generally used. Unless it is a very old machine without this, the first one is used:

1. KLIPS, very old, used in Linux versions before version 2.6. By creating a virtual IPSec interface and routing IPSec packets, you can easily add firewall rules.

2. Linux kernel XFRM/NETKEY (ipsec transform), execute specific forwarding strategy and packet unpacking, if there is offload, execute offload to increase speed. The new version of the kernel also supports the creation of a virtual IPSec interface to facilitate the addition of firewall rules.

Control surface-Libreswan

Here we mainly talk about libreswan, libreswan is currently used more IPSec control surface implementation, in normal use, you need to master the pluto and whack commands in libreswan

1. The pluto command is an IPsec IKE keying daemon, responsible for automating the SA negotiation between ipsec.

Start the pluto daemon command: ipsec pluto

2. The whack command is a command used by the user to interact with the pluto daemon

# Add an ipsec connection (the specific configuration of vpn1 is written in the file)

ipsec whack addconn vpn1 --config ipsec.config

# Allow the pluto daemon to start listening

ipsec whack --listen

# Initialize ipsec connection

ipsec whack --initiate --name vpn1

Data plane-XFRM

The Linux kernel supports the implementation of the IPSec data plane through the XFRM framework, and the xfrm framework supports the Linux network namespace.

xfrm uses two databases to record ipsec data plane information.

1. The xfrm policy is stored in the SPD (security policy database) of the kernel. Tell ipsec which traffic needs to be processed by ipsec.



2. The xfrm state is stored in the SADB (security association database) of the kernel. Represents one-way traffic, including encryption keys, logos, request IDs, statistics and other information.



Create an ipsec tunnel manually


The ip xfrm command can manually create ipsec tunnel communication between the two devices, skipping the SA negotiation on the control plane of libreswan

192.168.0.6 <=======> 192.168.0.28, the script is as follows:

A=192.168.0.6

B=192.168.0.28

ip xfrm state add src $A dst $B proto esp spi 0x00000301 mode tunnel auth md5 0x96358c90783bbfa3d7b196ceabe0536b

enc des3_ede 0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df

ip xfrm state add src $B dst $A proto esp spi 0x00000302 mode tunnel auth md5 0x99358c90783bbfa3d7b196ceabe0536b

enc des3_ede 0xffddb555acfd9d77b03ea3843f2653255afe8eb5573965df

ip xfrm policy add src $A dst $B dir out ptype main tmpl src $A dst $B proto esp mode tunnel

ip xfrm policy add src $B dst $A dir in ptype main tmpl src $B dst $A proto esp mode tunnel

ip xfrm state add src $A dst $B proto esp spi 0x00000301 mode tunnel auth md5 0x96358c90783bbfa3d7b196ceabe0536b

enc des3_ede 0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df

ip xfrm state add src $B dst $A proto esp spi 0x00000302 mode tunnel auth md5 0x99358c90783bbfa3d7b196ceabe0536b

enc des3_ede 0xffddb555acfd9d77b03ea3843f2653255afe8eb5573965df

ip xfrm policy add src $A dst $B dir in ptype main tmpl src $A dst $B proto esp mode tunnel

ip xfrm policy add src $B dst $A dir out ptype main tmpl src $B dst $A proto esp mode tunnel

tcpdump capture

Capture the packet and look at the ping packet between the two machines, you can find that the ping packet has been encrypted as an ESP packet.
Must read :
The difference between IPsec VPN and SSL VPN, how to choose the right VPN
Mới hơn Cũ hơn
Gangstar Vegas v6.8.0e MOD APK + OBB (Unlimited Money/VIP 10)
Poppy Playtime Chapter 1 v1.0.8 APK (Full Game)