<div dir="ltr">Hi folks,<div><br></div><div>I'm trying to setup an IPsec tunnel with rsa auth but ipsec always fails in importing the public key of the peer.</div><div><br></div><div>I tried by specifying the file containing the pub key both as relative path and absolute the import always fails.</div><div><br></div><div>I specified the entire string within ipsec.conf but it failed as well.</div><div><br></div><div>I saw there is an example on the STrongSWan site but there they use certificates whereas I have only priv and pub keys.</div><div><br></div><div>Here below some information</div><div><br></div><div>0) STRONGSWAN version</div><div><div>root@ubuntu:/etc/ipsec.d/private# ipsec version</div><div>Linux strongSwan U5.1.2/K3.16.0-36-generic</div></div><div><br></div><div>1) PUBLIC KEY</div><div><div><div>root@ubuntu:/etc/ipsec.d# cat R14_pub.key</div><div>-----BEGIN PUBLIC KEY-----</div><div>MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEArkTi9BjN+Dz2YmWJSEcD</div><div>E+FxLaBejnkbIRUEAZT55CSkdQqF+FxqqmDxYkTglK8McDD5kjtc1cewT7dYHpiJ</div><div>ZeQRuPMOC4TeZ40KmGxtE5PHd2nFGgLxI3DAP864+SlAmEAg2d1rFKHYHCY38dvC</div><div>aIZtW1JNFKhwx05tGVLo94k0KqAhp4o3sQ+sCChu8IzAOuIUj60NSO06tV2nD2lq</div><div>UYat7ZW5EkoskX5xzRjOn04uIROD1/4nnnB3Sq1fZQ8fG5PLe5+rb0c0RTmxpQUd</div><div>QudWiu7bEo5HI6eZp0k8kq00QlesiDrIA5+IxOjsulF9OdmOpT+zJM3BAQgUFfGk</div><div>SQghJeNJov84Yte8T1XdYbrgCTB2KRgQpTYyBLY7Y9USdFqeYt8jI9Ylhz9GYL+y</div><div>uSGIs7JgcvR4LuUWcm0tZY+YusYdsr3sXbGzI7D665J6cSvGqPdmbJonrL0/nNhy</div><div>2Lizs7p+CKZXTQub8081Cx+R2RpcroTzO+lqaLIaBMIXNiwJDZPnllXmn8UA5f6K</div><div>ui2Fria+13B5UPS+5A5Xhnk/jmmmaVOeL26fa+ln2179dnv8xmIHog+pFcJEmOMR</div><div>2YeWdy7SPUBfTBoTkLyOpzxl1GPg4Oxjq70JjnFD6VdKsoAT23wPmJPKBxmuapqK</div><div>7ue9SfdRKgKQWUZgCQwxJRkCAwEAAQ==</div><div>-----END PUBLIC KEY-----</div></div></div><div><br></div><div>2) Permisson of the file</div><div><div><div><div>-rw-r--r--   1 root root   800 May  2 03:18 R14_pub.key</div></div></div></div><div><br></div><div><div>3) config</div><div><div>root@ubuntu:/etc/ipsec.d# cat ../ipsec.conf</div><div>config setup</div><div><br></div><div>conn %default</div><div>        ikelifetime=60m</div><div>        keylife=20m</div><div>        rekeymargin=3m</div><div>        keyingtries=1</div><div>        keyexchange=ikev1</div><div>        left=192.168.72.4</div><div>        leftsubnet=<a href="http://172.16.102.161/32">172.16.102.161/32</a></div><div>        leftid=192.168.72.4</div><div>        leftfirewall=no</div><div>        leftauth=pubkey</div><div>#leftrsasigkey=ubuntu_prv.key</div><div>#authby=secret</div><div><br></div><div>conn gre-ipsec</div><div>        right=192.168.72.144</div><div>        rightsubnet=<a href="http://172.16.102.162/32">172.16.102.162/32</a></div><div>        rightrsasigkey=/etc/ipsec.d/R14_pub.key</div><div>        rightid=192.168.72.144</div><div>        rightauth=pubkey</div><div>        auto=add</div></div></div><div><br></div><div>4) Logs</div><div><div>May  2 03:18:37 ubuntu charon: 00[CFG]   loaded RSA private key from '/etc/ipsec.d/private/ubuntu_prv.key'</div><div>May  2 03:18:37 ubuntu charon: 00[LIB] loaded plugins: charon addrblock attr ccm cmac constraints ctr eap-identity gcm md4 openssl pkcs12 pkcs7 pkcs8 rc2 resolve sha1 test-vectors xcbc sha2 md5 aes hmac pem pkcs1 x509 revocation random nonce kernel-netlink socket-default updown stroke</div><div>May  2 03:18:37 ubuntu charon: 00[LIB] unable to load 5 plugin features (5 due to unmet dependencies)</div><div>May  2 03:18:37 ubuntu charon: 00[LIB] dropped capabilities, running as uid 0, gid 0</div><div>May  2 03:18:37 ubuntu charon: 00[JOB] spawning 16 worker threads</div><div>May  2 03:18:37 ubuntu charon: 11[CFG] received stroke: add connection 'gre-ipsec'</div><div>May  2 03:18:37 ubuntu charon: 11[LIB] building CRED_CERTIFICATE - TRUSTED_PUBKEY failed, tried 0 builders</div><div>May  2 03:18:37 ubuntu charon: 11[CFG]   loading public key for "192.168.72.144" from '/etc/ipsec.d/R14_pub.key' failed</div><div>May  2 03:18:37 ubuntu charon: 11[CFG] added configuration 'gre-ipsec'</div></div><div><br></div><div>Can anyone tell me the reason for which the import fails?</div><div>What should the format of the public-key-file be?</div><div><br></div><div>Thanks in advance,</div><div><br></div><div>Alex</div></div>