<div dir="ltr">Hello OpenSIPS,<div><br></div><div>I'm trying to implement the stir_shaken_verify() function, and I have a feeling the rest_get() is truncating output variable...</div><div><br></div><div>I have these for the modules</div><div><br></div><div>...</div><div># STIR/SHAKEN modules<br>loadmodule "rest_client.so"<br>loadmodule "stir_shaken.so"<br>modparam("stir_shaken", "require_date_hdr", 0)<br>modparam("stir_shaken", "verify_date_freshness", 300)<br>loadmodule "cfgutils.so"<br>modparam("cfgutils", "shvset", "stirshaken=s:enable")<br>modparam("stir_shaken", "ca_list", "/etc/opensips/tls/calist.pem")<br></div><div>...</div><div><br></div><div>and then I'm using something like this to do the verifying</div><div><br></div><div>...</div><div>Â Â $var(rc) = rest_get( "$identity(x5u)", $var(cert), $var(ctype), $var(http_rc));<br>Â Â if ($var(rc) < 0) {<br>Â Â Â Â xlog("L_ERR", "rest_get() FAILED\n");<br>Â Â Â Â send_reply(436, "Bad Identity Info");<br>Â Â Â Â exit;<br>Â Â } else {<br>Â Â Â Â $var(len) = $(var(cert){s.len});<br>Â Â Â Â $var(cert_full) = $(var(cert){s.escape.common});<br>Â Â Â Â xlog("L_ERR","cert full = $var(cert_full)");<br>Â Â Â Â xlog("L_ERR", "length $$var(cert) = $var(len)\n");<br>Â Â Â Â xlog("L_ERR", "rest_get() PASSED: Â $$var(cert) = $var(cert)");<br>Â Â }<br><br></div><div>Â Â xlog("L_ERR","$$identity(x5u) = $identity(x5u)");<br>Â Â $var(rc) = stir_shaken_verify("$var(cert)", $var(err_code), $var(err_reason), $identity(orig), $identity(dest));<br>Â Â if ($var(rc) < -1) {<br>Â Â Â Â xlog("L_ERR", "stir_shaken_verify() FAILED\n");<br>Â Â Â Â send_reply($var(err_code), $var(err_reason));<br>Â Â Â Â exit;<br>Â Â } else {<br>Â Â Â Â xlog("L_ERR", "stir_shaken_verify() PASSED\n");<br>Â Â }<br></div><div>...</div><div><br></div><div><br></div><div>my output xlogs are showing</div><div>...</div><div>/usr/local/sbin/opensips[113989]: cert full = -----BEGIN CERTIFICATE-----<br>/usr/local/sbin/opensips[113989]: length $var(cert) = 2367<br>/usr/local/sbin/opensips[113989]: rest_get() PASSED: Â $var(cert) = -----BEGIN CERTIFICATE-----<br>/usr/local/sbin/opensips[113989]: cached $var(cert) is still good<br>/usr/local/sbin/opensips[113989]: $identity(x5u) = <a href="https://cr.sansay.com/star2star-prod-stirshaken">https://cr.sansay.com/star2star-prod-stirshaken</a><br>/usr/local/sbin/opensips[113989]: INFO:stir_shaken:verify_callback: certificate validation failed: certificate signature failure<br>/usr/local/sbin/opensips[113989]: INFO:stir_shaken:w_stir_verify: Invalid certificate<br>/usr/local/sbin/opensips[113989]: stir_shaken_verify() FAILED<br></div><div>...</div><div><br></div><div>the variable is showing 2367 bytes</div><div><br></div><div>$var(len) = $(var(cert){s.len});<br></div>xlog("L_ERR", "length $$var(cert) = $var(len)\n");<br><div>/usr/local/sbin/opensips[113989]: length $var(cert) = 2367<br></div><div><br></div><div>but regardless what I try to print, it only printing the first line</div><br>$var(cert_full) = $(var(cert){s.escape.common});<br>xlog("L_ERR","cert full = $var(cert_full)");<br><div>/usr/local/sbin/opensips[113989]: cert full = -----BEGIN CERTIFICATE-----<br></div><div><br></div><div>Â xlog("L_ERR", "rest_get() PASSED: Â $$var(cert) = $var(cert)");<br></div><div>/usr/local/sbin/opensips[113989]: rest_get() PASSED: Â $var(cert) = -----BEGIN CERTIFICATE-----<br></div><div>....</div><div><br></div><div>Perhaps this isnt the issue after all, but I am unable to determine why the stir_shaken_verify() is failing</div><div><br></div><div>/usr/local/sbin/opensips[113989]: INFO:stir_shaken:verify_callback: certificate validation failed: certificate signature failure<br>/usr/local/sbin/opensips[113989]: INFO:stir_shaken:w_stir_verify: Invalid certificate<br></div><div><br></div><div>I feel like the $var(cert) is being truncated which i why it's failing... but I have no clue...</div><div><br></div><div>Can you provide pointers?</div><div>Thanks</div></div>