/testing/guestbin/swan-prep --x509
Preparing X.509 files
west #
 ipsec certutil -D -n east
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 #
 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
"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
"ikev2-westnet-eastnet-x509-cr" #1: initiating IKEv2 connection to 192.1.2.23 using UDP
"ikev2-westnet-eastnet-x509-cr" #1: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #1: processed IKE_SA_INIT response from 192.1.2.23:UDP/500 {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=DH19}, initiating IKE_AUTH
"ikev2-westnet-eastnet-x509-cr" #1: sent IKE_AUTH request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #1: initiator established IKE SA; authenticated peer RSASSA-PSS with SHA2_512
"ikev2-westnet-eastnet-x509-cr" #2: initiator established Child SA using #1; IPsec tunnel [192.0.1.0/24===192.0.2.0/24] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 ../../guestbin/ping-once.sh --up -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
#2: "ikev2-westnet-eastnet-x509-cr", type=ESP, add_time=1234567890, inBytes=84, outBytes=84, maxBytes=2^63B, 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
"ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
"ikev2-westnet-eastnet-x509-cr" #2: ESP traffic information: in=84B out=84B
"ikev2-westnet-eastnet-x509-cr" #1: deleting IKE SA (ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr" #3: initiating IKEv2 connection to 192.1.2.23 using UDP
"ikev2-westnet-eastnet-x509-cr" #3: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #3: processed IKE_SA_INIT response from 192.1.2.23:UDP/500 {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=DH19}, initiating IKE_AUTH
"ikev2-westnet-eastnet-x509-cr" #3: sent IKE_AUTH request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #3: initiator established IKE SA; authenticated peer RSASSA-PSS with SHA2_512
"ikev2-westnet-eastnet-x509-cr" #4: initiator established Child SA using #3; IPsec tunnel [192.0.1.0/24===192.0.2.0/24] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
"ikev2-westnet-eastnet-x509-cr" #4: ESP traffic information: in=0B out=0B
"ikev2-westnet-eastnet-x509-cr" #3: deleting IKE SA (ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr" #5: initiating IKEv2 connection to 192.1.2.23 using UDP
"ikev2-westnet-eastnet-x509-cr" #5: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #5: processed IKE_SA_INIT response from 192.1.2.23:UDP/500 {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=DH19}, initiating IKE_AUTH
"ikev2-westnet-eastnet-x509-cr" #5: sent IKE_AUTH request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #5: initiator established IKE SA; authenticated peer RSASSA-PSS with SHA2_512
"ikev2-westnet-eastnet-x509-cr" #6: initiator established Child SA using #5; IPsec tunnel [192.0.1.0/24===192.0.2.0/24] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
"ikev2-westnet-eastnet-x509-cr" #6: ESP traffic information: in=0B out=0B
"ikev2-westnet-eastnet-x509-cr" #5: deleting IKE SA (ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr" #7: initiating IKEv2 connection to 192.1.2.23 using UDP
"ikev2-westnet-eastnet-x509-cr" #7: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #7: processed IKE_SA_INIT response from 192.1.2.23:UDP/500 {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=DH19}, initiating IKE_AUTH
"ikev2-westnet-eastnet-x509-cr" #7: sent IKE_AUTH request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #7: initiator established IKE SA; authenticated peer RSASSA-PSS with SHA2_512
"ikev2-westnet-eastnet-x509-cr" #8: initiator established Child SA using #7; IPsec tunnel [192.0.1.0/24===192.0.2.0/24] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
"ikev2-westnet-eastnet-x509-cr" #8: ESP traffic information: in=0B out=0B
"ikev2-westnet-eastnet-x509-cr" #7: deleting IKE SA (ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr" #9: initiating IKEv2 connection to 192.1.2.23 using UDP
"ikev2-westnet-eastnet-x509-cr" #9: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #9: processed IKE_SA_INIT response from 192.1.2.23:UDP/500 {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=DH19}, initiating IKE_AUTH
"ikev2-westnet-eastnet-x509-cr" #9: sent IKE_AUTH request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #9: initiator established IKE SA; authenticated peer RSASSA-PSS with SHA2_512
"ikev2-westnet-eastnet-x509-cr" #10: initiator established Child SA using #9; IPsec tunnel [192.0.1.0/24===192.0.2.0/24] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
"ikev2-westnet-eastnet-x509-cr" #10: ESP traffic information: in=0B out=0B
"ikev2-westnet-eastnet-x509-cr" #9: deleting IKE SA (ESTABLISHED_IKE_SA) and sending notification
west #
 ipsec auto --up ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr" #11: initiating IKEv2 connection to 192.1.2.23 using UDP
"ikev2-westnet-eastnet-x509-cr" #11: sent IKE_SA_INIT request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #11: processed IKE_SA_INIT response from 192.1.2.23:UDP/500 {cipher=AES_GCM_16_256 integ=n/a prf=HMAC_SHA2_512 group=DH19}, initiating IKE_AUTH
"ikev2-westnet-eastnet-x509-cr" #11: sent IKE_AUTH request to 192.1.2.23:UDP/500
"ikev2-westnet-eastnet-x509-cr" #11: initiator established IKE SA; authenticated peer RSASSA-PSS with SHA2_512
"ikev2-westnet-eastnet-x509-cr" #12: initiator established Child SA using #11; IPsec tunnel [192.0.1.0/24===192.0.2.0/24] {ESP/ESN=>0xESPESP <0xESPESP xfrm=AES_GCM_16_256-NONE DPD=passive}
west #
 ipsec auto --down ikev2-westnet-eastnet-x509-cr
"ikev2-westnet-eastnet-x509-cr": terminating SAs using this connection
"ikev2-westnet-eastnet-x509-cr" #12: ESP traffic information: in=0B out=0B
"ikev2-westnet-eastnet-x509-cr" #11: deleting IKE SA (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 PRIORITY ptype main
	tmpl src 0.0.0.0 dst 0.0.0.0
		proto esp reqid REQID mode transport
XFRM done
IPSEC 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 #
 
