如何安装:OpenSSL + WAMP

Sta*_*bie 6 ssl openssl wamp

这里有没有人有关于如何在我的本地开发机器上获取SSL的明确而详细的步骤?我在c:\ wamp上安装了最新版本的WAMP(2.2c).我在网上找到的说明在大多数情况下似乎已经过时,而且缺乏正确完成工作所需的细节.

小智 11

指南:WampServer 2.5中的Openssl

先决条件:通常不需要安装openssl(它与Wamp捆绑在一起).例如,Apache 2.4.9包含1.0.1g.

系统变量:

  • 打开Windows系统面板("WIN + Q"搜索:系统)>高级系统设置>高级>环境变量
  • 在名为OPENSSL_CONF的系统变量中添加一个新条目,其值为openssl.cnf的路径(通常是C:\ wamp\bin\apache\apache2.4.9\conf\openssl.cnf)

openssl文件夹结构:

  • 在C:\ wamp\bin\apache\apache#.#.#\ conf中创建以下文件夹结构:

    ..
    demoCA
    |-----certs
    |-----crl
    |-----newcerts
    |-----private
    

配置openssl.cnf:

  • 我遵循了Neil C. Obremski的建议并清除了以下默认值:
    • countryName_default(是"AU")
    • stateOrProvinceName_default(是"Some-State")
    • 0.organizationName_default(是"Internet Widgits Pty Ltd")
    • organizationalUnitName_default(已经为空)

创建证书:

  • 从命令行浏览到C:\ wamp\bin\apache\apache#.#.#\ bin \并调用"openssl req -new -out cacert.csr -keyout cacert.pem".如果提示输入密码,之后输入DN信息,如下所示.

    Loading 'screen' into random state - done
    Generating a 1024 bit RSA private key
    .......................++++++
    ....++++++
    writing new private key to 'cacert.pem'
    Enter PEM pass phrase: my_secret_pass
    Verifying - Enter PEM pass phrase: my_secret_pass
    `-----
    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) []:
    State or Province Name (full name) []:
    Locality Name (eg, city) []:
    Organization Name (eg, company) []:
    Organizational Unit Name (eg, section) []:
    Common Name (e.g. server FQDN or YOUR name) []:local
    Email Address []:
    
    Please enter the following 'extra' attributes
    to be sent with your certificate request
    A challenge password []:
    An optional company name []:
    
    C:\wamp\bin\apache\apache2.4.9\bin>
    
  • 在同一控制台窗口中,现在使用"openssl rsa -in cacert.pem -out cacert.key",如果要求输入先前输入的密码.

    Enter pass phrase for cacert.pem: my_secret_pass
    writing RSA key
    
  • 删除C:\ wamp\bin\apache\apache2.4.9\bin中的".rnd"文件

  • 仍然在同一个窗口中调用"openssl x509 -in cacert.csr -out cacert.cert -req -signkey cacert.key -days 365".如果您遇到以下错误"无法写入'随机状态'".这是一个已知的错误!要解决此调用"set RANDFILE = .rnd"并重试上一个命令.

恭喜您现在是自签名证书的所有者!

我根据本网站放置了构建的文件(它们当前位于bin文件夹中):

  • cacert.pem,cacert.key在C:\ wamp\bin\apache\apache#.#.#\ conf\demoCA\private
  • cacert.cert,cacert.csr在C:\ wamp\bin\apache\apache#.#.#\ conf\demoCA\certs

在httpd.conf中启用SLL(搜索"#Include conf/extra/httpd-ssl.conf")+更改httpd-ssl.conf中的以下条目:

SSLSessionCache        "shmcb:C:/wamp/logs/ssl_scache(512000)"
DocumentRoot "C:/wamp/www"
#ErrorLog
#TransferLog
SSLCertificateFile "C:/wamp/bin/apache/apache2.4.9/conf/demoCA/certs/cacert.cert"
SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.4.9/conf/demoCA/private/cacert.key"
CustomLog "C:/wamp/logs/ssl_request.log" \
Run Code Online (Sandbox Code Playgroud)

现在通过调用httpd -t来测试Apache安装.如果您收到以下错误"SSLSessionCache:'shmcb'会话缓存不受支持(已知名称:).也许您需要加载适当的socache模块(mod_socache_shmcb?)." 在httpd.conf中启用以下条目"LoadModule socache_shmcb_module modules/mod_socache_shmcb.so"

Wamp现在配置了https支持:-)

我还使用httpd.conf中的以下配置启用了"LoadModule status_module modules/mod_status.so":

<IfModule status_module>

ExtendedStatus On
<Location /server-status>
    SetHandler server-status
</Location>

</IfModule>
Run Code Online (Sandbox Code Playgroud)

您现在可以在此检查您的服务器状态

https://localhost/server-status/
Run Code Online (Sandbox Code Playgroud)

Apache/2.4.9(Win64)OpenSSL/1.0.1g PHP/5.5.12服务器在localhost端口443

备注:

  • 我试图让它在我的机器上工作时做了这个tute(这是我第一次尝试在windows/wamp上使用OpenSSL).
  • 本指南不适用于生产系统!
  • 您可能需要根据openssl.cnf更改名称等内容
  • 我的目的不是制作最好的教程,而是简单地记下所有必要的更改,以使SSL在WAMP中工作.
  • 确保为x509证书设置正确的日期金额
  • 我终于知道为什么NSA可以轻易地进入具有如此复杂过程的服务器:D
  • 既然Wamp将apache与OpenSSL捆绑在一起,那么单独安装它可能会更好吗?


小智 8

我安装了WAMP 2.2E.

我遇到了同样的问题,经过大约一个小时的搜索互联网并尝试各种各样的事情后,我偶然发现openssl可以通过以下方式启用:

  • 单击系统托盘中的WAMP图标,
  • 徘徊在"PHP",
  • 然后"PHP扩展",
  • 然后在很长的扩展列表中仔细查看"php_openssl".