X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-info;h=71597720a9d91c1d2ea05b2fccbbf34a961d8c81;hb=4b2cfd95e457993eac649b7cf11d98f182a73c10;hp=5e9603e45db44f73ab6d749aa167b0ffcb81362c;hpb=c50d88536a4feb3087d1aa802e110250cb2861fc;p=mirror%2Fuserdir-ldap.git diff --git a/ud-info b/ud-info index 5e9603e..7159772 100755 --- a/ud-info +++ b/ud-info @@ -36,6 +36,8 @@ AttrInfo = {"cn": ["First Name", 101], "uid": ["Unix User ID",0], "loginshell": ["Unix Shell",7], "supplementarygid": ["Unix Groups",0], + "allowedhosts": ["Host ACL",0], + "member": ["LDAP Group",0], "emailforward": ["Email Forwarding",8], "ircnick": ["IRC Nickname",9], "onvacation": ["Vacation Message",10], @@ -43,7 +45,8 @@ AttrInfo = {"cn": ["First Name", 101], "latitude": ["Latitude",12], "longitude": ["Longitude",13], "comment": ["Comment",114], - "userpassword": ["Crypted Password",115]}; + "userpassword": ["Crypted Password",115], + "dnszoneentry": ["d.net Entry",116]}; AttrPrompt = {"cn": ["Common name or first name"], "mn": ["Middle name (or initial if it ends in a dot)"], @@ -61,8 +64,11 @@ AttrPrompt = {"cn": ["Common name or first name"], "userpassword": ["The users Crypt'd password"], "comment": ["Admin Comment about the account"], "supplementarygid": ["Groups the user is in"], + "allowedhosts": ["Grant access to certain hosts"], + "member": ["LDAP Group Member for slapd ACLs"], "latitude": ["XEarth latitude in ISO 6709 format - see /usr/share/zoneinfo/zone.tab or etak.com"], "longitude": ["XEarth latitude in ISO 6709 format - see /usr/share/zoneinfo/zone.tab or etak.com"], + "dnszoneentry": ["DNS Zone fragment associated this this user"], "labeledurl": ["Web home page"]}; # Create a map of IDs to desc,value,attr @@ -136,6 +142,20 @@ def PrintKeys(Attrs): print x, print; +# Print the SSH RSA Authentication keys for a user +def PrintSshRSAKeys(Attrs): + if Attrs[1].has_key("sshrsaauthkey") == 0: + return; + First = 0; + for x in Attrs[1]["sshrsaauthkey"]: + if First == 0: + print "%-24s:" % ("SSH RSA Auth Keys"), + First = 1; + else: + print "%-24s:" % (""), + + print FormatSSHAuth(x); + # Display all of the attributes in a numbered list def ShowAttrs(Attrs): print; @@ -143,6 +163,7 @@ def ShowAttrs(Attrs): PrintModTime(Attrs); PrintShadow(Attrs); PrintKeys(Attrs); + PrintSshRSAKeys(Attrs); for at in Attrs[1].keys(): if AttrInfo.has_key(at): @@ -167,7 +188,8 @@ def ShowAttrs(Attrs): # Change a single attribute def ChangeAttr(Attrs,Attr): - if (Attr == "supplementarygid"): + if (Attr == "supplementarygid" or Attr == "allowedhosts" or \ + Attr == "member" or Attr == "dnszoneentry"): return MultiChangeAttr(Attrs,Attr); print "Old value: '%s'" % (GetAttr(Attrs,Attr,"")); @@ -272,12 +294,20 @@ UserDn = "uid=" + User + "," + BaseDn; # Enable changing of supplementary gid's if (RootMode == 1): - AttrInfo["supplementarygid"][1] = 100; - OrderedIndex[AttrInfo["supplementarygid"][1]] = [AttrInfo["supplementarygid"][0], "","supplementarygid"]; - OrigOrderedIndex[AttrInfo["supplementarygid"][1]] = [AttrInfo["supplementarygid"][0], "","supplementarygid"]; + # Items that root can edit + list = ["supplementarygid","allowedhosts","member"]; + Count = 0; + for x in list: + AttrInfo[x][1] = 200 + Count; + OrderedIndex[AttrInfo[x][1]] = [AttrInfo[x][0], "",x]; + OrigOrderedIndex[AttrInfo[x][1]] = [AttrInfo[x][0], "",x]; + Count = Count + 1; # Query the server for all of the attributes Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid=" + User); +if len(Attrs) == 0: + print "User",User,"was not found."; + sys.exit(0); # repeatedly show the account configuration while(1): @@ -302,9 +332,13 @@ while(1): NewUser = raw_input("User? "); if NewUser == "": continue; + NAttrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid=" + NewUser); + if len(NAttrs) == 0: + print "User",NewUser,"was not found."; + continue; + Attrs = NAttrs; User = NewUser; UserDn = "uid=" + User + "," + BaseDn; - Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid=" + User); OrderedIndex = copy.deepcopy(OrigOrderedIndex); continue;