From ee3eb0677056b25df70d8fe93a74cb2e6c0e38f5 Mon Sep 17 00:00:00 2001 From: jgg <> Date: Tue, 28 Sep 1999 00:20:16 +0000 Subject: [PATCH] DNS Stuff --- doc/samples/ud-zoneupdate | 7 ++++++ doc/ud-info.1.yo | 2 ++ ud-arbimport | 3 +-- ud-generate | 48 +++++++++++++++++++++++++++++++++++++-- ud-info | 7 ++++-- ud-replicate | 1 + 6 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 doc/samples/ud-zoneupdate diff --git a/doc/samples/ud-zoneupdate b/doc/samples/ud-zoneupdate new file mode 100644 index 0000000..50bf425 --- /dev/null +++ b/doc/samples/ud-zoneupdate @@ -0,0 +1,7 @@ +#!/bin/sh +set -e + +sed -e "s/[1-9].*; Serial.*$/`date +%Y%m%d00` ; Serial/" < $1 > $1.new +mv -f $1.new $1 +ndc reload 2>&1 /dev/null + diff --git a/doc/ud-info.1.yo b/doc/ud-info.1.yo index 841a01f..09df24f 100644 --- a/doc/ud-info.1.yo +++ b/doc/ud-info.1.yo @@ -39,6 +39,8 @@ itemize( it() supplementarygid - A list of group names that the user belongs. This field emulates the functionality of the traditional Unix group file. [root] + it() dnszoneentry - A list of zone file fragments that are placed in + the zone file for debian.net. [root] it() allowedhosts - Permits access to hosts outside of the group list. [root] it() onvacation - A message indicating that the user is on vacation. The time of departure and expected return date should be included as diff --git a/ud-arbimport b/ud-arbimport index cf57cbc..5b64ed8 100755 --- a/ud-arbimport +++ b/ud-arbimport @@ -29,13 +29,12 @@ l = ldap.open(LDAPServer); UserDn = "uid=" + AdminUser + "," + BaseDn; l.simple_bind_s(UserDn,Password); -# Read the override file into the unknown map. The override file is a list -# of colon delimited entires mapping PGP email addresess to local users List = open(arguments[1],"r"); while(1): Line = List.readline(); if Line == "": break; + Split = re.split("[:\n]",Line); Rec = [(ldap.MOD_REPLACE,arguments[0],string.strip(Split[1]))]; diff --git a/ud-generate b/ud-generate index d52b801..a145b68 100755 --- a/ud-generate +++ b/ud-generate @@ -267,7 +267,7 @@ def GenMarkers(l,File): if PasswdAttrs == None: raise "No Users"; - # Write out the email address for each user + # Write out the position for each user for x in PasswdAttrs: if x[1].has_key("latitude") == 0 or x[1].has_key("longitude") == 0: continue; @@ -284,6 +284,43 @@ def GenMarkers(l,File): raise; Done(File,F,Fdb); +# Generate the DNS Zone file +def GenDNS(l,File): + F = None; + Fdb = None; + try: + F = open(File + ".tmp","w"); + Fdb = None; + + # Fetch all the users + global PasswdAttrs; + if PasswdAttrs == None: + raise "No Users"; + + # Write out the zone file entry for each user + for x in PasswdAttrs: + if x[1].has_key("dnszoneentry") == 0: + continue; + try: + F.write("; %s\n"%(EmailAddress(x))); + for z in x[1]["dnszoneentry"]: + Split = string.split(string.lower(z)); + for y in range(0,len(Split)): + if Split[y] == "$": + Split[y] = "\n\t"; + + Line = string.join(Split," ") + "\n"; + F.write(Line); + F.write("\n"); + except: + pass; + + # Oops, something unspeakable happened. + except: + Die(F,Fdb); + raise; + Done(File,F,Fdb); + # Connect to the ldap server l = ldap.open(LDAPServer); F = open(PassDir+"/pass-"+pwd.getpwuid(posix.getuid())[0],"r"); @@ -308,7 +345,7 @@ PasswdAttrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid=*",\ "gecos","loginshell","userpassword","shadowlastchange",\ "shadowmin","shadowmax","shadowwarning","shadowinactive", "shadowexpire","emailforward","latitude","longitude",\ - "allowedhosts","sshrsaauthkey"]); + "allowedhosts","sshrsaauthkey","dnszoneentry","cn","sn"]); # Open the control file if len(sys.argv) == 1: @@ -332,7 +369,11 @@ while(1): # Get the group list and convert any named groups to numerics GroupList = {}; + ExtraList = {}; for I in Split[2:]: + if I[0] == '[': + ExtraList[I] = None; + continue; GroupList[I] = None; if GroupIDMap.has_key(I): GroupList[str(GroupIDMap[I])] = None; @@ -348,3 +389,6 @@ while(1): GenForward(l,OutDir+"forward-alias"); GenMarkers(l,OutDir+"markers"); + if ExtraList.has_key("[DNS]"): + GenDNS(l,OutDir+"dns-zone"); + diff --git a/ud-info b/ud-info index 9739380..4245931 100755 --- a/ud-info +++ b/ud-info @@ -45,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)"], @@ -67,6 +68,7 @@ AttrPrompt = {"cn": ["Common name or first name"], "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 @@ -189,7 +191,8 @@ def ShowAttrs(Attrs): # Change a single attribute def ChangeAttr(Attrs,Attr): - if (Attr == "supplementarygid" or Attr == "allowedhosts" or Attr == "member"): + if (Attr == "supplementarygid" or Attr == "allowedhosts" or \ + Attr == "member" or Attr == "dnszoneentry"): return MultiChangeAttr(Attrs,Attr); print "Old value: '%s'" % (GetAttr(Attrs,Attr,"")); diff --git a/ud-replicate b/ud-replicate index 1439847..3aa20be 100755 --- a/ud-replicate +++ b/ud-replicate @@ -11,3 +11,4 @@ rsync -e ssh -rp sshdist@samosa:/var/cache/userdir-ldap/hosts/$HOST . > /dev/nul makedb $HOST/passwd.tdb -o passwd.db > /dev/null 2>&1 makedb $HOST/shadow.tdb -o shadow.db > /dev/null 2>&1 makedb $HOST/group.tdb -o group.db > /dev/null 2>&1 +ln -sf $HOST/ssh-rsa-shadow . > /dev/null 2>&1 -- 2.20.1