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

permissions: introduce func allow_register_include_port() #3846

Merged
merged 1 commit into from
May 27, 2024

Conversation

zenichev
Copy link
Contributor

Pre-Submission Checklist

  • Commit message has the format required by CONTRIBUTING guide
  • Commits are split per component (core, individual modules, libs, utils, ...)
  • Each component has a single commit (if not, squash them into one commit)
  • 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)
  • 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
  • Tested changes locally
  • Related to issue #XXXX (replace XXXX with an open issue number)

Description

Introduce new function: allow_register_include_port() to be able to check the whole Contact header including port.

Example, register.deny content is:

	ALL : "^sip:.*192.168.0.101:5062"

If the Contact is: "Contact: sip:testuser1004@192.168.0.101:5062" then this will check the Contact hf including port of it.

Otherwise if usual allow_register() function is used, then only the "testuser1004@192.168.0.101" will be taken into account, which will lead the regex to be failing and letting the check to pass through.

The func allow_register_include_port() works similarly as allow_register() except it checks Contact's port.

A separate function was created in order to not complicate things by introducing one more parameter to the
existing function allow_register(), which already takes a variable amount of parameters, so 1 or 2 parameters
(depending on if it is a "basename" or "allow-file, deny-file").

Documentation updated accordingly.
Additionally, "Register File Format" section has been added to the doc (to provide allow/deny file examples).

Full backwards compatibility is kept in place,
no need for users of the module to change anything in their configuration or kamailio script itself.

Introduce new function: `allow_register_include_port()`
to be able to check the whole Contact header including port.

Example, register.deny content is:
	ALL : "^sip:.*192.168.0.101:5062"

If the Contact is: "Contact: <sip:testuser1004@192.168.0.101:5062>"
then this will check the Contact hf including port of it.

Otherwise if usual `allow_register()` function is used,
then only the "testuser1004@192.168.0.101" will be taken into
account, which will lead the regex to be failing and letting
the check to pass through.

The func `allow_register_include_port()` works similarly
as `allow_register()` except it checks Contact's port.

Full backwards compatibility is kept in place,
no need for users of the module to change anything in
their configuration or kamailio script itself.
@zenichev zenichev force-pushed the allow_register_include_port branch from cc72e4d to 732c27e Compare May 10, 2024 08:32
@zenichev
Copy link
Contributor Author

@mtirpak can you pleae have a look?

@zenichev
Copy link
Contributor Author

@henningw maybe you could have a look?
We've tested that on our systems, and actually use it already in our latest master.

Regards,
Donat

@linuxmaniac linuxmaniac merged commit 534a359 into kamailio:master May 27, 2024
4 checks passed
zenichev added a commit to zenichev/kamailio-wiki that referenced this pull request May 27, 2024
linuxmaniac pushed a commit to kamailio/kamailio-wiki that referenced this pull request May 27, 2024
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

Successfully merging this pull request may close these issues.

None yet

2 participants