<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 15.11.17 18:27, Robert wrote:<br>
</div>
<blockquote type="cite"
cite="mid:536A419B-A10B-4184-AC7E-46D839F939F1@vooey.co.uk">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Thank you Daniel. This provides me with some capability, but I
can’t seem to consume the result in the configuration, I just get
lots of errors. The issue seems to be that the value of the
define, passed via -A doesn’t seem to be processed in anyway.
<div class=""><br class="">
</div>
<div class="">I’ve had a quick look in the cfg.lex and cfg.y
files, but that’s the first time delving into Flex etc. so I’m
not sure I’m following it correctly.</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div class="">I’ve tried every combination of encapsulation of
the parameters in single and double quotes I can think of
i.e. -A DBURL=“…”, -A “DBURL=…”, all with the same result.</div>
</div>
</div>
</blockquote>
<br>
Variants of the quoting was referring to the value of DBURL, maybe
it was not clear ... Anyhow, I just tried and the next command
starts kamailio with the default config:<br>
<br>
./src/kamailio -f etc/kamailio.cfg -A WITH_MYSQL -A WITH_AUTH -A
DBURL='"mysql://kamailio:kamailiorw@localhost/kamailio"' -L
src/modules/ -a no -E -e -ddd<br>
<br>
Note that the value for DBURL is enclosed first in between ' ' and
then inside are " ".<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote type="cite"
cite="mid:536A419B-A10B-4184-AC7E-46D839F939F1@vooey.co.uk">
<div class="">
<div class="">
<div class=""><br class="">
</div>
<div class="">I also tried #!subst "/DB_URL/DBURL/g” but that
doesn’t seem to expand out the DBURL define.</div>
<div class=""><br class="">
</div>
<div class="">In short, I’m stumped… Any further thoughts
would be truly appreciated. I’ve put a few error details in
the mail below. I’m feeling that I may need to resort to
changing the behaviour of the subst directive to meet my
needs (more likely, add substvar, substfromfile or some
such).</div>
<div class=""><br class="">
</div>
<div class="">Any further thoughts would be truly welcome,
otherwise I think I’m going to have to dig out my dusty
K&R book and roll my sleeves up… Sincere thanks in
advance for any ideas.</div>
<div class=""><br class="">
</div>
<div class="">Cheers - Robert...</div>
<div class=""><br class="">
</div>
<div class="">-------------------------------------------------------------------------------------------------------------------------</div>
<div class=""><br class="">
</div>
<div class="">In the configuration file, I have failures for
example on:</div>
</div>
<div class="">
<div class=""><br class="">
</div>
<div class="">modparam("htable", "db_url", DBURL)</div>
<div class=""><br class="">
</div>
<div class="">when launched with the -A results in:</div>
<div class=""><br class="">
</div>
<div class="">0(7) DEBUG: <core> [core/cfg.lex:1838]:
pp_define_get(): ### returning define ID [DBURL] value [<a
href="oracle://username:password@/DB" class=""
moz-do-not-send="true">oracle://username:password@/DB</a>]<br
class="">
0(7) CRITICAL: <core> [core/cfg.y:3431]: yyerror_at():
parse error in config file
/usr/local/etc/kamailio/kamailio.cfg, line 97, column 30-35:
syntax error<br class="">
0(7) CRITICAL: <core> [core/cfg.y:3431]: yyerror_at():
parse error in config file
/usr/local/etc/kamailio/kamailio.cfg, line 97, column 30-35:
Invalid arguments<br class="">
0(7) CRITICAL: <core> [core/cfg.y:3434]: yyerror_at():
parse error in config file
/usr/local/etc/kamailio/kamailio.cfg, line 97, column 36: <br
class="">
ERROR: bad config file (3 errors)</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div class="">I’ve tried with #!subst but it seems that
pre-processor directive doesn’t expand out defines, so:</div>
<div class=""><br class="">
</div>
<div class="">#!subst "/DB_URL/DBURL/g”<br class="">
modparam("htable", "db_url", DB_URL)</div>
<div class=""><br class="">
</div>
<div class="">just results in:</div>
<div class=""><br class="">
</div>
<div class="">0(7) INFO: <core> [core/ppcfg.c:82]:
pp_subst_add(): ### added subst expression:
/DB_URL/DBURL/g<br class="">
0(7) DEBUG: <core> [core/re.c:436]: subst_run():
running. r=1<br class="">
0(7) DEBUG: <core> [core/re.c:504]: subst_str():
no match<br class="">
0(7) DEBUG: <core> [core/re.c:436]: subst_run():
running. r=1<br class="">
0(7) DEBUG: <core> [core/re.c:504]: subst_str():
no match<br class="">
0(7) DEBUG: <core> [core/re.c:436]: subst_run():
running. r=1<br class="">
0(7) DEBUG: <core> [core/re.c:504]: subst_str():
no match<br class="">
0(7) DEBUG: <core> [core/re.c:436]: subst_run():
running. r=1<br class="">
0(7) DEBUG: <core> [core/re.c:504]: subst_str():
no match<br class="">
0(7) DEBUG: <core> [core/re.c:436]: subst_run():
running. r=1<br class="">
0(7) DEBUG: <core> [core/re.c:504]: subst_str():
no match<br class="">
0(7) DEBUG: <core> [core/re.c:436]: subst_run():
running. r=1<br class="">
0(7) DEBUG: <core> [core/re.c:504]: subst_str():
no match<br class="">
0(7) CRITICAL: <core> [core/cfg.y:3431]:
yyerror_at(): parse error in config file
/usr/local/etc/kamailio/kamailio.cfg, line 97, column
30-35: syntax error<br class="">
0(7) CRITICAL: <core> [core/cfg.y:3431]:
yyerror_at(): parse error in config file
/usr/local/etc/kamailio/kamailio.cfg, line 97, column
30-35: Invalid arguments<br class="">
0(7) CRITICAL: <core> [core/cfg.y:3434]:
yyerror_at(): parse error in config file
/usr/local/etc/kamailio/kamailio.cfg, line 97, column
36: <br class="">
ERROR: bad config file (3 errors)</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 15 Nov 2017, at 07:46,
Daniel-Constantin Mierla <<a
href="mailto:miconda@gmail.com" class=""
moz-do-not-send="true">miconda@gmail.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class=""><span style="font-family: Helvetica;
font-size: 12px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start;
text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; float: none;
display: inline !important;" class="">Hello,</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<br style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<br style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">On 14.11.17 14:25, Robert wrote:</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<blockquote type="cite" style="font-family:
Helvetica; font-size: 12px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: auto;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class="">Hello,<br
class="">
<br class="">
I’m working for a UK high street bank and our
Kamailio implementation has been challenged
because we’ve got database passwords held in
clear in the configuration file.<br class="">
<br class="">
I am unable to find any examples of where this
has been worked around, there doesn’t seem to be
any module or configuration means of supplying a
variable in the modparam() entry that is
expanded a startup. The security tutorials only
seem to relate to the SIP level of security, not
Kamailio as a platform.<br class="">
<br class="">
My requirement is simple, I need to be able to
supply a password via means such as loading a
variable from a run-once script at start up, or
a module. The ideal would be to be able to read
in a Docker secret :)<br class="">
<br class="">
I am by no means a Kamailio expert, so apologies
in advance if this is a mindblowingly basic
thing to achieve, but I do feel I’ve exhausted
the Kamailio documentation, wiki etc. and all
the goodness Google usually has to offer and
drawn a blank.<br class="">
<br class="">
Sincere thanks in advance for any assistance.<br
class="">
<br class="">
<br class="">
</blockquote>
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">you can define a for a token to be used
inside kamailio.cfg by using -A</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">command line parameter. So when you
start kamailio, fetch the password</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">from your secure system by what so ever
meaning, then build the database</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">url based on it and run kamailio with:</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<br style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">kamailio - A DBURL='</span><a
href="mysql://user:passwd@dbhost/kamailio"
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">mysql://user:passwd@dbhost/kamailio</a><span
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">' ...</span><br style="font-family:
Helvetica; font-size: 12px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start;
text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" class="">
<br style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">You may need to enclose in double
quotes inside the single quotes, I am</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">not sure at this moment, but sometime
she shell 'eats' a pair of quotes,</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">so just try with it if first fails ...</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<br style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">Cheers,</span><br style="font-family:
Helvetica; font-size: 12px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start;
text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">Daniel</span><br style="font-family:
Helvetica; font-size: 12px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start;
text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" class="">
<br style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">--<span class="Apple-converted-space"> </span></span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">Daniel-Constantin Mierla</span><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<a href="http://www.twitter.com/miconda"
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">www.twitter.com/miconda</a><span
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class=""><span class="Apple-converted-space"> </span>--<span
class="Apple-converted-space"> </span></span><a
href="http://www.linkedin.com/in/miconda"
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">www.linkedin.com/in/miconda</a><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">Kamailio Advanced Training, Nov 13-15,
2017, in Berlin -<span
class="Apple-converted-space"> </span></span><a
href="http://www.asipto.com/"
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">www.asipto.com</a><br
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px;" class="">
<span style="font-family: Helvetica; font-size:
12px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing:
normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width:
0px; float: none; display: inline !important;"
class="">Kamailio World Conference -<span
class="Apple-converted-space"> </span></span><a
href="http://www.kamailioworld.com/"
style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal;
orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">www.kamailioworld.com</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 14-16, 2018 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
</body>
</html>