Apache2.2.9 + SSL + LDAP 认证配置目前均在 Windows 2003 上实现,linux 上的实现方式应该类似。
必需软件/系统
- 附带 openssl 的 apache server 安装程序。
- 已经配置好并可正常运行的 LDAP 系统,比如 Openldap 或 Sun Directory Server。在此示例中使用的是 Sun Directory Server,OpenLdap 的连接配置应该雷同
- 已经生成好的服务器证书和密钥,server.crt server.key
- 将 server.crt 和 server.key 放在 conf/ssl 下
- 根据以上两个文件的位置修改 conf/extra/http-ssl.conf 的配置
- 完成后,运行 bin/httpd 启动 httpd 服务器。浏览器测试 https://localhost 应该成功
- 再次打开 conf/extra/http-ssl.conf 添加 LDAP 认证信息,保存并再次运行 https://localhost 应该先出现用户名和密码的提示框。详细配置见后面的内容
配置文件内容:
conf/httpd.conf 相关配置片段
- # Secure (SSL/TLS) connections
- Include conf/extra/httpd-ssl.conf
- #
- # Note: The following must must be present to support
- # starting without SSL on platforms with no /dev/random equivalent
- # but a statically compiled-in mod_ssl.
- #
- <IfModule ssl_module>
- SSLRandomSeed startup builtin
- SSLRandomSeed connect builtin
- </IfModule>
conf/extra/http-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.2/mod/mod_ssl.html>
- #
- # 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.
- #
- #
- # 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 file:/dev/random 512
- #SSLRandomSeed startup file:/dev/urandom 512
- #SSLRandomSeed connect file:/dev/random 512
- #SSLRandomSeed connect file:/dev/urandom 512
- #
- # 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
- #