Εγκατάσταση SAMBA+LDAP Προεραιτικά LDAP-TLS

E-mail Εκτύπωση PDF
Αξιολόγηση Χρήστη: / 0
ΧείριστοΆριστο 

Προεραιτικά LDAP-TLS.
Για να μπορέσω να δημιουργήσω μια ασφαλή σύνδεση μεταξύ του LDAP εξυπηρετητή και το πελάτη, πρέπει να ενεργοποιήσω την SSL/TLS σύνδεση με το LDAP (θύρα 636). Για να γίνει αυτό απαιτείται ένα πιστοποιητικό x509 για τον εξυπηρετητή. Για τα πιστοποιητικά που χρησιμοποιούνται στο LDAP, επειδή δεν κρυπτογραφούμε το private key του πιστοποιητικού και το κλειδί του πιστοποιητικού περιλαμβάνεται στο πιστοποιητικό, καλό είναι να μη χρησιμοποιούμε self-signed πιστοποιητικά, γιατί αυτά θα μεταφερθούν σε όλα τα μηχανήματα του DOMAIN μας.

Γι αυτό το λόγο χρησιμοποιούμε CA Issued πιστοποιητικά, όπου το CA θα είμαστε πάλι εμείς. Αρχικά λοιπόν δημιουργούμε το φάκελο /etc/ldap/ssl και εγκαθιστούμε το openssl

#apt-get install openssl
#apt-get install ca-certificates
#cd /etc/ldap/ssl

Στη συνέχεια φτιάχνουμε το δικό μας CA x509 πιστοποιητικό:

#/usr/lib/ssl/CA.sh –newca
CA certificate filename (or enter to create)
Making CA certificate ...
Generating a 1024 bit RSA private key
....++++++
.........++++++
writing new private key to './demoCA/private/./cakey.pem'
Enter PEM pass phrase:*******
Verifying - Enter PEM pass phrase:*******
-----
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value, If you enter '.', the field will be left blank.
Country Name (2 letter code) [AU]:GR
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:LDAP COMPANY
Organizational Unit Name (eg, section) []:DEPT LDAP
Common Name (eg, YOUR name) []:mycertificationauthority.mydomain.gr
Email Address []: Αυτή η διεύθυνση ηλεκτρονικού ταχυδρομείου προστατεύεται από κακόβουλη χρήση. Χρειάζεται να ενεργοποιήσετε την Javascript για να τη δείτε.
Please enter the following 'extra' attributes to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /usr/lib/ssl/openssl.cnf
Enter pass phrase for ./demoCA/private/./cakey.pem:
Check that the request matches the signature
Signature ok

Η διαδικασία αυτή δημιουργεί τα αρχεία demoCA/cacert.pem και demoCA/private/cakey.pem (CA cert και private key). Στη συνέχεια φτιάχνω ένα certificate signing request για τον LDAP εξυπηρετητή χωρίς κρυπτογράφηση για το ιδιωτικό κλειδί (nodes).

#openssl req -newkey rsa:1024 -nodes -keyout newreq.pem -out newreq.pem
Generating a 1024 bit RSA private key
.........................++++++
.......................++++++
writing new private key to 'newreq.pem'
-----
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value, If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:GR
State or Province Name (full name) [Some-State]:............
Locality Name (eg, city) []:............
Organization Name (eg, company) [Internet Widgits Pty Ltd]:MY COMPANY
Organizational Unit Name (eg, section) []:MY DEPT
Common Name (eg, YOUR name) []:myhost.mydomain.gr
Email Address []: Αυτή η διεύθυνση ηλεκτρονικού ταχυδρομείου προστατεύεται από κακόβουλη χρήση. Χρειάζεται να ενεργοποιήσετε την Javascript για να τη δείτε.
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Στη συνέχεια το CA υπογράφει το certificate request του LDAP εξυπηρετητή:
#/usr/lib/ssl/misc/CA.sh –sign
Using configuration from /etc/ssl/openssl.cnf
Enter PEM pass phrase:
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated

Μετακινούμε τα παρακάτω αρχεία στο φάκελο /etc/ldap/ssl

#cp /etc/ldap/ssl/demoCA/cacert.pem /etc/ldap/ssl/
#cp /etc/ldap/ssl/newcert.pem /etc/ldap/ssl/ldap-server.pem
#cp /etc/ldap/ssl/newreq.pem /etc/ldap/ssl/ldap-server-key.pem
#chmod 400 /etc/ldap/ssl/ldap-server-key.pem

Η τελευταία εντολή κάνει το private key μη αναγνώσιμό εκτός από το διαχειριστή. Με την ίδια διαδικασία χρησιμοποιόντας το CA που έχουμε ήδη δημιουργήσει φτιάχνουμε πιστοποιητικά και κλειδιά και για τους πελάτες(Workstations). Mετά ανοίγουμε το configuration αρχείο /etc/ldap/slapd.conf του LDAP εξυπηρετητή και προσθέτουμε τις εξής γραμμές κάτω ακριβώς από τα schema:
TLSCipherSuite HIGH:MEDIUM:+SSLv2
TLSCACertificateFile /etc/ldap/ssl/cacert.pem
TLSCertificateFile /etc/ldap/ssl/ldap-server.pem
TLSCertificateKeyFile /etc/ldap/ssl/ldap-server-key.pem
# Use the following if client authentication is required
#TLSVerifyClient demand
# ... or not desired at all
TLSVerifyClient never ; Δεν θέλω να κάνω verify certificate των clients, αλλιώς demand.

Τέλος τροποποιώ το αρχείο /etc/ldap/ldap.conf ως εξής:

HOST localhost
PORT 636
BASE dc=ldap,dc=myhost,mydomain,dc=gr
TLS_CACERT /etc/ldap/ssl/cacert.pem
TLS_REQCERT demand
SIZELIMIT 0
TIMELIMIT 300

Εδώ τελειώνει το αρχικό configuration του slapd.conf. κλείνουμε το αρχείο και επανεκινουμε τον LDAP δαίμονα, παρακολουθώντας τo log file /var/log/ldaplogs :

#/etc/init.d/slapd start
#tail –f /var/log/ldaplogs
slapd[1471]: slapd starting
#netstat –an
tcp 0 0 0.0.0.0:389 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:636 0.0.0.0:* LISTEN

Το SAMBA χρησιμοποιεί το πακέτο SSLEAY για να προσφέρει SSL υποστήριξη στον εξυπηρετητή. Λόγω όμως του “US export law”, το SAMBA δεν μπορεί να ενωθεί με το SSLEAY και κυκλοφορεί σαν ξεχωριστό πακέτο. Για να το εγκαταστήσω κάνω τα εξής:
#apt-get install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl libmd5-perl
Toποθετούμε στο /etc/samba/smb.conf τα εξής:

ssl=yes
ssl server cert = /etc/certificates/cacert.pem
ssl server key = /etc/certificates/private/cakey.pem
ssl cA certDir = /etc/certificates



Tags: ssl/tls  self-signed  openssl  ca  x509  req  newreq  dn  key  pem  TLSCipherSuite  CACERT  REQCERT  SSLEAY  


Μοιραστείτε αυτό το άρθρο
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Dig Me Joomla Free PHP

Σχόλια
Προσθήκη νέου Αναζήτηση RSS
Γράψτε σχόλιο
Όνομα:
Email:
 
Τίτλος:
 
Please input the anti-spam code that you can read in the image.
Τελευταία Ενημέρωση ( Σάββατο, 28 Μάρτιος 2009 23:03 )  

Seach By Google

Translate this website :

Επιλογές


Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in /home/flakgr/public_html/libraries/joomla/cache/handler/callback.php on line 99

Manuals


Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in /home/flakgr/public_html/libraries/joomla/cache/handler/callback.php on line 99

Σε σύνδεση

Έχουμε 13 επισκέπτες και 2 μέλη συνδεδεμένους
  • Soorrurne
  • Callbeace

Τελευταία Σχόλια