### Description
The stirshaken module has an option to cache certificates instead of downloading it using http for each calls. The problem is that the module doesn't save the certificate chain in the cached file.
from here: https://github.com/kamailio/kamailio/blob/f7b35f05f31bd7cc01aea4572c79ba48d…
We see that only `cert->x` is saved to the file. It needs to save `cert->chainx` as well.
Similarly, the load function should load both the x509 and associated x509 chain.
### Troubleshooting
#### Reproduction
To reproduce, we need to configure the stirshaken module to do cerrtificate caching:
```
modparam("stirshaken", "vs_verify_x509_cert_path", 1)
modparam("stirshaken", "vs_ca_dir", "/path/to/ca")
modparam("stirshaken", "vs_cache_certificates", 1)
modparam("stirshaken", "vs_cache_dir", "/path/to/cert_cache")
modparam("stirshaken", "vs_cache_expire_s", 100)
```
Then send 2 calls featuring an identity header signed by a private key associated to a public certificate that includes a chain such as https://pstn-cdn.live.gtc.goto.com/certs/stirshaken/goto-2022-09
Verification for the fist call should work, but verification of x509 cert path will fail on second call
#### SIP Traffic
Example sip INVITE that should help reproduce the problem.
```
INVITE sip:+13855551212@216.82.227.102:5060 SIP/2.0
Max-Forwards: 61
f: <sip:+13852194167@reg.mydomain.net>;tag=as04e1a3e0
t: <sip:+13851212@somedomain.net>
m: <sip:+13852194167@reg.mydomain.net:5060>
i: 59ede93214794e1033b27ed249a90f15(a)reg.mydomain.net
CSeq: 102 INVITE
Date: Mon, 19 Sep 2022 15:04:01 GMT
l: 0
Identity: eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cHM6Ly9wc3RuLWNkbi5saXZlLmd0Yy5nb3RvLmNvbS9jZXJ0cy9zdGlyc2hha2VuL2dvdG8tMjAyMi0wOSJ9.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxNTE0ODM4MjY0NyJdfSwiaWF0IjoxNjYzNTk5ODQxLCJvcmlnIjp7InRuIjoiMTM4NTIxOTQxNjcifSwib3JpZ2lkIjoiNTllZGU5MzIxNDc5NGUxMDMzYjI3ZWQyNDlhOTBmMTVAcmVnLmppdmVpcC5uZXQifQ.wX5H0FhPt99MPWbdk_xgZXOWCHPGRcS_RiGTBBE5mG_r6By6StdnsBWiipdU9xyLuG3nSPKKFybhdO1S8OIeSQ;info=<https://pstn-cdn.live.gtc.goto.com/certs/stirshaken/goto-2022-09>;alg=ES256;ppt=shaken
```
### Possible Solutions
The module should save/load `cert->chainx` as well. Maybe a new set of function in libstirshaken should be added to save/load a certificate (vs saving/loading x509)
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3246
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3246(a)github.com>
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] 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:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
When the stirshaken module is in use and configured to cache certifications, validation will succeed on the very first attempt but will then fail every time the certificate is loaded from cache. The reason is because this module only saves the certificate and discards the any supplied chain certificates. This patch causes the module to save all supplied certificates and properly loads them upon retrieval.
For the loading to work a patch is required in libstirshaken. A PR has already been submitted and is linked below. Without that patch the problem will persist but no other harm is done. This is a safe change to make that does not break existing behaviour.
- save all certificates provided by signor to the disk cache
- properly load all certificates when loading from cache
- requires patch to libstirshaken (PR 123); this patch causes no harm (but no benefit) without it
- resolve unrelated compiler warnings on 32bit systems
https://github.com/signalwire/libstirshaken/pull/123
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3175
-- Commit Summary --
* stirshaken: Properly handle intermediary/chain certificates when caching certificates
* stirshaken: close file in write failure cases
-- File Changes --
M src/modules/stirshaken/stirshaken_mod.c (106)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3175.patchhttps://github.com/kamailio/kamailio/pull/3175.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3175
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3175(a)github.com>
Hello,
as I am not a user of dialog variables, I am turning to community to ask
for help testing the current master branch with configurations that make
use of dialog variables and acc dialog-based cdr generation.
With a few reports of issues related to dialog modules and unexpected
crashes, I looked over the code and noticed that the access of the value
for dialog variables was not protected, making them vulnerable of
invalid memory access in case of the variable was updated by another
process or dialog was terminated.
I introduced a couple of new functions to try to cover different use
cases of getting the dlg variable values, dialog management code was not
affected, but given that these commits need to be backported to stable
branch (5.6), I want to get proper feedback from community that things
work fine.
A previous attempt of a simpler fix was not enough, having side effects
to acc module for dialog-based cdr generation, because it was keeping
referenced to many dlg variables at the same time.
In short, it would be appreciated any feedback on testing dialog and acc
with dialog-based cdr generation using git master branch.
Cheers,
Daniel
--
Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
Nov 7-10, 2022 (Europe Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] 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
- [x] 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:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
We have found a random crash in the CTL module handler and we are using kamailio 5.4.7. Based on the core log analysis, we have identified that, due to some of the RPC events this crash happens.
This crash happen when "rpc_mod_is_printed_one" funtion recevies the parameter ( mem_counter *stats ) as NULL. To avoid the crash, we have added the below code.
if ( stats == NULL || current == NULL )
{
LM_ERR("rpc_mod_is_printed_one -> funtion parameter contains null value \n");
return 1;
}
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3250
-- Commit Summary --
* Update mod_stats.c Random crash in CTL handler
-- File Changes --
M src/modules/kex/mod_stats.c (6)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3250.patchhttps://github.com/kamailio/kamailio/pull/3250.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3250
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3250(a)github.com>
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [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
- [x] 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:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [x] PR should be backported to stable branches
- [x] Tested changes locally
- [x] Related to https://github.com/kamailio/kamailio/commit/aa6e9963b2725c1b6b7e5ff995a77c2…https://lists.kamailio.org/pipermail/sr-users/2020-November/111152.html
#### Description
tm.t_uac_start adds new tag into from header even if it exists. It has already been fixed for t_uac_send function. But there is the same problem for tm.t_uac_start RPC command. I've fixed it in the same way.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3251
-- Commit Summary --
* tm: proper fill of From/To URI/tag values using parsed structure in rpc_t_uac()
-- File Changes --
M src/modules/tm/rpc_uac.c (24)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3251.patchhttps://github.com/kamailio/kamailio/pull/3251.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3251
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3251(a)github.com>
Dear all
we have seen a core in a running production kamailio instance today, i attach you the bt in dropbox
version: kamailio 5.4.4 (x86_64/linux) 0ddb01-dirty
centos7 3.10.0-693.17.1.el7.x86_64
https://www.dropbox.com/s/fpunfs0o9aqhwww/kamailio_core_17agosto.txt?dl=0
~~~
#0 0x00007f4c131446ad in print_lists (dlg=0x7f4b60abb2e8) at dlg_var.c:277
#1 0x00007f4c131467ff in pv_set_dlg_variable (msg=0x7f4c17592d70, param=0x7f4c17aa88d0, op=254, val=0x7ffc8de8c990) at dlg_var.c:443
#2 0x00000000004f9c82 in lval_pvar_assign (h=0x7ffc8de8ddc0, msg=0x7f4c17592d70, lv=0x7f4c17aa8998, rv=0x7f4c17aa8b18) at core/lvalue.c:352
#3 0x00000000004fa780 in lval_assign (h=0x7ffc8de8ddc0, msg=0x7f4c17592d70, lv=0x7f4c17aa8998, rve=0x7f4c17aa8b10) at core/lvalue.c:400
#4 0x00000000004c3f6f in do_action (h=0x7ffc8de8ddc0, a=0x7f4c17aa92b0, msg=0x7f4c17592d70) at core/action.c:1455
#5 0x00000000004c5cab in run_actions (h=0x7ffc8de8ddc0, a=0x7f4c17aa8668, msg=0x7f4c17592d70) at core/action.c:1581
#6 0x00000000004b8867 in do_action (h=0x7ffc8de8ddc0, a=0x7f4c17aac2b0, msg=0x7f4c17592d70) at core/action.c:1067
#7 0x00000000004c5cab in run_actions (h=0x7ffc8de8ddc0, a=0x7f4c17aa34c0, msg=0x7f4c17592d70) at core/action.c:1581
#8 0x00000000004c63ef in run_top_route (a=0x7f4c17aa34c0, msg=0x7f4c17592d70, c=0x7ffc8de8ddc0) at core/action.c:1666
#9 0x00007f4c16bbc0a2 in reply_received (p_msg=0x7f4c17592d70) at t_reply.c:2543
#10 0x00000000005d0b69 in do_forward_reply (msg=0x7f4c17592d70, mode=0) at core/forward.c:764
#11 0x00000000005d283b in forward_reply (msg=0x7f4c17592d70) at core/forward.c:865
#12 0x0000000000622dd2 in receive_msg (
buf=0xb034a0 <buf.7140> "SIP/2.0 100 Trying\r\nVia: SIP/2.0/UDP 79.170.68.186;branch=z9hG4bK895d.0e2ee1cb7a0cde9ed9e78d7f0ec22c00.0\r\nVia: SIP/2.0/UDP 79.170.71.172:5080;received=79.170.71.172;rport=5080;branch=z9hG4bKtmtBy7jaQ5"..., len=449, rcv_info=0x7ffc8de8e8b0) at core/receive.c:509
#13 0x0000000000521e67 in udp_rcv_loop () at core/udp_server.c:543
#14 0x0000000000429f56 in main_loop () at main.c:1689
#15 0x0000000000434034 in main (argc=13, argv=0x7ffc8de8f148) at main.c:2876
~~~
Best regards,
Noel
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2828
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [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:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [x] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
Ported all carrierroute module functions to KEMI API.
Here is an example,
```python3
...
# User location service
def ksr_route_location(self, msg):
if KSR.pv.get("$rm") == "INVITE" and KSR.carrierroute.cr_user_carrier("$fU", "$fd", "$avp(carrier)") > 0:
if KSR.pv.get("$rm") == "INVITE" and KSR.carrierroute.cr_route("$avp(carrier)","$avp(domain)","$rU","$rU","call_id") > 0:
KSR.info('Routing call via user carrier route\n')
self.ksr_route_relay(msg)
rc = KSR.registrar.lookup("location")
if rc < 0:
KSR.tm.t_newtran()
if rc == -1 or rc == -3:
KSR.sl.send_reply(404, "Not Found")
return -255
elif rc == -2:
KSR.sl.send_reply(405, "Method Not Allowed")
return -255
# when routing via usrloc, log the missed calls also
if KSR.is_INVITE() :
KSR.setflag(FLT_ACCMISSED)
self.ksr_route_relay(msg)
return -255
...
```
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3247
-- Commit Summary --
* KEMI API implementation for carrierroute module
-- File Changes --
M src/modules/carrierroute/carrierroute.c (50)
M src/modules/carrierroute/carrierroute.h (1)
M src/modules/carrierroute/cr_func.c (260)
M src/modules/carrierroute/cr_func.h (63)
A src/modules/carrierroute/cr_kemi.c (199)
A src/modules/carrierroute/cr_kemi.h (119)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3247.patchhttps://github.com/kamailio/kamailio/pull/3247.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3247
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3247(a)github.com>
Hello,
Kamailio SIP Server project is organizing another meeting of its
developers during November 16-17, 2022, hosted again by sipgate.de in
Dusseldorf, Germany.
The event is intended to facilitate the interaction between Kamailio
developers and to offer a convenient environment for working together on
several topics of high interest for the project, including writing code
for Kamailio and its tools, improving documentation, or discuss about
future development.
Everyone from the community is welcome to join. Please note we have a
limited capacity of seats in the meeting room, the main policy for
accepting participants being first come first server. Also, very
important to be aware that this is not an event to learn how to use
Kamailio.
More details about the event, the venue, how to register, are available at:
* https://www.kamailio.org/w/developers-meeting/
Looking forward to those two intensive hacking Kamailio days in Dusseldorf!
Cheers,
Daniel
--
Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
Oct 10-13, 2022 (Europe Timezone)
* https://www.asipto.com/sw/kamailio-advanced-training-online/