Advertisement
d1cor

ipsec_net-net_pki.conf

Oct 18th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.73 KB | None | 0 0
  1. side A
  2.  
  3. Instalar el strongswan-pki
  4.  
  5. cd /etc/ipsec.d/
  6.  
  7. # clave y cert de la CA
  8.  
  9. ipsec pki --gen --type rsa --size 4096 --outform pem > private/ca_key.pem
  10.  
  11. ipsec pki --self --ca --lifetime 3650 --in private/ca_key.pem --type rsa --dn "C=CH, O=strongSwan, CN=Root CA" --outform pem > cacerts/ca_cert.pem    
  12.  
  13.  
  14.  
  15. # clave y cert del client1
  16.  
  17. ipsec pki --gen --type rsa --size 2048 --outform pem > private/client1Key.pem
  18.  
  19. chmod 600 private/client1Key.pem
  20.  
  21. ipsec pki --pub --in private/client1Key.pem --type rsa | ipsec pki --issue --lifetime 730 --cacert cacerts/ca_cert.pem --cakey private/ca_key.pem --dn "C=CH, O=strongSwan, CN=device1" --san device1 --flag serverAuth --flag ikeIntermediate --outform pem > certs/client1Cert.pem
  22.  
  23.  
  24. # clave y cert del client2
  25.  
  26. ipsec pki --gen --type rsa --size 2048 --outform pem > private/client2Key.pem
  27.  
  28. chmod 600 private/client2Key.pem
  29.  
  30. ipsec pki --pub --in private/client2Key.pem --type rsa | ipsec pki --issue --lifetime 730 --cacert cacerts/ca_cert.pem --cakey private/ca_key.pem --dn "C=CH, O=strongSwan, CN=device2" --san device2 --flag serverAuth --flag ikeIntermediate --outform pem > certs/client2Cert.pem
  31.  
  32.  
  33. ############################ Side A:
  34.  
  35. config setup
  36.         charondebug="all"
  37.         uniqueids=yes
  38.         strictcrlpolicy=no
  39. conn %default
  40. conn tunnel #
  41.         left=10.0.0.10
  42.         leftsubnet=192.168.10.0/24
  43.         right=10.0.0.20
  44.         rightsubnet=192.168.20.0/24
  45.         ike=aes256-sha2_256-modp1024!
  46.         esp=aes256-sha2_256!
  47.         keyingtries=0
  48.         ikelifetime=1h
  49.         lifetime=8h
  50.         dpddelay=30
  51.         dpdtimeout=120
  52.         dpdaction=restart
  53.         #authby=secret
  54.         auto=start
  55.         keyexchange=ikev2
  56.         type=tunnel
  57.         leftcert=client1Cert.pem
  58.         rightcert=client2Cert.pem
  59.         leftid="C=CH, O=strongSwan, CN=device1"
  60.         rightid="C=CH, O=strongSwan, CN=device2"
  61.        
  62. # en el /etc/ipsec.secrets
  63. : RSA client1Key.pem
  64.  
  65. ############################ Side B:
  66.  
  67. config setup
  68.         charondebug="all"
  69.         uniqueids=yes
  70.         strictcrlpolicy=no
  71. conn %default
  72. conn tunnel #
  73.         left=10.0.0.10
  74.         leftsubnet=192.168.10.0/24
  75.         right=10.0.0.20
  76.         rightsubnet=192.168.20.0/24
  77.         ike=aes256-sha2_256-modp1024!
  78.         esp=aes256-sha2_256!
  79.         keyingtries=0
  80.         ikelifetime=1h
  81.         lifetime=8h
  82.         dpddelay=30
  83.         dpdtimeout=120
  84.         dpdaction=restart
  85.         #authby=secret
  86.         auto=start
  87.         keyexchange=ikev2
  88.         type=tunnel
  89.         leftcert=client1Cert.pem
  90.         rightcert=client2Cert.pem
  91.         leftid="C=CH, O=strongSwan, CN=device1"
  92.         rightid="C=CH, O=strongSwan, CN=device2"
  93.  
  94. # en el /etc/ipsec.secrets
  95. : RSA client2Key.pem
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement