### Description
When invoking jwt_verify with an expired JWT, it causes TLS termination with log print from the tls_server and tls_util.
While trying to debug the issue, I tried to give the method an invalid key path.
I got the following log (as expected):
```
failed to read key file
```
Then the flow continued just fine (fallback to proxy_authorization).
When I gave it a correct file path, but the content is wrong, the problem still occurred.
This makes me think the problem is in the …
[View More]method :
```
static int ki_jwt_verify_key(sip_msg_t* msg, str *key, str *alg, str *claims,
str *jwtval)
```
### Troubleshooting
#### Reproduction
Use an expired JWT
#### Log Messages
```
May 4 12:52:37 kamailio01 /usr/sbin/kamailio[21921]: INFO: {1 13605 INVITE 71a5d88a-b485-43c0-bac4-a2723333efeb} <script>: request_route: method [INVITE] from [sip:1234@barash.com] to [sip:pre-arranged-conf-factory@barash.com]
May 4 12:52:37 kamailio01 /usr/sbin/kamailio[21921]: ERROR: {1 13605 INVITE 71a5d88a-b485-43c0-bac4-a2723333efeb} jwt [jwt_mod.c:514]: ki_jwt_verify(): failed to decode jwt value
May 4 12:52:37 kamailio01 /usr/sbin/kamailio[21921]: INFO: {1 13605 INVITE 71a5d88a-b485-43c0-bac4-a2723333efeb} <script>: route[AUTH] failed to verify jwt token.
May 4 12:52:37 kamailio01 /usr/sbin/kamailio[21921]: ERROR: tls [tls_server.c:1330]: tls_h_read_f(): protocol level error
May 4 12:52:37 kamailio01 /usr/sbin/kamailio[21921]: ERROR: tls [tls_util.h:51]: tls_err_ret(): TLS read:error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding (sni: dev-proxy.barash.com)
May 4 12:52:37 kamailio01 /usr/sbin/kamailio[21921]: ERROR: tls [tls_util.h:51]: tls_err_ret(): TLS read:error:04067072:rsa routines:rsa_ossl_public_decrypt:padding check failed (sni: dev-proxy.barash.com)
May 4 12:52:37 kamailio01 /usr/sbin/kamailio[21921]: ERROR: tls [tls_server.c:1334]: tls_h_read_f(): src addr: 172.19.140.11:37188
May 4 12:52:37 kamailio01 /usr/sbin/kamailio[21921]: ERROR: tls [tls_server.c:1337]: tls_h_read_f(): dst addr: 172.19.140.70:5061
May 4 12:52:37 kamailio01 /usr/sbin/kamailio[21921]: ERROR: <core> [core/tcp_read.c:1478]: tcp_read_req(): ERROR: tcp_read_req: error reading - c: 0x7f731ec677f8 r: 0x7f731ec67920 (-1)
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.6.4 (x86_64/linux) a004cf
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, 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_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: a004cf
compiled on 09:56:56 Mar 22 2023 with gcc 8.3.0
```
* **Operating System**:
```
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Linux kamailio01.dev.wb.internal 4.19.0-23-amd64 #1 SMP Debian 4.19.269-1 (2022-12-20) x86_64 GNU/Linux
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3434
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3434(a)github.com>
[View Less]
#### 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 …
[View More]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)
- [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 -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
Enhancements to siptrace module to allow HEP replication of custom sip message given as parameter.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3442
-- Commit Summary --
* siptrace: added sip_trace_msg(dst, corlid, vmsg)
* siptrace; fix parameter inside sip_trace_msg()
* siptrace: sip_trace_msg() exported with 3 parameters
* siptrace: reworked sip_trace_msg() to specify source and target addresses
-- File Changes --
M src/modules/siptrace/siptrace.c (68)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3442.patchhttps://github.com/kamailio/kamailio/pull/3442.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3442
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3442(a)github.com>
[View Less]
### Description
crash happens if `lcr_id` passed to any of the functions ``KSR.lcr.load_gws*()`` is not defined in the lcr_gw table.
### Debugging Data
```
Core was generated by `/usr/sbin/kamailio -P /run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg'.
Program terminated with signal SIGSEGV, Segmentation fault.
(gdb) bt
#0 ki_load_gws_furi (_m=0x7f1e66521100, lcr_id=3, ruri_user=0x7ffe1f856360, from_uri=0x7ffe1f856370) at lcr_mod.c:2312
#1 0x00007f1e65d8ca35 in …
[View More]sr_apy_kemi_exec_func_ex (ket=0x7f1e655c27f0 <sr_kemi_lcr_exports+144>, self=0x7f1e60ecd090, args=0x7f1e60dd07c0, idx=544) at apy_kemi.c:1354
#2 0x00007f1e65d90477 in sr_apy_kemi_exec_func (self=0x7f1e60ecd090, args=0x7f1e60dd07c0, idx=544) at apy_kemi.c:1829
#3 0x00007f1e65d9b6ff in sr_apy_kemi_exec_func_544 (self=0x7f1e60ecd090, args=0x7f1e60dd07c0) at apy_kemi_export.c:4395
#4 0x00007f1e658d4c74 in ?? () from /lib/x86_64-linux-gnu/libpython3.9.so.1.0
#5 0x00007f1e6588ea50 in _PyObject_MakeTpCall () from /lib/x86_64-linux-gnu/libpython3.9.so.1.0
#6 0x00007f1e658402f2 in _PyEval_EvalFrameDefault () from /lib/x86_64-linux-gnu/libpython3.9.so.1.0
#7 0x00007f1e65837033 in ?? () from /lib/x86_64-linux-gnu/libpython3.9.so.1.0
#8 0x00007f1e6583f4b7 in _PyEval_EvalFrameDefault () from /lib/x86_64-linux-gnu/libpython3.9.so.1.0
#9 0x00007f1e65837033 in ?? () from /lib/x86_64-linux-gnu/libpython3.9.so.1.0
#10 0x00007f1e6583f4b7 in _PyEval_EvalFrameDefault () from /lib/x86_64-linux-gnu/libpython3.9.so.1.0
#11 0x00007f1e65837033 in ?? () from /lib/x86_64-linux-gnu/libpython3.9.so.1.0
#12 0x00007f1e658916a4 in ?? () from /lib/x86_64-linux-gnu/libpython3.9.so.1.0
#13 0x00007f1e65da52fc in apy_exec (_msg=0x7f1e66521100, fname=0x7f1e65dae11d "ksr_request_route", fparam=0x0, emode=1) at python_exec.c:139
#14 0x00007f1e65d62cae in sr_kemi_config_engine_python (msg=0x7f1e66521100, rtype=1, rname=0x0, rparam=0x0) at apy_kemi.c:66
#15 0x000056247fc0a6e4 in sr_kemi_route (keng=0x562480066420 <_sr_kemi_eng_list>, msg=0x7f1e66521100, rtype=1, ename=0x0, edata=0x0) at core/kemi.c:3784
#16 0x000056247fc9da66 in receive_msg (buf=0x562480105280 <buf> "INVITE sip:0031686807515@34.91.122.173 SIP/2.0\r\nRecord-Route: <sip:94.247.7.211;lr;ftag=tj0p4Q1r8H5ap>\r\nVia: SIP/2.0/UDP 94.247.7.211;TH=div;branch=z9hG4bKdc26.e6a724746d6ff0bf5231906a5f1c8734.0\r\nVia:"..., len=1202, rcv_info=0x7ffe1f857090)
at core/receive.c:502
#17 0x000056247fe01a5d in udp_rcv_loop () at core/udp_server.c:544
#18 0x000056247fb1a09b in main_loop () at main.c:1722
#19 0x000056247fb2720c in main (argc=10, argv=0x7ffe1f857ab8) at main.c:3078
(gdb) p lcr_count_param
$1 = 1
(gdb) p lcr_id
$2 = 3
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3435
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3435(a)github.com>
[View Less]
Hello,
the branch 5.7 was created, therefore the master branch is open for
adding new features, to be part of future release series v5.8.x (or
whatever version is decided for next series).
Any bug fix committed to master that applies to 5.7.x or older stable
branches should be backported as usual with "git cherry-pick -x ..." to
appropriate branches like 5.7 or 5.6.
Expect that v5.7.0 will be released in a few weeks from now.
Based on the workflow used during the past years, the next future
…
[View More]release v5.8.0 should be out after another 8-10 months of development,
plus 1-2 months of testing, so sometime during the first part of 2024.
Cheers,
Daniel
--
Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - June 5-7, 2023 - www.kamailioworld.com
[View Less]