Unable to estable ikev2 vpn with ios after update to current

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to estable ikev2 vpn with ios after update to current

Theodore Wynnychenko-2
Hello

I have been a bit remiss, and have not updated my system in a couple of months.
I have been following current for a year or two, in general, without incident.

Anyway, after updating last night, I am unable to establish a ikev2 vpn with an
ios 10.3.2 device.  A OBSD6.1<->OBSD6.1 ikev2 vpn is working fine.

I am hoping that someone could shove me in a direction.

I have been using iked with iOS for about a year without a problem.

However, after the update, I noticed that all iOS vpn attempts were failing.

Running # iked -dvvv and trying to connect showed:

...
ca_setauth: auth length 510
ikev2_ike_auth_recv: unexpected auth method RSA_SIG, was expecting SIG
ikev2_resp_recv: failed to send auth response
sa_state: AUTH_REQUEST -> CLOSED from xxx.yyy.1.254:64252 to xxx.yyy.1.20:4500
policy 'ios_vpn'
ikev2_recv: closing SA
sa_free: ispi 0xcd95648ffb47ac65 rspi 0x86e6b00a7646172e
config_free_proposals: free 0x13f816f06500
config_free_proposals: free 0x13f8e4f63580
ca_setauth: auth length 528
ca_validate_pubkey: could not open public key pubkeys/fqdn/ios.ikev2.myfqdn.com
ca_x509_subjectaltname: FQDN/ios.ikev2.myfqdn.com
ca_validate_cert: /C=US/ST=Illinois... ok
ikev2_getimsgdata: imsg 24 rspi 0x86e6b00a7646172e ispi 0xcd95648ffb47ac65
initiator 0 sa invalid type 14 data length 528
ikev2_dispatch_cert: invalid auth reply


I found a suggestion that placing an RSA public certificate on the local OBSD
machine could help.

So, I used:

# openssl rsa -in private.key -pubout >
/etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.com

Now, running # iked -dvvv shows:

set_policy_auth_method: using rsa for peer
/etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.com
set_policy: found pubkey for /etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.com
ikev2 "ios_vpn" passive esp inet from 0.0.0.0/0 to xxx.yyy.15.0/24 local
xxx.yyy.1.20 peer any ikesa enc aes-256,aes-192,aes-128,3des prf
hmac-sha2-256,hmac-sha1 auth hmac-sha2-256,hmac-sha1 group
modp2048,modp1536,modp1024 childsa enc aes-256,aes-192,aes-128 auth
hmac-sha2-256,hmac-sha1 srcid ikesync.myfqdn.com dstid ios.ikev2.myfqdn.com
ikelifetime 1800 lifetime 1800 bytes 536870912 rsa config address xxx.yyy.15.131
config netmask 255.255.255.0 config name-server xxx.yyy.1.128 config name-server
xxx.yyy.1.129 config netbios-server xxx.yyy.2.99
ca_privkey_serialize: type RSA_KEY length 2349
ca_pubkey_serialize: type RSA_KEY length 526
ca_privkey_to_method: type RSA_KEY method RSA_SIG
config_getpolicy: received policy
ca_getkey: received private key type RSA_KEY length 2349
ca_getkey: received public key type RSA_KEY length 526
ca_dispatch_parent: config reset
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpfkey: received pfkey fd 3
config_getcompile: compilation done
config_getsocket: received socket fd 4
config_getsocket: received socket fd 5
config_getsocket: received socket fd 6
config_getsocket: received socket fd 7
ca_reload: loaded ca file ca.crt
ca_reload: /C=US/ST=Illinois...
ca_reload: loaded 1 ca certificate
ca_reload: loaded cert file local.myfqdn.com.crt
ca_reload: loaded cert file ikesync.myfqdn.com.crt
ca_validate_cert: /C=US/ST=Illinois... ok
ca_validate_cert: /C=US/ST=Illinois... ok
ca_reload: local cert type X509_CERT
config_getocsp: ocsp_url none
ikev2_dispatch_cert: updated local CERTREQ type X509_CERT length 20
ikev2_dispatch_cert: updated local CERTREQ type X509_CERT length 20
ikev2_recv: IKE_SA_INIT request from initiator xxx.yyy.1.254:55008 to
xxx.yyy.1.20:500 policy 'jacqueline_iphone_vpn' id 0, 432 bytes
ikev2_recv: ispi 0xd14315b81593285a rspi 0x0000000000000000
ikev2_policy2id: srcid FQDN/ikesync.myfqdn.com length 27
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x0000000000000000
nextpayload SA version 0x20 exchange IKE_SA_INIT flags 0x08 msgid 0 length 432
response 0
ikev2_pld_payloads: payload SA nextpayload KE critical 0x00 length 48
ikev2_pld_sa: more 0 reserved 0 length 44 proposal #1 protoid IKE spisize 0
xforms 4 spi 0
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type PRF id HMAC_SHA2_256
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type DH id MODP_2048
ikev2_pld_payloads: payload KE nextpayload NONCE critical 0x00 length 264
ikev2_pld_ke: dh group MODP_2048 reserved 0
ikev2_pld_payloads: payload NONCE nextpayload NOTIFY critical 0x00 length 20
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 8
ikev2_pld_notify: protoid NONE spisize 0 type REDIRECT_SUPPORTED
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_SOURCE_IP
ikev2_nat_detection: peer source 0xd14315b81593285a 0x0000000000000000
xxx.yyy.1.254:55008
ikev2_pld_notify: NAT_DETECTION_SOURCE_IP detected NAT, enabling UDP
encapsulation
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_DESTINATION_IP
ikev2_nat_detection: peer destination 0xd14315b81593285a 0x0000000000000000
xxx.yyy.1.20:500
ikev2_pld_payloads: payload NOTIFY nextpayload NONE critical 0x00 length 8
ikev2_pld_notify: protoid NONE spisize 0 type FRAGMENTATION_SUPPORTED
sa_state: INIT -> SA_INIT
ikev2_sa_negotiate: score 4
sa_stateok: SA_INIT flags 0x0000, require 0x0000
sa_stateflags: 0x0000 -> 0x0020 sa (required 0x0000 )
ikev2_sa_keys: SKEYSEED with 32 bytes
ikev2_sa_keys: S with 64 bytes
ikev2_prfplus: T1 with 32 bytes
ikev2_prfplus: T2 with 32 bytes
ikev2_prfplus: T3 with 32 bytes
ikev2_prfplus: T4 with 32 bytes
ikev2_prfplus: T5 with 32 bytes
ikev2_prfplus: T6 with 32 bytes
ikev2_prfplus: T7 with 32 bytes
ikev2_prfplus: Tn with 224 bytes
ikev2_sa_keys: SK_d with 32 bytes
ikev2_sa_keys: SK_ai with 32 bytes
ikev2_sa_keys: SK_ar with 32 bytes
ikev2_sa_keys: SK_ei with 32 bytes
ikev2_sa_keys: SK_er with 32 bytes
ikev2_sa_keys: SK_pi with 32 bytes
ikev2_sa_keys: SK_pr with 32 bytes
ikev2_add_proposals: length 44
ikev2_next_payload: length 48 nextpayload KE
ikev2_next_payload: length 264 nextpayload NONCE
ikev2_next_payload: length 36 nextpayload NOTIFY
ikev2_nat_detection: local source 0xd14315b81593285a 0x9f30f9d2ed8dfd11
xxx.yyy.1.20:500
ikev2_next_payload: length 28 nextpayload NOTIFY
ikev2_nat_detection: local destination 0xd14315b81593285a 0x9f30f9d2ed8dfd11
xxx.yyy.1.254:55008
ikev2_next_payload: length 28 nextpayload CERTREQ
ikev2_add_certreq: type X509_CERT length 21
ikev2_next_payload: length 25 nextpayload CERTREQ
ikev2_add_certreq: type RSA_KEY length 1
ikev2_next_payload: length 5 nextpayload NONE
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
nextpayload SA version 0x20 exchange IKE_SA_INIT flags 0x20 msgid 0 length 462
response 1
ikev2_pld_payloads: payload SA nextpayload KE critical 0x00 length 48
ikev2_pld_sa: more 0 reserved 0 length 44 proposal #1 protoid IKE spisize 0
xforms 4 spi 0
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type PRF id HMAC_SHA2_256
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type DH id MODP_2048
ikev2_pld_payloads: payload KE nextpayload NONCE critical 0x00 length 264
ikev2_pld_ke: dh group MODP_2048 reserved 0
ikev2_pld_payloads: payload NONCE nextpayload NOTIFY critical 0x00 length 36
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_SOURCE_IP
ikev2_pld_payloads: payload NOTIFY nextpayload CERTREQ critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_DESTINATION_IP
ikev2_pld_payloads: payload CERTREQ nextpayload CERTREQ critical 0x00 length 25
ikev2_pld_certreq: type X509_CERT length 20
ikev2_pld_payloads: payload CERTREQ nextpayload NONE critical 0x00 length 5
ikev2_pld_certreq: type RSA_KEY length 0
ikev2_msg_send: IKE_SA_INIT response from xxx.yyy.1.20:500 to
xxx.yyy.1.254:55008 msgid 0, 462 bytes
config_free_proposals: free 0x1529d4096700
ikev2_recv: IKE_AUTH request from initiator xxx.yyy.1.254:52833 to
xxx.yyy.1.20:4500 policy 'jacqueline_iphone_vpn' id 1, 2928 bytes
ikev2_recv: ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
ikev2_recv: updated SA to peer xxx.yyy.1.254:52833 local xxx.yyy.1.20:4500
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
nextpayload SK version 0x20 exchange IKE_AUTH flags 0x08 msgid 1 length 2928
response 0
ikev2_pld_payloads: payload SK nextpayload IDi critical 0x00 length 2900
ikev2_msg_decrypt: IV length 16
ikev2_msg_decrypt: encrypted payload length 2864
ikev2_msg_decrypt: integrity checksum length 16
ikev2_msg_decrypt: integrity check succeeded
ikev2_msg_decrypt: decrypted payload length 2864/2864 padding 14
ikev2_pld_payloads: decrypted payload IDi nextpayload NOTIFY critical 0x00
length 40
ikev2_pld_id: id FQDN/ios.ikev2.myfqdn.com length 36
ikev2_pld_payloads: decrypted payload NOTIFY nextpayload IDr critical 0x00
length 8
ikev2_pld_notify: protoid NONE spisize 0 type INITIAL_CONTACT
ikev2_pld_payloads: decrypted payload IDr nextpayload AUTH critical 0x00 length
31
ikev2_pld_id: id FQDN/ikesync.myfqdn.com length 27
ikev2_pld_id: unexpected id payload
ikev2_pld_payloads: decrypted payload AUTH nextpayload CERT critical 0x00 length
520
ikev2_pld_auth: method RSA_SIG length 512
sa_state: SA_INIT -> AUTH_REQUEST
ikev2_pld_payloads: decrypted payload CERT nextpayload CP critical 0x00 length
1997
ikev2_pld_cert: type X509_CERT length 1992
ikev2_pld_payloads: decrypted payload CP nextpayload NOTIFY critical 0x00 length
65
ikev2_pld_cp: type REQUEST length 57
ikev2_pld_cp: INTERNAL_IP4_ADDRESS 0x0001 length 0
ikev2_pld_cp: INTERNAL_IP4_SUBNET 0x000d length 0
ikev2_pld_cp: INTERNAL_IP4_DHCP 0x0006 length 0
ikev2_pld_cp: INTERNAL_IP4_DNS 0x0003 length 0
ikev2_pld_cp: INTERNAL_IP4_NETMASK 0x0002 length 0
ikev2_pld_cp: INTERNAL_IP6_ADDRESS 0x0008 length 0
ikev2_pld_cp: INTERNAL_IP6_SUBNET 0x000f length 17
ikev2_pld_cp: INTERNAL_IP6_DHCP 0x000c length 0
ikev2_pld_cp: INTERNAL_IP6_DNS 0x000a length 0
ikev2_pld_cp: <UNKNOWN:25> 0x0019 length 0
ikev2_pld_payloads: decrypted payload NOTIFY nextpayload NOTIFY critical 0x00
length 8
ikev2_pld_notify: protoid NONE spisize 0 type ESP_TFC_PADDING_NOT_SUPPORTED
ikev2_pld_payloads: decrypted payload NOTIFY nextpayload SA critical 0x00 length
8
ikev2_pld_notify: protoid NONE spisize 0 type NON_FIRST_FRAGMENTS_ALSO
ikev2_pld_payloads: decrypted payload SA nextpayload TSi critical 0x00 length 44
ikev2_pld_sa: more 0 reserved 0 length 40 proposal #1 protoid ESP spisize 4
xforms 3 spi 0x0f9dc45e
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type ESN id NONE
ikev2_pld_payloads: decrypted payload TSi nextpayload TSr critical 0x00 length
64
ikev2_pld_ts: count 2 length 56
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start 0.0.0.0 end 255.255.255.255
ikev2_pld_ts: type IPV6_ADDR_RANGE protoid 0 length 40 startport 0 endport 65535
ikev2_pld_ts: start :: end ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
ikev2_pld_payloads: decrypted payload TSr nextpayload NONE critical 0x00 length
64
ikev2_pld_ts: count 2 length 56
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start 0.0.0.0 end 255.255.255.255
ikev2_pld_ts: type IPV6_ADDR_RANGE protoid 0 length 40 startport 0 endport 65535
ikev2_pld_ts: start :: end ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
ikev2_resp_recv: NAT-T message received, updated SA
sa_stateok: SA_INIT flags 0x0000, require 0x0000
policy_lookup: peerid 'ios.ikev2.myfqdn.com'
ikev2_msg_auth: responder auth data length 510
ca_setauth: auth length 510
ikev2_msg_auth: initiator auth data length 496
ikev2_msg_authverify: method RSA_SIG keylen 1992 type X509_CERT
ikev2_msg_authverify: authentication successful
sa_state: AUTH_REQUEST -> AUTH_SUCCESS
sa_stateflags: 0x0020 -> 0x0030 authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
ikev2_sa_negotiate: score 4
sa_stateflags: 0x0030 -> 0x0030 authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x0030, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: cannot switch: AUTH_SUCCESS -> VALID
ikev2_ike_auth: no CERTREQ, using default
ikev2_policy2id: srcid FQDN/ikesync.myfqdn.com length 27
sa_stateflags: 0x0030 -> 0x0034 certreq,authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
config_free_proposals: free 0x152981361380
ca_setauth: auth length 512
ca_validate_pubkey: valid public key in file pubkeys/fqdn/ios.ikev2.myfqdn.com
ca_validate_cert: /C=US/ST=Illinois... in public key file, ok
ca_getreq: using local public key of type RSA_KEY
ikev2_getimsgdata: imsg 24 rspi 0x9f30f9d2ed8dfd11 ispi 0xd14315b81593285a
initiator 0 sa valid type 1 data length 512
ikev2_dispatch_cert: AUTH type 1 len 512
sa_stateflags: 0x0034 -> 0x003c certreq,auth,authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x0038, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: cannot switch: AUTH_SUCCESS -> VALID
ikev2_dispatch_cert: peer certificate is valid
sa_stateflags: 0x003c -> 0x003e certvalid,certreq,auth,authvalid,sa (required
0x003b cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x003a, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: cannot switch: AUTH_SUCCESS -> VALID
ikev2_getimsgdata: imsg 19 rspi 0x9f30f9d2ed8dfd11 ispi 0xd14315b81593285a
initiator 0 sa valid type 11 data length 526
ikev2_dispatch_cert: cert type RSA_KEY length 526, ok
sa_stateflags: 0x003e -> 0x003f cert,certvalid,certreq,auth,authvalid,sa
(required 0x003b cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x003b, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: AUTH_SUCCESS -> VALID
sa_stateok: VALID flags 0x003b, require 0x003b cert,certvalid,auth,authvalid,sa
sa_stateok: VALID flags 0x003b, require 0x003b cert,certvalid,auth,authvalid,sa
ikev2_sa_tag:  (0)
ikev2_childsa_negotiate: proposal 1
ikev2_childsa_negotiate: key material length 128
ikev2_prfplus: T1 with 32 bytes
ikev2_prfplus: T2 with 32 bytes
ikev2_prfplus: T3 with 32 bytes
ikev2_prfplus: T4 with 32 bytes
ikev2_prfplus: Tn with 128 bytes
pfkey_sa_getspi: spi 0x5fb0e721
pfkey_sa_init: new spi 0x5fb0e721
ikev2_next_payload: length 31 nextpayload CERT
ikev2_next_payload: length 531 nextpayload AUTH
ikev2_next_payload: length 520 nextpayload CP
ikev2_next_payload: length 48 nextpayload SA
ikev2_add_proposals: length 40
ikev2_next_payload: length 44 nextpayload TSi
ikev2_next_payload: length 24 nextpayload TSr
ikev2_next_payload: length 24 nextpayload NONE
ikev2_msg_encrypt: decrypted length 1222
ikev2_msg_encrypt: padded length 1232
ikev2_msg_encrypt: length 1223, padding 9, output length 1264
ikev2_next_payload: length 1268 nextpayload IDr
ikev2_msg_integr: message length 1296
ikev2_msg_integr: integrity checksum length 16
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
nextpayload SK version 0x20 exchange IKE_AUTH flags 0x20 msgid 1 length 1296
response 1
ikev2_pld_payloads: payload SK nextpayload IDr critical 0x00 length 1268
ikev2_msg_decrypt: IV length 16
ikev2_msg_decrypt: encrypted payload length 1232
ikev2_msg_decrypt: integrity checksum length 16
ikev2_msg_decrypt: integrity check succeeded
ikev2_msg_decrypt: decrypted payload length 1232/1232 padding 9
ikev2_pld_payloads: decrypted payload IDr nextpayload CERT critical 0x00 length
31
ikev2_pld_id: id FQDN/ikesync.myfqdn.com length 27
ikev2_pld_payloads: decrypted payload CERT nextpayload AUTH critical 0x00 length
531
ikev2_pld_cert: type RSA_KEY length 526
ikev2_pld_payloads: decrypted payload AUTH nextpayload CP critical 0x00 length
520
ikev2_pld_auth: method RSA_SIG length 512
ikev2_pld_payloads: decrypted payload CP nextpayload SA critical 0x00 length 48
ikev2_pld_cp: type REPLY length 40
ikev2_pld_cp: INTERNAL_IP4_ADDRESS 0x0001 length 4
ikev2_pld_cp: INTERNAL_IP4_NETMASK 0x0002 length 4
ikev2_pld_cp: INTERNAL_IP4_DNS 0x0003 length 4
ikev2_pld_cp: INTERNAL_IP4_DNS 0x0003 length 4
ikev2_pld_cp: INTERNAL_IP4_NBNS 0x0004 length 4
ikev2_pld_payloads: decrypted payload SA nextpayload TSi critical 0x00 length 44
ikev2_pld_sa: more 0 reserved 0 length 40 proposal #1 protoid ESP spisize 4
xforms 3 spi 0x5fb0e721
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type ESN id NONE
ikev2_pld_payloads: decrypted payload TSi nextpayload TSr critical 0x00 length
24
ikev2_pld_ts: count 1 length 16
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start xxx.yyy.15.0 end xxx.yyy.15.255
ikev2_pld_payloads: decrypted payload TSr nextpayload NONE critical 0x00 length
24
ikev2_pld_ts: count 1 length 16
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start 0.0.0.0 end 255.255.255.255
ikev2_msg_send: IKE_AUTH response from xxx.yyy.1.20:4500 to xxx.yyy.1.254:52833
msgid 1, 1296 bytes, NAT-T
pfkey_sa_add: update spi 0x5fb0e721
pfkey_sa: udpencap port 52833
ikev2_childsa_enable: loaded CHILD SA spi 0x5fb0e721
pfkey_sa_add: add spi 0x0f9dc45e
pfkey_sa: udpencap port 52833
ikev2_childsa_enable: loaded CHILD SA spi 0x0f9dc45e
ikev2_childsa_enable: loaded flow 0x1529ef902400
ikev2_childsa_enable: loaded flow 0x1529ef902800
sa_state: VALID -> ESTABLISHED from xxx.yyy.1.254:52833 to xxx.yyy.1.20:4500
policy 'ios_vpn'


And, if I run as a daemon, I can see:

# ipsecctl -s all

FLOWS:
flow esp in from xxx.yyy.15.0/24 to 0.0.0.0/0 peer xxx.yyy.1.254 srcid
FQDN/ikesync.myfqdn.com dstid FQDN/ios.ikev2.myfqdn.com type use
flow esp out from 0.0.0.0/0 to xxx.yyy.15.0/24 peer xxx.yyy.1.254 srcid
FQDN/ikesync.myfqdn.com dstid FQDN/ios.ikev2.myfqdn.com type require

SAD:
esp tunnel from xxx.yyy.1.20 to xxx.yyy.1.254 spi 0x05b906be auth hmac-sha2-256
enc aes-256
esp tunnel from xxx.yyy.1.254 to xxx.yyy.1.20 spi 0xebe5b208 auth hmac-sha2-256
enc aes-256

So, according to my OBSD 6.1 the VPN tunnel is up.

But, my iphone does not indicate that a VPN tunnel exists, and it is clearly
unable to access resources that require the VPN connection to be established.
The iphone simply shows "VPN connecting" for a second, and then stops and
reverts to its default status with no VPN.

I think I can get the logs off the iphone if necessary, but that's a bit more
difficult.

I am wondering if there is anything obvious that I am missing.

I am at a loss as to why this was working before the update to current, and why
OBSD shows a "VALID -> ESTABLISHED" state for the tunnel when the iOS device
shows no tunnel has been established.

Thanks for any help.

Ted



Reply | Threaded
Open this post in threaded view
|

Re: Unable to establish ikev2 vpn with ios after update to current - OpenBSD 6.1 GENERIC.MP#103 amd64

Theodore Wynnychenko-2
I updated to the most recent snapshot (OpenBSD 6.1 GENERIC.MP#103 amd64).

Unfortunately, while an OpenBSD to OpenBSD ikev2 tunnel works as expected,
attempts to establish a tunnel from ios to OpenBSD fail.

However, the OpenBSD machine appears to believe that the tunnel is up and fine
("sa_state: VALID -> ESTABLISHED"), while the iOS device indicates that no VPN
is up.

There appears to be no change from the snapshot from a couple of days ago, and
this had been working flawlessly through several snapshots over the last year.

Does anyone have any advice on this, and what might have changed?

I see nothing obvious that I need to change in the iked.conf based on the my
reading of the current manpage.

Thank you
Ted


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Theodore Wynnychenko
Sent: Sunday, June 04, 2017 8:14 PM
To: [hidden email]
Subject: Unable to estable ikev2 vpn with ios after update to current

Hello

I have been a bit remiss, and have not updated my system in a couple of months.
I have been following current for a year or two, in general, without incident.

Anyway, after updating last night, I am unable to establish a ikev2 vpn with an
ios 10.3.2 device.  A OBSD6.1<->OBSD6.1 ikev2 vpn is working fine.

I am hoping that someone could shove me in a direction.

I have been using iked with iOS for about a year without a problem.

However, after the update, I noticed that all iOS vpn attempts were failing.

Running # iked -dvvv and trying to connect showed:

...
ca_setauth: auth length 510
ikev2_ike_auth_recv: unexpected auth method RSA_SIG, was expecting SIG
ikev2_resp_recv: failed to send auth response
sa_state: AUTH_REQUEST -> CLOSED from xxx.yyy.1.254:64252 to xxx.yyy.1.20:4500
policy 'ios_vpn'
ikev2_recv: closing SA
sa_free: ispi 0xcd95648ffb47ac65 rspi 0x86e6b00a7646172e
config_free_proposals: free 0x13f816f06500
config_free_proposals: free 0x13f8e4f63580
ca_setauth: auth length 528
ca_validate_pubkey: could not open public key pubkeys/fqdn/ios.ikev2.myfqdn.com
ca_x509_subjectaltname: FQDN/ios.ikev2.myfqdn.com
ca_validate_cert: /C=US/ST=Illinois... ok
ikev2_getimsgdata: imsg 24 rspi 0x86e6b00a7646172e ispi 0xcd95648ffb47ac65
initiator 0 sa invalid type 14 data length 528
ikev2_dispatch_cert: invalid auth reply


I found a suggestion that placing an RSA public certificate on the local OBSD
machine could help.

So, I used:

# openssl rsa -in private.key -pubout >
/etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.com

Now, running # iked -dvvv shows:

set_policy_auth_method: using rsa for peer
/etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.com
set_policy: found pubkey for /etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.com
ikev2 "ios_vpn" passive esp inet from 0.0.0.0/0 to xxx.yyy.15.0/24 local
xxx.yyy.1.20 peer any ikesa enc aes-256,aes-192,aes-128,3des prf
hmac-sha2-256,hmac-sha1 auth hmac-sha2-256,hmac-sha1 group
modp2048,modp1536,modp1024 childsa enc aes-256,aes-192,aes-128 auth
hmac-sha2-256,hmac-sha1 srcid ikesync.myfqdn.com dstid ios.ikev2.myfqdn.com
ikelifetime 1800 lifetime 1800 bytes 536870912 rsa config address xxx.yyy.15.131
config netmask 255.255.255.0 config name-server xxx.yyy.1.128 config name-server
xxx.yyy.1.129 config netbios-server xxx.yyy.2.99
ca_privkey_serialize: type RSA_KEY length 2349
ca_pubkey_serialize: type RSA_KEY length 526
ca_privkey_to_method: type RSA_KEY method RSA_SIG
config_getpolicy: received policy
ca_getkey: received private key type RSA_KEY length 2349
ca_getkey: received public key type RSA_KEY length 526
ca_dispatch_parent: config reset
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpfkey: received pfkey fd 3
config_getcompile: compilation done
config_getsocket: received socket fd 4
config_getsocket: received socket fd 5
config_getsocket: received socket fd 6
config_getsocket: received socket fd 7
ca_reload: loaded ca file ca.crt
ca_reload: /C=US/ST=Illinois...
ca_reload: loaded 1 ca certificate
ca_reload: loaded cert file local.myfqdn.com.crt
ca_reload: loaded cert file ikesync.myfqdn.com.crt
ca_validate_cert: /C=US/ST=Illinois... ok
ca_validate_cert: /C=US/ST=Illinois... ok
ca_reload: local cert type X509_CERT
config_getocsp: ocsp_url none
ikev2_dispatch_cert: updated local CERTREQ type X509_CERT length 20
ikev2_dispatch_cert: updated local CERTREQ type X509_CERT length 20
ikev2_recv: IKE_SA_INIT request from initiator xxx.yyy.1.254:55008 to
xxx.yyy.1.20:500 policy 'jacqueline_iphone_vpn' id 0, 432 bytes
ikev2_recv: ispi 0xd14315b81593285a rspi 0x0000000000000000
ikev2_policy2id: srcid FQDN/ikesync.myfqdn.com length 27
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x0000000000000000
nextpayload SA version 0x20 exchange IKE_SA_INIT flags 0x08 msgid 0 length 432
response 0
ikev2_pld_payloads: payload SA nextpayload KE critical 0x00 length 48
ikev2_pld_sa: more 0 reserved 0 length 44 proposal #1 protoid IKE spisize 0
xforms 4 spi 0
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type PRF id HMAC_SHA2_256
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type DH id MODP_2048
ikev2_pld_payloads: payload KE nextpayload NONCE critical 0x00 length 264
ikev2_pld_ke: dh group MODP_2048 reserved 0
ikev2_pld_payloads: payload NONCE nextpayload NOTIFY critical 0x00 length 20
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 8
ikev2_pld_notify: protoid NONE spisize 0 type REDIRECT_SUPPORTED
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_SOURCE_IP
ikev2_nat_detection: peer source 0xd14315b81593285a 0x0000000000000000
xxx.yyy.1.254:55008
ikev2_pld_notify: NAT_DETECTION_SOURCE_IP detected NAT, enabling UDP
encapsulation
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_DESTINATION_IP
ikev2_nat_detection: peer destination 0xd14315b81593285a 0x0000000000000000
xxx.yyy.1.20:500
ikev2_pld_payloads: payload NOTIFY nextpayload NONE critical 0x00 length 8
ikev2_pld_notify: protoid NONE spisize 0 type FRAGMENTATION_SUPPORTED
sa_state: INIT -> SA_INIT
ikev2_sa_negotiate: score 4
sa_stateok: SA_INIT flags 0x0000, require 0x0000
sa_stateflags: 0x0000 -> 0x0020 sa (required 0x0000 )
ikev2_sa_keys: SKEYSEED with 32 bytes
ikev2_sa_keys: S with 64 bytes
ikev2_prfplus: T1 with 32 bytes
ikev2_prfplus: T2 with 32 bytes
ikev2_prfplus: T3 with 32 bytes
ikev2_prfplus: T4 with 32 bytes
ikev2_prfplus: T5 with 32 bytes
ikev2_prfplus: T6 with 32 bytes
ikev2_prfplus: T7 with 32 bytes
ikev2_prfplus: Tn with 224 bytes
ikev2_sa_keys: SK_d with 32 bytes
ikev2_sa_keys: SK_ai with 32 bytes
ikev2_sa_keys: SK_ar with 32 bytes
ikev2_sa_keys: SK_ei with 32 bytes
ikev2_sa_keys: SK_er with 32 bytes
ikev2_sa_keys: SK_pi with 32 bytes
ikev2_sa_keys: SK_pr with 32 bytes
ikev2_add_proposals: length 44
ikev2_next_payload: length 48 nextpayload KE
ikev2_next_payload: length 264 nextpayload NONCE
ikev2_next_payload: length 36 nextpayload NOTIFY
ikev2_nat_detection: local source 0xd14315b81593285a 0x9f30f9d2ed8dfd11
xxx.yyy.1.20:500
ikev2_next_payload: length 28 nextpayload NOTIFY
ikev2_nat_detection: local destination 0xd14315b81593285a 0x9f30f9d2ed8dfd11
xxx.yyy.1.254:55008
ikev2_next_payload: length 28 nextpayload CERTREQ
ikev2_add_certreq: type X509_CERT length 21
ikev2_next_payload: length 25 nextpayload CERTREQ
ikev2_add_certreq: type RSA_KEY length 1
ikev2_next_payload: length 5 nextpayload NONE
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
nextpayload SA version 0x20 exchange IKE_SA_INIT flags 0x20 msgid 0 length 462
response 1
ikev2_pld_payloads: payload SA nextpayload KE critical 0x00 length 48
ikev2_pld_sa: more 0 reserved 0 length 44 proposal #1 protoid IKE spisize 0
xforms 4 spi 0
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type PRF id HMAC_SHA2_256
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type DH id MODP_2048
ikev2_pld_payloads: payload KE nextpayload NONCE critical 0x00 length 264
ikev2_pld_ke: dh group MODP_2048 reserved 0
ikev2_pld_payloads: payload NONCE nextpayload NOTIFY critical 0x00 length 36
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_SOURCE_IP
ikev2_pld_payloads: payload NOTIFY nextpayload CERTREQ critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_DESTINATION_IP
ikev2_pld_payloads: payload CERTREQ nextpayload CERTREQ critical 0x00 length 25
ikev2_pld_certreq: type X509_CERT length 20
ikev2_pld_payloads: payload CERTREQ nextpayload NONE critical 0x00 length 5
ikev2_pld_certreq: type RSA_KEY length 0
ikev2_msg_send: IKE_SA_INIT response from xxx.yyy.1.20:500 to
xxx.yyy.1.254:55008 msgid 0, 462 bytes
config_free_proposals: free 0x1529d4096700
ikev2_recv: IKE_AUTH request from initiator xxx.yyy.1.254:52833 to
xxx.yyy.1.20:4500 policy 'jacqueline_iphone_vpn' id 1, 2928 bytes
ikev2_recv: ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
ikev2_recv: updated SA to peer xxx.yyy.1.254:52833 local xxx.yyy.1.20:4500
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
nextpayload SK version 0x20 exchange IKE_AUTH flags 0x08 msgid 1 length 2928
response 0
ikev2_pld_payloads: payload SK nextpayload IDi critical 0x00 length 2900
ikev2_msg_decrypt: IV length 16
ikev2_msg_decrypt: encrypted payload length 2864
ikev2_msg_decrypt: integrity checksum length 16
ikev2_msg_decrypt: integrity check succeeded
ikev2_msg_decrypt: decrypted payload length 2864/2864 padding 14
ikev2_pld_payloads: decrypted payload IDi nextpayload NOTIFY critical 0x00
length 40
ikev2_pld_id: id FQDN/ios.ikev2.myfqdn.com length 36
ikev2_pld_payloads: decrypted payload NOTIFY nextpayload IDr critical 0x00
length 8
ikev2_pld_notify: protoid NONE spisize 0 type INITIAL_CONTACT
ikev2_pld_payloads: decrypted payload IDr nextpayload AUTH critical 0x00 length
31
ikev2_pld_id: id FQDN/ikesync.myfqdn.com length 27
ikev2_pld_id: unexpected id payload
ikev2_pld_payloads: decrypted payload AUTH nextpayload CERT critical 0x00 length
520
ikev2_pld_auth: method RSA_SIG length 512
sa_state: SA_INIT -> AUTH_REQUEST
ikev2_pld_payloads: decrypted payload CERT nextpayload CP critical 0x00 length
1997
ikev2_pld_cert: type X509_CERT length 1992
ikev2_pld_payloads: decrypted payload CP nextpayload NOTIFY critical 0x00 length
65
ikev2_pld_cp: type REQUEST length 57
ikev2_pld_cp: INTERNAL_IP4_ADDRESS 0x0001 length 0
ikev2_pld_cp: INTERNAL_IP4_SUBNET 0x000d length 0
ikev2_pld_cp: INTERNAL_IP4_DHCP 0x0006 length 0
ikev2_pld_cp: INTERNAL_IP4_DNS 0x0003 length 0
ikev2_pld_cp: INTERNAL_IP4_NETMASK 0x0002 length 0
ikev2_pld_cp: INTERNAL_IP6_ADDRESS 0x0008 length 0
ikev2_pld_cp: INTERNAL_IP6_SUBNET 0x000f length 17
ikev2_pld_cp: INTERNAL_IP6_DHCP 0x000c length 0
ikev2_pld_cp: INTERNAL_IP6_DNS 0x000a length 0
ikev2_pld_cp: <UNKNOWN:25> 0x0019 length 0
ikev2_pld_payloads: decrypted payload NOTIFY nextpayload NOTIFY critical 0x00
length 8
ikev2_pld_notify: protoid NONE spisize 0 type ESP_TFC_PADDING_NOT_SUPPORTED
ikev2_pld_payloads: decrypted payload NOTIFY nextpayload SA critical 0x00 length
8
ikev2_pld_notify: protoid NONE spisize 0 type NON_FIRST_FRAGMENTS_ALSO
ikev2_pld_payloads: decrypted payload SA nextpayload TSi critical 0x00 length 44
ikev2_pld_sa: more 0 reserved 0 length 40 proposal #1 protoid ESP spisize 4
xforms 3 spi 0x0f9dc45e
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type ESN id NONE
ikev2_pld_payloads: decrypted payload TSi nextpayload TSr critical 0x00 length
64
ikev2_pld_ts: count 2 length 56
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start 0.0.0.0 end 255.255.255.255
ikev2_pld_ts: type IPV6_ADDR_RANGE protoid 0 length 40 startport 0 endport 65535
ikev2_pld_ts: start :: end ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
ikev2_pld_payloads: decrypted payload TSr nextpayload NONE critical 0x00 length
64
ikev2_pld_ts: count 2 length 56
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start 0.0.0.0 end 255.255.255.255
ikev2_pld_ts: type IPV6_ADDR_RANGE protoid 0 length 40 startport 0 endport 65535
ikev2_pld_ts: start :: end ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
ikev2_resp_recv: NAT-T message received, updated SA
sa_stateok: SA_INIT flags 0x0000, require 0x0000
policy_lookup: peerid 'ios.ikev2.myfqdn.com'
ikev2_msg_auth: responder auth data length 510
ca_setauth: auth length 510
ikev2_msg_auth: initiator auth data length 496
ikev2_msg_authverify: method RSA_SIG keylen 1992 type X509_CERT
ikev2_msg_authverify: authentication successful
sa_state: AUTH_REQUEST -> AUTH_SUCCESS
sa_stateflags: 0x0020 -> 0x0030 authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
ikev2_sa_negotiate: score 4
sa_stateflags: 0x0030 -> 0x0030 authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x0030, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: cannot switch: AUTH_SUCCESS -> VALID
ikev2_ike_auth: no CERTREQ, using default
ikev2_policy2id: srcid FQDN/ikesync.myfqdn.com length 27
sa_stateflags: 0x0030 -> 0x0034 certreq,authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
config_free_proposals: free 0x152981361380
ca_setauth: auth length 512
ca_validate_pubkey: valid public key in file pubkeys/fqdn/ios.ikev2.myfqdn.com
ca_validate_cert: /C=US/ST=Illinois... in public key file, ok
ca_getreq: using local public key of type RSA_KEY
ikev2_getimsgdata: imsg 24 rspi 0x9f30f9d2ed8dfd11 ispi 0xd14315b81593285a
initiator 0 sa valid type 1 data length 512
ikev2_dispatch_cert: AUTH type 1 len 512
sa_stateflags: 0x0034 -> 0x003c certreq,auth,authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x0038, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: cannot switch: AUTH_SUCCESS -> VALID
ikev2_dispatch_cert: peer certificate is valid
sa_stateflags: 0x003c -> 0x003e certvalid,certreq,auth,authvalid,sa (required
0x003b cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x003a, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: cannot switch: AUTH_SUCCESS -> VALID
ikev2_getimsgdata: imsg 19 rspi 0x9f30f9d2ed8dfd11 ispi 0xd14315b81593285a
initiator 0 sa valid type 11 data length 526
ikev2_dispatch_cert: cert type RSA_KEY length 526, ok
sa_stateflags: 0x003e -> 0x003f cert,certvalid,certreq,auth,authvalid,sa
(required 0x003b cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x003b, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: AUTH_SUCCESS -> VALID
sa_stateok: VALID flags 0x003b, require 0x003b cert,certvalid,auth,authvalid,sa
sa_stateok: VALID flags 0x003b, require 0x003b cert,certvalid,auth,authvalid,sa
ikev2_sa_tag:  (0)
ikev2_childsa_negotiate: proposal 1
ikev2_childsa_negotiate: key material length 128
ikev2_prfplus: T1 with 32 bytes
ikev2_prfplus: T2 with 32 bytes
ikev2_prfplus: T3 with 32 bytes
ikev2_prfplus: T4 with 32 bytes
ikev2_prfplus: Tn with 128 bytes
pfkey_sa_getspi: spi 0x5fb0e721
pfkey_sa_init: new spi 0x5fb0e721
ikev2_next_payload: length 31 nextpayload CERT
ikev2_next_payload: length 531 nextpayload AUTH
ikev2_next_payload: length 520 nextpayload CP
ikev2_next_payload: length 48 nextpayload SA
ikev2_add_proposals: length 40
ikev2_next_payload: length 44 nextpayload TSi
ikev2_next_payload: length 24 nextpayload TSr
ikev2_next_payload: length 24 nextpayload NONE
ikev2_msg_encrypt: decrypted length 1222
ikev2_msg_encrypt: padded length 1232
ikev2_msg_encrypt: length 1223, padding 9, output length 1264
ikev2_next_payload: length 1268 nextpayload IDr
ikev2_msg_integr: message length 1296
ikev2_msg_integr: integrity checksum length 16
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
nextpayload SK version 0x20 exchange IKE_AUTH flags 0x20 msgid 1 length 1296
response 1
ikev2_pld_payloads: payload SK nextpayload IDr critical 0x00 length 1268
ikev2_msg_decrypt: IV length 16
ikev2_msg_decrypt: encrypted payload length 1232
ikev2_msg_decrypt: integrity checksum length 16
ikev2_msg_decrypt: integrity check succeeded
ikev2_msg_decrypt: decrypted payload length 1232/1232 padding 9
ikev2_pld_payloads: decrypted payload IDr nextpayload CERT critical 0x00 length
31
ikev2_pld_id: id FQDN/ikesync.myfqdn.com length 27
ikev2_pld_payloads: decrypted payload CERT nextpayload AUTH critical 0x00 length
531
ikev2_pld_cert: type RSA_KEY length 526
ikev2_pld_payloads: decrypted payload AUTH nextpayload CP critical 0x00 length
520
ikev2_pld_auth: method RSA_SIG length 512
ikev2_pld_payloads: decrypted payload CP nextpayload SA critical 0x00 length 48
ikev2_pld_cp: type REPLY length 40
ikev2_pld_cp: INTERNAL_IP4_ADDRESS 0x0001 length 4
ikev2_pld_cp: INTERNAL_IP4_NETMASK 0x0002 length 4
ikev2_pld_cp: INTERNAL_IP4_DNS 0x0003 length 4
ikev2_pld_cp: INTERNAL_IP4_DNS 0x0003 length 4
ikev2_pld_cp: INTERNAL_IP4_NBNS 0x0004 length 4
ikev2_pld_payloads: decrypted payload SA nextpayload TSi critical 0x00 length 44
ikev2_pld_sa: more 0 reserved 0 length 40 proposal #1 protoid ESP spisize 4
xforms 3 spi 0x5fb0e721
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type ESN id NONE
ikev2_pld_payloads: decrypted payload TSi nextpayload TSr critical 0x00 length
24
ikev2_pld_ts: count 1 length 16
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start xxx.yyy.15.0 end xxx.yyy.15.255
ikev2_pld_payloads: decrypted payload TSr nextpayload NONE critical 0x00 length
24
ikev2_pld_ts: count 1 length 16
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start 0.0.0.0 end 255.255.255.255
ikev2_msg_send: IKE_AUTH response from xxx.yyy.1.20:4500 to xxx.yyy.1.254:52833
msgid 1, 1296 bytes, NAT-T
pfkey_sa_add: update spi 0x5fb0e721
pfkey_sa: udpencap port 52833
ikev2_childsa_enable: loaded CHILD SA spi 0x5fb0e721
pfkey_sa_add: add spi 0x0f9dc45e
pfkey_sa: udpencap port 52833
ikev2_childsa_enable: loaded CHILD SA spi 0x0f9dc45e
ikev2_childsa_enable: loaded flow 0x1529ef902400
ikev2_childsa_enable: loaded flow 0x1529ef902800
sa_state: VALID -> ESTABLISHED from xxx.yyy.1.254:52833 to xxx.yyy.1.20:4500
policy 'ios_vpn'


And, if I run as a daemon, I can see:

# ipsecctl -s all

FLOWS:
flow esp in from xxx.yyy.15.0/24 to 0.0.0.0/0 peer xxx.yyy.1.254 srcid
FQDN/ikesync.myfqdn.com dstid FQDN/ios.ikev2.myfqdn.com type use
flow esp out from 0.0.0.0/0 to xxx.yyy.15.0/24 peer xxx.yyy.1.254 srcid
FQDN/ikesync.myfqdn.com dstid FQDN/ios.ikev2.myfqdn.com type require

SAD:
esp tunnel from xxx.yyy.1.20 to xxx.yyy.1.254 spi 0x05b906be auth hmac-sha2-256
enc aes-256
esp tunnel from xxx.yyy.1.254 to xxx.yyy.1.20 spi 0xebe5b208 auth hmac-sha2-256
enc aes-256

So, according to my OBSD 6.1 the VPN tunnel is up.

But, my iphone does not indicate that a VPN tunnel exists, and it is clearly
unable to access resources that require the VPN connection to be established.
The iphone simply shows "VPN connecting" for a second, and then stops and
reverts to its default status with no VPN.

I think I can get the logs off the iphone if necessary, but that's a bit more
difficult.

I am wondering if there is anything obvious that I am missing.

I am at a loss as to why this was working before the update to current, and why
OBSD shows a "VALID -> ESTABLISHED" state for the tunnel when the iOS device
shows no tunnel has been established.

Thanks for any help.

Ted





Reply | Threaded
Open this post in threaded view
|

Re: Unable to establish ikev2 vpn with ios using current - OpenBSD 6.1 GENERIC.MP#106 amd64 - can anyone help?

Theodore Wynnychenko-2
Hello

I have updated to the last several snapshots as they have come out, but continue
to be unable to establish a VPN between iOS and OpenBSD.  As the iOS device has
not been updated recently, the "problem" appears to relate to something that
changed on the OpenBSD side.

I don't know, and don't even have an idea of how I could find out, if this is a
problem with iOS not following some standard, or if it is an issue with
OpenBSD's iked.

I am not trying to be demanding, and I am not suggesting that I am entitled to
any help whatsoever.  But, I will admit that I have come to rely on iked, and
the loss of a VPN to iOS is a problem for me.

I got logs off the an iphone (a snip is below), but other than seeing that the
iphone tries to create a VPN, and then fails and disconnects (despite the fact
that openBSD states the connection is ESTABLISHED), I have no clue what is
happening.

---
Jun  6 14:54:14 iPhone nesessionmanager(NetworkExtension)[124] <Error>: Not
hashing value with class __NSDate
Jun  6 14:54:14 iPhone nesessionmanager(NetworkExtension)[124] <Notice>:
NESMIKEv2VPNSession[Wynnychenko VPN:D636E9EF-3B66-4537-93E8-0E3DEC18D7AB]:
Received a start command from Preferences[200]
Jun  6 14:54:14 iPhone nesessionmanager(NetworkExtension)[124] <Notice>:
NESMIKEv2VPNSession[Wynnychenko VPN:D636E9EF-3B66-4537-93E8-0E3DEC18D7AB]:
status changed to connecting
Jun  6 14:54:14 iPhone nesessionmanager(NetworkExtension)[124] <Error>: Plugin
com.apple.neplugin.IKEv2 does not have a bundle URL
Jun  6 14:54:14 iPhone kernel(Sandbox)[0] <Notice>: SandboxViolation:
nesessionmanager(124) deny(1) file-issue-extension target:
/System/Library/Frameworks/NetworkExtension.framework/PluginIKEv2.vpnplugin
class: com.apple.vpn-plugin
Jun  6 14:54:14 iPhone nesessionmanager(NetworkExtension)[124] <Error>:
sendInitCommand: failed to create a com.apple.vpn-plugin sandbox extension for
/System/Library/Frameworks/NetworkExtension.framework/PluginIKEv2.vpnplugin
Jun  6 14:54:14 iPhone neagent(NetworkExtension)[824] <Error>: Certificate at
index 0 could not be created
Jun  6 14:54:14 iPhone neagent(NetworkExtension)[824] <Error>: Certificate
authentication data could not be verified
Jun  6 14:54:14 iPhone neagent(NetworkExtension)[824] <Error>: Failed to process
IKE Auth packet
Jun  6 14:54:14 iPhone nesessionmanager(NetworkExtension)[124] <Notice>:
NESMIKEv2VPNSession[Wynnychenko VPN:D636E9EF-3B66-4537-93E8-0E3DEC18D7AB]:
status changed to disconnecting
Jun  6 14:54:14 iPhone configd[32] <Notice>: network changed
Jun  6 14:54:14 iPhone kernel[0] <Notice>: SIOCPROTODETACH_IN6: ipsec3 error=6
Jun  6 14:54:14 iPhone configd(IPConfiguration)[32] <Notice>:
siocprotodetach(pdp_ip0) failed, Resource busy (16)
Jun  6 14:54:14 iPhone nesessionmanager(NetworkExtension)[124] <Notice>:
NESMIKEv2VPNSession[Wynnychenko VPN:D636E9EF-3B66-4537-93E8-0E3DEC18D7AB]:
status changed to disconnected, last stop reason Plugin initiated
---

If anyone can offer anything to help fix this issue, even just letting me know
that this a problem that I am experiencing locally and not a problem with the
current iked, I would really appreciate it.

Thank you
Ted



-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Theodore Wynnychenko
Sent: Monday, June 05, 2017 7:16 PM
To: [hidden email]
Subject: Re: Unable to establish ikev2 vpn with ios after update to current -
OpenBSD 6.1 GENERIC.MP#103 amd64

I updated to the most recent snapshot (OpenBSD 6.1 GENERIC.MP#103 amd64).

Unfortunately, while an OpenBSD to OpenBSD ikev2 tunnel works as expected,
attempts to establish a tunnel from ios to OpenBSD fail.

However, the OpenBSD machine appears to believe that the tunnel is up and fine
("sa_state: VALID -> ESTABLISHED"), while the iOS device indicates that no VPN
is up.

There appears to be no change from the snapshot from a couple of days ago, and
this had been working flawlessly through several snapshots over the last year.

Does anyone have any advice on this, and what might have changed?

I see nothing obvious that I need to change in the iked.conf based on the my
reading of the current manpage.

Thank you
Ted


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Theodore Wynnychenko
Sent: Sunday, June 04, 2017 8:14 PM
To: [hidden email]
Subject: Unable to estable ikev2 vpn with ios after update to current

Hello

I have been a bit remiss, and have not updated my system in a couple of months.
I have been following current for a year or two, in general, without incident.

Anyway, after updating last night, I am unable to establish a ikev2 vpn with an
ios 10.3.2 device.  A OBSD6.1<->OBSD6.1 ikev2 vpn is working fine.

I am hoping that someone could shove me in a direction.

I have been using iked with iOS for about a year without a problem.

However, after the update, I noticed that all iOS vpn attempts were failing.

Running # iked -dvvv and trying to connect showed:

...
ca_setauth: auth length 510
ikev2_ike_auth_recv: unexpected auth method RSA_SIG, was expecting SIG
ikev2_resp_recv: failed to send auth response
sa_state: AUTH_REQUEST -> CLOSED from xxx.yyy.1.254:64252 to xxx.yyy.1.20:4500
policy 'ios_vpn'
ikev2_recv: closing SA
sa_free: ispi 0xcd95648ffb47ac65 rspi 0x86e6b00a7646172e
config_free_proposals: free 0x13f816f06500
config_free_proposals: free 0x13f8e4f63580
ca_setauth: auth length 528
ca_validate_pubkey: could not open public key pubkeys/fqdn/ios.ikev2.myfqdn.com
ca_x509_subjectaltname: FQDN/ios.ikev2.myfqdn.com
ca_validate_cert: /C=US/ST=Illinois... ok
ikev2_getimsgdata: imsg 24 rspi 0x86e6b00a7646172e ispi 0xcd95648ffb47ac65
initiator 0 sa invalid type 14 data length 528
ikev2_dispatch_cert: invalid auth reply


I found a suggestion that placing an RSA public certificate on the local OBSD
machine could help.

So, I used:

# openssl rsa -in private.key -pubout >
/etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.com

Now, running # iked -dvvv shows:

set_policy_auth_method: using rsa for peer
/etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.com
set_policy: found pubkey for /etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.com
ikev2 "ios_vpn" passive esp inet from 0.0.0.0/0 to xxx.yyy.15.0/24 local
xxx.yyy.1.20 peer any ikesa enc aes-256,aes-192,aes-128,3des prf
hmac-sha2-256,hmac-sha1 auth hmac-sha2-256,hmac-sha1 group
modp2048,modp1536,modp1024 childsa enc aes-256,aes-192,aes-128 auth
hmac-sha2-256,hmac-sha1 srcid ikesync.myfqdn.com dstid ios.ikev2.myfqdn.com
ikelifetime 1800 lifetime 1800 bytes 536870912 rsa config address xxx.yyy.15.131
config netmask 255.255.255.0 config name-server xxx.yyy.1.128 config name-server
xxx.yyy.1.129 config netbios-server xxx.yyy.2.99
ca_privkey_serialize: type RSA_KEY length 2349
ca_pubkey_serialize: type RSA_KEY length 526
ca_privkey_to_method: type RSA_KEY method RSA_SIG
config_getpolicy: received policy
ca_getkey: received private key type RSA_KEY length 2349
ca_getkey: received public key type RSA_KEY length 526
ca_dispatch_parent: config reset
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpolicy: received policy
config_getpfkey: received pfkey fd 3
config_getcompile: compilation done
config_getsocket: received socket fd 4
config_getsocket: received socket fd 5
config_getsocket: received socket fd 6
config_getsocket: received socket fd 7
ca_reload: loaded ca file ca.crt
ca_reload: /C=US/ST=Illinois...
ca_reload: loaded 1 ca certificate
ca_reload: loaded cert file local.myfqdn.com.crt
ca_reload: loaded cert file ikesync.myfqdn.com.crt
ca_validate_cert: /C=US/ST=Illinois... ok
ca_validate_cert: /C=US/ST=Illinois... ok
ca_reload: local cert type X509_CERT
config_getocsp: ocsp_url none
ikev2_dispatch_cert: updated local CERTREQ type X509_CERT length 20
ikev2_dispatch_cert: updated local CERTREQ type X509_CERT length 20
ikev2_recv: IKE_SA_INIT request from initiator xxx.yyy.1.254:55008 to
xxx.yyy.1.20:500 policy 'jacqueline_iphone_vpn' id 0, 432 bytes
ikev2_recv: ispi 0xd14315b81593285a rspi 0x0000000000000000
ikev2_policy2id: srcid FQDN/ikesync.myfqdn.com length 27
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x0000000000000000
nextpayload SA version 0x20 exchange IKE_SA_INIT flags 0x08 msgid 0 length 432
response 0
ikev2_pld_payloads: payload SA nextpayload KE critical 0x00 length 48
ikev2_pld_sa: more 0 reserved 0 length 44 proposal #1 protoid IKE spisize 0
xforms 4 spi 0
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type PRF id HMAC_SHA2_256
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type DH id MODP_2048
ikev2_pld_payloads: payload KE nextpayload NONCE critical 0x00 length 264
ikev2_pld_ke: dh group MODP_2048 reserved 0
ikev2_pld_payloads: payload NONCE nextpayload NOTIFY critical 0x00 length 20
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 8
ikev2_pld_notify: protoid NONE spisize 0 type REDIRECT_SUPPORTED
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_SOURCE_IP
ikev2_nat_detection: peer source 0xd14315b81593285a 0x0000000000000000
xxx.yyy.1.254:55008
ikev2_pld_notify: NAT_DETECTION_SOURCE_IP detected NAT, enabling UDP
encapsulation
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_DESTINATION_IP
ikev2_nat_detection: peer destination 0xd14315b81593285a 0x0000000000000000
xxx.yyy.1.20:500
ikev2_pld_payloads: payload NOTIFY nextpayload NONE critical 0x00 length 8
ikev2_pld_notify: protoid NONE spisize 0 type FRAGMENTATION_SUPPORTED
sa_state: INIT -> SA_INIT
ikev2_sa_negotiate: score 4
sa_stateok: SA_INIT flags 0x0000, require 0x0000
sa_stateflags: 0x0000 -> 0x0020 sa (required 0x0000 )
ikev2_sa_keys: SKEYSEED with 32 bytes
ikev2_sa_keys: S with 64 bytes
ikev2_prfplus: T1 with 32 bytes
ikev2_prfplus: T2 with 32 bytes
ikev2_prfplus: T3 with 32 bytes
ikev2_prfplus: T4 with 32 bytes
ikev2_prfplus: T5 with 32 bytes
ikev2_prfplus: T6 with 32 bytes
ikev2_prfplus: T7 with 32 bytes
ikev2_prfplus: Tn with 224 bytes
ikev2_sa_keys: SK_d with 32 bytes
ikev2_sa_keys: SK_ai with 32 bytes
ikev2_sa_keys: SK_ar with 32 bytes
ikev2_sa_keys: SK_ei with 32 bytes
ikev2_sa_keys: SK_er with 32 bytes
ikev2_sa_keys: SK_pi with 32 bytes
ikev2_sa_keys: SK_pr with 32 bytes
ikev2_add_proposals: length 44
ikev2_next_payload: length 48 nextpayload KE
ikev2_next_payload: length 264 nextpayload NONCE
ikev2_next_payload: length 36 nextpayload NOTIFY
ikev2_nat_detection: local source 0xd14315b81593285a 0x9f30f9d2ed8dfd11
xxx.yyy.1.20:500
ikev2_next_payload: length 28 nextpayload NOTIFY
ikev2_nat_detection: local destination 0xd14315b81593285a 0x9f30f9d2ed8dfd11
xxx.yyy.1.254:55008
ikev2_next_payload: length 28 nextpayload CERTREQ
ikev2_add_certreq: type X509_CERT length 21
ikev2_next_payload: length 25 nextpayload CERTREQ
ikev2_add_certreq: type RSA_KEY length 1
ikev2_next_payload: length 5 nextpayload NONE
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
nextpayload SA version 0x20 exchange IKE_SA_INIT flags 0x20 msgid 0 length 462
response 1
ikev2_pld_payloads: payload SA nextpayload KE critical 0x00 length 48
ikev2_pld_sa: more 0 reserved 0 length 44 proposal #1 protoid IKE spisize 0
xforms 4 spi 0
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type PRF id HMAC_SHA2_256
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type DH id MODP_2048
ikev2_pld_payloads: payload KE nextpayload NONCE critical 0x00 length 264
ikev2_pld_ke: dh group MODP_2048 reserved 0
ikev2_pld_payloads: payload NONCE nextpayload NOTIFY critical 0x00 length 36
ikev2_pld_payloads: payload NOTIFY nextpayload NOTIFY critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_SOURCE_IP
ikev2_pld_payloads: payload NOTIFY nextpayload CERTREQ critical 0x00 length 28
ikev2_pld_notify: protoid NONE spisize 0 type NAT_DETECTION_DESTINATION_IP
ikev2_pld_payloads: payload CERTREQ nextpayload CERTREQ critical 0x00 length 25
ikev2_pld_certreq: type X509_CERT length 20
ikev2_pld_payloads: payload CERTREQ nextpayload NONE critical 0x00 length 5
ikev2_pld_certreq: type RSA_KEY length 0
ikev2_msg_send: IKE_SA_INIT response from xxx.yyy.1.20:500 to
xxx.yyy.1.254:55008 msgid 0, 462 bytes
config_free_proposals: free 0x1529d4096700
ikev2_recv: IKE_AUTH request from initiator xxx.yyy.1.254:52833 to
xxx.yyy.1.20:4500 policy 'jacqueline_iphone_vpn' id 1, 2928 bytes
ikev2_recv: ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
ikev2_recv: updated SA to peer xxx.yyy.1.254:52833 local xxx.yyy.1.20:4500
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
nextpayload SK version 0x20 exchange IKE_AUTH flags 0x08 msgid 1 length 2928
response 0
ikev2_pld_payloads: payload SK nextpayload IDi critical 0x00 length 2900
ikev2_msg_decrypt: IV length 16
ikev2_msg_decrypt: encrypted payload length 2864
ikev2_msg_decrypt: integrity checksum length 16
ikev2_msg_decrypt: integrity check succeeded
ikev2_msg_decrypt: decrypted payload length 2864/2864 padding 14
ikev2_pld_payloads: decrypted payload IDi nextpayload NOTIFY critical 0x00
length 40
ikev2_pld_id: id FQDN/ios.ikev2.myfqdn.com length 36
ikev2_pld_payloads: decrypted payload NOTIFY nextpayload IDr critical 0x00
length 8
ikev2_pld_notify: protoid NONE spisize 0 type INITIAL_CONTACT
ikev2_pld_payloads: decrypted payload IDr nextpayload AUTH critical 0x00 length
31
ikev2_pld_id: id FQDN/ikesync.myfqdn.com length 27
ikev2_pld_id: unexpected id payload
ikev2_pld_payloads: decrypted payload AUTH nextpayload CERT critical 0x00 length
520
ikev2_pld_auth: method RSA_SIG length 512
sa_state: SA_INIT -> AUTH_REQUEST
ikev2_pld_payloads: decrypted payload CERT nextpayload CP critical 0x00 length
1997
ikev2_pld_cert: type X509_CERT length 1992
ikev2_pld_payloads: decrypted payload CP nextpayload NOTIFY critical 0x00 length
65
ikev2_pld_cp: type REQUEST length 57
ikev2_pld_cp: INTERNAL_IP4_ADDRESS 0x0001 length 0
ikev2_pld_cp: INTERNAL_IP4_SUBNET 0x000d length 0
ikev2_pld_cp: INTERNAL_IP4_DHCP 0x0006 length 0
ikev2_pld_cp: INTERNAL_IP4_DNS 0x0003 length 0
ikev2_pld_cp: INTERNAL_IP4_NETMASK 0x0002 length 0
ikev2_pld_cp: INTERNAL_IP6_ADDRESS 0x0008 length 0
ikev2_pld_cp: INTERNAL_IP6_SUBNET 0x000f length 17
ikev2_pld_cp: INTERNAL_IP6_DHCP 0x000c length 0
ikev2_pld_cp: INTERNAL_IP6_DNS 0x000a length 0
ikev2_pld_cp: <UNKNOWN:25> 0x0019 length 0
ikev2_pld_payloads: decrypted payload NOTIFY nextpayload NOTIFY critical 0x00
length 8
ikev2_pld_notify: protoid NONE spisize 0 type ESP_TFC_PADDING_NOT_SUPPORTED
ikev2_pld_payloads: decrypted payload NOTIFY nextpayload SA critical 0x00 length
8
ikev2_pld_notify: protoid NONE spisize 0 type NON_FIRST_FRAGMENTS_ALSO
ikev2_pld_payloads: decrypted payload SA nextpayload TSi critical 0x00 length 44
ikev2_pld_sa: more 0 reserved 0 length 40 proposal #1 protoid ESP spisize 4
xforms 3 spi 0x0f9dc45e
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type ESN id NONE
ikev2_pld_payloads: decrypted payload TSi nextpayload TSr critical 0x00 length
64
ikev2_pld_ts: count 2 length 56
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start 0.0.0.0 end 255.255.255.255
ikev2_pld_ts: type IPV6_ADDR_RANGE protoid 0 length 40 startport 0 endport 65535
ikev2_pld_ts: start :: end ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
ikev2_pld_payloads: decrypted payload TSr nextpayload NONE critical 0x00 length
64
ikev2_pld_ts: count 2 length 56
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start 0.0.0.0 end 255.255.255.255
ikev2_pld_ts: type IPV6_ADDR_RANGE protoid 0 length 40 startport 0 endport 65535
ikev2_pld_ts: start :: end ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
ikev2_resp_recv: NAT-T message received, updated SA
sa_stateok: SA_INIT flags 0x0000, require 0x0000
policy_lookup: peerid 'ios.ikev2.myfqdn.com'
ikev2_msg_auth: responder auth data length 510
ca_setauth: auth length 510
ikev2_msg_auth: initiator auth data length 496
ikev2_msg_authverify: method RSA_SIG keylen 1992 type X509_CERT
ikev2_msg_authverify: authentication successful
sa_state: AUTH_REQUEST -> AUTH_SUCCESS
sa_stateflags: 0x0020 -> 0x0030 authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
ikev2_sa_negotiate: score 4
sa_stateflags: 0x0030 -> 0x0030 authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x0030, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: cannot switch: AUTH_SUCCESS -> VALID
ikev2_ike_auth: no CERTREQ, using default
ikev2_policy2id: srcid FQDN/ikesync.myfqdn.com length 27
sa_stateflags: 0x0030 -> 0x0034 certreq,authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
config_free_proposals: free 0x152981361380
ca_setauth: auth length 512
ca_validate_pubkey: valid public key in file pubkeys/fqdn/ios.ikev2.myfqdn.com
ca_validate_cert: /C=US/ST=Illinois... in public key file, ok
ca_getreq: using local public key of type RSA_KEY
ikev2_getimsgdata: imsg 24 rspi 0x9f30f9d2ed8dfd11 ispi 0xd14315b81593285a
initiator 0 sa valid type 1 data length 512
ikev2_dispatch_cert: AUTH type 1 len 512
sa_stateflags: 0x0034 -> 0x003c certreq,auth,authvalid,sa (required 0x003b
cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x0038, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: cannot switch: AUTH_SUCCESS -> VALID
ikev2_dispatch_cert: peer certificate is valid
sa_stateflags: 0x003c -> 0x003e certvalid,certreq,auth,authvalid,sa (required
0x003b cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x003a, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: cannot switch: AUTH_SUCCESS -> VALID
ikev2_getimsgdata: imsg 19 rspi 0x9f30f9d2ed8dfd11 ispi 0xd14315b81593285a
initiator 0 sa valid type 11 data length 526
ikev2_dispatch_cert: cert type RSA_KEY length 526, ok
sa_stateflags: 0x003e -> 0x003f cert,certvalid,certreq,auth,authvalid,sa
(required 0x003b cert,certvalid,auth,authvalid,sa)
sa_stateok: VALID flags 0x003b, require 0x003b cert,certvalid,auth,authvalid,sa
sa_state: AUTH_SUCCESS -> VALID
sa_stateok: VALID flags 0x003b, require 0x003b cert,certvalid,auth,authvalid,sa
sa_stateok: VALID flags 0x003b, require 0x003b cert,certvalid,auth,authvalid,sa
ikev2_sa_tag:  (0)
ikev2_childsa_negotiate: proposal 1
ikev2_childsa_negotiate: key material length 128
ikev2_prfplus: T1 with 32 bytes
ikev2_prfplus: T2 with 32 bytes
ikev2_prfplus: T3 with 32 bytes
ikev2_prfplus: T4 with 32 bytes
ikev2_prfplus: Tn with 128 bytes
pfkey_sa_getspi: spi 0x5fb0e721
pfkey_sa_init: new spi 0x5fb0e721
ikev2_next_payload: length 31 nextpayload CERT
ikev2_next_payload: length 531 nextpayload AUTH
ikev2_next_payload: length 520 nextpayload CP
ikev2_next_payload: length 48 nextpayload SA
ikev2_add_proposals: length 40
ikev2_next_payload: length 44 nextpayload TSi
ikev2_next_payload: length 24 nextpayload TSr
ikev2_next_payload: length 24 nextpayload NONE
ikev2_msg_encrypt: decrypted length 1222
ikev2_msg_encrypt: padded length 1232
ikev2_msg_encrypt: length 1223, padding 9, output length 1264
ikev2_next_payload: length 1268 nextpayload IDr
ikev2_msg_integr: message length 1296
ikev2_msg_integr: integrity checksum length 16
ikev2_pld_parse: header ispi 0xd14315b81593285a rspi 0x9f30f9d2ed8dfd11
nextpayload SK version 0x20 exchange IKE_AUTH flags 0x20 msgid 1 length 1296
response 1
ikev2_pld_payloads: payload SK nextpayload IDr critical 0x00 length 1268
ikev2_msg_decrypt: IV length 16
ikev2_msg_decrypt: encrypted payload length 1232
ikev2_msg_decrypt: integrity checksum length 16
ikev2_msg_decrypt: integrity check succeeded
ikev2_msg_decrypt: decrypted payload length 1232/1232 padding 9
ikev2_pld_payloads: decrypted payload IDr nextpayload CERT critical 0x00 length
31
ikev2_pld_id: id FQDN/ikesync.myfqdn.com length 27
ikev2_pld_payloads: decrypted payload CERT nextpayload AUTH critical 0x00 length
531
ikev2_pld_cert: type RSA_KEY length 526
ikev2_pld_payloads: decrypted payload AUTH nextpayload CP critical 0x00 length
520
ikev2_pld_auth: method RSA_SIG length 512
ikev2_pld_payloads: decrypted payload CP nextpayload SA critical 0x00 length 48
ikev2_pld_cp: type REPLY length 40
ikev2_pld_cp: INTERNAL_IP4_ADDRESS 0x0001 length 4
ikev2_pld_cp: INTERNAL_IP4_NETMASK 0x0002 length 4
ikev2_pld_cp: INTERNAL_IP4_DNS 0x0003 length 4
ikev2_pld_cp: INTERNAL_IP4_DNS 0x0003 length 4
ikev2_pld_cp: INTERNAL_IP4_NBNS 0x0004 length 4
ikev2_pld_payloads: decrypted payload SA nextpayload TSi critical 0x00 length 44
ikev2_pld_sa: more 0 reserved 0 length 40 proposal #1 protoid ESP spisize 4
xforms 3 spi 0x5fb0e721
ikev2_pld_xform: more 3 reserved 0 length 12 type ENCR id AES_CBC
ikev2_pld_attr: attribute type KEY_LENGTH length 256 total 4
ikev2_pld_xform: more 3 reserved 0 length 8 type INTEGR id HMAC_SHA2_256_128
ikev2_pld_xform: more 0 reserved 0 length 8 type ESN id NONE
ikev2_pld_payloads: decrypted payload TSi nextpayload TSr critical 0x00 length
24
ikev2_pld_ts: count 1 length 16
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start xxx.yyy.15.0 end xxx.yyy.15.255
ikev2_pld_payloads: decrypted payload TSr nextpayload NONE critical 0x00 length
24
ikev2_pld_ts: count 1 length 16
ikev2_pld_ts: type IPV4_ADDR_RANGE protoid 0 length 16 startport 0 endport 65535
ikev2_pld_ts: start 0.0.0.0 end 255.255.255.255
ikev2_msg_send: IKE_AUTH response from xxx.yyy.1.20:4500 to xxx.yyy.1.254:52833
msgid 1, 1296 bytes, NAT-T
pfkey_sa_add: update spi 0x5fb0e721
pfkey_sa: udpencap port 52833
ikev2_childsa_enable: loaded CHILD SA spi 0x5fb0e721
pfkey_sa_add: add spi 0x0f9dc45e
pfkey_sa: udpencap port 52833
ikev2_childsa_enable: loaded CHILD SA spi 0x0f9dc45e
ikev2_childsa_enable: loaded flow 0x1529ef902400
ikev2_childsa_enable: loaded flow 0x1529ef902800
sa_state: VALID -> ESTABLISHED from xxx.yyy.1.254:52833 to xxx.yyy.1.20:4500
policy 'ios_vpn'


And, if I run as a daemon, I can see:

# ipsecctl -s all

FLOWS:
flow esp in from xxx.yyy.15.0/24 to 0.0.0.0/0 peer xxx.yyy.1.254 srcid
FQDN/ikesync.myfqdn.com dstid FQDN/ios.ikev2.myfqdn.com type use
flow esp out from 0.0.0.0/0 to xxx.yyy.15.0/24 peer xxx.yyy.1.254 srcid
FQDN/ikesync.myfqdn.com dstid FQDN/ios.ikev2.myfqdn.com type require

SAD:
esp tunnel from xxx.yyy.1.20 to xxx.yyy.1.254 spi 0x05b906be auth hmac-sha2-256
enc aes-256
esp tunnel from xxx.yyy.1.254 to xxx.yyy.1.20 spi 0xebe5b208 auth hmac-sha2-256
enc aes-256

So, according to my OBSD 6.1 the VPN tunnel is up.

But, my iphone does not indicate that a VPN tunnel exists, and it is clearly
unable to access resources that require the VPN connection to be established.
The iphone simply shows "VPN connecting" for a second, and then stops and
reverts to its default status with no VPN.

I think I can get the logs off the iphone if necessary, but that's a bit more
difficult.

I am wondering if there is anything obvious that I am missing.

I am at a loss as to why this was working before the update to current, and why
OBSD shows a "VALID -> ESTABLISHED" state for the tunnel when the iOS device
shows no tunnel has been established.

Thanks for any help.

Ted







Reply | Threaded
Open this post in threaded view
|

Re: Unable to establish ikev2 vpn with ios using current - OpenBSD 6.1 GENERIC.MP#106 amd64 - can anyone help?

Stuart Henderson
On 2017-06-07, Theodore Wynnychenko <[hidden email]> wrote:
> I have updated to the last several snapshots as they have come out, but continue
> to be unable to establish a VPN between iOS and OpenBSD.  As the iOS device has
> not been updated recently, the "problem" appears to relate to something that
> changed on the OpenBSD side.
..
> I have been a bit remiss, and have not updated my system in a couple of months.
> I have been following current for a year or two, in general, without incident.
>
> Anyway, after updating last night, I am unable to establish a ikev2 vpn with an
> ios 10.3.2 device.  A OBSD6.1<->OBSD6.1 ikev2 vpn is working fine.

Does 6.1 work to your ios device? (fwiw I do have various ios and windows
devices connecting to 6.1 iked here).

Can you work backwards, updating iked source to earlier dates, building and
testing until you find the commit which broke it?

cd /usr/src
cvs up -D 2017/05/01 -P sbin/iked usr.sbin/ikectl
cd sbin/iked
make obj && make && sudo make install
cd ../../usr.sbin/ikectl
make obj && make && sudo make install
(restart iked/test)

Dates to try

2017/04/28
2017/04/25
2017/04/20
2017/04/15

And before this it's 6.1.



Reply | Threaded
Open this post in threaded view
|

Is anyone able to use certificates with openbsd iked/ikev2 and Apple iOS (iphone)?

Theodore Wynnychenko-2
In reply to this post by Theodore Wynnychenko-2
Hello

Last year (before about 3/27/2017 when "Add support for RFC4754 (ECDSA) and
RFC7427 authentication" diff was committed to current), I had set up and had
been able to connect iOS devices (iphone/ipad) to OpenBSD's iked, and have ikev2
VPN's happen, almost as if by, magic.

Authentication was accomplished using certificates signed by a local authority
and then distributed to the iOS devices.

Since 3/27/17, this has not been working.  I sent a couple of emails about this
last year (the initial one:
https://marc.info/?l=openbsd-bugs&m=149706080419488&w=2).

Over the last year, I have tried many things.  Even though I don't know anything
about programming (or C), I tried making little changes to the iked source, all
without success.  (Is that any surprise? No.  I was amazed at times that my
changes even resulted in a program that would actually start up and run.)

I have tried creating several different CA's and certificates, using various
different algorithms (ECDSA and RSA, with varying key lengths), all without
success.  For example, I just tried creating a CA and certificates with
ECDSA384/SHA2-384; I distribute those to the iOS device (which supports them),
but, iked will not accept them and create a tunnel.

In iked.conf, if I don't explicitly state something like "ecdsa384" as the
authentication method (and, this requires having a local copy of the public key
on the openbsd machine), iked falls back to rfc7427 for authentication, but it
appears that iOS does not support this (yet?).

I have been downgrading iked to a version before the 3/27/17 (every time I
update -current), and this still allows my old certificates to work.  But, that
doesn't seem sustainable.

I have no idea how to proceed?

Has anyone been able to get -current (or at least, a snapshot after 3/27/17)
version of iked to work with any iOS devices using certificates successfully?

If so, I would really appreciate some advice on how it can be done.

Thanks
Ted


Reply | Threaded
Open this post in threaded view
|

Re: Is anyone able to use certificates with openbsd iked/ikev2 and Apple iOS (iphone)?

J Evans
 > Hello
 >
 > Last year (before about 3/27/2017 when "Add support for RFC4754
(ECDSA) and
 > RFC7427 authentication" diff was committed to current), I had set up
and had
 > been able to connect iOS devices (iphone/ipad) to OpenBSD's iked, and
have ikev2
 > VPN's happen, almost as if by, magic.
 >
 > Authentication was accomplished using certificates signed by a local
authority
 > and then distributed to the iOS devices.
 >
 > Since 3/27/17, this has not been working.  I sent a couple of emails
about this
 > last year (the initial one:
 > https://marc.info/?l=openbsd-bugs&m=149706080419488&w=2).
 >
 > Over the last year, I have tried many things.  Even though I don't
know anything
 > about programming (or C), I tried making little changes to the iked
source, all
 > without success.  (Is that any surprise? No.  I was amazed at times
that my
 > changes even resulted in a program that would actually start up and run.)
 >
 > I have tried creating several different CA's and certificates, using
various
 > different algorithms (ECDSA and RSA, with varying key lengths), all
without
 > success.  For example, I just tried creating a CA and certificates with
 > ECDSA384/SHA2-384; I distribute those to the iOS device (which
supports them),
 > but, iked will not accept them and create a tunnel.
 >
 > In iked.conf, if I don't explicitly state something like "ecdsa384"
as the
 > authentication method (and, this requires having a local copy of the
public key
 > on the openbsd machine), iked falls back to rfc7427 for
authentication, but it
 > appears that iOS does not support this (yet?).
 >
 > I have been downgrading iked to a version before the 3/27/17 (every
time I
 > update -current), and this still allows my old certificates to work. 
But, that
 > doesn't seem sustainable.
 >
 > I have no idea how to proceed?
 >
 > Has anyone been able to get -current (or at least, a snapshot after
3/27/17)
 > version of iked to work with any iOS devices using certificates
successfully?
 >
 > If so, I would really appreciate some advice on how it can be done.
 >
 > Thanks
 > Ted

I am not an expert and have not tried to connect an ios device, but I
noticed
from your other email, that your problem was *similar* to one I had.

 From other email:
 > In this case, there is an error, and the tunnel is CLOSED.

 > ikev2_ike_auth_recv: unexpected auth method RSA_SIG, was expecting SIG
 > ikev2_resp_recv: failed to send auth response
 > sa_state: AUTH_REQUEST -> CLOSED from xxx.yyy.1.254:62164 to
xxx.yyy.1.20:4500
 > policy 'ios2_vpn'

 > Before learning how to go back in time, I found a suggestion that
placing an RSA
 > public certificate on the local OBSD machine could help.

 > So, I used:

 > # openssl rsa -in private.key -pubout >
 > /etc/iked/pubkeys/fqdn/ios.ikev2.myfqdn.co

I had a problem like this where the active peers (clients) would
complain about
not having a public key and show the above error as well. It seems from
the openssl command above that you
created a public key for the active peer, which is backwards from what
ended up
working for me. I created a public key based on the private key of the
passive
peer (server) and copied it to /etc/iked/pubkeys/ipv4/ on the active peers
(clients) and then I was able to connect.

 > Jun  6 14:54:14 iPhone neagent(NetworkExtension)[824] <Error>:
Certificate
 > at index 0 could not be created
 > Jun  6 14:54:14 iPhone neagent(NetworkExtension)[824] <Error>:
Certificate
 > authentication data could not be verified

This error from your iphone log is *similar* to the one I was recieveing
on my
openbsd clients.

So on whatever machine the CA is on, I did:
openssl rsa -in /etc/ssl/NAME_OF_CA/private/ip.of.passive.peer.key \
-pubout -out ip.of.passive.peer

... and then copied ip.of.passive.peer to /etc/iked/pubkeys/ipv4/ on the
*clients*

I am not sure where that would be on the iphone. Hope this helps, I am by no
means an expert, and  if I am giving bad advice hopefully someone more
informed
will chime in.

I got this info from here:
https://www.going-flying.com/blog/mikrotik-openbsd-ikev2.html

It seems the person writing the article upgraded to 6.1 and things had
changed.



Reply | Threaded
Open this post in threaded view
|

Re: Is anyone able to use certificates with openbsd iked/ikev2 and Apple iOS (iphone)?

Tim Stewart-2
In reply to this post by Theodore Wynnychenko-2
Hi Ted,

On 6/2/18 12:26 PM, Theodore Wynnychenko wrote:

> Hello
>
> Last year (before about 3/27/2017 when "Add support for RFC4754 (ECDSA) and
> RFC7427 authentication" diff was committed to current), I had set up and had
> been able to connect iOS devices (iphone/ipad) to OpenBSD's iked, and have ikev2
> VPN's happen, almost as if by, magic.
>
> Authentication was accomplished using certificates signed by a local authority
> and then distributed to the iOS devices.
>
> Since 3/27/17, this has not been working.  I sent a couple of emails about this
> last year (the initial one:
> https://marc.info/?l=openbsd-bugs&m=149706080419488&w=2).
>
> Over the last year, I have tried many things.  Even though I don't know anything
> about programming (or C), I tried making little changes to the iked source, all
> without success.  (Is that any surprise? No.  I was amazed at times that my
> changes even resulted in a program that would actually start up and run.)
>
> I have tried creating several different CA's and certificates, using various
> different algorithms (ECDSA and RSA, with varying key lengths), all without
> success.  For example, I just tried creating a CA and certificates with
> ECDSA384/SHA2-384; I distribute those to the iOS device (which supports them),
> but, iked will not accept them and create a tunnel.
>
> In iked.conf, if I don't explicitly state something like "ecdsa384" as the
> authentication method (and, this requires having a local copy of the public key
> on the openbsd machine), iked falls back to rfc7427 for authentication, but it
> appears that iOS does not support this (yet?).
>
> I have been downgrading iked to a version before the 3/27/17 (every time I
> update -current), and this still allows my old certificates to work.  But, that
> doesn't seem sustainable.
>
> I have no idea how to proceed?
>
> Has anyone been able to get -current (or at least, a snapshot after 3/27/17)
> version of iked to work with any iOS devices using certificates successfully?
>
> If so, I would really appreciate some advice on how it can be done.
>
> Thanks
> Ted

Last night I tried to set up my iPad for the first time and ran into a
similar issue.  Today I remembered writing a patch for a similar issue
after RFC7427 was added:

   https://marc.info/?l=openbsd-tech&m=149499973130985

After applying this, and adding the `rsa' ikeauth parameter to the
policy, the iPad successfully connected.

Can you try applying that patch and see if it resolves your issue?  If
it also works for you, I'll reply on that thread and see if anyone wants
to opine on the patch.

-TimS

--
Tim Stewart
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Is anyone able to use certificates with openbsd iked/ikev2 and Apple iOS (iphone)?

Matthew Ernisse
I have not tried ECDSA, however I've had iOS and macOS devices
running with iked since it came into OpenBSD using certificate auth
with RSA 2048 certs and a RSA 4096 CA.

I just recently wrote a blog post on it, it includes a general overview
of how I did it and a fragment of my .mobileconfig and iked.conf.

https://www.going-flying.com/blog/protecting-my-macos-and-ios-devices-with-an-openbsd-vpn.html

My VPN endpoint is currently running:
OpenBSD 6.4 (GENERIC) #7: Thu Feb 28 18:10:07 CET 2019
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC

--Matt


> On Apr 4, 2019, at 20:08, Tim Stewart <[hidden email]> wrote:
>
> Hi Ted,
>
> On 6/2/18 12:26 PM, Theodore Wynnychenko wrote:
>> Hello
>> Last year (before about 3/27/2017 when "Add support for RFC4754 (ECDSA) and
>> RFC7427 authentication" diff was committed to current), I had set up and had
>> been able to connect iOS devices (iphone/ipad) to OpenBSD's iked, and have ikev2
>> VPN's happen, almost as if by, magic.
>> Authentication was accomplished using certificates signed by a local authority
>> and then distributed to the iOS devices.
>> Since 3/27/17, this has not been working.  I sent a couple of emails about this
>> last year (the initial one:
>> https://marc.info/?l=openbsd-bugs&m=149706080419488&w=2).
>> Over the last year, I have tried many things.  Even though I don't know anything
>> about programming (or C), I tried making little changes to the iked source, all
>> without success.  (Is that any surprise? No.  I was amazed at times that my
>> changes even resulted in a program that would actually start up and run.)
>> I have tried creating several different CA's and certificates, using various
>> different algorithms (ECDSA and RSA, with varying key lengths), all without
>> success.  For example, I just tried creating a CA and certificates with
>> ECDSA384/SHA2-384; I distribute those to the iOS device (which supports them),
>> but, iked will not accept them and create a tunnel.
>> In iked.conf, if I don't explicitly state something like "ecdsa384" as the
>> authentication method (and, this requires having a local copy of the public key
>> on the openbsd machine), iked falls back to rfc7427 for authentication, but it
>> appears that iOS does not support this (yet?).
>> I have been downgrading iked to a version before the 3/27/17 (every time I
>> update -current), and this still allows my old certificates to work.  But, that
>> doesn't seem sustainable.
>> I have no idea how to proceed?
>> Has anyone been able to get -current (or at least, a snapshot after 3/27/17)
>> version of iked to work with any iOS devices using certificates successfully?
>> If so, I would really appreciate some advice on how it can be done.
>> Thanks
>> Ted
>
> Last night I tried to set up my iPad for the first time and ran into a similar issue.  Today I remembered writing a patch for a similar issue after RFC7427 was added:
>
>  https://marc.info/?l=openbsd-tech&m=149499973130985
>
> After applying this, and adding the `rsa' ikeauth parameter to the policy, the iPad successfully connected.
>
> Can you try applying that patch and see if it resolves your issue?  If it also works for you, I'll reply on that thread and see if anyone wants to opine on the patch.
>
> -TimS
>
> --
> Tim Stewart
> [hidden email]
>

Reply | Threaded
Open this post in threaded view
|

Re: Is anyone able to use certificates with openbsd iked/ikev2 and Apple iOS (iphone)?

Michael Lam
Are you able to have 2 clients connected at the same time? When I tried
that (I am using mschap) whenever the 2nd client connects the 1st one's
traffic will not go through anymore (it stays connected but no traffic
can go through).

I raised this a month ago but seems to have no response. Still trying
my luck.

> On 5 Apr 2019, at 9:39 AM, Matthew Ernisse <[hidden email]> wrote:
>
> I have not tried ECDSA, however I've had iOS and macOS devices
> running with iked since it came into OpenBSD using certificate auth
> with RSA 2048 certs and a RSA 4096 CA.
>
> I just recently wrote a blog post on it, it includes a general overview
> of how I did it and a fragment of my .mobileconfig and iked.conf.
>
> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.going-flying.com%2Fblog%2Fprotecting-my-macos-and-ios-devices-with-an-openbsd-vpn.html&amp;data=02%7C01%7C%7C675601333aaa494427c508d6b9c79949%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636900664254709962&amp;sdata=uIBgD24uPOMi6qRmTNOzrYPjdx87Fny1jzlyX5CSI%2B4%3D&amp;reserved=0
>
> My VPN endpoint is currently running:
> OpenBSD 6.4 (GENERIC) #7: Thu Feb 28 18:10:07 CET 2019
>    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC
>
> --Matt
>
>
>> On Apr 4, 2019, at 20:08, Tim Stewart <[hidden email]> wrote:
>>
>> Hi Ted,
>>
>> On 6/2/18 12:26 PM, Theodore Wynnychenko wrote:
>>> Hello
>>> Last year (before about 3/27/2017 when "Add support for RFC4754 (ECDSA) and
>>> RFC7427 authentication" diff was committed to current), I had set up and had
>>> been able to connect iOS devices (iphone/ipad) to OpenBSD's iked, and have ikev2
>>> VPN's happen, almost as if by, magic.
>>> Authentication was accomplished using certificates signed by a local authority
>>> and then distributed to the iOS devices.
>>> Since 3/27/17, this has not been working.  I sent a couple of emails about this
>>> last year (the initial one:
>>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmarc.info%2F%3Fl%3Dopenbsd-bugs%26m%3D149706080419488%26w%3D2&amp;data=02%7C01%7C%7C675601333aaa494427c508d6b9c79949%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636900664254709962&amp;sdata=uJr1HNzvBSGIIzxR4CxW3ZuMyksW9B9mD%2BI4PBdUSs4%3D&amp;reserved=0).
>>> Over the last year, I have tried many things.  Even though I don't know anything
>>> about programming (or C), I tried making little changes to the iked source, all
>>> without success.  (Is that any surprise? No.  I was amazed at times that my
>>> changes even resulted in a program that would actually start up and run.)
>>> I have tried creating several different CA's and certificates, using various
>>> different algorithms (ECDSA and RSA, with varying key lengths), all without
>>> success.  For example, I just tried creating a CA and certificates with
>>> ECDSA384/SHA2-384; I distribute those to the iOS device (which supports them),
>>> but, iked will not accept them and create a tunnel.
>>> In iked.conf, if I don't explicitly state something like "ecdsa384" as the
>>> authentication method (and, this requires having a local copy of the public key
>>> on the openbsd machine), iked falls back to rfc7427 for authentication, but it
>>> appears that iOS does not support this (yet?).
>>> I have been downgrading iked to a version before the 3/27/17 (every time I
>>> update -current), and this still allows my old certificates to work.  But, that
>>> doesn't seem sustainable.
>>> I have no idea how to proceed?
>>> Has anyone been able to get -current (or at least, a snapshot after 3/27/17)
>>> version of iked to work with any iOS devices using certificates successfully?
>>> If so, I would really appreciate some advice on how it can be done.
>>> Thanks
>>> Ted
>>
>> Last night I tried to set up my iPad for the first time and ran into a similar issue.  Today I remembered writing a patch for a similar issue after RFC7427 was added:
>>
>> https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmarc.info%2F%3Fl%3Dopenbsd-tech%26m%3D149499973130985&amp;data=02%7C01%7C%7C675601333aaa494427c508d6b9c79949%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636900664254709962&amp;sdata=HjDwiJ%2BqxTq%2BeddEPECY1HXTp68V2xoqJI7pnlzrDDc%3D&amp;reserved=0
>>
>> After applying this, and adding the `rsa' ikeauth parameter to the policy, the iPad successfully connected.
>>
>> Can you try applying that patch and see if it resolves your issue?  If it also works for you, I'll reply on that thread and see if anyone wants to opine on the patch.
>>
>> -TimS
>>
>> --
>> Tim Stewart
>> [hidden email]
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Is anyone able to use certificates with openbsd iked/ikev2 and Apple iOS (iphone)?

Matthew Ernisse
On Fri, Apr 05, 2019 at 01:45:19PM +0000, Michael Lam said unto me:
>
> Are you able to have 2 clients connected at the same time? When I tried
> that (I am using mschap) whenever the 2nd client connects the 1st one's
> traffic will not go through anymore (it stays connected but no traffic
> can go through).

Yes.  In general I have 3 static site-to-site tunnels with specific
flows (running GRE on top), and then typically 1 but have had  3 simultaneous
connections hitting the roadwarrior policy.  All of the tunnels are
using rsa certificate authentication with FQDN ids.

--Matt

--
Matthew Ernisse
[hidden email]
http://www.going-flying.com/

Reply | Threaded
Open this post in threaded view
|

Re: Is anyone able to use certificates with openbsd iked/ikev2 and Apple iOS (iphone)?

quisquous
In reply to this post by Michael Lam
On 04/05, Michael Lam wrote:
>Are you able to have 2 clients connected at the same time? When I tried
>that (I am using mschap) whenever the 2nd client connects the 1st one's
>traffic will not go through anymore (it stays connected but no traffic
>can go through).

I've noticed that, if my 2 ikedv2 clients are on the same network using
NAT and private IPs, instead of having their own public IPs, that they
kick each other off when either of them connects to my remote ikedv2
server. At least last time I tried, on OpenBSD 6.3 I think. Both clients
and server are running OpenBSD.

Searching the interwebs led me to think maybe IPSEC and NAT-T don't
support that scenario...the flows say to send all the packets to the
NATted network's public IP, but maybe the NATted network router doesn't
know where to send it to after that, or rather, only can handle one such
connection at a time, so, whenever a new one is started, the old one
gets stomped.

Anyhoo, I don't know what I'm talking about, my usage of OpenBSD has
only helped me get from complete ignorance of this stuff to slightly
less ignorant, so, take all this with a grain of salt. :)

Reply | Threaded
Open this post in threaded view
|

Re: Is anyone able to use certificates with openbsd iked/ikev2 and Apple iOS (iphone)?

Michael Lam
In reply to this post by Matthew Ernisse
Hi,

I don't have GRE and all clients are iOS devices on the same policy. The
symptom is like when the 2nd client connects, the IPSec flow that is shown
via ipsecctl -sa indicates that the 2nd flow, due to the fact that it is
assigned an IP address in the same subnet of the first one (due to the
config-address directive in iked.conf, overrides the flow control of the
first client.

I will try again using certificates to see if it works and if time permits
but I doubt the behaviour will be different that using mschap.

Rgds,

Michael

> On 5 Apr 2019, at 10:05 PM, Matthew Ernisse <[hidden email]> wrote:
>
> On Fri, Apr 05, 2019 at 01:45:19PM +0000, Michael Lam said unto me:
>>
>> Are you able to have 2 clients connected at the same time? When I tried
>> that (I am using mschap) whenever the 2nd client connects the 1st one's
>> traffic will not go through anymore (it stays connected but no traffic
>> can go through).
>
> Yes.  In general I have 3 static site-to-site tunnels with specific
> flows (running GRE on top), and then typically 1 but have had  3 simultaneous
> connections hitting the roadwarrior policy.  All of the tunnels are
> using rsa certificate authentication with FQDN ids.
>
> --Matt
>
> --
> Matthew Ernisse
> [hidden email]
> https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.going-flying.com%2F&amp;data=02%7C01%7C%7C3bce9717b64e4d2b05db08d6b9f6a3dd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636900866311673906&amp;sdata=A7rqTNJWvQlyqwPljmIltHQaWxOMqUm0o8JuMsNEfD4%3D&amp;reserved=0
>

Reply | Threaded
Open this post in threaded view
|

Re: Is anyone able to use certificates with openbsd iked/ikev2 and Apple iOS (iphone)?

Tim Stewart-2
In reply to this post by Matthew Ernisse
Matt,

Matthew Ernisse <[hidden email]> writes:

> I have not tried ECDSA, however I've had iOS and macOS devices
> running with iked since it came into OpenBSD using certificate auth
> with RSA 2048 certs and a RSA 4096 CA.
>
> I just recently wrote a blog post on it, it includes a general overview
> of how I did it and a fragment of my .mobileconfig and iked.conf.
>
> https://www.going-flying.com/blog/protecting-my-macos-and-ios-devices-with-an-openbsd-vpn.html
>
> My VPN endpoint is currently running:
> OpenBSD 6.4 (GENERIC) #7: Thu Feb 28 18:10:07 CET 2019
>     [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC


My configuration is rather similar, at least in spirit.  The main
differences I see are that I specify a dstid in iked.conf and I don't
specify exact crypto transforms.  My .mobileconfig file is basically
identical to yours.

I'll do another round of testing and be more explicit about the crypto
transforms, and will reply here with the results.

Thanks for the link!

-TimS


>> On Apr 4, 2019, at 20:08, Tim Stewart <[hidden email]> wrote:
>>
>> Hi Ted,
>>
>> On 6/2/18 12:26 PM, Theodore Wynnychenko wrote:
>>> Hello
>>> Last year (before about 3/27/2017 when "Add support for RFC4754 (ECDSA) and
>>> RFC7427 authentication" diff was committed to current), I had set up and had
>>> been able to connect iOS devices (iphone/ipad) to OpenBSD's iked, and have ikev2
>>> VPN's happen, almost as if by, magic.
>>> Authentication was accomplished using certificates signed by a local authority
>>> and then distributed to the iOS devices.
>>> Since 3/27/17, this has not been working.  I sent a couple of emails about this
>>> last year (the initial one:
>>> https://marc.info/?l=openbsd-bugs&m=149706080419488&w=2).
>>> Over the last year, I have tried many things.  Even though I don't know anything
>>> about programming (or C), I tried making little changes to the iked source, all
>>> without success.  (Is that any surprise? No.  I was amazed at times that my
>>> changes even resulted in a program that would actually start up and run.)
>>> I have tried creating several different CA's and certificates, using various
>>> different algorithms (ECDSA and RSA, with varying key lengths), all without
>>> success.  For example, I just tried creating a CA and certificates with
>>> ECDSA384/SHA2-384; I distribute those to the iOS device (which supports them),
>>> but, iked will not accept them and create a tunnel.
>>> In iked.conf, if I don't explicitly state something like "ecdsa384" as the
>>> authentication method (and, this requires having a local copy of the public key
>>> on the openbsd machine), iked falls back to rfc7427 for authentication, but it
>>> appears that iOS does not support this (yet?).
>>> I have been downgrading iked to a version before the 3/27/17 (every time I
>>> update -current), and this still allows my old certificates to work.  But, that
>>> doesn't seem sustainable.
>>> I have no idea how to proceed?
>>> Has anyone been able to get -current (or at least, a snapshot after 3/27/17)
>>> version of iked to work with any iOS devices using certificates successfully?
>>> If so, I would really appreciate some advice on how it can be done.
>>> Thanks
>>> Ted
>>
>> Last night I tried to set up my iPad for the first time and ran into a similar issue.  Today I remembered writing a patch for a similar issue after RFC7427 was added:
>>
>>  https://marc.info/?l=openbsd-tech&m=149499973130985
>>
>> After applying this, and adding the `rsa' ikeauth parameter to the policy, the iPad successfully connected.
>>
>> Can you try applying that patch and see if it resolves your issue?  If it also works for you, I'll reply on that thread and see if anyone wants to opine on the patch.
>>
>> -TimS
>>
>> --
>> Tim Stewart
>> [hidden email]
>>