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