[Da-tools-commits] ./da-tools/userdir-ldap-common r394: Add IPv6-Adresses (and IPv4 in v6 notation - ::ffff:192.0.2.1) to ssh_known_hosts. [aba]

Peter Palfrader peter at palfrader.org
Wed May 14 15:37:21 UTC 2008


------------------------------------------------------------
revno: 394
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.2.34
    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: 349.2.35
    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
-------------- next part --------------
=== modified file 'debian/changelog'
--- a/debian/changelog	2008-05-14 15:32:49 +0000
+++ b/debian/changelog	2008-05-14 15:37:21 +0000
@@ -2,8 +2,10 @@
 
   * 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]
 
- -- Peter Palfrader <weasel at debian.org>  Wed, 14 May 2008 17:31:22 +0200
+ -- Peter Palfrader <weasel at debian.org>  Wed, 14 May 2008 17:33:47 +0200
 
 userdir-ldap (0.3.21) unstable; urgency=low
 

=== modified file 'ud-generate'
--- a/ud-generate	2008-04-21 22:18:09 +0000
+++ b/ud-generate	2008-05-10 21:52:42 +0000
@@ -718,12 +718,23 @@
          x[1].has_key("sshRSAHostKey") == 0:
          continue;
       Host = GetAttr(x,"hostname");
+      HostNames = [ Host ]
       SHost = Host.find(".")
+      if SHost != None: HostNames += [Host[0:SHost]]
+
+      IPAdressesT = None
+      IPAdresses = []
+      # get IP adresses back as "proto adress" to distinguish between v4 and v6
+      try:
+         IPAdressesT = set([ (a[0],a[4][0]) for a in socket.getaddrinfo(Host, None)])
+      except:
+         if code[0] != -2: raise
+      for addr in IPAdressesT:
+         if addr[0] == socket.AF_INET: IPAdresses += [addr[1], "::ffff:"+addr[1]]
+	 else: IPAdresses += [addr[1]]
+
       for I in x[1]["sshRSAHostKey"]:
-         if SHost == None:
-            Line = "%s,%s %s" %(Host,socket.gethostbyname(Host),I);
-         else:
-            Line = "%s,%s,%s %s" %(Host,Host[0:SHost],socket.gethostbyname(Host),I);
+         Line = "%s,%s %s" %(",".join(HostNames + IPAdresses), I);
          Line = Sanitize(Line) + "\n";
          F.write(Line);
   # Oops, something unspeakable happened.



More information about the Da-tools-commits mailing list