[sr-dev] Generating a crypto random key in Kamailio
Henning Westerholt
hw at kamailio.org
Tue Mar 26 09:45:55 CET 2013
Am Donnerstag, 14. März 2013, 13:00:32 schrieb Peter Dunkley:
> For outbound I currently have a modparam to set the flow token key.
> There is absolutely no reason why this should be user configurable,
> replicated across multiple Kamailio instances, or survive Kamailio
> restart as each flow is unique and should be re-established if there is
> a server failure.
>
> I would much prefer to have Kamailio just select its own key at
> start-up. Is there any simple way to get Kamailio to select a 20-octet
> crypto random string?
Hello Peter,
there is no API to get this certain data at the moment. During startup the
core initialize the glibc rand and our fastrand pseudo-random number generator
from /dev/urandom. Then you can call e.g. in your module the rand, random or
fastrand functions and use this to generate your random string. For an example
have a look to generate_random_secret in auth/auth_mod.c.
Cheers,
Henning Westerholt
More information about the sr-dev
mailing list