Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to convert ipsec addr4 [] #35

Open
mrgogoa4 opened this issue Nov 24, 2023 · 31 comments
Open

Unable to convert ipsec addr4 [] #35

mrgogoa4 opened this issue Nov 24, 2023 · 31 comments

Comments

@mrgogoa4
Copy link

I'm using kamailio-ims 5.3 and when I tried to register with Android and Nokia phones it gave me this error also I used basic ipsec-tools, and after that, I changed it to strongswan but still no success. Would someone be able to help me with it?

kamailio IMS logs:
ims kamailio[23396]: #1[0;39;49m#001[0;31;49m22(23396) ERROR: ims_ipsec_pcscf [cmd.c:412]: create_ipsec_tunnel(): Unable to convert ipsec addr4 []
ims kamailio[23396]: #1[0;39;49m#001[0;32;49m22(23396) NOTICE: <script>: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1321;spi-s=1322;port-c=7089;port-s=7090,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1321;spi-s=1322;port-c=7089;port-s=7090,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1321;spi-s=1322;port-c=7089;port-s=7090,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1321;spi-s=1322;port-c=7089;port-s=7090,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1321;spi-s=1322;port-c=7089;port-s=7090,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1321;spi-s=1322;port-c=7089;port-s=7090
ims kamailio[23396]: #1[0;39;49m#001[0;31;49m22(23396) ERROR: ims_ipsec_pcscf [cmd.c:412]: create_ipsec_tunnel(): Unable to convert ipsec addr4 []

IPsec status:
Status of IKE charon daemon (strongSwan 5.8.2, Linux 5.4.0-166-generic, x86_64):
uptime: 2 days, since Nov 22 06:36:55 2023
malloc: sbrk 1486848, mmap 0, used 513424, free 973424
worker threads: 11 of 16 idle, 5/0/0/0 working, job queue: 0/0/0/0, scheduled: 0
loaded plugins: charon aesni aes rc2 sha2 sha1 md5 mgf1 random nonce x509 revocation constraints pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem openssl fips-prf gmp agent xcbc hmac gcm drbg attr kernel-netlink resolve socket-default connmark stroke updown eap-mschapv2 xauth-generic counters
Listening IP addresses:
192.168.0.1
Connections:
ims: 192.168.0.1...%any IKEv1/2
ims: local: [192.168.0.1] uses pre-shared key authentication
ims: remote: uses pre-shared key authentication
ims: child: 0.0.0.0/0 === dynamic TUNNEL
Security Associations (0 up, 0 connecting):
none

@mrgogoa4
Copy link
Author

in the pcap capture it's replied to UE "503 Service Unavailable (Create ipsec failed)"

@herlesupreeth
Copy link
Owner

I believe the IMS REGISTER is sent using IPv6 address rather than IPv4. And, I dont think IPv6 is supported.

@mrgogoa4
Copy link
Author

I disabled IPv6 on the OS system and tried again but no success still giving me that 503 Create ipsec failed

Kamailio logs:
ov 29 17:18:57 ims kamailio[421558]: #1[0;39;49m#001[0;32;49m108(421558) NOTICE: <script>: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1280;spi-s=1281;port-c=7048;port-s=7049,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1280;spi-s=1281;port-c=7048;port-s=7049,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1280;spi-s=1281;port-c=7048;port-s=7049,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1280;spi-s=1281;port-c=7048;port-s=7049,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1280;spi-s=1281;port-c=7048;port-s=7049,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1280;spi-s=1281;port-c=7048;port-s=7049
Nov 29 17:18:58 ims kamailio[421558]: #1[0;31;49m108(421558) ERROR: ims_ipsec_pcscf [cmd.c:307]: get_ck_ik(): Error getting CK
Nov 29 17:18:58 ims kamailio[421558]: #1[0;39;49m#001[0;32;49m108(421558) NOTICE: <script>: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1282;spi-s=1283;port-c=7050;port-s=7051,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1282;spi-s=1283;port-c=7050;port-s=7051,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1282;spi-s=1283;port-c=7050;port-s=7051,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1282;spi-s=1283;port-c=7050;port-s=7051,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1282;spi-s=1283;port-c=7050;port-s=7051,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1282;spi-s=1283;port-c=7050;port-s=7051
Nov 29 17:24:53 ims kamailio[421553]: #1[0;39;49m#001[0;31;49m104(421553) ERROR: ims_ipsec_pcscf [ipsec.c:582]: clean_sa(): Error sending delete SAs command via netlink socket: No data available
Nov 29 17:24:53 ims kamailio[421553]: #1[0;39;49m#001[0;35;49m104(421553) WARNING: ims_ipsec_pcscf [cmd.c:1170]: ipsec_cleanall(): Error cleaning IPSec Security associations during startup.
Nov 29 17:24:53 ims kamailio[421553]: #1[0;39;49m#001[0;31;49m104(421553) ERROR: ims_ipsec_pcscf [ipsec.c:624]: clean_policy(): Error sending delete policies command via netlink socket: No data available
Nov 29 17:24:53 ims kamailio[421553]: #1[0;39;49m#001[0;35;49m104(421553) WARNING: ims_ipsec_pcscf [cmd.c:1174]: ipsec_cleanall(): Error cleaning IPSec Policies during startup.
Nov 29 17:30:20 ims kamailio[421555]: #1[0;39;49m#001[0;31;49m106(421555) ERROR: ims_ipsec_pcscf [ipsec.c:582]: clean_sa(): Error sending delete SAs command via netlink socket: No data available
Nov 29 17:30:20 ims kamailio[421555]: #1[0;39;49m#001[0;35;49m106(421555) WARNING: ims_ipsec_pcscf [cmd.c:1170]: ipsec_cleanall(): Error cleaning IPSec Security associations during startup.
Nov 29 17:30:20 ims kamailio[421555]: #1[0;39;49m#001[0;31;49m106(421555) ERROR: ims_ipsec_pcscf [ipsec.c:624]: clean_policy(): Error sending delete policies command via netlink socket: No data available
Nov 29 17:30:20 ims kamailio[421555]: #1[0;39;49m#001[0;35;49m106(421555) WARNING: ims_ipsec_pcscf [cmd.c:1174]: ipsec_cleanall(): Error cleaning IPSec Policies during startup.
Nov 29 17:30:20 ims kamailio[421557]: #1[0;39;49m#001[0;32;49m107(421557) NOTICE: <script>: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1286;spi-s=1287;port-c=7054;port-s=7055,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1286;spi-s=1287;port-c=7054;port-s=7055,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1286;spi-s=1287;port-c=7054;port-s=7055,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1286;spi-s=1287;port-c=7054;port-s=7055,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1286;spi-s=1287;port-c=7054;port-s=7055,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1286;spi-s=1287;port-c=7054;port-s=7055

But I changed authentication on HSS to Digest-AKAv1(3GPP) and Digest-MD5(FOKUS)
Kamailio logs:
Nov 29 17:56:58 ims kamailio[428270]: #1[0;39;49m#001[0;32;49m105(428270) NOTICE: <script>: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1250;spi-s=1251;port-c=7018;port-s=7019,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1250;spi-s=1251;port-c=7018;port-s=7019,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1250;spi-s=1251;port-c=7018;port-s=7019,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1250;spi-s=1251;port-c=7018;port-s=7019,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1250;spi-s=1251;port-c=7018;port-s=7019,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1250;spi-s=1251;port-c=7018;port-s=7019

in the PCAP it gives me below and just stuck on it:
401 Unauthorized - Challenging the UE

I tried again android and nokia.

@herlesupreeth
Copy link
Owner

I disabled IPv6 on the OS system and tried again but no success still giving me that 503 Create ipsec failed

This will not help. Rather when the UE attaches the network you allocate only IPv4 IP. If you are using open5gs you can set the IP type as IPv4 in the WebUI. This way you probably wont see this issue.

@laf0rge
Copy link

laf0rge commented Nov 29, 2023 via email

@riccardv
Copy link

riccardv commented Dec 6, 2023

A common configuration problem when IPsec doesn't work is to execute kamailio with non root permissions, so the IPsec SA establishment fail.

@mrgogoa4
Copy link
Author

I've tried rebuilding the deployment several times with no success. Tried it on Docker as well. I feel like I have no other choice.
I just remembered that I had disabled the QoS feature before because the eNB I'm using doesn't support QoS and failed on the first reg request.

Are there any cases where IPsec won't work because of that?

@herlesupreeth
Copy link
Owner

I just remembered that I had disabled the QoS feature before because the eNB I'm using doesn't support QoS and failed on the first reg request.

Are there any cases where IPsec won't work because of that?

I dont think eNB supporting QoS or not has any effect on IPSec

Can you describe your setup? which OS you are using? kernel version? are you using a virtualbox/VMWare etc

@mrgogoa4
Copy link
Author

I'm using the KVM virtualization on top of its Ubuntu 20.04 (Focal Fossa) as the first environment and another one is also running on the VM which is also Ubuntu 22.04 (Jammy Jellyfish) on the KVM virtualization as I'm using docker-compose to deploy IMS. But the docker image is also ubuntu:focal.

Ubuntu 22 kernel: Linux imsdoc 5.15.0-78-generic #85-Ubuntu SMP Fri Jul 7 15:25:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 20 kernel: Linux ims01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
ubuntu:focal: Linux b7xxxxxxxx 5.15.0-78-generic #85-Ubuntu SMP Fri Jul 7 15:25:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

@mrgogoa4
Copy link
Author

on the docker deployment I got below logs the IPsec is listening on the socket but on the Ubuntu 20 I got nothing there in the logs like this:

pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:268]: mod_init(): Successfully bound to PCSCF Usrloc module
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:275]: mod_init(): Successfully bound to TM module
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:118]: ipsec_print_all_socket_lists(): Listening on:
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5060
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5100
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6100
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5101
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6101
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5102
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6102
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5103
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6103
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5104
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6104
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5105
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6105
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5106
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6106
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5107
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6107
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5108
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6108
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:5109
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): udp: 172.22.0.21 [172.22.0.21]:6109
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5060
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5100
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6100
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5101
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6101
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5102
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6102
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5103
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6103
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5104
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6104
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5105
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6105
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5106
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6106
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5107
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6107
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5108
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6108
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:5109
pcscf | 0(39) INFO: ims_ipsec_pcscf [ims_ipsec_pcscf_mod.c:168]: ipsec_print_all_socket_lists(): tcp: 172.22.0.21 [172.22.0.21]:6109
pcscf | 0(39) ERROR: ims_ipsec_pcscf [ipsec.c:582]: clean_sa(): Error sending delete SAs command via netlink socket: No data available
pcscf | 0(39) WARNING: ims_ipsec_pcscf [cmd.c:1170]: ipsec_cleanall(): Error cleaning IPSec Security associations during startup.
pcscf | 0(39) ERROR: ims_ipsec_pcscf [ipsec.c:624]: clean_policy(): Error sending delete policies command via netlink socket: No data available
pcscf | 0(39) WARNING: ims_ipsec_pcscf [cmd.c:1174]: ipsec_cleanall(): Error cleaning IPSec Policies during startup.
pcscf | 0(39) INFO: ims_registrar_pcscf [ims_registrar_pcscf_mod.c:275]: mod_init(): Successfully bound to PCSCF IPSEC module

@herlesupreeth
Copy link
Owner

The logs above with docker deployment looks good. You can ignore those ERRORS in the logs as they are just trying to clean you SAs when the list of SAs is empty (i.e. no UE using IPSec has connected yet)

@mrgogoa4
Copy link
Author

Yes, I got this and when I disabled the IPsec UE can registered on the IMS.

I compared with that example of ipsec_reg and it's just stuck after 4 Challenging and there is nothing, Can you analysis my packet capture?

image

I tried with one Nokia Model: TA-1272 and one android version 11. iPhone doesn't send the IPsec request I need to talk with Apple, right?

@herlesupreeth
Copy link
Owner

herlesupreeth commented Dec 19, 2023

Please attach the packet capture to analyse the issue.

I disabled the IPsec UE can registered on the IMS.

Can you elaborate on what you mean by this? If you disable IPSec on P-CSCF that does not guarantee that UE wont use IPSec. If the UE has SIP header Proxy-Require: seg-agree in SIP REGISTER then UE wont attach to IMS if IPSec is not present.

@mrgogoa4
Copy link
Author

mrgogoa4 commented Dec 20, 2023

I mean I commented the #!define WITH_IPSEC to disable the IPsec feature of the IMS in pcscf.cfg configuration and tried to register with android and nokia is successful. I attached my pcap.
reg_IPsec.zip

@herlesupreeth
Copy link
Owner

image

I am not sure why, but ESP protocol is not supported on that host

@mrgogoa4
Copy link
Author

mrgogoa4 commented Jan 2, 2024

Sorry, I wrote the wrong information here. In my test environment, the primary physical server operating system is Centos 7 (Core). I will replace it with Ubuntu and try again and share the results.

@mrgogoa4
Copy link
Author

mrgogoa4 commented Jan 2, 2024

Now my test environment is Proxmox on dell physical server on top of it it's Ubuntu 22.04.3 LTS (Jammy Jellyfish) and I deployed IMS with docker compose. I tried to register android to my test IMS and now it's getting me below:

101(151) NOTICE: <script>: PCSCF: REGISTER sip:ims.mnc033.mcc428.3gppnetwork.org (sip:[email protected] (10.129.1.86:1024) to sip:[email protected], [email protected])
101(151) INFO: rr [rr_mod.c:515]: pv_get_route_uri_f(): No route header present.
101(151) NOTICE: <script>: PCSCF REGISTER:
Destination URI:
Request URI: sip:ims.mnc033.mcc428.3gppnetwork.org
101(151) INFO: rr [rr_mod.c:515]: pv_get_route_uri_f(): No route header present.
101(151) NOTICE: <script>: Source IP and Port: (10.129.1.86:1024)
Route-URI:
101(151) NOTICE: <script>: Received IP and Port: (172.22.0.9:5060)
101(151) NOTICE: <script>: Contact header: sip:[email protected]:5060;+g.3gpp.smsip;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel";audio;video;+sip.instance="urn:gsma:imei:86575604-099092-0"
101(151) INFO: ims_registrar_pcscf [sec_agree.c:296]: cscf_get_security_verify(): No security-verify parameters found
101(151) ERROR: ims_ipsec_pcscf [ipsec.c:582]: clean_sa(): Error sending delete SAs command via netlink socket: No data available
101(151) WARNING: ims_ipsec_pcscf [cmd.c:1170]: ipsec_cleanall(): Error cleaning IPSec Security associations during startup.
101(151) ERROR: ims_ipsec_pcscf [ipsec.c:624]: clean_policy(): Error sending delete policies command via netlink socket: No data available
101(151) WARNING: ims_ipsec_pcscf [cmd.c:1174]: ipsec_cleanall(): Error cleaning IPSec Policies during startup.
101(151) INFO: [core/tcp_main.c:3010]: tcpconn_1st_send(): quick connect for 0x7ff4f8090e10
102(152) NOTICE: <script>: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1234;spi-s=1235;port-c=7002;port-s=7003,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1234;spi-s=1235;port-c=7002;port-s=7003,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1234;spi-s=1235;port-c=7002;port-s=7003,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1234;spi-s=1235;port-c=7002;port-s=7003,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1234;spi-s=1235;port-c=7002;port-s=7003,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1234;spi-s=1235;port-c=7002;port-s=7003
102(152) NOTICE: <script>: port-c=7002
102(152) NOTICE: <script>: port-s=7003
102(152) NOTICE: <script>: Expires=600000
102(152) NOTICE: <script>: Old header - WWW-Authenticate=Digest realm="ims.mnc033.mcc428.3gppnetwork.org", nonce="F5iWrfp0vHjJjwdHKQJHvZ4vNEfsigAAwFr7JZSZVFY=", algorithm=AKAv1-MD5, ck="bf1161d98495941480c51ba0fd0d042a", ik="52826c82df8237dbeb22826abf1791d6", qop="auth"
102(152) NOTICE: <script>: New header - WWW-Authenticate=Digest realm="ims.mnc033.mcc428.3gppnetwork.org", nonce="F5iWrfp0vHjJjwdHKQJHvZ4vNEfsigAAwFr7JZSZVFY=", algorithm=AKAv1-MD5, qop="auth"
101(151) ERROR: [core/tcp_read.c:299]: tcp_read_data(): error reading: Connection reset by peer (104) ([10.129.1.86]:1024 ->101(151) ERROR: [core/tcp_read.c:303]: tcp_read_data(): -> [172.22.0.9]:5060)
101(151) ERROR: [core/tcp_read.c:1503]: tcp_read_req(): ERROR: tcp_read_req: error reading - c: 0x7ff4f8088c48 r: 0x7ff4f8088cc8 (-1)

And pcap is looks like below:
image

@mrgogoa4
Copy link
Author

mrgogoa4 commented Jan 2, 2024

I enabled the debug mode and Now it looks like IPsec is working with android UE on this host:

{"log":"\u001b[0;39;49m\u001b[0;39;49m\u001b[0;39;49m67(104) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 67 rank 67: ims_ipsec_pcscf [udp receiver child=2 sock=172.22.0.9:6107]\n","stream":"stderr","time":"2024-01-02T04:10:39.123378703Z"}
{"log":"\u001b[0;39;49m69(106) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 69 rank 69: ims_ipsec_pcscf [udp receiver child=0 sock=172.22.0.9:5108]\n","stream":"stderr","time":"2024-01-02T04:10:39.123800147Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m70(107) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 70 rank 70: ims_ipsec_pcscf [udp receiver child=1 sock=172.22.0.9:5108]\n","stream":"stderr","time":"2024-01-02T04:10:39.124038543Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m71(108) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 71 rank 71: ims_ipsec_pcscf [udp receiver child=2 sock=172.22.0.9:5108]\n","stream":"stderr","time":"2024-01-02T04:10:39.124948698Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m73(110) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 73 rank 73: ims_ipsec_pcscf [udp receiver child=0 sock=172.22.0.9:6108]\n","stream":"stderr","time":"2024-01-02T04:10:39.125791493Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m74(111) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 74 rank 74: ims_ipsec_pcscf [udp receiver child=1 sock=172.22.0.9:6108]\n","stream":"stderr","time":"2024-01-02T04:10:39.126189772Z"}
{"log":"75(112) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 75 rank 75: ims_ipsec_pcscf [udp receiver child=2 sock=172.22.0.9:6108]\n","stream":"stderr","time":"2024-01-02T04:10:39.126657371Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m\u001b[0;39;49m72(109) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 72 rank 72: ims_ipsec_pcscf [udp receiver child=3 sock=172.22.0.9:5108]\n","stream":"stderr","time":"2024-01-02T04:10:39.126899859Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m76(113) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 76 rank 76: ims_ipsec_pcscf [udp receiver child=3 sock=172.22.0.9:6108]\n","stream":"stderr","time":"2024-01-02T04:10:39.12748217Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m77(114) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 77 rank 77: ims_ipsec_pcscf [udp receiver child=0 sock=172.22.0.9:5109]\n","stream":"stderr","time":"2024-01-02T04:10:39.127956723Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m78(115) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 78 rank 78: ims_ipsec_pcscf [udp receiver child=1 sock=172.22.0.9:5109]\n","stream":"stderr","time":"2024-01-02T04:10:39.128386926Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m\u001b[0;39;49m79(116) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 79 rank 79: ims_ipsec_pcscf [udp receiver child=2 sock=172.22.0.9:5109]\n","stream":"stderr","time":"2024-01-02T04:10:39.129150216Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m80(117) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 80 rank 80: ims_ipsec_pcscf [udp receiver child=3 sock=172.22.0.9:5109]\n","stream":"stderr","time":"2024-01-02T04:10:39.129394434Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m81(118) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 81 rank 81: ims_ipsec_pcscf [udp receiver child=0 sock=172.22.0.9:6109]\n","stream":"stderr","time":"2024-01-02T04:10:39.131022628Z"}
{"log":"82(119) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 82 rank 82: ims_ipsec_pcscf [udp receiver child=1 sock=172.22.0.9:6109]\n","stream":"stderr","time":"2024-01-02T04:10:39.13121916Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m83(120) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 83 rank 83: ims_ipsec_pcscf [udp receiver child=2 sock=172.22.0.9:6109]\n","stream":"stderr","time":"2024-01-02T04:10:39.131407931Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m84(121) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 84 rank 84: ims_ipsec_pcscf [udp receiver child=3 sock=172.22.0.9:6109]\n","stream":"stderr","time":"2024-01-02T04:10:39.132566164Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m85(122) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 85 rank -1: ims_ipsec_pcscf [slow timer]\n","stream":"stderr","time":"2024-01-02T04:10:39.132787028Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m\u001b[0;39;49m86(123) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 86 rank -1: ims_ipsec_pcscf [timer]\n","stream":"stderr","time":"2024-01-02T04:10:39.133019155Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m87(124) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 87 rank -1: ims_ipsec_pcscf [secondary timer]\n","stream":"stderr","time":"2024-01-02T04:10:39.134127383Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m 0(37) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 0 rank 0: ims_ipsec_pcscf [main]\n","stream":"stderr","time":"2024-01-02T04:10:39.134350804Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m88(125) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 88 rank -2: ims_ipsec_pcscf [ctl handler]\n","stream":"stderr","time":"2024-01-02T04:10:39.134515259Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m89(126) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 89 rank 1001: ims_ipsec_pcscf [cdp_worker]\n","stream":"stderr","time":"2024-01-02T04:10:39.136592321Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m90(127) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 90 rank 1002: ims_ipsec_pcscf [cdp_worker]\n","stream":"stderr","time":"2024-01-02T04:10:39.136859894Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m91(128) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 91 rank 1003: ims_ipsec_pcscf [cdp_worker]\n","stream":"stderr","time":"2024-01-02T04:10:39.137088462Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m\u001b[0;39;49m92(129) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 92 rank 1004: ims_ipsec_pcscf [cdp_worker]\n","stream":"stderr","time":"2024-01-02T04:10:39.137423649Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m93(130) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 93 rank 1002: ims_ipsec_pcscf [cdp_receiver_peer_unkown]\n","stream":"stderr","time":"2024-01-02T04:10:39.140532445Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m94(131) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 94 rank 1000: ims_ipsec_pcscf [cdp_receiver_peer]\n","stream":"stderr","time":"2024-01-02T04:10:39.140740473Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m95(132) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 95 rank 1000: ims_ipsec_pcscf [cdp_acceptor]\n","stream":"stderr","time":"2024-01-02T04:10:39.141138069Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m96(133) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 96 rank 1001: ims_ipsec_pcscf [cdp_timer]\n","stream":"stderr","time":"2024-01-02T04:10:39.141281755Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m98(135) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 98 rank -2: ims_ipsec_pcscf [JSONRPCS FIFO]\n","stream":"stderr","time":"2024-01-02T04:10:39.142076509Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m99(136) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 99 rank -2: ims_ipsec_pcscf [JSONRPCS DATAGRAM]\n","stream":"stderr","time":"2024-01-02T04:10:39.14323499Z"}
{"log":"\u001b[0;39;49m100(137) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 100 rank 85: ims_ipsec_pcscf [tcp receiver (generic) child=0]\n","stream":"stderr","time":"2024-01-02T04:10:39.144926252Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m\u001b[0;39;49m101(138) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 101 rank 86: ims_ipsec_pcscf [tcp receiver (generic) child=1]\n","stream":"stderr","time":"2024-01-02T04:10:39.145146751Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m102(139) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 102 rank 87: ims_ipsec_pcscf [tcp receiver (generic) child=2]\n","stream":"stderr","time":"2024-01-02T04:10:39.145382819Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m\u001b[0;39;49m103(140) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 103 rank 88: ims_ipsec_pcscf [tcp receiver (generic) child=3]\n","stream":"stderr","time":"2024-01-02T04:10:39.146708949Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m104(141) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 104 rank 89: ims_ipsec_pcscf [tcp receiver (generic) child=4]\n","stream":"stderr","time":"2024-01-02T04:10:39.146799684Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m105(142) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 105 rank 90: ims_ipsec_pcscf [tcp receiver (generic) child=5]\n","stream":"stderr","time":"2024-01-02T04:10:39.146991849Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m\u001b[0;39;49m107(144) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 107 rank 92: ims_ipsec_pcscf [tcp receiver (generic) child=7]\n","stream":"stderr","time":"2024-01-02T04:10:39.147566168Z"}
{"log":"106(143) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 106 rank 91: ims_ipsec_pcscf [tcp receiver (generic) child=6]\n","stream":"stderr","time":"2024-01-02T04:10:39.147610585Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m108(145) DEBUG: \u003ccore\u003e [core/sr_module.c:778]: init_mod_child(): idx 108 rank -4: ims_ipsec_pcscf [tcp main process]\n","stream":"stderr","time":"2024-01-02T04:10:39.148690795Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m100(137) DEBUG: ims_ipsec_pcscf [cmd.c:1157]: ipsec_reconfig(): Clean all ipsec tunnels\n","stream":"stderr","time":"2024-01-02T04:11:01.129380533Z"}
{"log":"\u001b[0;39;49m\u001b[0;31;49m100(137) ERROR: ims_ipsec_pcscf [ipsec.c:582]: clean_sa(): Error sending delete SAs command via netlink socket: No data available\n","stream":"stderr","time":"2024-01-02T04:11:01.129420705Z"}
{"log":"\u001b[0;39;49m\u001b[0;35;49m100(137) WARNING: ims_ipsec_pcscf [cmd.c:1170]: ipsec_cleanall(): Error cleaning IPSec Security associations during startup.\n","stream":"stderr","time":"2024-01-02T04:11:01.129428813Z"}
{"log":"\u001b[0;39;49m\u001b[0;31;49m100(137) ERROR: ims_ipsec_pcscf [ipsec.c:624]: clean_policy(): Error sending delete policies command via netlink socket: No data available\n","stream":"stderr","time":"2024-01-02T04:11:01.130591676Z"}
{"log":"\u001b[0;39;49m\u001b[0;35;49m100(137) WARNING: ims_ipsec_pcscf [cmd.c:1174]: ipsec_cleanall(): Error cleaning IPSec Policies during startup.\n","stream":"stderr","time":"2024-01-02T04:11:01.130614173Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m100(137) DEBUG: htable [ht_var.c:89]: pv_set_ht_cell(): set value for $sht(ipsec_clients=\u003esip:[email protected]:5060)\n","stream":"stderr","time":"2024-01-02T04:11:01.13073849Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m100(137) DEBUG: htable [ht_var.c:89]: pv_set_ht_cell(): set value for $sht(ipsec_clients=\u003esip:[email protected]:5060)\n","stream":"stderr","time":"2024-01-02T04:11:01.130762687Z"}
{"log":"\u001b[0;39;49m\u001b[0;31;49m101(138) ERROR: *** cfgtrace:onreply_route=[REGISTER_reply] c=[/etc/kamailio_pcscf/route/register.cfg] l=264 a=25 n=ipsec_create\n","stream":"stderr","time":"2024-01-02T04:11:01.152104242Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m101(138) DEBUG: ims_ipsec_pcscf [cmd.c:269]: fill_contact(): AOR \u003csip:[email protected]:5060\u003e\n","stream":"stderr","time":"2024-01-02T04:11:01.152220143Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m101(138) DEBUG: ims_ipsec_pcscf [cmd.c:283]: fill_contact(): SIP REPLY fill contact with AOR [sip:[email protected]:5060], VIA [2://10.129.1.215:5060], received_host [2://10.129.1.215:1025]\n","stream":"stderr","time":"2024-01-02T04:11:01.152226Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m101(138) DEBUG: ims_ipsec_pcscf [cmd.c:702]: ipsec_create(): Registration for contact with AOR [sip:[email protected]:5060], VIA [2://10.129.1.215:5060], received_host [2://10.129.1.215:1025]\n","stream":"stderr","time":"2024-01-02T04:11:01.152324608Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m101(138) DEBUG: ims_ipsec_pcscf [cmd.c:437]: create_ipsec_tunnel(): Creating security associations: Local IP: 172.22.0.9 port_pc: 5100 port_ps: 6100; UE IP: 10.129.1.215; port_uc 7004 port_us 7005; spi_pc 4096, spi_ps 4097, spi_uc 1236, spi_us 1237, alg hmac-sha-1-96, ealg aes-cbc\n","stream":"stderr","time":"2024-01-02T04:11:01.15233271Z"}
{"log":"\u001b[0;39;49m\u001b[0;32;49m101(138) NOTICE: \u003cscript\u003e: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005\n","stream":"stderr","time":"2024-01-02T04:11:01.15244144Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m101(138) DEBUG: \u003ccore\u003e [core/re.c:455]: subst_run(): matched (0, 525): [ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005]\n","stream":"stderr","time":"2024-01-02T04:11:01.152491598Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m101(138) DEBUG: \u003ccore\u003e [core/re.c:455]: subst_run(): matched (0, 525): [ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1236;spi-s=1237;port-c=7004;port-s=7005]\n","stream":"stderr","time":"2024-01-02T04:11:01.152533541Z"}
{"log":"Security-Server: ipsec-3gpp;q=0.1;prot=esp;mod=trans;spi-c=4096;spi-s=4097;port-c=5100;port-s=6100;alg=hmac-sha-1-96;ealg=aes-cbc\r\n","stream":"stderr","time":"2024-01-02T04:11:01.152908461Z"}
{"log":"Security-Server: ipsec-3gpp;q=0.1;prot=esp;mod=trans;spi-c=4096;spi-s=4097;port-c=5100;port-s=6100;alg=hmac-sha-1-96;ealg=aes-cbc\r\n","stream":"stderr","time":"2024-01-02T04:11:01.153087982Z"}
{"log":"\u001b[0;39;49m\u001b[0;39;49m85(122) DEBUG: ims_ipsec_pcscf [cmd.c:512]: destroy_ipsec_tunnel(): Destroying security associations: Local IP: 172.22.0.9 client port: 5100 server port: 6100; UE IP: 10.129.1.215; client port 7004 server port 7005; spi_ps 4097, spi_pc 4096, spi_us 1237, spi_uc 1236\n","stream":"stderr","time":"2024-01-02T04:13:39.133438653Z"}

@mrgogoa4
Copy link
Author

mrgogoa4 commented Jan 2, 2024

Now everything looks good but it's stuck on after exchanged few ESP package with UE and cannot register with IMS

Logs:
pcscf | 107(144) NOTICE: <script>: PCSCF: REGISTER sip:ims.mnc033.mcc428.3gppnetwork.org (sip:[email protected] (10.129.1.154:1030) to sip:[email protected], [email protected])
pcscf | 107(144) INFO: rr [rr_mod.c:515]: pv_get_route_uri_f(): No route header present.
pcscf | 107(144) NOTICE: <script>: PCSCF REGISTER:
pcscf | Destination URI:
pcscf | Request URI: sip:ims.mnc033.mcc428.3gppnetwork.org
pcscf | 107(144) INFO: rr [rr_mod.c:515]: pv_get_route_uri_f(): No route header present.
pcscf | 107(144) NOTICE: <script>: Source IP and Port: (10.129.1.154:1030)
pcscf | Route-URI:
pcscf | 107(144) NOTICE: <script>: Received IP and Port: (172.22.0.9:5060)
pcscf | 107(144) NOTICE: <script>: Contact header: sip:[email protected]:5060;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel";audio;video;+sip.instance="urn:gsma:imei:36252343-243152-0"
pcscf | 107(144) INFO: ims_registrar_pcscf [sec_agree.c:296]: cscf_get_security_verify(): No security-verify parameters found
pcscf | 107(144) ERROR: ims_ipsec_pcscf [ipsec.c:582]: clean_sa(): Error sending delete SAs command via netlink socket: No data available
pcscf | 107(144) WARNING: ims_ipsec_pcscf [cmd.c:1170]: ipsec_cleanall(): Error cleaning IPSec Security associations during startup.
pcscf | 107(144) ERROR: ims_ipsec_pcscf [ipsec.c:624]: clean_policy(): Error sending delete policies command via netlink socket: No data available
pcscf | 107(144) WARNING: ims_ipsec_pcscf [cmd.c:1174]: ipsec_cleanall(): Error cleaning IPSec Policies during startup.
icscf | 33(82) INFO: ims_icscf [cxdx_uar.c:71]: create_uaa_return_code(): created AVP successfully : [uaa_return_code]
icscf | 20(69) INFO: ims_icscf [cxdx_avp.c:137]: cxdx_get_avp(): cxdx_get_result_code: Failed finding avp
icscf | 20(69) INFO: ims_icscf [cxdx_uar.c:71]: create_uaa_return_code(): created AVP successfully : [uaa_return_code]
scscf | 3(53) NOTICE: <script>: SCSCF: REGISTER sip:scscf.ims.mnc033.mcc428.3gppnetwork.org:6060 (sip:[email protected] (172.22.0.7:4060) to sip:[email protected], [email protected])
scscf | 3(53) ERROR: <script>: ALGORITHM IS [] and User-Agent is []
scscf | 3(53) DEBUG: ims_auth [authorize.c:728]: authenticate(): Running authenticate, is_proxy_auth=0
scscf | 3(53) DEBUG: ims_auth [authorize.c:748]: authenticate(): Checking if REGISTER is authorized for realm [ims.mnc033.mcc428.3gppnetwork.org]...
scscf | 3(53) DEBUG: ims_auth [utils.c:168]: get_nonce_response(): Calling find_credentials with realm [ims.mnc033.mcc428.3gppnetwork.org]
scscf | 3(53) DEBUG: ims_auth [utils.c:57]: ims_find_credentials(): Searching credentials in realm [ims.mnc033.mcc428.3gppnetwork.org]
scscf | 3(53) DEBUG: ims_auth [utils.c:92]: ims_find_credentials(): *hook = 0x7fa48f6d2cf0
scscf | 3(53) DEBUG: ims_auth [utils.c:103]: ims_find_credentials(): Credential parsed successfully
scscf | 3(53) DEBUG: ims_auth [utils.c:106]: ims_find_credentials(): Comparing realm <ims.mnc033.mcc428.3gppnetwork.org> and <ims.mnc033.mcc428.3gppnetwork.org>
scscf | 3(53) DEBUG: ims_auth [utils.c:195]: get_nonce_response(): Found nonce response
scscf | 3(53) DEBUG: ims_auth [authorize.c:786]: authenticate(): Nonce or response missing: nonce len [0], response16 len[0]
scscf | 3(53) DEBUG: ims_auth [authorize.c:293]: challenge(): Looking for route block [REG_MAR_REPLY]
scscf | 3(53) INFO: ims_auth [cxdx_mar.c:79]: create_return_code(): created AVP successfully : [maa_return_code] - [-2]
scscf | 3(53) DEBUG: ims_auth [authorize.c:317]: challenge(): Need to challenge for realm [ims.mnc033.mcc428.3gppnetwork.org]
scscf | 3(53) DEBUG: ims_auth [authorize.c:324]: challenge(): Checking if REGISTER is authorized for realm [ims.mnc033.mcc428.3gppnetwork.org]...
scscf | 3(53) DEBUG: ims_auth [authorize.c:1448]: get_auth_userdata(): Searching auth_userdata for IMPU sip:[email protected] (Hash 724)
scscf | 3(53) DEBUG: ims_auth [authorize.c:1457]: get_auth_userdata(): Found auth_userdata
scscf | 3(53) DEBUG: ims_auth [authorize.c:460]: challenge(): Suspending SIP TM transaction
scscf | 3(53) DEBUG: ims_auth [authorize.c:1528]: multimedia_auth_request(): Sending MAR
scscf | 3(53) DEBUG: ims_auth [cxdx_mar.c:549]: cxdx_send_mar(): Successfully sent async diameter
scscf | 23(73) INFO: ims_auth [cxdx_avp.c:137]: cxdx_get_avp(): cxdx_get_experimental_result_code: Failed finding avp (avp_code = 297, vendor_id = 0)
scscf | 23(73) DEBUG: ims_auth [authorize.c:1305]: new_auth_vector(): new auth-vector with ck [3b9475dee17ec3af937a371ab5b03634] with status 0
scscf | 23(73) DEBUG: ims_auth [authorize.c:1559]: pack_challenge(): setting QOP str used is [, qop="auth"]
scscf | 23(73) DEBUG: ims_auth [authorize.c:1561]: pack_challenge(): QOP str used is [, qop="auth"]
scscf | 23(73) DEBUG: ims_auth [authorize.c:1448]: get_auth_userdata(): Searching auth_userdata for IMPU sip:[email protected] (Hash 724)
scscf | 23(73) DEBUG: ims_auth [authorize.c:1457]: get_auth_userdata(): Found auth_userdata
scscf | 23(73) DEBUG: ims_auth [authorize.c:1681]: add_auth_vector(): Adding auth_vector (status 1) for IMPU sip:[email protected] / IMPI [email protected] (Hash 724)
scscf | 23(73) DEBUG: ims_auth [cxdx_mar.c:464]: async_cdp_callback(): DBG:UAR Async CDP callback: ... Done resuming transaction
scscf | 23(73) INFO: ims_auth [cxdx_mar.c:79]: create_return_code(): created AVP successfully : [maa_return_code] - [1]
scscf | 23(73) WARNING: tm [t_suspend.c:192]: t_continue_helper(): active transaction not found
scscf | 23(73) DEBUG: ims_auth [cxdx_mar.c:87]: free_saved_transaction_data(): Freeing saved transaction data: async
pcscf | 100(137) NOTICE: <script>: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1246;spi-s=1247;port-c=7014;port-s=7015,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1246;spi-s=1247;port-c=7014;port-s=7015,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1246;spi-s=1247;port-c=7014;port-s=7015,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1246;spi-s=1247;port-c=7014;port-s=7015,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1246;spi-s=1247;port-c=7014;port-s=7015,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1246;spi-s=1247;port-c=7014;port-s=7015
pcscf | 100(137) NOTICE: <script>: port-c=7014
pcscf | 100(137) NOTICE: <script>: port-s=7015
pcscf | 100(137) NOTICE: <script>: Expires=600000
pcscf | 100(137) NOTICE: <script>: Old header - WWW-Authenticate=Digest realm="ims.mnc033.mcc428.3gppnetwork.org", nonce="MFXHzjW7vVyDBeUMvazFPj9SQHCAvgAA9tA7ALtBqdM=", algorithm=AKAv1-MD5, ck="3b9475dee17ec3af937a371ab5b03634", ik="20eea43f47cc33341fd942faaa9cf615", qop="auth"
pcscf | 100(137) NOTICE: <script>: New header - WWW-Authenticate=Digest realm="ims.mnc033.mcc428.3gppnetwork.org", nonce="MFXHzjW7vVyDBeUMvazFPj9SQHCAvgAA9tA7ALtBqdM=", algorithm=AKAv1-MD5, qop="auth"
pcscf | 107(144) ERROR: [core/tcp_read.c:299]: tcp_read_data(): error reading: Connection reset by peer (104) ([10.129.1.154]:1030 ->107(144) ERROR: [core/tcp_read.c:303]: tcp_read_data(): -> [172.22.0.9]:5060)
pcscf | 107(144) ERROR: [core/tcp_read.c:1503]: tcp_read_req(): ERROR: tcp_read_req: error reading - c: 0x7f74ae542b50 r: 0x7f74ae542bd0 (-1)

PCAP:

image

Can you give me some advice on it? @herlesupreeth

@herlesupreeth
Copy link
Owner

herlesupreeth commented Jan 2, 2024

Please post a pcap of the registration scenario

@mrgogoa4
Copy link
Author

mrgogoa4 commented Jan 2, 2024

This is my pcap of the registration.

reg_P_04.zip

@mrgogoa4
Copy link
Author

mrgogoa4 commented Jan 2, 2024

Now the IPsec netlink messages is below:

root@1f68fbf31520:/# ip xfrm monitor

src 10.129.1.92 dst 172.22.0.9
proto esp spi 0x00001001 reqid 4097 mode transport
replay-window 32
auth-trunc hmac(sha1) 0x8f96dbda1e5bb35f5dc063d432337ba0 96
enc cbc(aes) 0x70ffccfbfad4acedb3559be494ac4ee5
anti-replay context: seq 0x0, oseq 0x0, bitmap 0x00000000
sel src 10.129.1.92/32 dst 172.22.0.9/32 sport 7012 dport 6100
src 10.129.1.92/32 dst 172.22.0.9/32 sport 7012 dport 6100
dir in priority 2080
tmpl src 10.129.1.92 dst 172.22.0.9
proto esp reqid 4097 mode transport
src 172.22.0.9 dst 10.129.1.92
proto esp spi 0x000004dd reqid 1245 mode transport
replay-window 32
auth-trunc hmac(sha1) 0x8f96dbda1e5bb35f5dc063d432337ba0 96
enc cbc(aes) 0x70ffccfbfad4acedb3559be494ac4ee5
anti-replay context: seq 0x0, oseq 0x0, bitmap 0x00000000
sel src 172.22.0.9/32 dst 10.129.1.92/32 sport 5100 dport 7013
src 172.22.0.9/32 dst 10.129.1.92/32 sport 5100 dport 7013
dir out priority 2080
tmpl src 172.22.0.9 dst 10.129.1.92
proto esp reqid 1245 mode transport
src 172.22.0.9 dst 10.129.1.92
proto esp spi 0x000004dc reqid 1244 mode transport
replay-window 32
auth-trunc hmac(sha1) 0x8f96dbda1e5bb35f5dc063d432337ba0 96
enc cbc(aes) 0x70ffccfbfad4acedb3559be494ac4ee5
anti-replay context: seq 0x0, oseq 0x0, bitmap 0x00000000
sel src 172.22.0.9/32 dst 10.129.1.92/32 sport 6100 dport 7012
src 172.22.0.9/32 dst 10.129.1.92/32 sport 6100 dport 7012
dir out priority 2080
tmpl src 172.22.0.9 dst 10.129.1.92
proto esp reqid 1244 mode transport
src 10.129.1.92 dst 172.22.0.9
proto esp spi 0x00001000 reqid 4096 mode transport
replay-window 32
auth-trunc hmac(sha1) 0x8f96dbda1e5bb35f5dc063d432337ba0 96
enc cbc(aes) 0x70ffccfbfad4acedb3559be494ac4ee5
anti-replay context: seq 0x0, oseq 0x0, bitmap 0x00000000
sel src 10.129.1.92/32 dst 172.22.0.9/32 sport 7013 dport 5100
src 10.129.1.92/32 dst 172.22.0.9/32 sport 7013 dport 5100
dir in priority 2080
tmpl src 10.129.1.92 dst 172.22.0.9
proto esp reqid 4096 mode transport
src 10.129.1.92/32 dst 172.22.0.9/32 sport 7012 dport 5100
dir in priority 2080
tmpl src 10.129.1.92 dst 172.22.0.9
proto esp reqid 4097 mode transport
src 172.22.0.9/32 dst 10.129.1.92/32 sport 5100 dport 7012
dir out priority 2080
tmpl src 172.22.0.9 dst 10.129.1.92
proto esp reqid 1245 mode transport
src 172.22.0.9/32 dst 10.129.1.92/32 sport 6100 dport 7013
dir out priority 2080
tmpl src 172.22.0.9 dst 10.129.1.92
proto esp reqid 1244 mode transport
src 10.129.1.92/32 dst 172.22.0.9/32 sport 7013 dport 6100
dir in priority 2080
tmpl src 10.129.1.92 dst 172.22.0.9
proto esp reqid 4096 mode transport

@herlesupreeth
Copy link
Owner

image

From what I see here in the pcap, it could be that kamailio at branch 5.3 has a bug in handling encrypted traffic which may have been resolved in upstream kamailio branch

you could try the https://github.com/herlesupreeth/docker_open5gs/tree/test_upstream_kamailio branch and see if the registration works. That branch takes the latest upstream kamailio code

@mrgogoa4
Copy link
Author

mrgogoa4 commented Jan 5, 2024

Thank you for providing the new information. I tried to change those new changes on the Kamailio but it's like there is no modparam("ims_qos", "dialog_direction", RX_IMS_REG_DIALOG_DIRECTION) on the test upstream Kamailio, also other options not working as well. Are you sure those changes worked well?

Also, I deployed the new Kamailio 5.7.2, but it's the same as the 5.3 version stuck on the ESP part during the registration process with IPsec.

@herlesupreeth
Copy link
Owner

I tried to change those new changes on the Kamailio but it's like there is no modparam("ims_qos", "dialog_direction", RX_IMS_REG_DIALOG_DIRECTION) on the test upstream Kamailio, also other options not working as well. Are you sure those changes worked well?

After switching to that branch you need to recompile kamailio base image as those modparams are only present in upstream kamailio repo. And, I have tested both registration and calling with COTS UE using IPSec

@mrgogoa4
Copy link
Author

mrgogoa4 commented Jan 8, 2024

I again compiled and deployed with all above you mentioned changes but still stuck on that IPsec part and still wondering why. My test environment is still the same as Proxmox on top of that Ubuntu 22 and docker. Dockerfile=> ubuntu:focal

Ubuntu 22 Kernel: Linux bernetes 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Docker ubuntu:focal Kernel: root@7172f51ef75a:/# uname -a
Linux 7172f51ef75a 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Proxmox kernel: root@explorer:~# uname -a
Linux explorer 6.2.16-3-pve #1 SMP PREEMPT_DYNAMIC PVE 6.2.16-3 (2023-06-17T05:58Z) x86_64 GNU/Linux

Now kamailio version is below: with test_upstream

root@7172f51ef75a:/# kamailio -v
version: kamailio 5.8.0-dev2 (x86_64/linux) e27922
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: e27922
compiled on 02:27:06 Jan 8 2024 with gcc 9.4.0

