/testing/guestbin/swan-prep --x509
Preparing X.509 files
west #
 certutil -D -n east -d sql:/etc/ipsec.d
west #
 # confirm that the network is alive
west #
 ../../guestbin/wait-until-alive -I 192.0.1.254 192.0.2.254
destination -I 192.0.1.254 192.0.2.254 is alive
west #
 # ensure that clear text does not get through
west #
 iptables -A INPUT -i eth1 -s 192.0.2.0/24 -j DROP
west #
 iptables -I INPUT -m policy --dir in --pol ipsec -j ACCEPT
west #
 # confirm clear text does not get through
west #
 ../../guestbin/ping-once.sh --down -I 192.0.1.254 192.0.2.254
down
west #
 ipsec _stackmanager start
west #
 mkdir /tmp/tmpnss-west
west #
 export NSS_DISABLE_UNLOAD=no
west #
 export NSS_SDB_USE_CACHE=yes
west #
 export TMPDIR=/tmp/tmpnss-west
west #
 export NSS_DEBUG_PKCS11_MODULE="NSS Internal PKCS #11 Module"
west #
 export LOGGING=1
west #
 export SOCKETTRACE=1
west #
 export NSPR_LOG_FILE=/tmp/nspr.log
west #
 export NSS_OUTPUT_FILE=/tmp/nss.log
west #
 # 2 3 and 4 are more verbose
west #
 export NSPR_LOG_MODULES="nss_mod_log:4"
west #
 ipsec pluto --config /etc/ipsec.conf
west #
 ../../guestbin/wait-until-pluto-started
west #
 ipsec auto --add ikev2-westnet-eastnet-x509-cr
002 "ikev2-westnet-eastnet-x509-cr": added IKEv2 connection
west #
 ipsec whack --impair suppress-retransmits
west #
 echo "initdone"
initdone
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
1v2 "ikev2-westnet-eastnet-x509-cr" #1: initiating IKEv2 connection
1v2 "ikev2-westnet-eastnet-x509-cr" #1: sent IKE_SA_INIT request
1v2 "ikev2-westnet-eastnet-x509-cr" #1: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "ikev2-westnet-eastnet-x509-cr" #1: established IKE SA; authenticated using RSA with SHA2_512
004 "ikev2-westnet-eastnet-x509-cr" #2: established Child SA; IPsec tunnel [192.0.1.0-192.0.1.255:0-65535 0] -> [192.0.2.0-192.0.2.255:0-65535 0] {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
west #
 ping -n -q -c 4 -I 192.0.1.254 192.0.2.254
PING 192.0.2.254 (192.0.2.254) from 192.0.1.254 : 56(84) bytes of data.
--- 192.0.2.254 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time XXXX
rtt min/avg/max/mdev = 0.XXX/0.XXX/0.XXX/0.XXX ms
west #
 ipsec whack --trafficstatus
