Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.36 MB, 188 trang )
Giao thức LDAP
GVHD: TS. Lưu Thanh Trà
NOPLAIN
NOACTIVE
NOANONYMOUS
56
NOPLAIN
KERBEROS_V4 NOACTIVE
NOANONYMOUS
56
LOGIN
NOANONYMOUS
0
PLAIN
NOANONYMOUS
0
SCRAM-MD5
NONE
0
SRP
NOPLAIN
0
GSSAPI
Ví dụ :
Giả sử trong file slapd.conf của bạn có các dòng sau :
## No PLAIN or ANONYMOUS mechanisms; use DES encrpytion
sasl-secprops noplain,noanonymous,minssf=56
So sánh với các giá trị trong hai bảng trên, bạn sẽ thấy được server của bạn chỉ cho phép các cơ chế
sau : DIGEST-MD5, GSSAPI, KERBEROS_4 cho việc authentication
5.4 SSL/TLS Options
Tương tự SASL, slapd.conf có nhiều tùy chỉnh để cấu hình những thứ liên qua tới SSL và TLS, bao
gồm :
TLSCipherSuite cipher-suite-specification
TLSCertificateFile filename
TLSCertificateKeyFile filename
Thông số TLSCipherSuite cho phép bạn chỉ ra cipher nào sẽ được server chấp nhận, ngoài ra nó còn
chỉ ra thứ tự cho các ciphers. Dưới đây là tùy chỉnh thường thấy:
RC4:DES:EXPORT40
HIGH:MEDIUM
3DES:SHA1:+SSL2
Hai thông số còn lại cho slapd biết vị trí của server’s certificate và private key tương ứng.
5.4.1
Tạo server’s certificate
Chúng ta sẽ dùng CA.pl script để tạo các certificates. Để tạo mới 1 certificate, ta dùng lệnh –
newcert và trả lời các câu hỏi cần thiết.
Chương 3
19
Lê Tiến Cường – Nguyễn Minh Đức
Lê Thạch Giang- Hoàng Ngọc Hưng
Giao thức LDAP
GVHD: TS. Lưu Thanh Trà
$ /usr/local/misc/CA.pl -newcert
Enter PEM pass phrase:test
Verifying password - Enter PEM pass phrase:test
----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) [GB]:US
State or Province Name (full name) [Berkshire]:Alabama
Locality Name (eg, city) [Newbury]:Somewhere
Organization Name (eg, company) [My Company Ltd]:PlaineJoe Dot Org
Organizational Unit Name (eg, section) [ ]:IT
Common Name (eg, your name or your server's hostname) [ ]:pogo.plainjoe.org
Email Address [ ]:jerry@plainjoe.org
Certificate (and private key) is in newreq.pem
Lệnh trên sẽ tạo ra 1 file tên là newreq.pem chứa private key được bảo vệ bởi passworf và tự đăng
kí certificate. Đây là nội dung của newreq.pem
-----BEGIN RSA PRIVATE KEY----Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,D8851189E7EA85CE
ImZpOfzqhNhNa6MRQBtYxjPbWmHw+3XxVAowO1FJyFQRQhuRDqrUia1IW7Tikb4d
rvjbv8T1+SN9vRGWBpz3nAERnS6uEnzPu201b9X413uXaF80TYYId7OUalG5mjqr
GG0oHaYwbmvAIRyhq3zhqCnBgscZ0l5DCXGTw0T1TeqaTfD8BpRE4ES+F0dlKjRf
yXuXmLrTg0C9ITokzRj4Xtu0nJfQ5LKouooeI43FHqFBFV4Jw5IIKOuAg/tkinez
VqVesaV707PLqdlYNAVx26z/nPwbbAT2JY4fqemBzjBJPDN6Tr/QncYgbMcG+H5/
7z7mBmOWq7nCpgFSwV1KgvtDIOjqZmGSpTLbZ/pY+JUT3iPsRAaL5XHDZDM6pF0l
R70ePd3Z5sUcg1TJlnuPYejyTi1OM/hoKrNnjM+4bTY8St14zAaMV15G/3GGJue0
jeJkBZba8UpQ539yPfuPINueJFG+QipDUnHWVHSWIGhqiKVZxPTZWCZrgHx7UbYw
fQVORGQ6ddu6vYNiODYXUnN3YtvD02OkbiGVl53OXlYv5hOydqdWRhA1hfR8SKAG
fnt1OV9yjC/0K2mj+nMNOu5kHMfA+Q6hw7mvWAsR/2ldX+/QTA8n1oRi7U4zySUL
iaAycSQl/yFHeHBhjOqFzKhvJU9Ux1A/lDzmFZ/vPGsSCvyv3GD1IzK1wvbUgxKE
3DzA1OuuUCl36HYTEgeFG2DqHPxzjhtqPyGgTG4xmB3dOndMys4VxeWB3Y+3vy3I
B6faH3/UKv1S6Fhj6xzxODjlLLt2zV0obi3F67QBXEvD08FCYtLIww= =
-----END RSA PRIVATE KEY---------BEGIN CERTIFICATE----MIIDsDCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBnTELMAkGA1UEBhMCVV
Mx
EDAOBgNVBAgTB0FsYWJhbWExEjAQBgNVBAcTCVNvbWV3aGVyZTEaMBgGA1UECh
MR
UGxhaW5lSm9lIERvdCBPcmcxCzAJBgNVBAsTAklUMRwwGgYDVQQDExNnYXJpb24u
cGxhaW5qb2Uub3JnMSEwHwYJKoZIhvcNAQkBFhJqZXJyeUBwbGFpbmpvZS5vcmcw
HhcNMDIxMTE2MjI0MzA5WhcNMDMxMTE2MjI0MzA5WjCBnTELMAkGA1UEBhMCVV
Mx
Chương 3
20
Lê Tiến Cường – Nguyễn Minh Đức
Lê Thạch Giang- Hoàng Ngọc Hưng
Giao thức LDAP
GVHD: TS. Lưu Thanh Trà
EDAOBgNVBAgTB0FsYWJhbWExEjAQBgNVBAcTCVNvbWV3aGVyZTEaMBgGA1UECh
MR
UGxhaW5lSm9lIERvdCBPcmcxCzAJBgNVBAsTAklUMRwwGgYDVQQDExNnYXJpb24u
cGxhaW5qb2Uub3JnMSEwHwYJKoZIhvcNAQkBFhJqZXJyeUBwbGFpbmpvZS5vcmcw
gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALV0pZLKCwqioakJtgKr0+DScZ9h
C/nLcOxw9t6RUHlWSD9aGC9rMaMGrxG5YqI+dEuhbGWhnVo37IsMlHC+oJsXwY/2
r/RQT5dk1jyC4qt+2r4mGGC/QbCX0GRjT0gn3obB570XZ19qBCfYwIXOtYncIX0P
0fUwFVRG5frBL5QDAgMBAAGjgf0wgfowHQYDVR0OBBYEFPVRTbSjVJ4v4pOb0N0k
oJk8YZIGMIHKBgNVHSMEgcIwgb+AFPVRTbSjVJ4v4pOb0N0koJk8YZIGoYGjpIGg
MIGdMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHQWxhYmFtYTESMBAGA1UEBxM
JU29t
ZXdoZXJlMRowGAYDVQQKExFQbGFpbmVKb2UgRG90IE9yZzELMAkGA1UECxMCSVQ
x
HDAaBgNVBAMTE2dhcmlvbi5wbGFpbmpvZS5vcmcxITAfBgkqhkiG9w0BCQEWEmpl
cnJ5QHBsYWluam9lLm9yZ4IBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAU
A
A4GBAIM+ySiITRXb/d1qcO/XUQSKdU3IXqPgS8jY3U12Bll/kCZFcZxjksg6xBib
91Y/bonSEisJG74zn/0ts3sjsr3QKZp5xFcYCyK3IYjaqnFeAOh+eUp54vLpmQZX
e4QaeTkg/8MnS3vFvWoxfo4Z1Zu/wWhp9WMRRwIVAR99Ppps
-----END CERTIFICATE----Lưu lại key vào file mới newkey.pem
$ openssl rsa -in newreq.pem -out newkey.pem
read RSA key
Enter PEM pass phrase:test
writing RSA key
Đổi tên file newkey.pem lại tùy theo lựa chọn của bạn, như slapd-key.pem chẳng hạn.
Cuối cùng, sử dụng text editor, xóa private key cũ trong newreq.pem, đổi tên lại (chẳng hạn:
slapd-cert.pem). Bây giờ ta đã có 2 file :
slapd-key.pem
LDAP server's private key
slapd-cert.pem
LDAP server's public certificate
Dưới đây là các thông số TLS configuration :
# /usr/local/etc/openldap/slapd.conf
# Global section
## Include the minimum schema required.
include /usr/local/etc/openldap/schema/core.schema
## Added logging parameters
loglevel 296
pidfile /usr/local/var/slapd.pid
Chương 3
21
Lê Tiến Cường – Nguyễn Minh Đức
Lê Thạch Giang- Hoàng Ngọc Hưng
Giao thức LDAP
argsfile
GVHD: TS. Lưu Thanh Trà
/usr/local/var/slapd.args
## TLS options for slapd
TLSCipherSuite
HIGH
TLSCertificateFile /etc/local/slapd-cert.pem
TLSCertificateKeyFile /etc/local/slapd-key.pem
#######################################################
## Database sections omitted
5.5 Các thông số liên quan tới bảo mật khác :
Ngoài các thông số trên, còn 5 tùy chỉnh khác liên quan tới bảo mật :
security
require
allow
disallow
password-hash
Thông số security chỉ ra hệ số cường độ bảo vệ. Bảng dưới đây cho các tùy chỉnh và giá trị cho
thông số trên :
Table 3-5. Possible values for the slapd.conf security parameter
Value
Description
sasl
Defines the SASL security strength factor.
ssf
Defines the overall security strength factor.
tls
Defines the security strength factor to the SSL/TLS security layer.
transport
Defines the security strength provided by the underlying transport layer. Eventually, this
option will be used to choose between multiple secure transport layer protocols, such as
TLS and IPSEC.
update_sasl
update_ssf
Define the security strength of the various layers when performing update operations on
the directory.
update_tls
update_transport
Các hệ số lấy giá trị sử dụng cho minssf và maxssf trong bảng 3.3
Tham số require phân biệt với tham số security bởi việc cho phép administrator định nghĩa nhữn
điều kiện để cung cấp quyền truy cập vào directory.
Chương 3
22
Lê Tiến Cường – Nguyễn Minh Đức
Lê Thạch Giang- Hoàng Ngọc Hưng
Giao thức LDAP
GVHD: TS. Lưu Thanh Trà
Table 3-6. Values for the require parameter
Value
Description
none
Clears all requirements.
authc
Requires client authentication prior to directory access (i.e., no anonymous access).
bind
Requires the client to issue a bind request, possibly an anonymous bind, prior to directory
operations.
LDAPv3
Requires the client to use Version 3 of the LDAP protocol for directory access. By default,
OpenLDAP supports both LDAPv2 and v3 clients.
SASL
strong
Require the client to use strong (SASL) authentication in order to be granted access to the
directory. Currently, these two options are identical.
Tham số allow cung cấp một cách thức khác để mở hoặc tắt những tính năng nhất định. Hiện tại,
allow chỉ hỗ trợ hai tùy chỉnh :
none
This is the default setting.
tls_2_anon
Allows TLS to force the current session to anonymous status.
Tham số disallow cho nhiều tùy chỉnh hơn :
bind_v2
Disables LDAPv2 bind requests
bind_anon
Disables anonymous binds
bind_anon_cred
Disables anonymous credentials when the DN is empty
bind_anon_dn
Disables anonymous binds when the DN is nonempty
bind_simple
Disables simple binds
Chương 3
23
Lê Tiến Cường – Nguyễn Minh Đức
Lê Thạch Giang- Hoàng Ngọc Hưng