[Da-tools-commits] ./da-tools/userdir-ldap-turmzimmer r392: merge from -common and enable authorized_keys
Andreas Barth
aba at not.so.argh.org
Fri May 16 18:06:23 UTC 2008
------------------------------------------------------------
revno: 392
committer: Andreas Barth <aba at not.so.argh.org>
branch nick: userdir-ldap-turmzimmer
timestamp: Fri 2008-05-16 18:06:23 +0000
message:
merge from -common and enable authorized_keys
added:
TODO
templates/admin-info
modified:
debian/changelog
ud-fingerserv
ud-generate
ud-info
ud-mailgate
ud-replicate
ud-roleadd
userdir-ldap.conf
userdir-ldap.schema
------------------------------------------------------------
revno: 349.4.37
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Mon 2008-04-21 13:31:04 +0200
message:
Teach ud-mailgate about ipv6 addresses (RT#193).
Sanitize DNS entries somewhat before inserting them into LDAP.
modified:
debian/changelog
ud-mailgate
------------------------------------------------------------
revno: 349.4.38
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Mon 2008-04-21 23:55:05 +0200
message:
add a TODO file
added:
TODO
------------------------------------------------------------
revno: 349.4.39
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Tue 2008-04-22 00:08:29 +0200
message:
another todo item
modified:
TODO
------------------------------------------------------------
revno: 349.4.40
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Tue 2008-04-22 00:18:09 +0200
message:
A few copyright notices
modified:
ud-fingerserv
ud-generate
ud-mailgate
ud-replicate
ud-roleadd
------------------------------------------------------------
revno: 349.4.41
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Wed 2008-04-23 22:33:56 +0200
message:
todo item
modified:
TODO
------------------------------------------------------------
revno: 379.2.1
committer: Marc 'HE' Brockschmidt <he at debian.org>
branch nick: userdir-ldap-common
timestamp: Wed 2008-04-23 23:08:10 +0200
message:
Merge Peter's debian.org-ud-ldap changes.
added:
TODO
debian/postrm
modified:
debian/changelog
debian/postinst
debian/rules
ud-fingerserv
ud-generate
ud-mailgate
ud-replicate
ud-roleadd
------------------------------------------------------------
revno: 379.2.2
committer: Marc 'HE' Brockschmidt <he at debian.org>
branch nick: userdir-ldap-common
timestamp: Wed 2008-04-23 23:11:12 +0200
message:
Add another todo item
modified:
TODO
------------------------------------------------------------
revno: 379.2.3
committer: Martin Zobel-Helas <zobel at debian.org>
branch nick: userdir-ldap-common
timestamp: Sat 2008-05-10 14:19:22 +0200
message:
add VoIP
modified:
ud-info
ud-mailgate
userdir-ldap.schema
------------------------------------------------------------
revno: 379.2.4
committer: Andreas Barth <aba at alioth>
branch nick: userdir-ldap-common
timestamp: Sat 2008-05-10 21:49:42 +0000
message:
Add IPv6-Adresses (and IPv4 in both ways) into ssh_known_hosts
modified:
ud-generate
------------------------------------------------------------
revno: 379.2.5
committer: Andreas Barth <aba at alioth>
branch nick: userdir-ldap-common
timestamp: Sat 2008-05-10 21:52:42 +0000
message:
more sanitizing for IP adresses
modified:
ud-generate
------------------------------------------------------------
revno: 379.2.6
committer: Joerg Jaspert <joerg at debian.org>
branch nick: userdir-ldap-common
timestamp: Tue 2008-05-13 00:12:56 +0200
message:
First version of a check for ssh keys
modified:
ud-mailgate
userdir-ldap.conf
------------------------------------------------------------
revno: 379.2.7
committer: Joerg Jaspert <joerg at ganneff.de>
branch nick: userdir-ldap-common
timestamp: Wed 2008-05-14 16:56:04 +0200
message:
Merge sshkeys check with the alioth userdir-ldap-common
modified:
debian/changelog
ud-mailgate
ud-replicate
------------------------------------------------------------
revno: 349.4.42
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Tue 2008-05-13 22:09:02 +0200
message:
* ud-replicate: use the host key to sync stuff from the db server,
that is, call ssh with ii /etc/ssh/ssh_host_rsa_key.
* ud-replicate: Call ssh with -o PreferredAuthentications=publickey
so that it does not even try password authentication.
modified:
debian/changelog
ud-replicate
------------------------------------------------------------
revno: 349.4.43
committer: Joerg Jaspert <joerg at ganneff.de>
branch nick: ud-ldap-sshkey
timestamp: Wed 2008-05-14 16:43:40 +0200
message:
Check ssh keys:
- reject all DSA keys, similar to RSA1 keys.
- reject and mail the admins for broken keys, ie keys
- of size below 1024 or
- known to be bad (fingerprintlist)
modified:
ud-mailgate
userdir-ldap.conf
------------------------------------------------------------
revno: 379.2.8
committer: Joerg Jaspert <joerg at ganneff.de>
branch nick: userdir-ldap-common
timestamp: Wed 2008-05-14 17:34:01 +0200
message:
Add missing admin info template
added:
templates/admin-info
------------------------------------------------------------
revno: 379.2.9
committer: Joerg Jaspert <joerg at debian.org>
branch nick: userdir-ldap-common
timestamp: Thu 2008-05-15 01:02:17 +0200
message:
Merge from Debian
modified:
debian/changelog
ud-generate
------------------------------------------------------------
revno: 349.5.1
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Wed 2008-05-14 17:29:25 +0200
message:
Merge: Add another todo item
modified:
TODO
------------------------------------------------------------
revno: 349.5.2
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Wed 2008-05-14 17:32:49 +0200
message:
Add VoIP fiels to the LDAP shema and teach ud-info and ud-mailgate about it. [zobel]
modified:
debian/changelog
ud-info
ud-mailgate
userdir-ldap.schema
------------------------------------------------------------
revno: 349.5.3
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Wed 2008-05-14 17:37:21 +0200
message:
Add IPv6-Adresses (and IPv4 in v6 notation - ::ffff:192.0.2.1) to ssh_known_hosts. [aba]
modified:
debian/changelog
ud-generate
------------------------------------------------------------
revno: 349.5.4
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Wed 2008-05-14 17:47:17 +0200
message:
Merge: ud-mailgate no longer accepts ssh dss keys, keys with a size smaller than 1024.
Additionally it checks new keys against a blacklist of ssh key fingerprints. [joerg]
added:
templates/admin-info
modified:
debian/changelog
ud-mailgate
userdir-ldap.conf
------------------------------------------------------------
revno: 349.5.5
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Wed 2008-05-14 17:48:00 +0200
message:
0.3.22
modified:
debian/changelog
------------------------------------------------------------
revno: 349.5.6
committer: Peter Palfrader <peter at palfrader.org>
branch nick: userdir-ldap
timestamp: Wed 2008-05-14 17:56:01 +0200
message:
Fix generation of known_hosts file.
modified:
debian/changelog
ud-generate
------------------------------------------------------------
revno: 379.2.10
committer: Joerg Jaspert <joerg at debian.org>
branch nick: userdir-ldap-common
timestamp: Thu 2008-05-15 23:35:13 +0200
message:
Modify the SSH1 key check so it matches all RSA1 keys, not only those of size 1024
modified:
ud-mailgate
------------------------------------------------------------
revno: 379.2.11
committer: Andreas Barth <aba at not.so.argh.org>
branch nick: userdir-ldap-common
timestamp: Fri 2008-05-16 17:34:58 +0000
message:
Add compatibility to dchroot-dsa to ud-replicate
modified:
debian/changelog
ud-replicate
------------------------------------------------------------
revno: 379.2.12
committer: Andreas Barth <aba at not.so.argh.org>
branch nick: userdir-ldap-common
timestamp: Fri 2008-05-16 17:40:19 +0000
message:
Add (disabled) generation of authorized_keys
modified:
debian/changelog
ud-generate
------------------------------------------------------------
revno: 379.2.13
committer: Andreas Barth <aba at not.so.argh.org>
branch nick: userdir-ldap-common
timestamp: Fri 2008-05-16 17:58:28 +0000
message:
Add performance optimization by caching IP adresses in ud-generate as a precondition for automatically adding aliases
modified:
debian/changelog
ud-generate
-------------- next part --------------
=== added file 'TODO'
--- a/TODO 1970-01-01 00:00:00 +0000
+++ b/TODO 2008-04-23 21:11:12 +0000
@@ -0,0 +1,16 @@
+ - Not done
+ * Top priority
+ . Partially done
+ o Done
+ d Deferrable
+ D Deferred
+ X Abandoned
+
+- db.d.o/machines.cgi should group machines by purpose (RT#275)
+- some mails from the mail gateway should use an empty envelope sender (RT#593)
+- add aliasnames (db, buildd, ..) to ssh_known_hosts
+- get rid of openssh patch requirement
+- use --delete in ud-replicate's rsync?
+- fix ud-useradd emails with non-ascii in subject
+- allow to keep further auth tokens in the LDAP, for example for SMTP AUTH or
+ SIP stuff. Or OpenID. Or whatever.
=== modified file 'debian/changelog'
--- a/debian/changelog 2008-04-19 21:33:51 +0000
+++ b/debian/changelog 2008-05-16 18:06:23 +0000
@@ -1,3 +1,53 @@
+userdir-ldap (10:0.3.24+turmzimmer.1) stable; urgency=low
+
+ * Release for turmzimmer.net
+ * Enable generation of authorized_keys
+
+ -- Andreas Barth <aba at not.so.argh.org> Fri, 16 May 2008 18:35:19 +0000
+
+userdir-ldap (0.3.24) UNRELEASED; urgency=low
+
+ * Add compatibility to dchroot-dsa to ud-replicate.
+ * Add (disabled) generation of authorized_keys suiteable for sshdist.
+ * Add performance optimization by caching IP adresses in ud-generate
+ (as a precondition for automatically adding aliases)
+
+ -- Andreas Barth <aba at not.so.argh.org> Fri, 16 May 2008 17:35:19 +0000
+
+userdir-ldap (0.3.23) unstable; urgency=low
+
+ * Fix generation of known_hosts file.
+
+ -- Peter Palfrader <weasel at debian.org> Wed, 14 May 2008 17:55:45 +0200
+
+userdir-ldap (0.3.22) unstable; urgency=low
+
+ * Add VoIP fiels to the LDAP shema and teach ud-info and ud-mailgate
+ about it. [zobel]
+ * Add IPv6-Adresses (and IPv4 in v6 notation - ::ffff:192.0.2.1) to
+ ssh_known_hosts. [aba]
+ * ud-mailgate no longer accepts ssh dss keys, keys with a size smaller
+ than 1024. Additionally it checks new keys against a blacklist of
+ ssh key fingerprints. [joerg]
+
+ -- Peter Palfrader <weasel at debian.org> Wed, 14 May 2008 17:47:45 +0200
+
+userdir-ldap (0.3.21) unstable; urgency=low
+
+ * ud-replicate: use the host key to sync stuff from the db server,
+ that is, call ssh with ii /etc/ssh/ssh_host_rsa_key.
+ * ud-replicate: Call ssh with -o PreferredAuthentications=publickey
+ so that it does not even try password authentication.
+
+ -- Peter Palfrader <weasel at debian.org> Tue, 13 May 2008 22:06:23 +0200
+
+userdir-ldap (0.3.20) unstable; urgency=low
+
+ * Teach ud-mailgate about ipv6 addresses (RT#193).
+ * Sanitize DNS entries somewhat before inserting them into LDAP.
+
+ -- Peter Palfrader <weasel at debian.org> Mon, 21 Apr 2008 13:29:36 +0200
+
userdir-ldap (10:0.3.19+turmzimmer1) stable; urgency=high
* First da-tools-based ud-ldap release for the turmzimmer.net farm. Let's
=== added file 'templates/admin-info'
--- a/templates/admin-info 1970-01-01 00:00:00 +0000
+++ b/templates/admin-info 2008-05-14 15:34:01 +0000
@@ -0,0 +1,17 @@
+To: __ADMIN__
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+Subject: User trying to add a bad or too small key to LDAP
+
+Hello admins!
+
+I (__USER__) just tried to add a known bad or too small SSH key
+to LDAP:
+
+__ERROR__
+
+Please lart me, thanks.
+
+--
+Thanks, __USER__
\ No newline at end of file
=== modified file 'ud-fingerserv'
--- a/ud-fingerserv 2008-04-17 17:49:45 +0000
+++ b/ud-fingerserv 2008-04-21 22:18:09 +0000
@@ -3,6 +3,7 @@
# (c) 1999 Randolph Chung. Licensed under the GPL. <tausq at debian.org>
# (c) 2004 Martin Schulze. Licensed under the GPL. <joey at debian.org>
+# Copyright (c) 2008 Peter Palfrader <peter at palfrader.org>
use lib '/var/www/userdir-ldap/';
#use lib '/home/randolph/projects/userdir-ldap/web';
=== modified file 'ud-generate'
--- a/ud-generate 2008-04-19 21:31:30 +0000
+++ b/ud-generate 2008-05-16 18:06:23 +0000
@@ -6,6 +6,8 @@
# Copyright (c) 2003-2004 James Troup <troup at debian.org>
# Copyright (c) 2004-2005,7 Joey Schulze <joey at infodrom.org>
# Copyright (c) 2001-2007 Ryan Murray <rmurray at debian.org>
+# Copyright (c) 2008 Peter Palfrader <peter at palfrader.org>
+# Copyright (c) 2008 Andreas Barth <aba at not.so.argh.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -696,8 +698,26 @@
raise;
Done(File,F,None);
+# cache IP adresses
+HostToIPCache = {}
+def HostToIP(Host):
+ global HostToIPCache
+ if not Host in HostToIPCache:
+ IPAdressesT = None
+ try:
+ IPAdressesT = list(set([ (a[0],a[4][0]) for a in socket.getaddrinfo(Host, None)]))
+ except socket.gaierror, (code):
+ if code[0] != -2: raise
+ IPAdresses = []
+ for addr in IPAdressesT:
+ if addr[0] == socket.AF_INET: IPAdresses += [addr[1], "::ffff:"+addr[1]]
+ else: IPAdresses += [addr[1]]
+ HostToIPCache[Host] = IPAdresses
+ return HostToIPCache[Host]
+
+
# Generate the ssh known hosts file
-def GenSSHKnown(l,File):
+def GenSSHKnown(l,File,mode=None):
F = None;
try:
OldMask = os.umask(0022);
@@ -713,12 +733,16 @@
x[1].has_key("sshRSAHostKey") == 0:
continue;
Host = GetAttr(x,"hostname");
+ HostNames = [ Host ]
SHost = Host.find(".")
+ if SHost != None: HostNames += [Host[0:SHost]]
+
for I in x[1]["sshRSAHostKey"]:
- if SHost == None:
- Line = "%s,%s %s" %(Host,socket.gethostbyname(Host),I);
+ if mode and mode == 'authorized_keys':
+ #Line = 'command="rsync --server --sender -pr . /var/cache/userdir-ldap/hosts/%s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,from="%s" %s' % (Host, ",".join(HNames + HostToIP(Host)), I)
+ Line = 'command="rsync --server --sender -pr . /var/cache/userdir-ldap/hosts/%s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding %s' % (Host,I)
else:
- Line = "%s,%s,%s %s" %(Host,Host[0:SHost],socket.gethostbyname(Host),I);
+ Line = "%s %s" %(",".join(HostNames + HostToIP(Host)), I);
Line = Sanitize(Line) + "\n";
F.write(Line);
# Oops, something unspeakable happened.
@@ -807,6 +831,7 @@
GenPrivate(l,GlobalDir+"debian-private");
GenDisabledAccounts(l,GlobalDir+"disabled-accounts");
GenSSHKnown(l,GlobalDir+"ssh_known_hosts");
+GenSSHKnown(l,GlobalDir+"authorized_keys", 'authorized_keys');
GenHosts(l,GlobalDir+"debianhosts");
GenMailDisable(l,GlobalDir+"mail-disable");
GenMailBool(l,GlobalDir+"mail-greylist","mailGreylisting");
=== modified file 'ud-info'
--- a/ud-info 2007-12-26 20:49:42 +0000
+++ b/ud-info 2008-05-10 12:19:22 +0000
@@ -55,7 +55,8 @@
"mailWhitelist": ["Mail Whitelist",24],
"comment": ["Comment",116],
"userPassword": ["Crypted Password",117],
- "dnsZoneEntry": ["d.net Entry",118]};
+ "dnsZoneEntry": ["d.net Entry",118],
+ "VoIP": ["VoIP Address",119]};
AttrPrompt = {"cn": ["Common name or first name"],
"mn": ["Middle name (or initial if it ends in a dot)"],
@@ -89,7 +90,8 @@
"dnsZoneEntry": ["DNS Zone fragment associated this this user"],
"labeledURI": ["Web home page"],
"jabberJID": ["Jabber ID"],
- "icqUin": ["ICQ UIN Number"]};
+ "icqUin": ["ICQ UIN Number"],
+ "VoIP": ["VoIP Address"]};
# Create a map of IDs to desc,value,attr
OrderedIndex = {};
=== modified file 'ud-mailgate'
--- a/ud-mailgate 2007-12-26 20:49:42 +0000
+++ b/ud-mailgate 2008-05-15 21:35:13 +0000
@@ -1,9 +1,14 @@
#!/usr/bin/env python
# -*- mode: python -*-
-import userdir_gpg, userdir_ldap, sys, traceback, time, ldap, os;
-import pwd
-from userdir_gpg import *;
-from userdir_ldap import *;
+
+# Prior copyright probably rmurray, troup, joey, jgg -- weasel 2008
+# Copyright (c) 2008 Peter Palfrader <peter at palfrader.org>
+# Copyright (c) 2008 Joerg Jaspert <joerg at debian.org>
+
+import userdir_gpg, userdir_ldap, sys, traceback, time, ldap, os, commands
+import pwd, tempfile
+from userdir_gpg import *
+from userdir_ldap import *
# Error codes from /usr/include/sysexits.h
ReplyTo = ConfModule.replyto;
@@ -11,6 +16,7 @@
ChPassFrom = ConfModule.chpassfrom;
ChangeFrom = ConfModule.changefrom;
ReplayCacheFile = ConfModule.replaycachefile;
+SSHFingerprintFile = ConfModule.fingerprintfile
EX_TEMPFAIL = 75;
EX_PERMFAIL = 65; # EX_DATAERR
@@ -23,6 +29,9 @@
SeenList = {}
DNS = {}
+SSHFingerprint = re.compile('^(\d+) ([0-9a-f\:]{47}) (.+)$')
+SSHRSA1Match = re.compile('^\d+ (\d+) \d+ .*')
+
ArbChanges = {"c": "..",
"l": ".*",
"facsimileTelephoneNumber": ".*",
@@ -40,6 +49,7 @@
"mailDisableMessage": ".*",
"mailGreylisting": "^(TRUE|FALSE)$",
"mailCallout": "^(TRUE|FALSE)$",
+ "VoIP": ".*",
};
DelItems = {"c": None,
@@ -67,6 +77,7 @@
"mailRHSBL": None,
"mailWhitelist": None,
"mailDisableMessage": None,
+ "VoIP": None,
};
# Decode a GPS location from some common forms
@@ -212,16 +223,87 @@
Attrs.append((ldap.MOD_REPLACE,"longitude",sLong));
return "Position set to %s/%s (%s/%s decimal degrees)"%(sLat,sLong,Lat,Long);
+# Load bad ssh fingerprints
+def LoadBadSSH():
+ f = open(SSHFingerprintFile, "r")
+ bad = []
+ FingerprintLine = re.compile('^([0-9a-f\:]{47}).*$')
+ for line in f.readlines():
+ Match = FingerprintLine.match(line)
+ if Match is not None:
+ g = Match.groups()
+ bad.append(g[0])
+ return bad
+
# Handle an SSH authentication key, the line format is:
# [options] 1024 35 13188913666680[..] [comment]
-def DoSSH(Str,Attrs):
+def DoSSH(Str, Attrs, badkeys, uid):
Match = SSH2AuthSplit.match(Str);
+ g = Match.groups()
+ typekey = g[1]
if Match == None:
- Match = re.compile('^1024 (\d+) ').match(Str)
+ Match =SSHRSA1Match.match(Str)
if Match is not None:
- return "SSH1 keys not supported anymore"
+ return "RSA1 keys not supported anymore"
return None;
-
+
+ (fd, path) = tempfile.mkstemp(".pub", "sshkeytry", "/tmp")
+ f = open(path, "w")
+ f.write("%s\n" % (Str))
+ f.close()
+ cmd = "/usr/bin/ssh-keygen -l -f %s < /dev/null" % (path)
+ (result, output) = commands.getstatusoutput(cmd)
+ os.remove(path)
+ if (result != 0):
+ raise Error, "ssh-keygen -l invocation failed!\n%s\n" % (output)
+
+
+ # Head
+ Date = time.strftime("%a, %d %b %Y %H:%M:%S +0000",time.gmtime(time.time()))
+ ErrReplyHead = "From: %s\nCc: %s\nReply-To: %s\nDate: %s\n" % (os.environ['SENDER'],os.environ['SENDER'],ReplyTo,Date)
+ Subst = {}
+ Subst["__ADMIN__"] = ReplyTo
+ Subst["__USER__"] = uid
+
+ Match = SSHFingerprint.match(output)
+ g = Match.groups()
+
+ if int(g[0]) < 1024:
+ try:
+ # Body
+ Subst["__ERROR__"] = "SSH keysize %s is below limit 1024" % (g[0])
+ ErrReply = TemplateSubst(Subst,open(TemplatesDir+"admin-info","r").read())
+
+ Child = os.popen("/usr/sbin/sendmail -t","w")
+ Child.write(ErrReplyHead)
+ Child.write(ErrReply)
+ if Child.close() != None:
+ raise Error, "Sendmail gave a non-zero return code"
+ except:
+ sys.exit(EX_TEMPFAIL)
+
+ # And now break and stop processing input, which sends a reply to the user.
+ raise Error, "SSH keys must have at least 1024 bits, processing halted, NOTHING MODIFIED AT ALL"
+ elif g[1] in badkeys:
+ try:
+ # Body
+ Subst["__ERROR__"] = "SSH key with fingerprint %s known as bad key" % (g[1])
+ ErrReply = TemplateSubst(Subst,open(TemplatesDir+"admin-info","r").read())
+
+ Child = os.popen("/usr/sbin/sendmail -t","w")
+ Child.write(ErrReplyHead)
+ Child.write(ErrReply)
+ if Child.close() != None:
+ raise Error, "Sendmail gave a non-zero return code"
+ except:
+ sys.exit(EX_TEMPFAIL)
+
+ # And now break and stop processing input, which sends a reply to the user.
+ raise Error, "Submitted SSH Key known to be bad and insecure, processing halted, NOTHING MODIFIED AT ALL"
+
+ if (typekey == "dss"):
+ return "DSA keys not accepted anymore"
+
global SeenKey;
if SeenKey:
Attrs.append((ldap.MOD_ADD,"sshRSAAuthKey",Str));
@@ -232,17 +314,28 @@
return "SSH Keys replaced with "+FormatSSHAuth(Str);
# Handle changing a dns entry
-# host in a 12.12.12.12
-# host in cname foo.bar. <- Trailing dot is required
+# host IN A 12.12.12.12
+# host IN AAAA 1234::5678
+# host IN CNAME foo.bar. <- Trailing dot is required
+# host IN MX foo.bar. <- Trailing dot is required
def DoDNS(Str,Attrs,DnRecord):
- cname = re.match("^[-\w]+\s+in\s+cname\s+[-\w.]+\.$",Str,re.IGNORECASE);
- if re.match('^[-\w]+\s+in\s+a\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$',\
- Str,re.IGNORECASE) == None and cname == None and \
- re.match("^[-\w]+\s+in\s+mx\s+\d{1,3}\s+[-\w.]+\.$",Str,re.IGNORECASE) == None:
- return None;
+ cnamerecord = re.match("^[-\w]+\s+IN\s+CNAME\s+([-\w.]+\.)$",Str,re.IGNORECASE)
+ arecord = re.match('^[-\w]+\s+IN\s+A\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$',Str,re.IGNORECASE)
+ mxrecord = re.match("^[-\w]+\s+IN\s+MX\s+(\d{1,3})\s+([-\w.]+\.)$",Str,re.IGNORECASE)
+ #aaaarecord = re.match('^[-\w]+\s+IN\s+AAAA\s+((?:[0-9a-f]{1,4})(?::[0-9a-f]{1,4})*(?::(?:(?::[0-9a-f]{1,4})*|:))?)$',Str,re.IGNORECASE)
+ aaaarecord = re.match('^[-\w]+\s+IN\s+AAAA\s+([A-F0-9:]{2,39})$',Str,re.IGNORECASE)
+
+ if cnamerecord == None and\
+ arecord == None and\
+ mxrecord == None and\
+ aaaarecord == None:
+ return None;
# Check if the name is already taken
- G = re.match('^([-\w+]+)\s',Str).groups();
+ G = re.match('^([-\w+]+)\s',Str)
+ if G == None:
+ raise Error, "Hostname not found although we already passed record syntax checks"
+ hostname = G.group(1)
# Check for collisions
global l;
@@ -250,7 +343,7 @@
# since we accept either. It'd probably be better to parse the
# incoming string in order to construct what we feed LDAP rather
# than just passing it through as is.]
- filter = "(|(dnsZoneEntry=%s *)(dnsZoneEntry=%s *))" % (G[0], G[0])
+ filter = "(|(dnsZoneEntry=%s *)(dnsZoneEntry=%s *))" % (hostname, hostname)
Rec = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,filter,["uid"]);
for x in Rec:
if GetAttr(x,"uid") != GetAttr(DnRecord,"uid"):
@@ -259,24 +352,59 @@
global SeenDNS;
global DNS;
- if cname:
- if DNS.has_key(G[0]):
- return "CNAME and other RR types not allowed: "+Str
- else:
- DNS[G[0]] = 2
- else:
- if DNS.has_key(G[0]) and DNS[G[0]] == 2:
- return "CNAME and other RR types not allowed: "+Str
- else:
- DNS[G[0]] = 1
-
+ if cnamerecord:
+ if DNS.has_key(hostname):
+ return "CNAME and other RR types not allowed: "+Str
+ else:
+ DNS[hostname] = 2
+ else:
+ if DNS.has_key(hostname) and DNS[hostname] == 2:
+ return "CNAME and other RR types not allowed: "+Str
+ else:
+ DNS[hostname] = 1
+
+ if cnamerecord != None:
+ sanitized = "%s IN CNAME %s" % (hostname, cnamerecord.group(1))
+ elif arecord != None:
+ ipaddress = arecord.group(1)
+ for quad in ipaddress.split('.'):
+ if not (int(quad) >=0 and int(quad) <= 255):
+ return "Invalid quad %s in IP address %s in line %s" %(quad, ipaddress, Str)
+ sanitized = "%s IN A %s"% (hostname, ipaddress)
+ elif mxrecord != None:
+ priority = mxrecord.group(1)
+ mx = mxrecord.group(2)
+ sanitized = "%s IN MX %s %s" % (hostname, priority, mx)
+ elif aaaarecord != None:
+ ipv6address = aaaarecord.group(1)
+ parts = ipv6address.split(':')
+ if len(parts) > 8:
+ return "Invalid IPv6 address (%s): too many parts"%(ipv6address)
+ if len(parts) <= 2:
+ return "Invalid IPv6 address (%s): too few parts"%(ipv6address)
+ if parts[0] == "":
+ parts.pop(0)
+ if parts[-1] == "":
+ parts.pop(-1)
+ seenEmptypart = False
+ for p in parts:
+ if len(p) > 4:
+ return "Invalid IPv6 address (%s): part %s is longer than 4 characters"%(ipv6address, p)
+ if p == "":
+ if seenEmptypart:
+ return "Invalid IPv6 address (%s): more than one :: (nothing in between colons) is not allowed"%(ipv6address)
+ seenEmptypart = True
+ sanitized = "%s IN AAAA %s" % (hostname, ipv6address)
+ else:
+ raise Error, "None of the types I recognize was it. I shouldn't be here. confused."
+
if SeenDNS:
- Attrs.append((ldap.MOD_ADD,"dnsZoneEntry",Str));
- return "DNS Entry added "+Str;
-
- Attrs.append((ldap.MOD_REPLACE,"dnsZoneEntry",Str));
+ Attrs.append((ldap.MOD_ADD,"dnsZoneEntry",sanitized));
+ return "DNS Entry added "+sanitized;
+
+ Attrs.append((ldap.MOD_REPLACE,"dnsZoneEntry",sanitized));
SeenDNS = 1;
- return "DNS Entry replaced with "+Str;
+ return "DNS Entry replaced with "+sanitized;
# Handle an RBL list (mailRBL, mailRHSBL, mailWhitelist)
def DoRBL(Str,Attrs):
@@ -318,12 +446,13 @@
Result = Result + "> "+Line+"\n";
try:
if Line == "show":
- Show = 1;
- Res = "OK";
+ Show = 1;
+ Res = "OK";
else:
- Res = DoPosition(Line,Attrs) or DoDNS(Line,Attrs,DnRecord) or \
- DoArbChange(Line,Attrs) or DoSSH(Line,Attrs) or \
- DoDel(Line,Attrs) or DoRBL(Line,Attrs);
+ badkeys = LoadBadSSH()
+ Res = DoPosition(Line,Attrs) or DoDNS(Line,Attrs,DnRecord) or \
+ DoArbChange(Line,Attrs) or DoSSH(Line,Attrs,badkeys,GetAttr(DnRecord,"uid")) or \
+ DoDel(Line,Attrs) or DoRBL(Line,Attrs)
except:
Res = None;
Result = Result + "==> %s: %s\n" %(sys.exc_type,sys.exc_value);
=== modified file 'ud-replicate'
--- a/ud-replicate 2008-04-19 21:13:59 +0000
+++ b/ud-replicate 2008-05-16 18:06:23 +0000
@@ -3,6 +3,7 @@
# Copyright (c) 1999-2001 Jason Gunthorpe <jgg at debian.org>
# Copyright (c) 2002-2003,2006 Ryan Murray <rmurray at debian.org>
# Copyright (c) 2004-2005 Joey Schulze <joey at infodrom.org>
+# Copyright (c) 2008 Peter Palfrader <peter at palfrader.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,7 +49,7 @@
;;
esac
-rsync ${verbose} -e ssh -rp "${udhost}/var/cache/userdir-ldap/hosts/$HOST" .
+rsync ${verbose} -e 'ssh -i /etc/ssh/ssh_host_rsa_key -o PreferredAuthentications=publickey' -rp "${udhost}/var/cache/userdir-ldap/hosts/$HOST" .
makedb "$HOST/passwd.tdb" -o passwd.db.t
if [ -s "$HOST/shadow.tdb" ]
@@ -69,6 +70,11 @@
if [ -x /usr/bin/dchroot ]; then
CHROOTS=`dchroot --listpaths`
+fi
+if [ -x /usr/bin/dchroot-dsa ]; then
+ CHROOTS=$(dchroot-dsa -i | grep Location | awk '{print $2}')
+fi
+if [ -n "$CHROOTS" ]; then
for c in $CHROOTS; do
if [ -x "$c/usr/bin/makedb" ]
then
=== modified file 'ud-roleadd'
--- a/ud-roleadd 2007-12-26 20:49:42 +0000
+++ b/ud-roleadd 2008-04-21 22:18:09 +0000
@@ -4,6 +4,7 @@
# Copyright (c) 1999-2000 Jason Gunthorpe <jgg at debian.org>
# Copyright (c) 2001-2003 James Troup <troup at debian.org>
# Copyright (c) 2004-2005 Joey Schulze <joey at infodrom.org>
+# Copyright (c) 2007 Peter Palfrader <peter at palfrader.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
=== modified file 'userdir-ldap.conf'
--- a/userdir-ldap.conf 2008-04-19 21:33:51 +0000
+++ b/userdir-ldap.conf 2008-05-16 18:06:23 +0000
@@ -24,6 +24,7 @@
templatesdir = "/etc/userdir-ldap/templates/";
replaycachefile = "/var/cache/userdir-ldap/mail/replay";
#replaycachefile = "/tmp/replay";
+fingerprintfile = "/etc/userdir-ldap/badfingerprints"
# Echelon
ech_errorlog = "/org/db.debian.org/mail/Log/ech-errors.log"
=== modified file 'userdir-ldap.schema'
--- a/userdir-ldap.schema 2007-12-25 14:37:29 +0000
+++ b/userdir-ldap.schema 2008-05-10 12:19:22 +0000
@@ -3,6 +3,7 @@
# XXX
# - [PP] Now version controlled in db.d.o bzr repository - 2007-12-25
# - [HE] Add 'purpose', 'physicalHost' to debianServer - 2007-12-25
+# - [zobel] Add 'VoIP' - 2008-05-10
#
# 0.7 [RM]
# - Add 'gender' and 'birthDate' to debianDeveloper
@@ -96,6 +97,7 @@
# .32 - mailDisableMessage
# .33 - purpose
# .34 - physicalHost
+# .35 - VoIP
#
# .3 - experimental LDAP objectClasses
# .1 - debianDeveloper
@@ -350,6 +352,13 @@
SINGLE-VALUE
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
+attributetype ( 1.3.6.1.4.1.9586.100.4.2.35
+ NAME 'VoIP'
+ DESC 'VoIP URL to communicate with that person'
+ EQUALITY caseIgnoreIA5Match
+ SUBSTR caseIgnoreIA5SubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
+
# Public object classes
objectclass ( 1.3.6.1.4.1.9586.100.4.1.1
More information about the Da-tools-commits
mailing list