Monday, 4 May 2015

IPSec VPN (public key authentication) using Libreswan in RHEL7

In Public key authentication, the hosts are manually configured with each other's public key.  Authentication is based on  the hosts having their private key. The hosts should have their private key to authenticate each other.
The use of public key authentication is recommended over  PSK authentication. In a PSK system a major issue is the secure distribution of the PSK to remote hosts. This problem doesnot occur in public key authentication as the public key is not secret and can be distributed without any fear.      

Consider 2 hosts:
Left:   192.168.100.2
Right: 192.168.100.3
An IPSec VPN tunnel will be established between these 2 hosts.
 
On both the machines, run the following commands:
 1) Install package
       yum -y install libreswan

2) Open firewall ports. 500/udp, protocol=esp
     firewall-cmd --zone=public --add-port=500/udp --permanent
     firewall-cmd --add-rich-rule='rule protocol value="esp" accept' --permanent
     firewall-cmd --reload

3) Generate RSA key pair      
    ipsec  newhostkey  --configdir  /etc/ipsec.d  --output  /etc/ipsec.d/oserver.secrets
  

4) Edit the file '/etc/ipsec.conf' and uncomment the below line
     include /etc/ipsec.d/*.conf


On the host "Left" 192.168.100.2 , run the following command
    ipsec showhostkey --left > left.pub


On the host "Right" 192.168.100.3
1) run the following command
     ipsec showhostkey --right > right.pub

2) copy the file 'right.pub' to the Left host.(192.168.100.2)


On the host "Left" 192.168.100.2
1) Create the file '/etc/ipsec.d/oserver.conf' and add the following entries.
      conn myconn
           left=192.168.100.2
           leftrsasigkey=0sAQO86qaScc1wsNN6G7 [...]
           right=192.168.100.3
           rightrsasigkey=0sAQPFZNZ1/OPvK8Gcl1iktCK [...]
           authby=rsasig
           auto=add


     Note: 1) Copy the leftrsasigkey from the file 'left.pub' by using vi editor's read file command. :r left.pub. Similarly copy rightrsasigkey from the file 'right.pub' by using the command :r right.pub.
Copy paste from the terminal can lead to extra newlines, carriage returns which can corrupt the key.     
 2) Remember to maintain indentation as shown above. Also don't leave any blank lines in between the entries.

2) copy the file '/etc/ipsec.d/oserver.conf' to the Right host.(192.168.100.3)


On both the hosts, Start the service
       systemctl start ipsec


On any one machine, run the following commands:
1) Establish  the connection.      ipsec auto --up myconn
      
2) View Status
      ipsec auto --status

1 comment:

  1. SSN FULLZ AVAILABLE

    Fresh & valid spammed USA SSN+Dob Leads with DL available in bulk.

    >>1$ each SSN+DOB
    >>3$ each with SSN+DOB+DL
    >>5$ each for premium fullz (700+ credit score with replacement guarantee)

    Prices are negotiable in bulk order
    Serious buyer contact me no time wasters please
    Bulk order will be preferable

    CONTACT
    Telegram > @leadsupplier
    ICQ > 752822040
    Email > leads.sellers1212@gmail.com

    OTHER STUFF YOU CAN GET

    SSN+DOB Fullz
    CC's with CVV's (vbv & non-vbv)
    USA Photo ID'S (Front & back)

    All type of tutorials available
    (Carding, spamming, hacking, scam page, Cash outs, dumps cash outs)

    SQL Injector
    Premium Accounts (Netflix, Pornhub, etc)
    Paypal Logins
    Bitcoin Cracker
    SMTP Linux Root
    DUMPS with pins track 1 and 2
    WU & Bank transfers
    Socks, rdp's, vpn
    Php mailer
    Server I.P's
    HQ Emails with passwords
    All types of tools & tutorials.. & much more

    Looking for long term business
    For trust full vendor, feel free to contact

    CONTACT
    Telegram > @leadsupplier
    ICQ > 752822040
    Email > leads.sellers1212@gmail.com

    ReplyDelete