Open weiyu10 opened 3 years ago
Maybe you are missing some crypto kernel modules, not all modules are added as a dependency on the default installation
I'm having the same issue. Noting your reply, I manually installed all available kmod-crypto modules (with the exception of the hardware offloading modules as they're not relevant) but the problem persists.
I did note that the installed version of libreswan is 3.27, and the installed libnss version is 3.55.
There seems to have been a libreswan issue revealed between libnss 3.51 and 3.52 reported here and here which later versions of libreswan were updated to handle; what version of libnss was the current libreswan built against?
My setup is OpenWRT 19.07.7 version running on Linksys WRT3200ACM, btw.
@lucize I manually installed all available kmod-crypto modules,but the problem persists. lsmod:
ablk_helper 12288 7 twofish_avx_x86_64,serpent_avx2,serpent_avx_x86_64,cast6_avx_x86_64,cast5_avx_x86_64,camellia_aesni_avx2,camellia_aesni_avx_x86_64
af_alg 16384 2 algif_skcipher,algif_hash
af_key 28672 0
ah4 16384 0
ah6 12288 0
akcipher 12288 1 rsa_generic
algif_hash 12288 0
algif_skcipher 12288 0
anubis 16384 0
asn1_decoder 12288 1 rsa_generic
authenc 12288 0
blowfish_common 16384 1 blowfish_x86_64
blowfish_x86_64 20480 0
bnx2 69632 0
button_hotplug 12288 0
camellia_aesni_avx_x86_64 28672 1 camellia_aesni_avx2
camellia_aesni_avx2 28672 0
camellia_generic 24576 0
camellia_x86_64 49152 2 camellia_aesni_avx2,camellia_aesni_avx_x86_64
cast_common 12288 4 cast6_avx_x86_64,cast6_generic,cast5_avx_x86_64,cast5_generic
cast5_avx_x86_64 49152 0
cast5_generic 20480 1 cast5_avx_x86_64
cast6_avx_x86_64 69632 0
cast6_generic 20480 1 cast6_avx_x86_64
cbc 12288 0
ccm 16384 0
ccp 53248 0
cmac 12288 0
crc_ccitt 12288 1 ppp_async
crypto_acompress 12288 1 deflate
cryptodev 36864 0
ctr 12288 0
cts 12288 0
deflate 8192 0
des_generic 20480 0
drbg 24576 0
e1000 90112 0
e1000e 147456 0
ecdh_generic 20480 0
echainiv 8192 0
esp4 16384 0
esp6 16384 0
fcrypt 12288 0
gcm 16384 0
ghash_generic 8192 0
hmac 12288 0
i2c_dev 12288 0
igb 131072 0
ip_tables 16384 4 iptable_nat,iptable_mangle,iptable_filter
ip_tunnel 20480 1 ip_vti
ip_vti 12288 0
ip6_tables 16384 24 ip6table_mangle,ip6table_filter
ip6_tunnel 28672 1 ip6_vti
ip6_vti 16384 0
ip6t_REJECT 12288 2
ip6table_filter 12288 1
ip6table_mangle 12288 1
ipcomp 12288 0
ipcomp6 12288 0
ipt_MASQUERADE 12288 1
ipt_REJECT 12288 2
ipt_ah 8192 0
iptable_filter 12288 1
iptable_mangle 12288 1
iptable_nat 12288 1
jitterentropy_rng 12288 0
khazad 28672 0
kpp 12288 1 ecdh_generic
md4 8192 0
md5 12288 0
michael_mic 8192 0
mii 12288 1 r8169
mpi 20480 1 rsa_generic
nf_conntrack 65536 13 nf_conntrack_ipv6,ipt_MASQUERADE,xt_state,xt_nat,xt_conntrack,xt_REDIRECT,xt_CT,nf_nat_masquerade_ipv4,nf_conntrack_ipv4,nf_nat_ipv4,nf_nat,nf_flow_table,nf_conntrack_rtcache
nf_conntrack_ipv4 12288 11
nf_conntrack_ipv6 12288 5
nf_conntrack_rtcache 12288 0
nf_defrag_ipv4 12288 1 nf_conntrack_ipv4
nf_defrag_ipv6 12288 1 nf_conntrack_ipv6
nf_flow_table 20480 2 xt_FLOWOFFLOAD,nf_flow_table_hw
nf_flow_table_hw 12288 1
nf_log_common 12288 2 nf_log_ipv4,nf_log_ipv6
nf_log_ipv4 12288 0
nf_log_ipv6 12288 0
nf_nat 20480 4 xt_nat,nf_nat_redirect,nf_nat_masquerade_ipv4,nf_nat_ipv4
nf_nat_ipv4 12288 1 iptable_nat
nf_nat_masquerade_ipv4 12288 1 ipt_MASQUERADE
nf_nat_redirect 12288 1 xt_REDIRECT
nf_reject_ipv4 12288 1 ipt_REJECT
nf_reject_ipv6 12288 1 ip6t_REJECT
pcbc 12288 0
ppp_async 16384 0
ppp_generic 28672 3 pppoe,ppp_async,pppox
pppoe 16384 0
pppox 12288 1 pppoe
pps_core 12288 1 ptp
ptp 16384 2 e1000e,igb
r8169 65536 0
rmd160 16384 0
rsa_generic 16384 0
seqiv 8192 0
serpent_avx_x86_64 49152 1 serpent_avx2
serpent_avx2 49152 0
serpent_generic 24576 2 serpent_avx2,serpent_avx_x86_64
sha1_generic 12288 2 sha1_ssse3,ccp
sha1_ssse3 28672 0
sha256_generic 16384 2 sha256_ssse3,ccp
sha256_ssse3 28672 0
sha512_generic 12288 1 sha512_ssse3
sha512_ssse3 40960 0
slhc 12288 1 ppp_generic
tea 8192 0
tgr192 16384 0
tun 28672 0
tunnel4 12288 2 ip_vti,xfrm4_tunnel
tunnel6 12288 2 xfrm6_tunnel,ip6_tunnel
twofish_avx_x86_64 53248 0
twofish_common 20480 3 twofish_avx_x86_64,twofish_x86_64_3way,twofish_x86_64
twofish_x86_64 12288 2 twofish_avx_x86_64,twofish_x86_64_3way
twofish_x86_64_3way 28672 1 twofish_avx_x86_64
wp512 28672 0
x_tables 20480 27 ipt_REJECT,ipt_MASQUERADE,xt_time,xt_tcpudp,xt_state,xt_policy,xt_nat,xt_multiport,xt_mark,xt_mac,xt_limit,xt_esp,xt_conntrack,xt_comment,xt_TCPMSS,xt_REDIRECT,xt_LOG,xt_FLOWOFFLOAD,xt_CT,iptable_mangle,iptable_filter,ipt_ah,ip_tables,ip6table_mangle,ip6table_filter,ip6_tables,ip6t_REJECT
xcbc 12288 0
xfrm_algo 12288 7 esp6,ah6,esp4,ah4,xfrm_user,xfrm_ipcomp,af_key
xfrm_ipcomp 12288 2 ipcomp6,ipcomp
xfrm_user 28672 0
xfrm4_mode_beet 8192 0
xfrm4_mode_transport 8192 0
xfrm4_mode_tunnel 8192 0
xfrm4_tunnel 12288 0
xfrm6_mode_beet 8192 0
xfrm6_mode_transport 8192 0
xfrm6_mode_tunnel 8192 0
xfrm6_tunnel 12288 1 ipcomp6
xt_CT 12288 0
xt_FLOWOFFLOAD 12288 0
xt_LOG 12288 0
xt_REDIRECT 12288 0
xt_TCPMSS 12288 4
xt_comment 8192127
xt_conntrack 12288 14
xt_esp 8192 0
xt_limit 12288 20
xt_mac 8192 0
xt_mark 8192 0
xt_multiport 8192 0
xt_nat 12288 0
xt_policy 12288 0
xt_state 12288 0
xt_tcpudp 8192 12
xt_time 12288 0
I don't have at the moment a 19.07 test system, can you build your own packages ? try to copy the nspr,nss and libreswan from master and build against the same kernel it should work in replacing the release packages
I don't currently have a build environment set up, but I might be able to do that. Is there a particular docker build image I should look for? Alternatively, as you're not running 19.07 yourself, is there an older supported release I could install to get this working? Units aren't deployed yet so that's an option for me.
newer versions of libreswan don't depend on kernel, you may try to use packages from master, but I'll prepare a vm also
using just the newer nss and nspr didn't helped but now I'm a bit curious about this xfrm interface is not supported on 4.14 kernel so we can force ignore that dependency
LE: binary from master (some force overwrite) the other dependencies are libcap-ng libevent27 libsqlite30 libldns libunbound
pluto[2723]: Initializing NSS using read-write database "sql:/etc/ipsec.d"
pluto[2723]: FIPS Mode: NO
pluto[2723]: NSS crypto library initialized
pluto[2723]: FIPS mode disabled for pluto daemon
pluto[2723]: FIPS HMAC integrity support [disabled]
pluto[2723]: libcap-ng support [enabled]
pluto[2723]: Linux audit support [disabled]
pluto[2723]: Starting Pluto (Libreswan Version 4.3 IKEv2 IKEv1 XFRM(netkey) XFRMI esp-hw-offload FORK PTHREAD_SETSCHEDPRIO NSS (IPsec profile) (NSS-PRF) DNSSEC LIBCAP_NG) pid:2723
pluto[2723]: core dump dir: /var/run/pluto
pluto[2723]: secrets file: /etc/ipsec.secrets
pluto[2723]: leak-detective disabled
pluto[2723]: NSS crypto [enabled]
pluto[2723]: XAUTH PAM support [disabled]
pluto[2723]: initializing libevent in pthreads mode: headers: 2.1.12-stable (2010c00); library: 2.1.12-stable (2010c00)
pluto[2723]: NAT-Traversal support [enabled]
pluto[2723]: Encryption algorithms:
pluto[2723]: AES_CCM_16 {256,192,*128} IKEv1: ESP IKEv2: ESP FIPS aes_ccm, aes_ccm_c
pluto[2723]: AES_CCM_12 {256,192,*128} IKEv1: ESP IKEv2: ESP FIPS aes_ccm_b
pluto[2723]: AES_CCM_8 {256,192,*128} IKEv1: ESP IKEv2: ESP FIPS aes_ccm_a
pluto[2723]: 3DES_CBC [*192] IKEv1: IKE ESP IKEv2: IKE ESP FIPS NSS(CBC) 3des
pluto[2723]: CAMELLIA_CTR {256,192,*128} IKEv1: ESP IKEv2: ESP
pluto[2723]: CAMELLIA_CBC {256,192,*128} IKEv1: IKE ESP IKEv2: IKE ESP NSS(CBC) camellia
pluto[2723]: AES_GCM_16 {256,192,*128} IKEv1: ESP IKEv2: IKE ESP FIPS NSS(GCM) aes_gcm, aes_gcm_c
pluto[2723]: AES_GCM_12 {256,192,*128} IKEv1: ESP IKEv2: IKE ESP FIPS NSS(GCM) aes_gcm_b
pluto[2723]: AES_GCM_8 {256,192,*128} IKEv1: ESP IKEv2: IKE ESP FIPS NSS(GCM) aes_gcm_a
pluto[2723]: AES_CTR {256,192,*128} IKEv1: IKE ESP IKEv2: IKE ESP FIPS NSS(CTR) aesctr
pluto[2723]: AES_CBC {256,192,*128} IKEv1: IKE ESP IKEv2: IKE ESP FIPS NSS(CBC) aes
pluto[2723]: NULL_AUTH_AES_GMAC {256,192,*128} IKEv1: ESP IKEv2: ESP FIPS aes_gmac
pluto[2723]: NULL [] IKEv1: ESP IKEv2: ESP
pluto[2723]: CHACHA20_POLY1305 [*256] IKEv1: IKEv2: IKE ESP NSS(AEAD) chacha20poly1305
pluto[2723]: Hash algorithms:
pluto[2723]: MD5 IKEv1: IKE IKEv2: NSS
pluto[2723]: SHA1 IKEv1: IKE IKEv2: IKE FIPS NSS sha
pluto[2723]: SHA2_256 IKEv1: IKE IKEv2: IKE FIPS NSS sha2, sha256
pluto[2723]: SHA2_384 IKEv1: IKE IKEv2: IKE FIPS NSS sha384
pluto[2723]: SHA2_512 IKEv1: IKE IKEv2: IKE FIPS NSS sha512
pluto[2723]: PRF algorithms:
pluto[2723]: HMAC_MD5 IKEv1: IKE IKEv2: IKE native(HMAC) md5
pluto[2723]: HMAC_SHA1 IKEv1: IKE IKEv2: IKE FIPS NSS sha, sha1
pluto[2723]: HMAC_SHA2_256 IKEv1: IKE IKEv2: IKE FIPS NSS sha2, sha256, sha2_256
pluto[2723]: HMAC_SHA2_384 IKEv1: IKE IKEv2: IKE FIPS NSS sha384, sha2_384
pluto[2723]: HMAC_SHA2_512 IKEv1: IKE IKEv2: IKE FIPS NSS sha512, sha2_512
pluto[2723]: AES_XCBC IKEv1: IKEv2: IKE native(XCBC) aes128_xcbc
pluto[2723]: Integrity algorithms:
pluto[2723]: HMAC_MD5_96 IKEv1: IKE ESP AH IKEv2: IKE ESP AH native(HMAC) md5, hmac_md5
pluto[2723]: HMAC_SHA1_96 IKEv1: IKE ESP AH IKEv2: IKE ESP AH FIPS NSS sha, sha1, sha1_96, hmac_sha1
pluto[2723]: HMAC_SHA2_512_256 IKEv1: IKE ESP AH IKEv2: IKE ESP AH FIPS NSS sha512, sha2_512, sha2_512_256, hmac_sha2_512
pluto[2723]: HMAC_SHA2_384_192 IKEv1: IKE ESP AH IKEv2: IKE ESP AH FIPS NSS sha384, sha2_384, sha2_384_192, hmac_sha2_384
pluto[2723]: HMAC_SHA2_256_128 IKEv1: IKE ESP AH IKEv2: IKE ESP AH FIPS NSS sha2, sha256, sha2_256, sha2_256_128, hmac_sha2_256
pluto[2723]: HMAC_SHA2_256_TRUNCBUG IKEv1: ESP AH IKEv2: AH
pluto[2723]: AES_XCBC_96 IKEv1: ESP AH IKEv2: IKE ESP AH native(XCBC) aes_xcbc, aes128_xcbc, aes128_xcbc_96
pluto[2723]: AES_CMAC_96 IKEv1: ESP AH IKEv2: ESP AH FIPS aes_cmac
pluto[2723]: NONE IKEv1: ESP IKEv2: IKE ESP FIPS null
pluto[2723]: DH algorithms:
pluto[2723]: NONE IKEv1: IKEv2: IKE ESP AH FIPS NSS(MODP) null, dh0
pluto[2723]: MODP1536 IKEv1: IKE ESP AH IKEv2: IKE ESP AH NSS(MODP) dh5
pluto[2723]: MODP2048 IKEv1: IKE ESP AH IKEv2: IKE ESP AH FIPS NSS(MODP) dh14
pluto[2723]: MODP3072 IKEv1: IKE ESP AH IKEv2: IKE ESP AH FIPS NSS(MODP) dh15
pluto[2723]: MODP4096 IKEv1: IKE ESP AH IKEv2: IKE ESP AH FIPS NSS(MODP) dh16
pluto[2723]: MODP6144 IKEv1: IKE ESP AH IKEv2: IKE ESP AH FIPS NSS(MODP) dh17
pluto[2723]: MODP8192 IKEv1: IKE ESP AH IKEv2: IKE ESP AH FIPS NSS(MODP) dh18
pluto[2723]: DH19 IKEv1: IKE IKEv2: IKE ESP AH FIPS NSS(ECP) ecp_256, ecp256
pluto[2723]: DH20 IKEv1: IKE IKEv2: IKE ESP AH FIPS NSS(ECP) ecp_384, ecp384
pluto[2723]: DH21 IKEv1: IKE IKEv2: IKE ESP AH FIPS NSS(ECP) ecp_521, ecp521
pluto[2723]: DH31 IKEv1: IKE IKEv2: IKE ESP AH NSS(ECP) curve25519
pluto[2723]: testing CAMELLIA_CBC:
pluto[2723]: Camellia: 16 bytes with 128-bit key
pluto[2723]: Camellia: 16 bytes with 128-bit key
pluto[2723]: Camellia: 16 bytes with 256-bit key
pluto[2723]: Camellia: 16 bytes with 256-bit key
pluto[2723]: testing AES_GCM_16:
pluto[2723]: empty string
pluto[2723]: one block
pluto[2723]: two blocks
pluto[2723]: two blocks with associated data
pluto[2723]: testing AES_CTR:
pluto[2723]: Encrypting 16 octets using AES-CTR with 128-bit key
pluto[2723]: Encrypting 32 octets using AES-CTR with 128-bit key
pluto[2723]: Encrypting 36 octets using AES-CTR with 128-bit key
pluto[2723]: Encrypting 16 octets using AES-CTR with 192-bit key
pluto[2723]: Encrypting 32 octets using AES-CTR with 192-bit key
pluto[2723]: Encrypting 36 octets using AES-CTR with 192-bit key
pluto[2723]: Encrypting 16 octets using AES-CTR with 256-bit key
pluto[2723]: Encrypting 32 octets using AES-CTR with 256-bit key
pluto[2723]: Encrypting 36 octets using AES-CTR with 256-bit key
pluto[2723]: testing AES_CBC:
pluto[2723]: Encrypting 16 bytes (1 block) using AES-CBC with 128-bit key
pluto[2723]: Encrypting 32 bytes (2 blocks) using AES-CBC with 128-bit key
pluto[2723]: Encrypting 48 bytes (3 blocks) using AES-CBC with 128-bit key
pluto[2723]: Encrypting 64 bytes (4 blocks) using AES-CBC with 128-bit key
pluto[2723]: testing AES_XCBC:
pluto[2723]: RFC 3566 Test Case 1: AES-XCBC-MAC-96 with 0-byte input
pluto[2723]: RFC 3566 Test Case 2: AES-XCBC-MAC-96 with 3-byte input
pluto[2723]: RFC 3566 Test Case 3: AES-XCBC-MAC-96 with 16-byte input
pluto[2723]: RFC 3566 Test Case 4: AES-XCBC-MAC-96 with 20-byte input
pluto[2723]: RFC 3566 Test Case 5: AES-XCBC-MAC-96 with 32-byte input
pluto[2723]: RFC 3566 Test Case 6: AES-XCBC-MAC-96 with 34-byte input
pluto[2723]: RFC 3566 Test Case 7: AES-XCBC-MAC-96 with 1000-byte input
pluto[2723]: RFC 4434 Test Case AES-XCBC-PRF-128 with 20-byte input (key length 16)
pluto[2723]: RFC 4434 Test Case AES-XCBC-PRF-128 with 20-byte input (key length 10)
pluto[2723]: RFC 4434 Test Case AES-XCBC-PRF-128 with 20-byte input (key length 18)
pluto[2723]: testing HMAC_MD5:
pluto[2723]: RFC 2104: MD5_HMAC test 1
pluto[2723]: RFC 2104: MD5_HMAC test 2
pluto[2723]: RFC 2104: MD5_HMAC test 3
pluto[2723]: 2 CPU cores online
pluto[2723]: starting up 2 helper threads
pluto[2723]: started thread for helper 0
pluto[2723]: started thread for helper 1
pluto[2723]: using Linux xfrm kernel support code on #0 SMP Mon Feb 15 15:22:37 2021
pluto[2723]: seccomp security for helper not supported
pluto[2723]: seccomp security for helper not supported
pluto[2723]: seccomp security not supported
pluto[2723]: "ikev1": added IKEv1 connection
pluto[2723]: "ikev1-nat": added IKEv1 connection
pluto[2723]: listening for IKE messages
pluto[2723]: Kernel supports NIC esp-hw-offload
pluto[2723]: adding UDP interface eth0 10.160.20.206:500
pluto[2723]: adding UDP interface eth0 10.160.20.206:4500
pluto[2723]: adding UDP interface lo 127.0.0.1:500
pluto[2723]: adding UDP interface lo 127.0.0.1:4500
pluto[2723]: adding UDP interface lo [::1]:500
pluto[2723]: loading secrets from "/etc/ipsec.secrets"
Have you tried applying the patch for libreswan referenced in one of my prior links? I expect the patch is against a newer version than 3.27, but may still work... (haven't finished setting up my own build environment yet, btw)
@nlindq-maei yes https://github.com/openwrt/packages/blob/f98158b75518bc7096a96cc8ac7b461be149821e/net/libreswan/patches/030-fix_nss_3.52.patch fixes the build, so there is no other way than rebuild the package
I still don't know how make a PR against stable branch
I trust there's someone in the OpenWRT dev team who can help with that... in the meantime, would it be feasible to attach the updated .ipk to this ticket? I could download and apply the package manually to test the fix here; that'd get us by until stable branch is updated.
search all the packages mentioned in the download section https://downloads.openwrt.org/snapshots/targets/
I'm curious what the release philosophy for OpenWRT as it pertains to version upgrades might be--is it preferable to upgrade to the latest version of libreswan in the stable branch, or use the "release" version with the backported fix? If it works, I'm fine either way--just curious whether there are guidelines as to the desired approach.
depends of your usage, I always use master on my scenario, but if you have some application that are not in tree, then you have to stick with compatibility
I was able to install the snapshot build of libreswan 4.3-1 along with libcap-ng, libldns and libunbound, though I had to force install a couple of them. There's no revised libevent package in the snapshot downloads, and for some reason it doesn't recognize the current stable libevent2-7 package as satisfying dependencies, but the dynamic library appears to be linked properly even so.
It starts successfully and I was able to configure and establish a tunnel with another endpoint.
Do you know whether the "fixed" version for the stable branch will end up being 3.27 with the patch, or would you move to the latest release including the additional support libraries adapted for stable?
I think it will be only with 3.27, libevent is in the base folder, not in packages
I used snapshot image to test the IPSec function, and the problem has been solved
Do you know whether the patched 3.27 package has been integrated into stable yet? If not, do you know when?
this should fix it https://github.com/openwrt/packages/pull/15295
Yep! I uninstalled the snapshot libreswan and library dependencies I'd installed manually; then installed libreswan from the stable repo and everything is now working perfectly. Thanks very much!
Maintainer: @lucize Environment: openwrt-19.07.7-x86-64 virtualbox
Description:
plutolog