|
Jan F |
9404cd |
diff -up openssh-5.8p1/HOWTO.ldap-keys.ldap2 openssh-5.8p1/HOWTO.ldap-keys
|
|
Jan F |
9992a8 |
--- openssh-5.8p1/HOWTO.ldap-keys.ldap2 2011-03-10 21:45:52.706855323 +0100
|
|
Jan F |
9992a8 |
+++ openssh-5.8p1/HOWTO.ldap-keys 2011-03-10 19:35:50.000000000 +0100
|
|
Jan F |
9404cd |
@@ -1,14 +1,108 @@
|
|
Jan F |
9404cd |
|
|
Jan F |
9404cd |
+HOW TO START
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
1) configure LDAP server
|
|
Jan F |
9404cd |
-2) add appropriate schema
|
|
Jan F |
9404cd |
+ * Use LDAP server documentation
|
|
Jan F |
9404cd |
+2) add appropriate LDAP schema
|
|
Jan F |
9404cd |
+ * For OpenLDAP or SunONE Use attached schema, otherwise you have to create it.
|
|
Jan F |
9404cd |
+ * LDAP user entry
|
|
Jan F |
9404cd |
+ User entry:
|
|
Jan F |
9404cd |
+ - attached to the 'ldapPublicKey' objectclass
|
|
Jan F |
9404cd |
+ - attached to the 'posixAccount' objectclass
|
|
Jan F |
9404cd |
+ - with a filled 'sshPublicKey' attribute
|
|
Jan F |
9404cd |
3) insert users into LDAP
|
|
Jan F |
9404cd |
+ * Use LDAP Tree management tool as useful
|
|
Jan F |
9404cd |
+ * Entry in the LDAP server must respect 'posixAccount' and 'ldapPublicKey' which are defined in core.schema and the additionnal lpk.schema.
|
|
Jan F |
9404cd |
+ * Example:
|
|
Jan F |
9404cd |
+ dn: uid=captain,ou=commanders,dc=enterprise,dc=universe
|
|
Jan F |
9404cd |
+ objectclass: top
|
|
Jan F |
9404cd |
+ objectclass: person
|
|
Jan F |
9404cd |
+ objectclass: organizationalPerson
|
|
Jan F |
9404cd |
+ objectclass: posixAccount
|
|
Jan F |
9404cd |
+ objectclass: ldapPublicKey
|
|
Jan F |
9404cd |
+ description: Jonathan Archer
|
|
Jan F |
9404cd |
+ userPassword: Porthos
|
|
Jan F |
9404cd |
+ cn: onathan Archer
|
|
Jan F |
9404cd |
+ sn: onathan Archer
|
|
Jan F |
9404cd |
+ uid: captain
|
|
Jan F |
9404cd |
+ uidNumber: 1001
|
|
Jan F |
9404cd |
+ gidNumber: 1001
|
|
Jan F |
9404cd |
+ homeDirectory: /home/captain
|
|
Jan F |
9404cd |
+ sshPublicKey: ssh-rss AAAAB3.... =captain@universe
|
|
Jan F |
9404cd |
+ sshPublicKey: command="kill -9 1" ssh-rss AAAAM5...
|
|
Jan F |
9404cd |
4) on the ssh side set in sshd_config
|
|
Jan F |
9404cd |
-AuthorizedKeysCommand "/usr/libexec/openssh/ssh-ldap-wrapper"
|
|
Jan F |
9404cd |
-AuthorizedKeysCommandRunAs <appropriate user to run LDAP>
|
|
Jan F |
9404cd |
-5) do not forget to set
|
|
Jan F |
9404cd |
-PubkeyAuthentication yes
|
|
Jan F |
9404cd |
+ * Set up the backend
|
|
Jan F |
9404cd |
+ AuthorizedKeysCommand "/usr/libexec/openssh/ssh-ldap-wrapper"
|
|
Jan F |
9404cd |
+ AuthorizedKeysCommandRunAs <appropriate user to run LDAP>
|
|
Jan F |
9404cd |
+ * Do not forget to set
|
|
Jan F |
9404cd |
+ PubkeyAuthentication yes
|
|
Jan F |
9404cd |
+ * Swith off unnecessary auth methods
|
|
Jan F |
9404cd |
+5) confugure ldap.conf
|
|
Jan F |
9404cd |
+ * Default ldap.conf is placed in /etc/ssh
|
|
Jan F |
9404cd |
+ * The configuration style is the same as other ldap based aplications
|
|
Jan F |
9404cd |
+6) if necessary edit ssh-ldap-wrapper
|
|
Jan F |
9404cd |
+ * There is a possibility to change ldap.conf location
|
|
Jan F |
9404cd |
+ * There are some debug options
|
|
Jan F |
9404cd |
+ * Example
|
|
Jan F |
9404cd |
+ /usr/libexec/openssh -s -f /etc/ldap.conf -w -d >> /tmp/ldapdebuglog.txt
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+HOW TO MIGRATE FROM LPK
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+1) goto HOW TO START 4) .... the ldap schema is the same
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+2) convert the group requests to the appropriate LDAP requests
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+HOW TO SOLVE PROBLEMS
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+1) use debug in sshd
|
|
Jan F |
9404cd |
+ * /usr/sbin/sshd -d -d -d -d
|
|
Jan F |
9404cd |
+2) use debug in ssh-ldap-helper
|
|
Jan F |
9404cd |
+ * ssh-ldap-helper -d -d -d -d -s <username>
|
|
Jan F |
9992a8 |
+3) use tcpdump ... other ldap client etc.
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9992a8 |
+ADVANTAGES
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9992a8 |
+1) Blocking an user account can be done directly from LDAP (if sshd is using PubkeyAuthentication + AuthorizedKeysCommand with ldap only).
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+DISADVANTAGES
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+1) LDAP must be well configured, getting the public key of some user is not a problem, but if anonymous LDAP
|
|
Jan F |
9992a8 |
+ allows write to users dn, somebody could replace some user's public key by his own and impersonate some
|
|
Jan F |
9992a8 |
+ of your users in all your server farm -- be VERY CAREFUL.
|
|
Jan F |
9404cd |
+2) With incomplete PKI the MITM attack when sshd is requesting the public key, could lead to a compromise of your servers allowing login
|
|
Jan F |
9992a8 |
+ as the impersonated user.
|
|
Jan F |
9992a8 |
+3) If LDAP server is down there may be no fallback on passwd auth.
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+MISC.
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+1) todo
|
|
Jan F |
9404cd |
+ * Possibility to reuse the ssh-ldap-helper.
|
|
Jan F |
9992a8 |
+ * Tune the LDAP part to accept all possible LDAP configurations.
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+2) differences from original lpk
|
|
Jan F |
9404cd |
+ * No LDAP code in sshd.
|
|
Jan F |
9404cd |
+ * Support for various LDAP platforms and configurations.
|
|
Jan F |
9404cd |
+ * LDAP is configured in separate ldap.conf file.
|
|
Jan F |
9404cd |
+
|
|
Jan F |
9404cd |
+3) docs/link
|
|
Jan F |
9404cd |
+ * http://pacsec.jp/core05/psj05-barisani-en.pdf
|
|
Jan F |
9404cd |
+ * http://fritz.potsdam.edu/projects/openssh-lpk/
|
|
Jan F |
9404cd |
+ * http://fritz.potsdam.edu/projects/sshgate/
|
|
Jan F |
9404cd |
+ * http://dev.inversepath.com/trac/openssh-lpk
|
|
Jan F |
9404cd |
+ * http://lam.sf.net/ ( http://lam.sourceforge.net/documentation/supportedSchemas.htm )
|
|
Jan F |
9404cd |
|
|
Jan F |
9404cd |
+4) contributors/ideas/greets
|
|
Jan F |
9404cd |
+ - Eric AUGE <eau@phear.org>
|
|
Jan F |
9404cd |
+ - Andrea Barisani <andrea@inversepath.com>
|
|
Jan F |
9404cd |
+ - Falk Siemonsmeier.
|
|
Jan F |
9404cd |
+ - Jacob Rief.
|
|
Jan F |
9404cd |
+ - Michael Durchgraf.
|
|
Jan F |
9404cd |
+ - frederic peters.
|
|
Jan F |
9404cd |
+ - Finlay dobbie.
|
|
Jan F |
9404cd |
+ - Stefan Fisher.
|
|
Jan F |
9404cd |
+ - Robin H. Johnson.
|
|
Jan F |
9404cd |
+ - Adrian Bridgett.
|
|
Jan F |
9404cd |
|
|
Jan F |
9404cd |
-To debug the ssh-ldap-helper is possible to set
|
|
Jan F |
9404cd |
-the necessary flags in the ssh-ldap-wrapper.
|
|
Jan F |
9404cd |
+5) Author
|
|
Jan F |
9404cd |
+ Jan F. Chadima <jchadima@redhat.com>
|
|
Jan F |
9404cd |
|
|
Jan F |
9404cd |
diff -up openssh-5.8p1/ldap-helper.c.ldap2 openssh-5.8p1/ldap-helper.c
|
|
Jan F |
9992a8 |
--- openssh-5.8p1/ldap-helper.c.ldap2 2011-03-10 21:45:52.872854838 +0100
|
|
Jan F |
9992a8 |
+++ openssh-5.8p1/ldap-helper.c 2011-03-10 21:45:53.342855061 +0100
|
|
Jan F |
9404cd |
@@ -138,6 +138,7 @@ main(int ac, char **av)
|
|
Jan F |
9404cd |
if (config_single_user) {
|
|
Jan F |
9404cd |
process_user (config_single_user, outfile);
|
|
Jan F |
9404cd |
} else {
|
|
Jan F |
9404cd |
+ usage();
|
|
Jan F |
9404cd |
fatal ("Not yet implemented");
|
|
Jan F |
9404cd |
/* TODO
|
|
Jan F |
9404cd |
* open unix socket a run the loop on it
|
|
Jan F |
9404cd |
diff -up openssh-5.8p1/lpk-user-example.txt.ldap2 openssh-5.8p1/lpk-user-example.txt
|
|
Jan F |
9992a8 |
--- openssh-5.8p1/lpk-user-example.txt.ldap2 2011-03-10 21:45:52.986980339 +0100
|
|
Jan F |
9992a8 |
+++ openssh-5.8p1/lpk-user-example.txt 2011-03-10 21:45:53.379854929 +0100
|
|
Jan F |
9404cd |
@@ -1,117 +0,0 @@
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Post to ML -> User Made Quick Install Doc.
|
|
Jan F |
9404cd |
-Contribution from John Lane <john@lane.uk.net>
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-OpenSSH LDAP keystore Patch
|
|
Jan F |
9404cd |
-===========================
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-NOTE: these notes are a transcript of a specific installation
|
|
Jan F |
9404cd |
- they work for me, your specifics may be different!
|
|
Jan F |
9404cd |
- from John Lane March 17th 2005 john@lane.uk.net
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-This is a patch to OpenSSH 4.0p1 to allow it to obtain users' public keys
|
|
Jan F |
9404cd |
-from their LDAP record as an alternative to ~/.ssh/authorized_keys.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-(Assuming here that necessary build stuff is in $BUILD)
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-cd $BUILD/openssh-4.0p1
|
|
Jan F |
9404cd |
-patch -Np1 -i $BUILD/openssh-lpk-4.0p1-0.3.patch
|
|
Jan F |
9404cd |
-mkdir -p /var/empty &&
|
|
Jan F |
9404cd |
-./configure --prefix=/usr --sysconfdir=/etc/ssh \
|
|
Jan F |
9404cd |
- --libexecdir=/usr/sbin --with-md5-passwords --with-pam \
|
|
Jan F |
9404cd |
- --with-libs="-lldap" --with-cppflags="-DWITH_LDAP_PUBKEY"
|
|
Jan F |
9404cd |
-Now do.
|
|
Jan F |
9404cd |
-make &&
|
|
Jan F |
9404cd |
-make install
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Add the following config to /etc/ssh/ssh_config
|
|
Jan F |
9404cd |
-UseLPK yes
|
|
Jan F |
9404cd |
-LpkServers ldap://myhost.mydomain.com
|
|
Jan F |
9404cd |
-LpkUserDN ou=People,dc=mydomain,dc=com
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-We need to tell sshd about the SSL keys during boot, as root's
|
|
Jan F |
9404cd |
-environment does not exist at that time. Edit /etc/rc.d/init.d/sshd.
|
|
Jan F |
9404cd |
-Change the startup code from this:
|
|
Jan F |
9404cd |
- echo "Starting SSH Server..."
|
|
Jan F |
9404cd |
- loadproc /usr/sbin/sshd
|
|
Jan F |
9404cd |
- ;;
|
|
Jan F |
9404cd |
-to this:
|
|
Jan F |
9404cd |
- echo "Starting SSH Server..."
|
|
Jan F |
9404cd |
- LDAPRC="/root/.ldaprc" loadproc /usr/sbin/sshd
|
|
Jan F |
9404cd |
- ;;
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Re-start the sshd daemon:
|
|
Jan F |
9404cd |
-/etc/rc.d/init.d/sshd restart
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Install the additional LDAP schema
|
|
Jan F |
9404cd |
-cp $BUILD/openssh-lpk-0.2.schema /etc/openldap/schema/openssh.schema
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Now add the openSSH LDAP schema to /etc/openldap/slapd.conf:
|
|
Jan F |
9404cd |
-Add the following to the end of the existing block of schema includes
|
|
Jan F |
9404cd |
-include /etc/openldap/schema/openssh.schema
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Re-start the LDAP server:
|
|
Jan F |
9404cd |
-/etc/rc.d/init.d/slapd restart
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-To add one or more public keys to a user, eg "testuser" :
|
|
Jan F |
9404cd |
-ldapsearch -x -W -Z -LLL -b "uid=testuser,ou=People,dc=mydomain,dc=com" -D
|
|
Jan F |
9404cd |
-"uid=testuser,ou=People,dc=mydomain,dc=com" > /tmp/testuser
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-append the following to this /tmp/testuser file
|
|
Jan F |
9404cd |
-objectclass: ldapPublicKey
|
|
Jan F |
9404cd |
-sshPublicKey: ssh-rsa
|
|
Jan F |
9404cd |
-AAAAB3NzaC1yc2EAAAABJQAAAIB3dsrwqXqD7E4zYYrxwdDKBUQxKMioXy9pxFVai64kAPxjU9KS
|
|
Jan F |
9404cd |
-qIo7QfkjslfsjflksjfldfkjsldfjLX/5zkzRmT28I5piGzunPv17S89z8XwSsuAoR1t86t+5dlI
|
|
Jan F |
9404cd |
-7eZE/gVbn2UQkQq7+kdDTS2yXV6VnC52N/kKLG3ciBkBAw== General Purpose RSA Key
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Then do a modify:
|
|
Jan F |
9404cd |
-ldapmodify -x -D "uid=testuser,ou=People,dc=mydomain,dc=com" -W -f
|
|
Jan F |
9404cd |
-/tmp/testuser -Z
|
|
Jan F |
9404cd |
-Enter LDAP Password:
|
|
Jan F |
9404cd |
-modifying entry "uid=testuser,ou=People,dc=mydomain,dc=com"
|
|
Jan F |
9404cd |
-And check the modify is ok:
|
|
Jan F |
9404cd |
-ldapsearch -x -W -Z -b "uid=testuser,ou=People,dc=mydomain,dc=com" -D
|
|
Jan F |
9404cd |
-"uid=testuser,ou=People,dc=mydomain,dc=com"
|
|
Jan F |
9404cd |
-Enter LDAP Password:
|
|
Jan F |
9404cd |
-# extended LDIF
|
|
Jan F |
9404cd |
-#
|
|
Jan F |
9404cd |
-# LDAPv3
|
|
Jan F |
9404cd |
-# base <uid=testuser,ou=People,dc=mydomain,dc=com> with scope sub
|
|
Jan F |
9404cd |
-# filter: (objectclass=*)
|
|
Jan F |
9404cd |
-# requesting: ALL
|
|
Jan F |
9404cd |
-#
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-# testuser, People, mydomain.com
|
|
Jan F |
9404cd |
-dn: uid=testuser,ou=People,dc=mydomain,dc=com
|
|
Jan F |
9404cd |
-uid: testuser
|
|
Jan F |
9404cd |
-cn: testuser
|
|
Jan F |
9404cd |
-objectClass: account
|
|
Jan F |
9404cd |
-objectClass: posixAccount
|
|
Jan F |
9404cd |
-objectClass: top
|
|
Jan F |
9404cd |
-objectClass: shadowAccount
|
|
Jan F |
9404cd |
-objectClass: ldapPublicKey
|
|
Jan F |
9404cd |
-shadowLastChange: 12757
|
|
Jan F |
9404cd |
-shadowMax: 99999
|
|
Jan F |
9404cd |
-shadowWarning: 7
|
|
Jan F |
9404cd |
-loginShell: /bin/bash
|
|
Jan F |
9404cd |
-uidNumber: 9999
|
|
Jan F |
9404cd |
-gidNumber: 501
|
|
Jan F |
9404cd |
-homeDirectory: /home/testuser
|
|
Jan F |
9404cd |
-userPassword:: e1NTSEF9UDgwV1hnM1VjUDRJK0k1YnFiL1d4ZUJObXlZZ3Z3UTU=
|
|
Jan F |
9404cd |
-sshPublicKey: ssh-rsa
|
|
Jan F |
9404cd |
-AAAAB3NzaC1yc2EAAAABJQAAAIB3dsrwqXqD7E4zYYrxwdDKBUQxKMioXy9pxFVai64kAPxjU9KSqIo7QfkjslfsjflksjfldfkjsldfjLX/5zkzRmT28I5piGzunPv17S89z
|
|
Jan F |
9404cd |
-8XwSsuAoR1t86t+5dlI7eZE/gVbn2UQkQq7+kdDTS2yXV6VnC52N/kKLG3ciBkBAw== General Purpose RSA Key
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-# search result
|
|
Jan F |
9404cd |
-search: 3
|
|
Jan F |
9404cd |
-result: 0 Success
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-# numResponses: 2
|
|
Jan F |
9404cd |
-# numEntries: 1
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Now start a ssh session to user "testuser" from usual ssh client (e.g.
|
|
Jan F |
9404cd |
-puTTY). Login should succeed.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
Jan F |
9404cd |
diff -up openssh-5.8p1/README.lpk.ldap2 openssh-5.8p1/README.lpk
|
|
Jan F |
9992a8 |
--- openssh-5.8p1/README.lpk.ldap2 2011-03-10 21:45:53.112979980 +0100
|
|
Jan F |
9992a8 |
+++ openssh-5.8p1/README.lpk 2011-03-10 21:45:53.416856007 +0100
|
|
Jan F |
9404cd |
@@ -1,274 +0,0 @@
|
|
Jan F |
9404cd |
-OpenSSH LDAP PUBLIC KEY PATCH
|
|
Jan F |
9404cd |
-Copyright (c) 2003 Eric AUGE (eau@phear.org)
|
|
Jan F |
9404cd |
-All rights reserved.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Rewriten by Jan F. Chadima (jchadima@redhat.com)
|
|
Jan F |
9404cd |
-Copyright (c) 2010 Red Hat, Inc.
|
|
Jan F |
9404cd |
-The new PKA-LDAP patch is rewritten from the scratch.
|
|
Jan F |
9404cd |
-LDAP schema and part of the documentation is based on original
|
|
Jan F |
9404cd |
-LPK project (http://code.google.com/p/openssh-lpk),
|
|
Jan F |
9404cd |
-copyright (c) 2003 Eric AUGE
|
|
Jan F |
9404cd |
-The new openssh configuration is different from the original LPK one.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-Redistribution and use in source and binary forms, with or without
|
|
Jan F |
9404cd |
-modification, are permitted provided that the following conditions
|
|
Jan F |
9404cd |
-are met:
|
|
Jan F |
9404cd |
-1. Redistributions of source code must retain the above copyright
|
|
Jan F |
9404cd |
- notice, this list of conditions and the following disclaimer.
|
|
Jan F |
9404cd |
-2. Redistributions in binary form must reproduce the above copyright
|
|
Jan F |
9404cd |
- notice, this list of conditions and the following disclaimer in the
|
|
Jan F |
9404cd |
- documentation and/or other materials provided with the distribution.
|
|
Jan F |
9404cd |
-3. The name of the author may not be used to endorse or promote products
|
|
Jan F |
9404cd |
- derived from this software without specific prior written permission.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
Jan F |
9404cd |
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
Jan F |
9404cd |
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
Jan F |
9404cd |
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Jan F |
9404cd |
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
Jan F |
9404cd |
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Jan F |
9404cd |
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Jan F |
9404cd |
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Jan F |
9404cd |
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
Jan F |
9404cd |
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-purposes of this patch:
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-This patch would help to have authentication centralization policy
|
|
Jan F |
9404cd |
-using ssh public key authentication.
|
|
Jan F |
9404cd |
-This patch could be an alternative to other "secure" authentication system
|
|
Jan F |
9404cd |
-working in a similar way (Kerberos, SecurID, etc...), except the fact
|
|
Jan F |
9404cd |
-that it's based on OpenSSH and its public key abilities.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
->> FYI: <<
|
|
Jan F |
9404cd |
-'uid': means unix accounts existing on the current server
|
|
Jan F |
9404cd |
-'ServerGroup:' mean server group configured on the current server by the SSH_Filter option in the ldap.conf.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-example schema:
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- server1 (uid: eau,rival,toto) (ServerGroup: unix)
|
|
Jan F |
9404cd |
- ___________ /
|
|
Jan F |
9404cd |
- / \ --- - server3 (uid: eau, titi) (ServerGroup: unix)
|
|
Jan F |
9404cd |
- | LDAP Server | \
|
|
Jan F |
9404cd |
- | eau ,rival | server2 (uid: rival, eau) (ServerGroup: unix)
|
|
Jan F |
9404cd |
- | titi ,toto |
|
|
Jan F |
9404cd |
- | userx,.... | server5 (uid: eau) (ServerGroup: mail)
|
|
Jan F |
9404cd |
- \___________/ \ /
|
|
Jan F |
9404cd |
- ----- - server4 (uid: eau, rival) (no group configured)
|
|
Jan F |
9404cd |
- \
|
|
Jan F |
9404cd |
- etc...
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- WHAT WE NEED :
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- * configured LDAP server somewhere on the network (i.e. OpenLDAP)
|
|
Jan F |
9404cd |
- * patched sshd (with this patch ;)
|
|
Jan F |
9404cd |
- * LDAP user(/group) entry (look at users.ldif (& groups.ldif)):
|
|
Jan F |
9404cd |
- User entry:
|
|
Jan F |
9404cd |
- - attached to the 'ldapPublicKey' objectclass
|
|
Jan F |
9404cd |
- - attached to the 'posixAccount' objectclass
|
|
Jan F |
9404cd |
- - with a filled 'sshPublicKey' attribute
|
|
Jan F |
9404cd |
- Example:
|
|
Jan F |
9404cd |
- dn: uid=eau,ou=users,dc=cuckoos,dc=net
|
|
Jan F |
9404cd |
- objectclass: top
|
|
Jan F |
9404cd |
- objectclass: person
|
|
Jan F |
9404cd |
- objectclass: organizationalPerson
|
|
Jan F |
9404cd |
- objectclass: posixAccount
|
|
Jan F |
9404cd |
- objectclass: ldapPublicKey
|
|
Jan F |
9404cd |
- description: Eric AUGE Account
|
|
Jan F |
9404cd |
- userPassword: blah
|
|
Jan F |
9404cd |
- cn: Eric AUGE
|
|
Jan F |
9404cd |
- sn: Eric AUGE
|
|
Jan F |
9404cd |
- uid: eau
|
|
Jan F |
9404cd |
- uidNumber: 1034
|
|
Jan F |
9404cd |
- gidNumber: 1
|
|
Jan F |
9404cd |
- homeDirectory: /export/home/eau
|
|
Jan F |
9404cd |
- sshPublicKey: ssh-dss AAAAB3...
|
|
Jan F |
9404cd |
- sshPublicKey: ssh-dss AAAAM5...
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- Group entry:
|
|
Jan F |
9404cd |
- - attached to the 'posixGroup' objectclass
|
|
Jan F |
9404cd |
- - with a 'cn' groupname attribute
|
|
Jan F |
9404cd |
- - with multiple 'memberUid' attributes filled with usernames allowed in this group
|
|
Jan F |
9404cd |
- Example:
|
|
Jan F |
9404cd |
- # few members
|
|
Jan F |
9404cd |
- dn: cn=unix,ou=groups,dc=cuckoos,dc=net
|
|
Jan F |
9404cd |
- objectclass: top
|
|
Jan F |
9404cd |
- objectclass: posixGroup
|
|
Jan F |
9404cd |
- description: Unix based servers group
|
|
Jan F |
9404cd |
- cn: unix
|
|
Jan F |
9404cd |
- gidNumber: 1002
|
|
Jan F |
9404cd |
- memberUid: eau
|
|
Jan F |
9404cd |
- memberUid: user1
|
|
Jan F |
9404cd |
- memberUid: user2
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- HOW IT WORKS :
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- * without patch
|
|
Jan F |
9404cd |
- If a user wants to authenticate to log in a server the sshd, will first look for authentication method allowed (RSAauth,kerberos,etc..)
|
|
Jan F |
9404cd |
- and if RSAauth and tickets based auth fails, it will fallback to standard password authentication (if enabled).
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- * with the patch
|
|
Jan F |
9404cd |
- If a user want to authenticate to log in a server, the sshd will first look for auth method including LDAP pubkey, if the ldappubkey options is enabled.
|
|
Jan F |
9404cd |
- It will do an ldapsearch to get the public key directly from the LDAP instead of reading it from the server filesystem.
|
|
Jan F |
9404cd |
- (usually in $HOME/.ssh/authorized_keys)
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- 2 tokens are added to sshd_config :
|
|
Jan F |
9404cd |
- # here is the new patched ldap related tokens
|
|
Jan F |
9404cd |
- AuthorizedKeysCommand "/usr/libexec/openssh/ssh-ldap-wrapper"
|
|
Jan F |
9404cd |
- AuthorizedKeysCommandRunAs nobody
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- The LDAP configuratin is read from common /etc/ldap.conf configuration file.
|
|
Jan F |
9404cd |
-There is also one optional parameter in the LDAP configuration file, SSH_Filter, which is a LDAP filter limiting keys to be searched.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- HOW TO INSERT A USER/KEY INTO AN LDAP ENTRY
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- * my way (there is plenty :)
|
|
Jan F |
9404cd |
- - create ldif file (i.e. users.ldif)
|
|
Jan F |
9404cd |
- - cat ~/.ssh/id_dsa.pub OR cat ~/.ssh/id_rsa.pub OR cat ~/.ssh/identity.pub
|
|
Jan F |
9404cd |
- - my way in 4 steps :
|
|
Jan F |
9404cd |
- Example:
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- # you add this to the user entry in the LDIF file :
|
|
Jan F |
9404cd |
- [...]
|
|
Jan F |
9404cd |
- objectclass: posixAccount
|
|
Jan F |
9404cd |
- objectclass: ldapPublicKey
|
|
Jan F |
9404cd |
- [...]
|
|
Jan F |
9404cd |
- sshPubliKey: ssh-dss AAAABDh12DDUR2...
|
|
Jan F |
9404cd |
- [...]
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- # insert your entry and you're done :)
|
|
Jan F |
9404cd |
- ldapadd -D balblabla -w bleh < file.ldif
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- all standard options can be present in the 'sshPublicKey' attribute.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- WHY :
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- Simply because, i was looking for a way to centralize all sysadmins authentication, easily, without completely using LDAP
|
|
Jan F |
9404cd |
- as authentication method (like pam_ldap etc..).
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- After looking into Kerberos, SecurID, and other centralized secure authentications systems, the use of RSA and LDAP to get
|
|
Jan F |
9404cd |
- public key for authentication allows us to control who has access to which server (the user needs an account and to be in 'strongAuthenticationUser'
|
|
Jan F |
9404cd |
- objectclass within LDAP and part of the group the SSH server is in).
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- Passwords update are no longer a nightmare for a server farm (key pair passphrase is stored on each user's box and private key is locally encrypted using his passphrase
|
|
Jan F |
9404cd |
- so each user can change it as much as he wants).
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- Blocking a user account can be done directly from the LDAP (if sshd is using RSAAuth + ldap only).
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- RULES :
|
|
Jan F |
9404cd |
- Entry in the LDAP server must respect 'posixAccount' and 'ldapPublicKey' which are defined in core.schema.
|
|
Jan F |
9404cd |
- and the additionnal lpk.schema.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- This patch could allow a smooth transition between standard auth (/etc/passwd) and complete LDAP based authentication
|
|
Jan F |
9404cd |
- (pamldap, nss_ldap, etc..).
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- This can be an alternative to other (old?/expensive?) authentication methods (Kerberos/SecurID/..).
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- Referring to schema at the beginning of this file if user 'eau' is only in group 'unix'
|
|
Jan F |
9404cd |
- 'eau' would ONLY access 'server1', 'server2', 'server3' AND 'server4' BUT NOT 'server5'.
|
|
Jan F |
9404cd |
- If you then modify the LDAP 'mail' group entry to add 'memberUid: eau' THEN user 'eau' would be able
|
|
Jan F |
9404cd |
- to log in 'server5' (i hope you got the idea, my english is bad :).
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- Each server's sshd is patched and configured to ask the public key and the group infos in the LDAP
|
|
Jan F |
9404cd |
- server.
|
|
Jan F |
9404cd |
- When you want to allow a new user to have access to the server parc, you just add him an account on
|
|
Jan F |
9404cd |
- your servers, you add his public key into his entry on the LDAP server, it's done.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- Because sshds are looking public keys into the LDAP directly instead of a file ($HOME/.ssh/authorized_keys).
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- When the user needs to change his passphrase he can do it directly from his workstation by changing
|
|
Jan F |
9404cd |
- his own key set lock passphrase, and all servers are automatically aware.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- With a CAREFUL LDAP server configuration you could allow a user to add/delete/modify his own entry himself
|
|
Jan F |
9404cd |
- so he can add/modify/delete himself his public key when needed.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- FLAWS :
|
|
Jan F |
9404cd |
- LDAP must be well configured, getting the public key of some user is not a problem, but if anonymous LDAP
|
|
Jan F |
9404cd |
- allow write to users dn, somebody could replace someuser's public key by its own and impersonate some
|
|
Jan F |
9404cd |
- of your users in all your server farm be VERY CAREFUL.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- MITM attack when sshd is requesting the public key, could lead to a compromise of your servers allowing login
|
|
Jan F |
9404cd |
- as the impersonnated user.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- If LDAP server is down then, no fallback on passwd auth.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
- the ldap code part has not been well audited yet.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- LDAP USER ENTRY EXAMPLES (LDIF Format, look in users.ldif)
|
|
Jan F |
9404cd |
- --- CUT HERE ---
|
|
Jan F |
9404cd |
- dn: uid=jdoe,ou=users,dc=foobar,dc=net
|
|
Jan F |
9404cd |
- objectclass: top
|
|
Jan F |
9404cd |
- objectclass: person
|
|
Jan F |
9404cd |
- objectclass: organizationalPerson
|
|
Jan F |
9404cd |
- objectclass: posixAccount
|
|
Jan F |
9404cd |
- objectclass: ldapPublicKey
|
|
Jan F |
9404cd |
- description: My account
|
|
Jan F |
9404cd |
- cn: John Doe
|
|
Jan F |
9404cd |
- sn: John Doe
|
|
Jan F |
9404cd |
- uid: jdoe
|
|
Jan F |
9404cd |
- uidNumber: 100
|
|
Jan F |
9404cd |
- gidNumber: 100
|
|
Jan F |
9404cd |
- homeDirectory: /home/jdoe
|
|
Jan F |
9404cd |
- sshPublicKey: ssh-dss AAAAB3NzaC1kc3MAAAEBAOvL8pREUg9wSy/8+hQJ54YF3AXkB0OZrXB....
|
|
Jan F |
9404cd |
- [...]
|
|
Jan F |
9404cd |
- --- CUT HERE ---
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- LDAP GROUP ENTRY EXAMPLES (LDIF Format, look in groups.ldif)
|
|
Jan F |
9404cd |
- --- CUT HERE ---
|
|
Jan F |
9404cd |
- dn: cn=unix,ou=groups,dc=cuckoos,dc=net
|
|
Jan F |
9404cd |
- objectclass: top
|
|
Jan F |
9404cd |
- objectclass: posixGroup
|
|
Jan F |
9404cd |
- description: Unix based servers group
|
|
Jan F |
9404cd |
- cn: unix
|
|
Jan F |
9404cd |
- gidNumber: 1002
|
|
Jan F |
9404cd |
- memberUid: jdoe
|
|
Jan F |
9404cd |
- memberUid: user1
|
|
Jan F |
9404cd |
- memberUid: user2
|
|
Jan F |
9404cd |
- [...]
|
|
Jan F |
9404cd |
- --- CUT HERE ---
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
->> FYI: <<
|
|
Jan F |
9404cd |
-Multiple 'sshPublicKey' in a user entry are allowed, as well as multiple 'memberUid' attributes in a group entry
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- COMPILING:
|
|
Jan F |
9404cd |
- 1. Apply the patch
|
|
Jan F |
9404cd |
- 2. ./configure --with-your-options --with-ldap=/prefix/to/ldap_libs_and_includes
|
|
Jan F |
9404cd |
- 3. make
|
|
Jan F |
9404cd |
- 4. it's done.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- BLA :
|
|
Jan F |
9404cd |
- I hope this could help, and i hope to be clear enough,, or give ideas. questions/comments/improvements are welcome.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- TODO :
|
|
Jan F |
9404cd |
- Possibility to reuse the ssh-ldap-helper.
|
|
Jan F |
9404cd |
- Tune the LDAP part to all possible LDAP configurations.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- DIFFERENCES FROM ORIGINAL lpk
|
|
Jan F |
9404cd |
- No LDAP code in sshd.
|
|
Jan F |
9404cd |
- Support for various LDAP platforms and configurations.
|
|
Jan F |
9404cd |
- LDAP is configured in separate ldap.conf file.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- DOCS/LINK :
|
|
Jan F |
9404cd |
- http://pacsec.jp/core05/psj05-barisani-en.pdf
|
|
Jan F |
9404cd |
- http://fritz.potsdam.edu/projects/openssh-lpk/
|
|
Jan F |
9404cd |
- http://fritz.potsdam.edu/projects/sshgate/
|
|
Jan F |
9404cd |
- http://dev.inversepath.com/trac/openssh-lpk
|
|
Jan F |
9404cd |
- http://lam.sf.net/ ( http://lam.sourceforge.net/documentation/supportedSchemas.htm )
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- CONTRIBUTORS/IDEAS/GREETS :
|
|
Jan F |
9404cd |
- - Eric AUGE <eau@phear.org>
|
|
Jan F |
9404cd |
- - Andrea Barisani <andrea@inversepath.com>
|
|
Jan F |
9404cd |
- - Falk Siemonsmeier.
|
|
Jan F |
9404cd |
- - Jacob Rief.
|
|
Jan F |
9404cd |
- - Michael Durchgraf.
|
|
Jan F |
9404cd |
- - frederic peters.
|
|
Jan F |
9404cd |
- - Finlay dobbie.
|
|
Jan F |
9404cd |
- - Stefan Fisher.
|
|
Jan F |
9404cd |
- - Robin H. Johnson.
|
|
Jan F |
9404cd |
- - Adrian Bridgett.
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
-- CONTACT :
|
|
Jan F |
9404cd |
- Jan F. Chadima <jchadima@redhat.com>
|
|
Jan F |
9404cd |
-
|
|
Jan F |
9404cd |
diff -up openssh-5.8p1/ssh-ldap-helper.8.ldap2 openssh-5.8p1/ssh-ldap-helper.8
|
|
Jan F |
9992a8 |
--- openssh-5.8p1/ssh-ldap-helper.8.ldap2 2011-03-10 21:45:53.170854817 +0100
|
|
Jan F |
9992a8 |
+++ openssh-5.8p1/ssh-ldap-helper.8 2011-03-10 21:45:53.454980272 +0100
|
|
Jan F |
9404cd |
@@ -37,11 +37,12 @@ sshd configuration file
|
|
Jan F |
9404cd |
by setting
|
|
Jan F |
9404cd |
.Cm AuthorizedKeysCommand
|
|
Jan F |
9404cd |
to
|
|
Jan F |
9404cd |
-.Dq /usr/libexec/ssh-ldap-helper -s %u .
|
|
Jan F |
9404cd |
+.Dq /usr/libexec/ssh-ldap-wrapper .
|
|
Jan F |
9404cd |
.Pp
|
|
Jan F |
9404cd |
.Nm
|
|
Jan F |
9404cd |
is not intended to be invoked by the user, but from
|
|
Jan F |
9404cd |
-.Xr sshd 8 .
|
|
Jan F |
9404cd |
+.Xr sshd 8 via
|
|
Jan F |
9404cd |
+.Xr ssh-ldap-wrapper .
|
|
Jan F |
9404cd |
.Pp
|
|
Jan F |
9404cd |
The options are as follows:
|
|
Jan F |
9404cd |
.Bl -tag -width Ds
|