006 #2: "ikev2-westnet-eastnet-x509-cr", type=ESP, add_time=1234567890, inBytes=336, outBytes=336, id='C=CA, ST=Ontario, L=Toronto, O=Libreswan, OU=Test Department, CN=east.testing.libreswan.org, E=user-east@testing.libreswan.org'
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
002 "ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
005 "ikev2-westnet-eastnet-x509-cr" #2: ESP traffic information: in=336B out=336B
002 "ikev2-westnet-eastnet-x509-cr" #1: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
1v2 "ikev2-westnet-eastnet-x509-cr" #3: initiating IKEv2 connection
1v2 "ikev2-westnet-eastnet-x509-cr" #3: sent IKE_SA_INIT request
1v2 "ikev2-westnet-eastnet-x509-cr" #3: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "ikev2-westnet-eastnet-x509-cr" #3: established IKE SA; authenticated using RSA with SHA2_512
004 "ikev2-westnet-eastnet-x509-cr" #4: established Child SA; IPsec tunnel [192.0.1.0-192.0.1.255:0-65535 0] -> [192.0.2.0-192.0.2.255:0-65535 0] {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
002 "ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
005 "ikev2-westnet-eastnet-x509-cr" #4: ESP traffic information: in=0B out=0B
002 "ikev2-westnet-eastnet-x509-cr" #3: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
1v2 "ikev2-westnet-eastnet-x509-cr" #5: initiating IKEv2 connection
1v2 "ikev2-westnet-eastnet-x509-cr" #5: sent IKE_SA_INIT request
1v2 "ikev2-westnet-eastnet-x509-cr" #5: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "ikev2-westnet-eastnet-x509-cr" #5: established IKE SA; authenticated using RSA with SHA2_512
004 "ikev2-westnet-eastnet-x509-cr" #6: established Child SA; IPsec tunnel [192.0.1.0-192.0.1.255:0-65535 0] -> [192.0.2.0-192.0.2.255:0-65535 0] {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
002 "ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
005 "ikev2-westnet-eastnet-x509-cr" #6: ESP traffic information: in=0B out=0B
002 "ikev2-westnet-eastnet-x509-cr" #5: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
1v2 "ikev2-westnet-eastnet-x509-cr" #7: initiating IKEv2 connection
1v2 "ikev2-westnet-eastnet-x509-cr" #7: sent IKE_SA_INIT request
1v2 "ikev2-westnet-eastnet-x509-cr" #7: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "ikev2-westnet-eastnet-x509-cr" #7: established IKE SA; authenticated using RSA with SHA2_512
004 "ikev2-westnet-eastnet-x509-cr" #8: established Child SA; IPsec tunnel [192.0.1.0-192.0.1.255:0-65535 0] -> [192.0.2.0-192.0.2.255:0-65535 0] {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
002 "ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
005 "ikev2-westnet-eastnet-x509-cr" #8: ESP traffic information: in=0B out=0B
002 "ikev2-westnet-eastnet-x509-cr" #7: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
1v2 "ikev2-westnet-eastnet-x509-cr" #9: initiating IKEv2 connection
1v2 "ikev2-westnet-eastnet-x509-cr" #9: sent IKE_SA_INIT request
1v2 "ikev2-westnet-eastnet-x509-cr" #9: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "ikev2-westnet-eastnet-x509-cr" #9: established IKE SA; authenticated using RSA with SHA2_512
004 "ikev2-westnet-eastnet-x509-cr" #10: established Child SA; IPsec tunnel [192.0.1.0-192.0.1.255:0-65535 0] -> [192.0.2.0-192.0.2.255:0-65535 0] {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
002 "ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
005 "ikev2-westnet-eastnet-x509-cr" #10: ESP traffic information: in=0B out=0B
002 "ikev2-westnet-eastnet-x509-cr" #9: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
1v2 "ikev2-westnet-eastnet-x509-cr" #11: initiating IKEv2 connection
1v2 "ikev2-westnet-eastnet-x509-cr" #11: sent IKE_SA_INIT request
1v2 "ikev2-westnet-eastnet-x509-cr" #11: sent IKE_AUTH request {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=MODP2048}
003 "ikev2-westnet-eastnet-x509-cr" #11: established IKE SA; authenticated using RSA with SHA2_512
004 "ikev2-westnet-eastnet-x509-cr" #12: established Child SA; IPsec tunnel [192.0.1.0-192.0.1.255:0-65535 0] -> [192.0.2.0-192.0.2.255:0-65535 0] {ESP=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE NATOA=none NATD=none DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
002 "ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
005 "ikev2-westnet-eastnet-x509-cr" #12: ESP traffic information: in=0B out=0B
002 "ikev2-westnet-eastnet-x509-cr" #11: deleting state (STATE_V2_ESTABLISHED_IKE_SA) and sending notification
west #
 echo "done"
done
west #
 ../../guestbin/ipsec-look.sh
west NOW
XFRM state:
XFRM policy:
src 192.0.1.0/24 dst 192.0.2.0/24
	dir out priority 2084814 ptype main
	tmpl src 0.0.0.0 dst 0.0.0.0
		proto esp reqid REQID mode transport
XFRM done
IPSEC mangle TABLES
NEW_IPSEC_CONN mangle TABLES
ROUTING TABLES
default via 192.1.2.254 dev eth1
192.0.1.0/24 dev eth0 proto kernel scope link src 192.0.1.254
192.0.2.0/24 dev eth1 scope link src 192.0.1.254
192.1.2.0/24 dev eth1 proto kernel scope link src 192.1.2.45
NSS_CERTIFICATES
Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI
Libreswan test CA for mainca - Libreswan                     CT,, 
east-ec                                                      P,,  
hashsha1                                                     P,,  
nic                                                          P,,  
north                                                        P,,  
road                                                         P,,  
west                                                         u,u,u
west #
 grep Totals /tmp/nss.log
                   Totals       6764         70ms
west #
 cat /tmp/nss.log | grep C_ | sort -n -r -k 5
C_Sign                             6         39ms    6500.00us     55.71%
C_DeriveKey                      558       7000us      12.54us     10.00%
C_GetAttributeValue              526       6000us      11.41us      8.57%
C_GenerateKeyPair                  6       5000us     833.33us      7.14%
C_Initialize                       1       2000us    2000.00us      2.86%
C_FindObjectsInit                137       2000us      14.60us      2.86%
C_CloseSession                   915       2000us       2.19us      2.86%
C_Verify                           6       1000us     166.67us      1.43%
C_SignInit                        66       1000us      15.15us      1.43%
C_SignFinal                       60       1000us      16.67us      1.43%
C_Encrypt                        266       1000us       3.76us      1.43%
C_DestroyObject                  885       1000us       1.13us      1.43%
C_DecryptInit                    189       1000us       5.29us      1.43%
C_CreateObject                   315       1000us       3.17us      1.43%
C_WrapKey                        138          0 z       0.00us      0.00%
C_VerifyRecoverInit                1          0 z       0.00us      0.00%
C_VerifyRecover                    1          0 z       0.00us      0.00%
C_VerifyInit                       6          0 z       0.00us      0.00%
C_SignUpdate                     132          0 z       0.00us      0.00%
C_SetAttributeValue                6          0 z       0.00us      0.00%
C_OpenSession                    919          0 z       0.00us      0.00%
C_GetTokenInfo                     2          0 z       0.00us      0.00%
C_GetSlotList                      2          0 z       0.00us      0.00%
C_GetSlotInfo                      2          0 z       0.00us      0.00%
C_GetSessionInfo                   1          0 z       0.00us      0.00%
C_GetMechanismList                 4          0 z       0.00us      0.00%
C_GetMechanismInfo                13          0 z       0.00us      0.00%
C_GetInfo                          1          0 z       0.00us      0.00%
C_GenerateRandom                  67          0 z       0.00us      0.00%
C_GenerateKey                      1          0 z       0.00us      0.00%
C_FindObjectsFinal               137          0 z       0.00us      0.00%
C_FindObjects                    137          0 z       0.00us      0.00%
C_EncryptUpdate                    8          0 z       0.00us      0.00%
C_EncryptInit                    274          0 z       0.00us      0.00%
C_DigestUpdate                   314          0 z       0.00us      0.00%
C_DigestKey                       12          0 z       0.00us      0.00%
C_DigestInit                     230          0 z       0.00us      0.00%
C_DigestFinal                    230          0 z       0.00us      0.00%
C_DecryptUpdate                    8          0 z       0.00us      0.00%
C_Decrypt                        181          0 z       0.00us      0.00%
C_CloseAllSessions                 1          0 z       0.00us      0.00%
west #
 echo "for nspr logs, look at the verbose console log in OUTPUT"
for nspr logs, look at the verbose console log in OUTPUT
west #
 
