kamailio icon indicating copy to clipboard operation
kamailio copied to clipboard

ims_registrar_pcscf,ims_qos: support for trusting bottom via

Open vingarzan opened this issue 1 year ago • 0 comments

Pre-Submission Checklist

  • [x] Commit message has the format required by CONTRIBUTING guide
  • [x] Commits are split per component (core, individual modules, libs, utils, ...)
  • [x] Each component has a single commit (if not, squash them into one commit)
  • [x] No commits to README files for modules (changes must be done to docbook files in doc/ subfolder, the README file is autogenerated)

Type Of Change

  • [ ] Small bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds new functionality)
  • [ ] Breaking change (fix or feature that would change existing functionality)

Checklist:

  • [ ] PR should be backported to stable branches
  • [x] Tested changes locally
  • [x] Related to draft-PR https://github.com/kamailio/kamailio/pull/3891

Description

Normally, the IMS P-CSCF should identify the clients (UEs) by the received IP address and ports on Rx. The current code is using a mix of that, plus using Contact and Via headers, with arguable potential security issues.

This patch adds a new parameter to ims_registrar_pcscf and ims_qos modules, allowing for an optional outsource of the IPsec functionality to another element, which is also in charge of checking/enforcing correct UE Via header. The existing code is allowed to work as before, with the default value of the flag being towards that.

List of functional changes:

  • ims_qos
    • added trust_bottom_via parameter
    • used it on w_rx_aar_register()
  • ims_registrar_pcscf
    • added trust_bottom_via parameter
    • used it on update_contacts(), save_pending(), check_contact(), getContactP(), check_service_routes(), enforce_service_routes()
    • made ims_ipsec_pcscf dependency optional, with checks when used
    • skipped checks of port-uc in checkcontact() if the ims_ipsec_pcscf module was not loaded
    • added ignore_contact_rxproto_check parameter - IMS devices open IPsec Security Associations just between IPs and ports, with both UDP and TCP protocols allowed. The default then was set here to always ignore protocol checks. Before, the ignore_contact_rxport_check was used to skip this and still make it work, but that seemed like a typo/mistake with hidden effects.

List of indirect changes:

  • core/ut.h: added a str2ushort() macro, since code was using some dangerous casting and macros with a larger type
  • ims_registrar_pcscf: added Route headers in SUBSCRIBE to reginfo, with values from Service-Routes, as per 3GPP specs.
  • ims_usrloc_pcscf: small log fixes

For even more context, please see the discussion in https://github.com/kamailio/kamailio/pull/3891

vingarzan avatar Jul 02 '24 08:07 vingarzan