I got below error on pcscf:
101(140) NOTICE: <script>: PCSCF: REGISTER sip:ims.mnc033.mcc428.3gppnetwork.org (sip:[email protected] (10.129.1.168:1027) to sip:[email protected], [email protected])
101(140) INFO: rr [rr_mod.c:585]: pv_get_route_uri_f(): No route header present.
101(140) NOTICE: <script>: PCSCF REGISTER:
Destination URI:
Request URI: sip:ims.mnc033.mcc428.3gppnetwork.org
101(140) INFO: rr [rr_mod.c:585]: pv_get_route_uri_f(): No route header present.
101(140) NOTICE: <script>: Source IP and Port: (10.129.1.168:1027)
Route-URI:
101(140) NOTICE: <script>: Received IP and Port: (172.22.0.9:5060)
101(140) NOTICE: <script>: Contact header: sip:[email protected]:5060;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel";audio;video;+sip.instance="urn:gsma:imei:36252343-243152-0"
101(140) INFO: ims_registrar_pcscf [sec_agree.c:302]: cscf_get_security_verify(): No security-verify parameters found
102(141) NOTICE: <script>: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1240;spi-s=1241;port-c=7008;port-s=7009,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1240;spi-s=1241;port-c=7008;port-s=7009,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1240;spi-s=1241;port-c=7008;port-s=7009,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1240;spi-s=1241;port-c=7008;port-s=7009,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1240;spi-s=1241;port-c=7008;port-s=7009,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1240;spi-s=1241;port-c=7008;port-s=7009
102(141) NOTICE: <script>: port-c=7008
102(141) NOTICE: <script>: port-s=7009
102(141) NOTICE: <script>: Expires=600000
102(141) NOTICE: <script>: Old header - WWW-Authenticate=Digest realm="ims.mnc033.mcc428.3gppnetwork.org", nonce="/THz33JxFox0ddXT96q2NwEyn7f3cwAA699fpx0RvcA=", algorithm=AKAv1-MD5, ck="993026ad25f59d445ebb9840c1281454", ik="af44aa0202ff78fb893d11e4aa385c84", qop="auth"
102(141) NOTICE: <script>: New header - WWW-Authenticate=Digest realm="ims.mnc033.mcc428.3gppnetwork.org", nonce="/THz33JxFox0ddXT96q2NwEyn7f3cwAA699fpx0RvcA=", algorithm=AKAv1-MD5, qop="auth"
101(140) ERROR: [core/tcp_read.c:267]: tcp_read_data(): error reading: Connection reset by peer (104) ([10.129.1.168]:1027 ->101(140) ERROR: [core/tcp_read.c:270]: tcp_read_data(): -> [172.22.0.9]:5060)
101(140) ERROR: [core/tcp_read.c:1524]: tcp_read_req(): ERROR: tcp_read_req: error reading - c: 0x7f7dcb269730 r: 0x7f7dcb269858 (-1)
103(142) NOTICE: <script>: PCSCF: REGISTER sip:ims.mnc033.mcc428.3gppnetwork.org (sip:[email protected] (10.129.1.232:1028) to sip:[email protected], [email protected])
103(142) INFO: rr [rr_mod.c:585]: pv_get_route_uri_f(): No route header present.
103(142) NOTICE: <script>: PCSCF REGISTER:
Destination URI:
Request URI: sip:ims.mnc033.mcc428.3gppnetwork.org
103(142) INFO: rr [rr_mod.c:585]: pv_get_route_uri_f(): No route header present.
103(142) NOTICE: <script>: Source IP and Port: (10.129.1.232:1028)
Route-URI:
103(142) NOTICE: <script>: Received IP and Port: (172.22.0.9:5060)
103(142) NOTICE: <script>: Contact header: sip:[email protected]:5060;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel";audio;video;+sip.instance="urn:gsma:imei:36252343-243152-0"
103(142) INFO: ims_registrar_pcscf [sec_agree.c:302]: cscf_get_security_verify(): No security-verify parameters found
104(143) NOTICE: <script>: Security-Client=ipsec-3gpp;alg=hmac-md5-96;ealg=null;spi-c=1242;spi-s=1243;port-c=7010;port-s=7011,ipsec-3gpp;alg=hmac-md5-96;ealg=des-ede3-cbc;spi-c=1242;spi-s=1243;port-c=7010;port-s=7011,ipsec-3gpp;alg=hmac-md5-96;ealg=aes-cbc;spi-c=1242;spi-s=1243;port-c=7010;port-s=7011,ipsec-3gpp;alg=hmac-sha-1-96;ealg=null;spi-c=1242;spi-s=1243;port-c=7010;port-s=7011,ipsec-3gpp;alg=hmac-sha-1-96;ealg=des-ede3-cbc;spi-c=1242;spi-s=1243;port-c=7010;port-s=7011,ipsec-3gpp;alg=hmac-sha-1-96;ealg=aes-cbc;spi-c=1242;spi-s=1243;port-c=7010;port-s=7011
104(143) NOTICE: <script>: port-c=7010
104(143) NOTICE: <script>: port-s=7011
104(143) NOTICE: <script>: Expires=600000
104(143) NOTICE: <script>: Old header - WWW-Authenticate=Digest realm="ims.mnc033.mcc428.3gppnetwork.org", nonce="2itUf+f1hMXkSRcMrqNfTu8BKRzgVQAAzuGWUmgqhH0=", algorithm=AKAv1-MD5, ck="30d7e994eca41ff3f04116bd895a0468", ik="42e6d813fe12c1ba5af78297b59fd7de", qop="auth"
104(143) NOTICE: <script>: New header - WWW-Authenticate=Digest realm="ims.mnc033.mcc428.3gppnetwork.org", nonce="2itUf+f1hMXkSRcMrqNfTu8BKRzgVQAAzuGWUmgqhH0=", algorithm=AKAv1-MD5, qop="auth"
103(142) ERROR: [core/tcp_read.c:267]: tcp_read_data(): error reading: Connection reset by peer (104) ([10.129.1.232]:1028 ->103(142) ERROR: [core/tcp_read.c:270]: tcp_read_data(): -> [172.22.0.9]:5060)
103(142) ERROR: [core/tcp_read.c:1524]: tcp_read_req(): ERROR: tcp_read_req: error reading - c: 0x7f7dcb269730 r: 0x7f7dcb269858 (-1)

PCAP is same like before:
image

Sorry for the trouble.

@herlesupreeth
Copy link
Owner

If you are using the latest master branch from docker_open5gs repo (it uses upstream kamailio master branch), then you can add the below configuration to kamailio_pcscf.cfg file and re-deploy and give it a try

modparam("ims_ipsec_pcscf", "ipsec_preferred_ealg", "null")

@mrgogoa4
Copy link
Author

I have successfully registered IPsec using version 5.7.4 on ubuntu 22. But it still doesn't work with version 5.7.4 with docker compose on ubuntu 22, docker image is ubuntu:jammy.

After 401 challenging 6 ESP packets are exchanged with UE and it's stuck with docker compose on ubuntu 22. Is there anything extra I need to do with Docker?

@psheshupavan
Copy link

Hi,

I have tried the same procedure said in this mail chain but still facing issue. I have also used kamailio 5.7.4 version but didn't worked. I have downloaded the code, compile it and executed the binary with the configurtion files shared. But P-CSCF is not able to decode ESP messages.

Please help me if i need to configure any thing else.

Thanks,
Pavan

@grantmcf
Copy link

I'm also having this same problem. Ubuntu 22.04 Server with Kamailio 5.8.4 (stable) compiled from source. No strongswan, just what comes with Ubuntu base. After decoding the ESP packets in wireshark (I'm using a Samsung S24 UE) they are TCP SYN packets attempting to make a connection with Kamailio at port 5063 (set by modparam("ims_ipsec_pcscf", "ipsec_server_port", IPSEC_SERVER_PORT). There is no SYN ACK ever received and a bunch of TCP retransmissions. I can confirm there is indeed something listening on TCP port 5063 verified by command ss -a | grep 5063 so this looks like a possible decrypting problem. Using
modparam("ims_ipsec_pcscf", "ipsec_listen_addr", IPSEC_LISTEN_ADDR)
modparam("ims_ipsec_pcscf", "ipsec_client_port", IPSEC_CLIENT_PORT) <--- defined as 5062
modparam("ims_ipsec_pcscf", "ipsec_server_port", IPSEC_SERVER_PORT) <--- defined as 5063
modparam("ims_ipsec_pcscf", "ipsec_preferred_ealg", "aes-cbc")
modparam("ims_ipsec_pcscf", "ipsec_preferred_alg", "hmac-md5-96")

@grantmcf
Copy link

I'm also having this same problem. Ubuntu 22.04 Server with Kamailio 5.8.4 (stable) compiled from source. No strongswan, just what comes with Ubuntu base. After decoding the ESP packets in wireshark (I'm using a Samsung S24 UE) they are TCP SYN packets attempting to make a connection with Kamailio at port 5063 (set by modparam("ims_ipsec_pcscf", "ipsec_server_port", IPSEC_SERVER_PORT). There is no SYN ACK ever received and a bunch of TCP retransmissions. I can confirm there is indeed something listening on TCP port 5063 verified by command ss -a | grep 5063 so this looks like a possible decrypting problem. Using modparam("ims_ipsec_pcscf", "ipsec_listen_addr", IPSEC_LISTEN_ADDR) modparam("ims_ipsec_pcscf", "ipsec_client_port", IPSEC_CLIENT_PORT) <--- defined as 5062 modparam("ims_ipsec_pcscf", "ipsec_server_port", IPSEC_SERVER_PORT) <--- defined as 5063 modparam("ims_ipsec_pcscf", "ipsec_preferred_ealg", "aes-cbc") modparam("ims_ipsec_pcscf", "ipsec_preferred_alg", "hmac-md5-96")

This turned out to be a problem with permissions/priviliges for user 'kamailio' (all kamailio process are run as 'kamailio').

After running command 'sudo setcap cap_net_admin+ep /usr/local/sbin/kamailio' this issue with IPSec was resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants