Update new_guest_password

This commit is contained in:
Andy Teijelo 2015-11-10 13:55:10 -05:00
parent d5fa80675f
commit 19a3a7f64b

View file

@ -3,13 +3,15 @@
import random import random
import os import os
from main import users_file
newpass = ''.join(random.sample('abcdfghjkmnpqrstuvwxyz',8)) newpass = ''.join(random.sample('abcdfghjkmnpqrstuvwxyz',8))
f = open("/etc/freeradius/users.dpto2") f = open(users_file)
lines = f.readlines() lines = f.readlines()
f.close() f.close()
f = open("/etc/freeradius/users.dpto2","w") f = open(users_file,"w")
for line in lines: for line in lines:
if line.startswith("guest"): if line.startswith("guest"):
f.write('guest Cleartext-Password := "{}"\n'.format(newpass)) f.write('guest Cleartext-Password := "{}"\n'.format(newpass))
@ -17,4 +19,4 @@ for line in lines:
f.write(line) f.write(line)
f.close() f.close()
os.system("/home/ateijelo/programs/dpto2/reload_freeradius") os.system("/home/ateijelo/programs/dpto2/sendhup freeradius")