From 5c58925b8883cedd82f2d3f43c6905040be4df6c Mon Sep 17 00:00:00 2001 From: Martin Zobel-Helas Date: Sun, 12 Jan 2014 11:40:44 +0100 Subject: [PATCH] modify voipPassword code to match https://github.com/resiprocate/resiprocate/blob/master/reTurn/reTurnServer.config#L147 Signed-off-by: Martin Zobel-Helas --- ud-generate | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/ud-generate b/ud-generate index d8c394b..3cbe113 100755 --- a/ud-generate +++ b/ud-generate @@ -418,31 +418,18 @@ def GenVoipPassword(accounts, File): F = open(File, "w", 0600) os.umask(OldMask) - root = Element('include') - for a in accounts: if not 'voipPassword' in a: continue if not a.pw_active(): continue Pass = str(a['voipPassword']) - user = Element('user') - user.attrib['id'] = "%s" % (a['uid']) - root.append(user) - params = Element('params') - user.append(params) - param = Element('param') - params.append(param) - param.attrib['name'] = "a1-hash" - param.attrib['value'] = "%s" % (Pass) - variables = Element('variables') - user.append(variables) - variable = Element('variable') - variable.attrib['name'] = "toll_allow" - variable.attrib['value'] = "domestic,international,local" - variables.append(variable) - - F.write("%s" % (prettify(root))) + realm = 'sip.debian.org' + HA1 = "%s:%s%:%s" : (a['uid'], realm, Pass) + hashlib.md5(HA1).hexdigest() + Line = "%s:%s:%s:AUTHORIZED" % (a['uid'], realm, Pass) + Line = Sanitize(Line) + "\n" + F.write("%s" % (Line)) except: Die(File, None, F) -- 2.20.1