Strongswan-epdg with ADF.USIM

I am using strongswan-epdg to connect to the T/Mobile ePDG, following the guide at VoWiFi with Asterisk - Open Source IMS Client - Open Source Mobile Communications

I can establish an IPSec connection to the ePDG, connect to the P-CSCF and send a SIP REGISTER. It responds with the 401 containing information to set up the IPsec connection to the P_CSCF, which I’m planning to work on next.

However this only works with a several year old T/Mobile SIM that I have. Neither a Tello SIM nor T/Mobile SIM I’ve obtained within the last few weeks is able to establish the initial IPsec connection to the ePDG, they fail IKE as Unauthorized.

I believe these two new cards which don’t work are because they store their IMSI only in MF/ADF.USIM/EF.IMSI while the old card additionally stores its IMSI in MF/DF.GSM/EF.IMSI. I’ve verified this using pySim-shell’s export --json function.

So for example the code in strongswan-epdg/src/libcharon/plugins/eap_sim_pcsc/eap_sim_pcsc_card.c at cea991aea81c0ea03dbb037e9dd9cf1be20b001e - ims-volte-vowifi/strongswan-epdg - Osmocom gitea which only looks at MF/DF.GSM/EF.IMSI won’t succeed on the new cards.

I’m trying to add MF/ADF.USIM/EF.IMSI support in strongswan-epdg’s eap_sim_pcsc_card.c, though I’m struggling with it. I have TS 31.102 open. I think I need it to determine early on whether it is talking to a USIM or not, to fetch a different set of APDUs.

So, my questions:

  • Does this conclusion sound plausible?
  • I could try to read DF.GSM and then ADF.USIM if it fails, but I’m worried I’ll eventually learn there are SIM cards out there which misbehave if one tries to fetch nonexistent APDUs. Is that a legitimate concern?
2 Likes

I have working code in GitHub - DentonGentry/strongswan-epdg: Fork of https://gitea.osmocom.org/ims-volte-vowifi/strongswan-epdg, where commit Look for IMSI in ADF_USIM as well as DF_GSM. · DentonGentry/strongswan-epdg@65c2cd0 · GitHub tries both DF_GSM and ADF_USIM.

I have verified that it can establish an IPsec tunnel to the T/Mobile ePDG using the Tello SIM which did not work before, by reading the IMSI from ADF_USIM. I’ve also verified that the older T/Mobile SIM which worked before still works now.

1 Like

In case this didn’t happen yet, please kindly submit any improvements to the upstream repository where @jolly and/or @lynxis can review and possibly merge it.

Background: A classic GSM TS 11.11 SIM without ADF.USIM is pretty rare and unexpected in a VoWiFi situation, and i is up to the operator policy to decide whether to allow this configuration, as it is a security weakness due to the lack of mutual authentication in this case.

1 Like