# -*- coding: utf-8 -*- import subprocess class KrbManager: def __init__(self,llxvar): self.llxvar=llxvar def add_principal(self,uid,password): user=uid+"@"+self.llxvar["KRB5_REALM"] p1=subprocess.Popen(["llxcfg-krb5","addprinc",user,password],stdout=subprocess.PIPE) out=p1.communicate() #def add_principal def delete_principal(self,uid): user=uid+"@"+self.llxvar["KRB5_REALM"] p1=subprocess.Popen(["llxcfg-krb5","--force","delprinc",user],stdout=subprocess.PIPE) std_out,std_error=p1.communicate() #def delete_principal def change_password(self,uid,password): user=uid+"@"+self.llxvar["KRB5_REALM"] # llxcfg-krb5 passwd PRINCIPAL [-randkey|PASSWD] p1=subprocess.Popen(["llxcfg-krb5","passwd",user,password],stdout=subprocess.PIPE) out=p1.communicate() return out #def change_password