Tài liệu Apache 2.0 với giao thức SSL/TLS: Hướng dẫn từng bước (tiếp Phần I) pdf

19 523 0
Tài liệu Apache 2.0 với giao thức SSL/TLS: Hướng dẫn từng bước (tiếp Phần I) pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Apache 2.0 với giao thức SSL/TLS: Hướng dẫn bước (tiếp Phần I) Cấu hình SSL/TLS Trước chạy Apache lần đầu tiên, cần cung cấp cấu hình ban số nội dung web mẫu Ít nhất, cần theo bước sau (như Root): Tạo số nội dung web mẫu mà đáp ứng qua SSL/TLS: umask 022 mkdir /www echo " \ Test works." > /www/index.html chown -R root:sys /www Thay file cấu hình Apache mặc định (thơng thường tìm thấy trong/usr/local/apache2/conf/httpd.conf) mới, dùng nội dung sau toàn thực thi): # ================================================= # Basic settings # ================================================= User apache Group apache ServerAdmin webmaster@www.seccure.lab ServerName www.seccure.lab UseCanonicalName Off ServerSignature Off HostnameLookups Off ServerTokens Prod ServerRoot "/usr/local/apache2" DocumentRoot "/www" PidFile /usr/local/apache2/logs/httpd.pid ScoreBoardFile /usr/local/apache2/logs/httpd.scoreboard DirectoryIndex index.html # ================================================= # HTTP and performance settings # ================================================= Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 30 MinSpareServers MaxSpareServers 10 StartServers MaxClients 150 MaxRequestsPerChild # ================================================= # Access control # ================================================= Options None AllowOverride None Order deny,allow Deny from all Order allow,deny Allow from all # ================================================= # MIME encoding # ================================================= TypesConfig /usr/local/apache2/conf/mime.types DefaultType text/plain AddEncoding x-compress AddEncoding x-gzip Z gz tgz AddType application/x-compress AddType application/x-gzip AddType application/x-tar Z gz tgz tgz AddType application/x-x509-ca-cert AddType application/x-pkcs7-crl crt crl # ================================================= # Logs # ================================================= LogLevel warn LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-A combined LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent ErrorLog /usr/local/apache2/logs/error_log CustomLog /usr/local/apache2/logs/access_log combined CustomLog logs/ssl_request_log \ "%t %h %{HTTPS}x %{SSL_PROTOCOL}x %{SSL_CIPHER}x \ %{SSL_CIPHER_USEKEYSIZE}x %{SSL_CLIENT_VERIFY}x \"%r # ================================================= # SSL/TLS settings # ================================================= Listen 0.0.0.0:443 SSLEngine on SSLOptions +StrictRequire SSLRequireSSL SSLProtocol -all +TLSv1 +SSLv3 SSLCipherSuite HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+ME SSLMutex file:/usr/local/apache2/logs/ssl_mutex SSLRandomSeed startup file:/dev/urandom 1024 SSLRandomSeed connect file:/dev/urandom 1024 SSLSessionCache shm:/usr/local/apache2/logs/ssl_cache_shm SSLSessionCacheTimeout 600 SSLPassPhraseDialog builtin SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.crt SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.key SSLVerifyClient none SSLProxyEngine off AddType application/x-x509-ca-cert AddType application/x-pkcs7-crl crt crl SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 Chú ý: Các bạn nên thay đổi số giá trị file cấu hình Chẳng h server, địa e-mail người quản trị.v.v… 4 Tham gia cấu trúc lại thư mục khoá private web server, chứng c hồi chứng (CRLs) umask 022 mkdir /usr/local/apache2/conf/ssl.key mkdir /usr/local/apache2/conf/ssl.crt mkdir /usr/local/apache2/conf/ssl.crl Tạo dịch vụ “tự kí nhận” (nó dùng cho mục đích kiểm tra bạn nên lấy từ CA thích hợp Verisign): openssl req \ -new \ -x509 \ -days 30 \ -keyout /usr/local/apache2/conf/ssl.key/server.key \ -out /usr/local/apache2/conf/ssl.crt/server.crt \ -subj '/CN=Test-Only Certificate' Kiểm tra phần cài đặt Tại thời điểm này, bắt đầu Apache hỗ trợ SSL/TLS sau: /usr/local/apache2/bin/apachectl startssl Apache/2.0.52 mod_ssl/2.0.52 (Pass Phrase Dialog) Some of your private key files are encrypted for security reasons In order to read them you have to provide us with the pass phrases Server 127.0.0.1:443 (RSA) Enter pass phrase:************* Ok: Pass Phrase Dialog successful Sau máy chủ bắt đầu, cố gắng kết nối tới cách trỏ v đường dẫn URL có dạng: https://name.of.the.web.server (trong trường hợp làhttps://www.seccure.lab) Trong vài phút, thấy cảnh báo nói có vấn đề với việc kiểm web server muốn truy cập Minh hoạ hình ví dụ từ MS Hình Cảnh báo trước IE 6.0 Sự xuất cảnh báo cách hoàn hảo! Chúng ta nên nhận sau:  Web browser Certificate Authority (quyền hạn chứng chỉ), đư chứng web server (và khơng thể biết, dùng chứng certificate)  CN (Common Name) – Tên chung cho chứng không nối ghé thời điểm chứng chỉ đọc (Text-only Certificate), tên mi web server (ví dụ như:www.seccure.lab) Sau thực thi với Internet Explorer, nên xem nội dung web sau, nh 4: Hình Trang web làm việc mẫu SSL Một điều cần ý, có khố vàng cuối web browser Điều có thiết lập thành cơng Giá trị 128 bit nói lên khố đối xứng d dịch có độ dài 128 bit Và đủ mạnh (ít thời điểm này) để bảo vệ gia xâm nhập trái phép Nếu kích đúp vào biểu tượng khố, thấy thuộc tính củ hình 5: Hình Các chi tiết chứng tự kí (sekf-signed certificate) Gở rối Nếu lí khơng thể truy cập vào website, có hữu ích “s_client”, nằm thư viện OpenSSL Nó dùng để g SSL/TLS Ví dụ sau cách dùng chức nào: /usr/bin/openssl s_client -connect localhost:443 CONNECTED(00000003) depth=0 /CN=Test-Only Certificate verify error:num=18:self signed certificate verify return:1 depth=0 /CN=Test-Only Certificate verify return:1 Certificate chain s:/CN=Test-Only Certificate i:/CN=Test-Only Certificate Server certificate -BEGIN CERTIFICATE - MIICLzCCAZigAwIBAgIBADANBgkqhkiG9w0BAQQFADAgMR4wHAY LU9ubHkgQ2VydGlmaWNhdGUwHhcNMDQxMTIyMTg0ODUxWhcNMD WjAgMR4wHAYDVQQDExVUZXN0LU9ubHkgQ2VydGlmaWNhdGUwg AQEBBQADgY0AMIGJAoGBAMEttnihJ7JpksdToPi5ZVGcssUbHn/G+4G KvYuqNxBkSqqM1AanR0BFVEtVCSuq8KS9LLRdQLJ/B1UTMOGz1Pb14 LdLEFaCyfkjNKnUgeKMyzsdhZ52pF9febB+d8cLmvXFve28sTIxLCUK7l4 AgMBAAGjeTB3MB0GA1UdDgQWBBQ50isUEV6uFPZ0L4RbRm41+i1C QTA/gBQ50isUEV6uFPZ0L4RbRm41+i1CpaEkpCIwIDEeMBwGA1UEAxM bmx5IENlcnRpZmljYXRlggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZI gYEAThyofbK3hg8AJXbAUD6w6+mz6dwsBmcTWLvYtLQUh86B0zWnV NxfJ7yfo0PkqNnjHfvnb5W07GcfGgLx5/U3iUROObYlwKlr6tQzMoysNQ/Y 52sGsqaOOWpYlAGOaM8j57Nv/eXogQnDRT0txXqoVEbunmM= -END CERTIFICATE subject=/CN=Test-Only Certificate issuer=/CN=Test-Only Certificate No client certificate CA names sent SSL handshake has read 1143 bytes and written 362 bytes New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA Server public key is 1024 bit SSL-Session: Protocol : SSLv3 Cipher : DHE-RSA-AES256-SHA Session-ID: 56EA68A5750511917CC42A1B134A8F218C27C9C0241C35C53977A2A8B Session-ID-ctx: Master-Key: 303B60D625B020280F5F346AB00F8A61A7C4BEA707DFA0ED8D2F5237 7FB6EFFC02CE3B48F912D2C8929DB5BE Key-Arg : None Start Time: 1101164382 Timeout : 300 (sec) Verify return code: 18 (self signed certificate) GET / HTTP/1.0 HTTP/1.1 200 OK Date: Mon, 22 Nov 2004 22:59:56 GMT Server: Apache Last-Modified: Mon, 22 Nov 2004 17:24:56 GMT ETag: "5c911-46-229c0a00" Accept-Ranges: bytes Content-Length: 70 Connection: close Content-Type: text/html Test works closed Chức s_client có nhiều tuỳ chọn hữu ích Chẳng hạn tắt/mở (on/off) m (-ssl2 , -ssl3, -tls1) Sau khởi động lại Apache kiểm tra file đăng nhậ (/usr/local/apache2/logs/) để có thêm thơng tin Chúng ta dùng Ethereal ssldump Chúng ta xem c thơng báo Handshake SSL, cố gắng tìm lí lỗi khơng có Một hình nhỏ thực thi việc Ethereal mơ tả hình Hình Màn hình Ethereal với phương thức SSL Handshake Kết luận phần I Việc cài đặt chạy Apache secure giao thức SSL chứng m loạt Trong phần hai tới bạn giới thiều thiết thực thi cho mod_ssl, tiến trình tạo chứng web server phù ... Ethereal mơ tả hình Hình Màn hình Ethereal với phương thức SSL Handshake Kết luận phần I Việc cài đặt chạy Apache secure giao thức SSL chứng m loạt Trong phần hai tới bạn giới thiều thiết thực thi... đặt Tại thời điểm này, bắt đầu Apache hỗ trợ SSL/TLS sau: /usr/local /apache2 /bin/apachectl startssl Apache/ 2.0. 52 mod_ssl /2.0. 52 (Pass Phrase Dialog) Some of your private key files are encrypted... -keyout /usr/local /apache2 /conf/ssl.key/server.key \ -out /usr/local /apache2 /conf/ssl.crt/server.crt \ -subj ''/CN=Test-Only Certificate'' Kiểm tra phần cài đặt Tại thời điểm này, bắt đầu Apache hỗ trợ

Ngày đăng: 26/02/2014, 12:20

Hình ảnh liên quan

Hình 3. Cảnh báo trước của IE 6.0. - Tài liệu Apache 2.0 với giao thức SSL/TLS: Hướng dẫn từng bước (tiếp Phần I) pdf

Hình 3..

Cảnh báo trước của IE 6.0 Xem tại trang 12 của tài liệu.
Hình 4. Trang web làm việc mẫu của SSL. - Tài liệu Apache 2.0 với giao thức SSL/TLS: Hướng dẫn từng bước (tiếp Phần I) pdf

Hình 4..

Trang web làm việc mẫu của SSL Xem tại trang 13 của tài liệu.
Hình 5. Các chi tiết của chứng chỉ tự kí (sekf-signed certificate) - Tài liệu Apache 2.0 với giao thức SSL/TLS: Hướng dẫn từng bước (tiếp Phần I) pdf

Hình 5..

Các chi tiết của chứng chỉ tự kí (sekf-signed certificate) Xem tại trang 14 của tài liệu.
Hình 6. Màn hình Ethereal với phương thức SSL Handshake. - Tài liệu Apache 2.0 với giao thức SSL/TLS: Hướng dẫn từng bước (tiếp Phần I) pdf

Hình 6..

Màn hình Ethereal với phương thức SSL Handshake Xem tại trang 19 của tài liệu.

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan