Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » В помощь системному администратору » Apache 2.x Win32 и SSL (https)

Модерирует : lynx, Crash_Master, dg, emx, ShriEkeR

 Версия для печати • ПодписатьсяДобавить в закладки
Страницы: 1 2

Открыть новую тему     Написать ответ в эту тему

Wlad



Junior Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
ssl.conf вроде в норме, а при подключении модуля mod_ssl.so сервер вываливается с ошибкой. Перелопатил кучу инета и создалось впечатление, что под 2.х вообще не работает, только под 1.х. Может есть решение без этого модуля? Напр. с OpenSSL  и SSLeay32.dll я откровенно говоря не понял, что делать. У кого-нибудь это работает?

Всего записей: 72 | Зарегистр. 11-03-2002 | Отправлено: 06:50 31-05-2003 | Исправлено: lynx, 20:41 22-06-2004
lynx



Advanced lynx
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Wlad
 

Цитата:
ри подключении модуля mod_ssl.so сервер вываливается с ошибкой

 
С какой?
 

Цитата:
ssl.conf вроде в норме

 
Покажи.
 

Всего записей: 11712 | Зарегистр. 08-05-2001 | Отправлено: 20:26 31-05-2003
Wlad



Junior Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Вот значица ssl.conf
===========================================================
#
# This is the Apache server configuration file providing SSL support.
# It contains the configuration directives to instruct the server how to
# serve pages over an https connection. For detailing information about these  
# directives see <URL:http://httpd.apache.org/docs-2.0/mod/mod_ssl.html>
#
#   For the moment, see <URL:http://www.modssl.org/docs/> for this info.  
#   The documents are still being prepared from material donated by the
#   modssl project.
#  
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
<IfModule mod_ssl.c>
 
#   Until documentation is completed, please check http://www.modssl.org/
#   for additional config examples and module docmentation.  Directives
#   and features of mod_ssl are largely unchanged from the mod_ssl project
#   for Apache 1.3.
 
#
# When we also provide SSL we have to listen to the  
# standard HTTP port (see above) and to the HTTPS port
#
# Note: Configurations that use IPv6 but not IPv4-mapped addresses need two
#       Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443"
#
Listen 443
 
##
##  SSL Global Context
##
##  All SSL configuration in this context applies both to
##  the main server and all SSL-enabled virtual hosts.
##
 
#
#   Some MIME-types for downloading Certificates and CRLs
#
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
 
#   Pass Phrase Dialog:
#   Configure the pass phrase gathering process.
#   The filtering dialog program (`builtin' is a internal
#   terminal dialog) has to provide the pass phrase on stdout.
SSLPassPhraseDialog  builtin
 
#   Inter-Process Session Cache:
#   Configure the SSL Session Cache: First the mechanism  
#   to use and second the expiring timeout (in seconds).
#SSLSessionCache        none
#SSLSessionCache        shmht:logs/ssl_scache(512000)
#SSLSessionCache        shmcb:logs/ssl_scache(512000)
SSLSessionCache         dbm:logs/ssl_scache
SSLSessionCacheTimeout  300
 
#   Semaphore:
#   Configure the path to the mutual exclusion semaphore the
#   SSL engine uses internally for inter-process synchronization.  
SSLMutex  file:logs/ssl_mutex
 
#   Pseudo Random Number Generator (PRNG):
#   Configure one or more sources to seed the PRNG of the  
#   SSL library. The seed data should be of good random quality.
#   WARNING! On some platforms /dev/random blocks if not enough entropy
#   is available. This means you then cannot use the /dev/random device
#   because it would lead to very long connection times (as long as
#   it requires to make more entropy available). But usually those
#   platforms additionally provide a /dev/urandom device which doesn't
#   block. So, if available, use this one instead. Read the mod_ssl User
#   Manual for more details.
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
#SSLRandomSeed startup file:/dev/random  512
#SSLRandomSeed startup file:/dev/urandom 512
#SSLRandomSeed connect file:/dev/random  512
#SSLRandomSeed connect file:/dev/urandom 512
 
##
## SSL Virtual Host Context
##
 
<VirtualHost _default_:443>
 
#  General setup for the virtual host
DocumentRoot "D:/www"
ServerName localhost:443
ServerAdmin admin@waldenburg.d2g.com
ErrorLog "C:/Program Files/Apache Group/Apache2/logs/errssl.log"
TransferLog "C:/Program Files/Apache Group/Apache2/logs/accessl.log"
 
#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on
 
#   SSL Cipher Suite:
#   List the ciphers that the client is permitted to negotiate.
#   See the mod_ssl documentation for a complete list.
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
 
#   Server Certificate:
#   Point SSLCertificateFile at a PEM encoded certificate.  If
#   the certificate is encrypted, then you will be prompted for a
#   pass phrase.  Note that a kill -HUP will prompt again.  Keep
#   in mind that if you have both an RSA and a DSA certificate you
#   can configure both in parallel (to also allow the use of DSA
#   ciphers, etc.)
SSLCertificateFile "C:/Program Files/Apache Group/Apache2/conf/ssl.crt/snakeoil-rsa.crt"
#SSLCertificateFile"C:/Program Files/Apache Group/Apache2/conf/ssl.crt/snakeoil-dsa.crt"
 
#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you've both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile "C:/Program Files/Apache Group/Apache2/conf/ssl.key/snakeoil-rsa.key"
#SSLCertificateKeyFile "C:/Program Files/Apache Group/Apache2/conf/ssl.key/snakeoil-dsa.key"
 
#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFile
#   when the CA certificates are directly appended to the server
#   certificate for convinience.
#SSLCertificateChainFile "C:/Program Files/Apache Group/Apache2/conf/ssl.crt/ca.crt"
 
#   Certificate Authority (CA):
#   Set the CA certificate verification path where to find CA
#   certificates for client authentication or alternatively one
#   huge file containing all of them (file must be PEM encoded)
#   Note: Inside SSLCACertificatePath you need hash symlinks
#         to point to the certificate files. Use the provided
#         Makefile to update the hash symlinks after changes.
#SSLCACertificatePath "C:/Program Files/Apache Group/Apache2/conf/ssl.crt"
#SSLCACertificateFile "C:/Program Files/Apache Group/Apache2/conf/ssl.crt/ca-bundle.crt"
 
#   Certificate Revocation Lists (CRL):
#   Set the CA revocation path where to find CA CRLs for client
#   authentication or alternatively one huge file containing all
#   of them (file must be PEM encoded)
#   Note: Inside SSLCARevocationPath you need hash symlinks
#         to point to the certificate files. Use the provided
#         Makefile to update the hash symlinks after changes.
#SSLCARevocationPath "C:/Program Files/Apache Group/Apache2/conf/ssl.crl"
#SSLCARevocationFile "C:/Program Files/Apache Group/Apache2/conf/ssl.crl/ca-bundle.crl"
 
#   Client Authentication (Type):
#   Client certificate verification type and depth.  Types are
#   none, optional, require and optional_no_ca.  Depth is a
#   number which specifies how deeply to verify the certificate
#   issuer chain before deciding the certificate is not valid.
#SSLVerifyClient require
#SSLVerifyDepth  10
 
#   Access Control:
#   With SSLRequire you can do per-directory access control based
#   on arbitrary complex boolean expressions containing server
#   variable checks and other lookup directives.  The syntax is a
#   mixture between C and Perl.  See the mod_ssl documentation
#   for more details.
#<Location />
#SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
#            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
#            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
#            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
#            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
#           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
#</Location>
 
#   SSL Engine Options:
#   Set various options for the SSL engine.
#   o FakeBasicAuth:
#     Translate the client X.509 into a Basic Authorisation.  This means that
#     the standard Auth/DBMAuth methods can be used for access control.  The
#     user name is the `one line' version of the client's X.509 certificate.
#     Note that no password is obtained from the user. Every entry in the user
#     file needs this password: `xxj31ZMTZzkVA'.
#   o ExportCertData:
#     This exports two additional environment variables: SSL_CLIENT_CERT and
#     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
#     server (always existing) and the client (only existing when client
#     authentication is used). This can be used to import the certificates
#     into CGI scripts.
#   o StdEnvVars:
#     This exports the standard SSL/TLS related `SSL_*' environment variables.
#     Per default this exportation is switched off for performance reasons,
#     because the extraction step is an expensive operation and is usually
#     useless for serving static content. So one usually enables the
#     exportation for CGI and SSI requests only.
#   o CompatEnvVars:
#     This exports obsolete environment variables for backward compatibility
#     to Apache-SSL 1.x, mod_ssl 2.0.x, Sioux 1.0 and Stronghold 2.x. Use this
#     to provide compatibility to existing CGI scripts.
#   o StrictRequire:
#     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
#     under a "Satisfy any" situation, i.e. when it applies access is denied
#     and no other module can change it.
#   o OptRenegotiate:
#     This enables optimized SSL connection renegotiation handling when SSL
#     directives are used in per-directory context.  
SSLOptions +FakeBasicAuth +ExportCertData +CompatEnvVars +StrictRequire
<Files ~ "\.(cgi|shtml|phtml|php3|php4|php?)$">
    SSLOptions +StdEnvVars
</Files>
<Directory "D:/www/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
 
#   SSL Protocol Adjustments:
#   The safe and default but still SSL/TLS standard compliant shutdown
#   approach is that mod_ssl sends the close notify alert but doesn't wait for
#   the close notify alert from client. When you need a different shutdown
#   approach you can use one of the following variables:
#   o ssl-unclean-shutdown:
#     This forces an unclean shutdown when the connection is closed, i.e. no
#     SSL close notify alert is send or allowed to received.  This violates
#     the SSL/TLS standard but is needed for some brain-dead browsers. Use
#     this when you receive I/O errors because of the standard approach where
#     mod_ssl sends the close notify alert.
#   o ssl-accurate-shutdown:
#     This forces an accurate shutdown when the connection is closed, i.e. a
#     SSL close notify alert is send and mod_ssl waits for the close notify
#     alert of the client. This is 100% SSL/TLS standard compliant, but in
#     practice often causes hanging connections with brain-dead browsers. Use
#     this only for browsers where you know that their SSL implementation
#     works correctly.  
#   Notice: Most problems of broken clients are also related to the HTTP
#   keep-alive facility, so you usually additionally want to disable
#   keep-alive for those clients, too. Use variable "nokeepalive" for this.
#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
#   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
#   "force-response-1.0" for this.
SetEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
 
#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
CustomLog D:/www/cgi-bin/logs/ssl_request.log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
 
</VirtualHost>                                  
 
</IfModule>
 
===========================================================
 
 А вот такая вот  ошибка:
 
Служба "Apache2" завершена из-за внутренней ошибки 1.  Код 7024
 
(OS 10048)&#9580;с&#8730;ўэю ЁрчЁх°рхЄё  юфэю шёяюы№чютрэшх рфЁхёр ёюъхЄр  (яЁюЄюъюы/ёхЄхтющ рфЁхё/яюЁЄ).  : mak
e_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down
Unable to open logs
и вот такую чушь еще пишет.

Всего записей: 72 | Зарегистр. 11-03-2002 | Отправлено: 23:22 31-05-2003
Wlad



Junior Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Lynx
Нет никаких мыслей по поводу...?

Всего записей: 72 | Зарегистр. 11-03-2002 | Отправлено: 16:47 02-06-2003
Yaroslav_Behter

Newbie
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Я специально для ssl вытащил апач 1.3.27, а результат отрицательный.
OpenSSL скомпилировал, mod_ssl.so тоже скомпилировал. Все нормально, без ошибок.
Потом компилирую апач, он компилится нормально, только в конце для правки httpd.conf используется утилита awk. Ее не было. Нашел замену gawk. Она работает не правильно, не хватает памяти. Ну это не страшно. Сам изменил файл конфигурации. Запускаю, он работает, а библиотеку mod_ssl.so не подтягивает и mod_ssl.c тоже не вкючилась в апач!
Уже бьюсь над этой проблемой вторую неделю. Если кто-то может помочь, ХЕЛП!

Всего записей: 6 | Зарегистр. 21-07-2003 | Отправлено: 14:55 21-07-2003
Cheery



.:МордератоР:.
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Yaroslav_Behter
Какое сообщение об ошибке появляется???
Можешь взять awk отсюда.. только переименуй..
http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe

----------
Away/DND

Всего записей: 52737 | Зарегистр. 04-04-2002 | Отправлено: 16:09 21-07-2003
Yaroslav_Behter

Newbie
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
"Did you copy the openssl DLLs to WINNT/SYSTEM32 (or WINDOWS/SYSTEM on Win9x/ME)? "
 
Помоему в этом ошибка была! Я эти длл-ки не копировал с систем32!. А щас скопировал, и сразу подгружается этот модуль!
А за awk - ОГРОМНОЕ СПАСИБО!
 
Конечно, еще не правильно апач работает, но сдвиг с места серьёзный.
Не грузится страница, если набирать https:// . А просто http:// грузится!
Буду ковырять!

Всего записей: 6 | Зарегистр. 21-07-2003 | Отправлено: 16:47 21-07-2003
Cheery



.:МордератоР:.
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Yaroslav_Behter

Цитата:
Не грузится страница, если набирать https:// . А просто http:// грузится!  

А ты в ssl.conf прописал, какой порт слушать? Создал сертификаты?

----------
Away/DND

Всего записей: 52737 | Зарегистр. 04-04-2002 | Отправлено: 17:25 21-07-2003
Yaroslav_Behter

Newbie
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Я прописал все в httpd.conf. Я думаю, разницы никакой.
Так порты прописаны:
<IfDefine SSL>
Listen 80
Listen 443
</IfDefine>
 
а дальше
 
<VirtualHost ssl.ua:443>
#  General setup for the virtual host
DocumentRoot "c:/www"
ServerName ssl.ua
ServerAdmin admin@ssl.ua
ErrorLog logs/error_log_ssl
TransferLog logs/access_log_ssl
 
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile c:/apache1.3.27/conf/ssl.crt/snakeoil-dsa.crt
SSLCertificateKeyFile c:/apache1.3.27/conf/ssl.key/snakeoil-dsa.key
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
    SSLOptions +StdEnvVars
</Files>
<Directory "c:/www">
    SSLOptions +StdEnvVars
</Directory>
SetEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
 
</VirtualHost>
 
Сертификаты я взял те, что с пакетом mod_ssl.so идут. Может они просроченые?
А вот еще вопрос! Вот эта строка:
SSLMutex  file:logs/ssl_mutex
при запуске апача выдает ошибку. Я ее закоментировал.
Ошибка такая:
Syntax error on line 1072 of apache1.3.27/conf/httpd.conf:
SSLMutex: Lockfiles not available on this platform
Note the errors or messages above, and press the <ESC> key to exit.  25...
Я не знаю, на сколько это правильно.

Всего записей: 6 | Зарегистр. 21-07-2003 | Отправлено: 17:46 21-07-2003
Cheery



.:МордератоР:.
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Yaroslav_Behter

Цитата:
Syntax error on line 1072 of apache1.3.27/conf/httpd.conf:  
SSLMutex: Lockfiles not available on this platform  

Напиши SSLMutex  default

----------
Away/DND

Всего записей: 52737 | Зарегистр. 04-04-2002 | Отправлено: 20:38 21-07-2003
Yaroslav_Behter

Newbie
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
По умолчанию зачение "none". Слово default не поддерживается.
Написал none, все равно не пашет.
Если набирать http://ssl.ua:443/, то выводит страницу.
А если набрать https://ssl.ua/ - не найдена страница.
 
И еще, оказывается конструкция  
<IfDefine SSL>  
 ...
</IfDefine>  
не выполняется, т.е. настройки внутри этого блока не включаются. А почему, не пойму.

Всего записей: 6 | Зарегистр. 21-07-2003 | Отправлено: 12:21 22-07-2003
Cheery



.:МордератоР:.
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Yaroslav_Behter

Цитата:
По умолчанию зачение "none". Слово default не поддерживается.  
Написал none, все равно не пашет.  

Ясно.. я то со вторым апачем работаю..
 

Цитата:
Если набирать http://ssl.ua:443/,  то выводит страницу.  
А если набрать https://ssl.ua/  - не найдена страница.  

А это означает, что у тебя в браузере неправильные ассоциации с протоколом https... Видимо не на тот порт лезет..

----------
Away/DND

Всего записей: 52737 | Зарегистр. 04-04-2002 | Отправлено: 16:14 22-07-2003
Yaroslav_Behter

Newbie
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Ладно! Уговорили.  
У меня то и стоял Apache2.0.44, а я нашел только mod_ssl для 1.3.27. Он так и называется mod_ssl-2.8.14-1.3.27. Поэтому вытащил специально Apache1.3.27 и начал вместе все до кучи собирать.
Где тогда взять mod_ssl для второго апача?
Если можеш, на аську 127721176

Всего записей: 6 | Зарегистр. 21-07-2003 | Отправлено: 17:29 22-07-2003
Cheery



.:МордератоР:.
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Yaroslav_Behter

Цитата:
У меня то и стоял Apache2.0.44, а я нашел только mod_ssl для 1.3.27. Он так и называется mod_ssl-2.8.14-1.3.27. Поэтому вытащил специально Apache1.3.27 и начал вместе все до кучи собирать.  
Где тогда взять mod_ssl для второго апача?  

Как где ?) качаешь сорсы для второго апача.. там уже есть mod_ssl..
Ед, что еще нужно скачать это openssl и заранее откомпилять.. потом компиляешь апач.. например в VC 6... и все.

Цитата:
 
Если набирать http://ssl.ua:443/,   то выводит страницу.  
 

А вот это фигня ) У тебя просто апач слушает на этом порту без ssl... Иначе выдало бы что то в таком виде..

Цитата:
 
Bad request!
Your browser (or proxy) sent a request that this server could not understand.  
If you think this is a server error, please contact the webmaster  
 

Так что с браузером все ок.. а нехорошо с апачем..

----------
Away/DND

Всего записей: 52737 | Зарегистр. 04-04-2002 | Отправлено: 19:00 22-07-2003 | Исправлено: Cheery, 19:15 22-07-2003
Yaroslav_Behter

Newbie
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

Цитата:
И еще, оказывается конструкция  
<IfDefine SSL>  
 ...  
</IfDefine>  
не выполняется, т.е. настройки внутри этого блока не включаются. А почему, не пойму

Нашел! Я в одном месте убрал эти теги, а в другом нет. Как раз там, где настраивался виртуальный хост с ссл-ем! Получается он и слушал этот порт, но как простой, без ссл.
 
Завтра займусь вторым апачем. Этот уже победил.

Всего записей: 6 | Зарегистр. 21-07-2003 | Отправлено: 19:38 22-07-2003
Audciz



Advanced Member
Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору
Сорри за поднатие темы. Но как всё-таки установить поддержку ssl на Apache2. Система WinXP.

Всего записей: 649 | Зарегистр. 13-02-2003 | Отправлено: 17:24 04-06-2004
Cheery



.:МордератоР:.
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Для тех, кто в танке.. сертификат лучше создавать под линухом - там удобнее.. как?
http://www.modssl.org/docs/2.8/ssl_faq.html#ToC29
плюс не помню откуда.. всюду, где упоминается файл с расширением .sh есть такой же (насколько помню)  с расширением .pl

Цитата:
Введение
Пытаясь настроить кодированное соединение по https-протоколу, чтобы просто не гонять пароли открытым текстом, столкнулась с проблемой - развитие документации, проработка удобства, и чарующая простота не являются свойствами этой технологии. Хотя, вроде всё просто - есть дерево подписей и подписанный сертификат (грубо говоря - визитка сервера, с которым происходит соединение). Вы смотрите дерево подписей и сами думаете, доверяете вы этим подписям или нет. Или же у вас есть копия сертификата и вы сравниваете. В конце концов (и это требуется чаще всего) вам хочется не очень светиться эксклюзивными данными и вам всё равно какие там визитки. Эту простую задачу превратили в монстроидальный набор крючочков и ручечек. Мне понадобилась неделя чтобы, используя иногда по 3 статьи на разных языках одновременно , дойти до решения вопроса (у меня была задача номер три из моего списка  
 
Задача
Создать конфигурацию виртуального сервера с возможностью подключения по HTTPS-протоколу для более менее безопасной передачи эксклюзивных данных (трафик будет шифроваться). Вопрос начального обмена ключами, который может повлиять на безопасность соединения, я оставлю для самостоятельного изучения, как проблему выходящую за рамки этой статьи.  
 
Используемые инструменты
FreeBSD-4.7  
OpenSSL 0.9.6g  
Apache/1.3.26 + mod_perl/1.27  
Настройка конфигурации OpenSSL
В файлике /etc/ssl/openssl.cnf надо проделать следующие изменения:  
 
[ CA_default ]
 
dir             = .                     # Это каталог для работы с ssl
certs           = $dir/ssl.crt          # Это где будут лежать сертификаты
crl_dir         = $dir/ssl.crl          # Это где будут  листы "отзывов подписей"
database        = $dir/index.txt        # Здесь index file для индексирования запросов на подпись
new_certs_dir   = $dir/ssl.crt          # Сюда будут писать новые сертификаты
 
certificate     = $dir/nemesida-ca.pem  # Корневой сертификат
serial          = $dir/serial           # Серийный номер запроса
crl             = $dir/ssl.crl/nemesida.pem             # Текущий лист отзывов подписей
private_key     = $dir/ssl.key/nemesida-ca.key# Секретный ключ для основного сертификата
RANDFILE        = $dir/ssl.key/.rand    #  
 
Я так и не нашла, как обойти эти вещи заданием ключей, так что придётся править конфиг.  
 
Создаём "корневой" сертификат
Для удобства, перейдём в каталог с конфигурацией Apache, где у меня располагаются подкаталоги с искомыми сертификатами:  
 
# cd /usr/local/etc/apache  
 
Корневой сертификат является корнем дерева подписей и является как бы самой ГЛАВНОЙ подписью. Секретный ключ (он нужен для того, чтобы можно было воспользоваться вашим корневым сертификатом для подписи остальных) и сертификат создаются одной командой:  
 
# openssl req -config /etc/ssl/openssl.cnf -new -x509 -keyout ssl.key/nemesida-ca.pem -out nemesida-ca.pem -days 3650  
 
Вас спросят пароль - введите и запомните его. Все остальные поля заполняйте так, как вам подскажет сердце. Снимите пароль с ключа:  
 
# openssl rsa -in ssl.key/nemesida-ca.pem -out nemesida-ca.key  
 
Если вы не сможете спасти этот ключ от посягательств, то и пароль вам не поможет. Что делает эта строка, я затрудняюсь ответить точно, но так сделать рекомендуют:  
 
# openssl x509 -in nemesida-ca.pem -out nemesida-ca.crt  
 
Вот и всё - главная подпись, т.е. корневой сертификат, у вас есть. Он подписан сам собой.  
 
Подготавливаем площадку
Следующие действия, которые надо не забыть совершить, вызывают у меня бурный восторг. Следует создать два файла с некоторой индексной информацией, создать которые openssl не может, равно как и выдать разумное сообщение по этому поводу. Создадим индексный файл (ключевое слово database из openssl.cnf):  
 
# touch index.txt  
 
Создадим файл серийных номеров (ключевое слово serial из openssl.cnf):  
 
# echo '01' > serial  
 
Этот файл должен содержать две цифры (обязательно). Если вы ещё не создавали никаких сертификатов кроме корневого, файл должен содержать 01.  
 
Создаём сертификат сервера
Создание сертификатов сервера состоит из процедуры создания запроса на попись, а затем подписания этого запроса в отличии от создания самоподписанного корневого сертификата. Создаём запрос на подпись нового сертификата и создаём секретный ключ к нему:  
 
# openssl req -config /etc/ssl/openssl.cnf -new -keyout ssl.key/nemesida.pem -out ssl.csr/nemesida.pem  
 
Вводя даные, учтите, что поле Common Name должно содержать полностью определённое доменное имя (FQDN) того сайта, где вы будете использовать https-протокол, чтобы броузеры не выдавали предупреждения о неверности имени. Снимите пароль с ключа:  
 
# openssl rsa -in ssl.key/nemesida.pem -out nemesida.key  
 
Подпишите запрос (подписка запроса и есть создание нового сертификата) своим корневым сертификатом:  
 
# openssl ca -config /etc/ssl/openssl.cnf -policy policy_anything -out ssl.crt/nemesida.pem -infiles ssl.csr/nemesida.pem  
 
Подготовьте сертификат к использованию:  
 
# openssl x509 -in ssl.crt/nemesida.pem -out ssl.crt/nemesida.crt  
 
Списки запросов
Создайте на всякий случай список запросов (там будут храниться и данные по отзывам подписей, если вам это когда-либо понадобится):  
 
# openssl ca -gencrl -out ssl.crl/nemesida.pem  
 
Настройка Apache
В файле httpd.conf (сами найдите ваш файл конфигурации) прописываем:  
 
NameVirtualHost *:443
 
DocumentRoot "/home/nemesida/www"
ServerName nemesida.ru
ScriptAlias /cgi-bin/ /home/nemesida/cgi-bin/
SSLEngine on
SSLCertificateFile /usr/local/etc/apache/ssl.rt/nemesida.crt
SSLCertificateKeyFile /usr/local/etc/apache/ssl.key/nemesida.key
SSLCACertificateFile /usr/local/etc/apache/nemesida-ca.crt
SSLCARevocationFile /usr/local/etc/apache/ssl.crl/nemesida.crl
 
    SSLOptions +StdEnvVars
 
 
    SSLOptions +StdEnvVars
 
SetEnvIf User-Agent ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
 
Вот собственно и всё. Запускаете Apache и проверяете.  
 
Замечания
Пока вы не разберётесь в работе SSL, нельзя считать соединение безопасным. В данном случае представлен быстрый вариант настройки, не дающий никаких гарантий. Практически - это защита от дурака, которой тоже пренебрегать не следует.  
Берегите секретные ключи - иначе вся эта мышиная возня не имеет смысла.  
Поддержка виртуальных хостов "name based" возможна не в полном варианте - сетрификат вы не сможете сделать различными для разных "name based" виртуальных хостов. Это связано с тем, что сначала устанавливается SSL-туннель, а затем по нему идёт обмен данными, что определяет выбор сертификатов до получения HTTP-запроса.  
 

 
вот еще способ..

Цитата:
hagbard@fnord:~/certs$ /usr/local/ssl/misc/CA.pl -newca
CA certificate filename (or enter to create)
 
Making CA certificate ...
Using configuration from /usr/local/ssl/openssl.cnf
Generating a 1024 bit RSA private key
...............++++++
......................................++++++
writing new private key to './demoCA/private/cakey.pem'
Enter PEM pass phrase:
Verifying password - 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]:US
State or Province Name (full name) [Some-State]:California
Locality Name (eg, city) []:Sebastopol
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Illuminatus
   Enterprises, Ltd
Organizational Unit Name (eg, section) []:Administration
Common Name (eg, YOUR name) []:Hagbard Celine
Email Address []:hagbardceline1723@yahoo.com
Congratulations. You're the proud owner of your very own Certificate Authority. Take a look around:  
 
hagbard@fnord:~/certs$ ls
demoCA/
hagbard@fnord:~/certs$ cd demoCA/
hagbard@fnord:~/certs/demoCA$ ls -l
total 24
-rw-r--r--    1 rob      users        1407 Sep  8 14:12 cacert.pem
drwxr-xr-x    2 rob      users        4096 Sep  8 14:12 certs/
drwxr-xr-x    2 rob      users        4096 Sep  8 14:12 crl/
-rw-r--r--    1 rob      users           0 Sep  8 14:12 index.txt
drwxr-xr-x    2 rob      users        4096 Sep  8 14:12 newcerts/
drwxr-xr-x    2 rob      users        4096 Sep  8 14:12 private/
-rw-r--r--    1 rob      users           3 Sep  8 14:12 serial
The public key for your new Certificate Authority is contained in cacert.pem, and the private key is in private/cakey.pem. You can now use this private key to sign other SSL certs.  
 
To use your CA's authority to sign SSL certs, you'll need to make a new cert that a web server (such as Apache) can use. First, generate a private key and certificate request (see man CA.pl or my book, Linux Server Hacks). Now you can sign the new request with your own CA's key:  
 
hagbard@fnord:~/certs$ openssl ca -policy policy_anything \
  -out propaganda.discordia.eris.crt \
  -infiles propaganda.discordia.eris.csr
 
Using configuration from /usr/local/ssl/openssl.cnf
Enter PEM pass phrase:
Check that the request matches the signature
Signature ok
The Subjects Distinguished Name is as follows
countryName           RINTABLE:'US'
stateOrProvinceName   RINTABLE:'Texas'
localityName          RINTABLE:'Mad Dog'
organizationName      RINTABLE:'Discordia, Inc.'
organizationalUnitName:PRINTABLE:'Operations'
commonName            RINTABLE:'propaganda.discordia.eris'
emailAddress          :IA5STRING:'hail@discordia.eris'
Certificate is to be certified until Sep  8 22:49:26 2003 GMT (365 days)
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
Now, to use the .crt and .key with Apache + mod_ssl (or Apache-ssl), install them as you normally would (perhaps with lines like these):  
 
SSLCertificateFile /usr/local/apache/conf/ssl.crt/propaganda.discordia.eris.crt
SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/propaganda.discordia.eris.key
 


----------
Away/DND

Всего записей: 52737 | Зарегистр. 04-04-2002 | Отправлено: 20:44 22-06-2004
Bersarea



Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
При загрузке странички после того, как запросила(о) сертификат выдает сообщение следующего содержания :  
"This page contains both secure and nonsecure items. Do you want to display the nonsecure items? "
 
Вопрос в следующем:  
1. что может вызывать "это"?
2. Как от "этого" избавиться ?

Всего записей: 272 | Зарегистр. 08-02-2004 | Отправлено: 05:12 01-02-2005
Cheery



.:МордератоР:.
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Bersarea

Цитата:
Вопрос в следующем:  
1. что может вызывать "это"?  
2. Как от "этого" избавиться ?  

1. линки типа http
2. использовать относительные линки или c https

Цитата:
Downloading non-secure content from a secure Web site
 
The Web site you are viewing is a secure site. It uses a security protocol such as SSL (Secure Sockets Layer) or PCT (Private Communications Technology) to secure the information you send and receive.  
When sites use a security protocol, information that you provide, such as your name or credit-card number, is encrypted so that other people can’t read it. However, this Web page also contains items that do not use this secure protocol.  
Given what you know about this Web site and your computer, you must decide whether to continue working with this site.  
 
If you do not feel confident about working with this site, click No.


----------
Away/DND

Всего записей: 52737 | Зарегистр. 04-04-2002 | Отправлено: 05:22 01-02-2005
unreal666



Gold Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Как вообще компилировать Apache 2.2.x?
Какие дополнительные файлы нужны (для компиляции с поддержкой mod_sssl)? И где их найти и в какую папку их ложить?
Скачал исходники 2.2.2. Из компиляторов есть Microsoft Studio 2003 (русский) и Borland Compiler C++ 5.5. Сейчас качаю Intel C++.  
Ногами не пинать. Раньше никогда не компилил C++ файлы.
ОС - ВИнда Win2k SP4
Сертификаты для компиляции наверно не нужны?
 


----------
MSI PRO B650-P WIFI / Ryzen 5 7600X / RAM 32Gib / 4 HDD = 10Tib + 1 NVME 2Tib / Radeon RX 560 2Gib / Win 10 x64 // POB, PVD

Всего записей: 6637 | Зарегистр. 14-02-2005 | Отправлено: 22:18 16-06-2006 | Исправлено: unreal666, 02:03 17-06-2006
Открыть новую тему     Написать ответ в эту тему

Страницы: 1 2

Компьютерный форум Ru.Board » Компьютеры » В помощь системному администратору » Apache 2.x Win32 и SSL (https)


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru