如何确定Apache2上是否安装了OpenSSL和mod_ssl

Fio*_*ona 55 ssl apache2

有谁知道确定OpenSSL和mod_ssl是否安装在Apache2上的命令?

moh*_*bou 30

如果您的服务器上安装了PHP,您可以创建一个php文件,让我们称之为phpinfo.php并添加它<?php echo phpinfo();?>,然后在浏览器中打开该文件,这将显示有关您的系统环境的信息,以便快速查找有关您的Apache加载的信息模块,在结果页面上找到"已加载的模块".

  • 实际上你不需要'回声',该功能提供了它自己的输出. (6认同)

小智 25

如果您的服务器上安装了PHP,则可以使用" extension_loaded "功能在运行时将其删除.像这样:

<?php
if (!extension_loaded('openssl')) {
    // no openssl extension loaded.
}
?>
Run Code Online (Sandbox Code Playgroud)


小智 22

通常,当您编译apache2服务器(或通过软件包工具安装它)时,您可以通过点击此命令来检查可用的任何指令:

~# $(which httpd) -L | grep SSL # on RHEL/CentOS/Fedora
~# $(which apache2) -L | grep SSL # on Ubuntu/Debian
Run Code Online (Sandbox Code Playgroud)

如果您没有看到任何SSL*指令,则表示您没有编译mod_ssl的apache2.

希望它有所帮助;)

  • 不.许多服务器没有httpd,它是`apache2`,你的命令不起作用. (5认同)

bri*_*gge 18

默认的Apache安装配置为在服务器标题行上发送此信息.您可以使用curl命令查看任何服务器的此信息.

$ curl --head http://localhost/
HTTP/1.1 200 OK
Date: Fri, 04 Sep 2009 08:14:03 GMT
Server: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8a DAV/2 PHP/5.2.6 SVN/1.5.4 proxy_html/3.0.0
Run Code Online (Sandbox Code Playgroud)

  • 当ServerSignature和ServerTokens设置为在Apache中显示有限的数据时,这没有用. (8认同)

Ste*_*rcy 15

使用以下命令.

$ openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013 (or similar output)
Run Code Online (Sandbox Code Playgroud)

对于RHEL/CentOS/Fedora:

$ httpd -t -D DUMP_MODULES | grep ssl
ssl_module (shared)
Run Code Online (Sandbox Code Playgroud)

对于Ubuntu/Debian

$ apache2 -t -D DUMP_MODULES | grep ssl
ssl_module (shared)
Run Code Online (Sandbox Code Playgroud)

对于SUSE

$ httpd2 -t -D DUMP_MODUELS | grep ssl
ssl_module (shared)
Run Code Online (Sandbox Code Playgroud)


Ale*_*x W 6

使用Apache 2,您可以通过运行以下命令来查看HTTP守护程序当前正在加载哪些模块:

apache2ctl -M
Run Code Online (Sandbox Code Playgroud)

-M选项实际上只是一个传递给httpd的参数。

apache2ctl是Apache超文本传输​​协议(HTTP)服务器的前端。它旨在帮助管理员控制Apache apache2守护程序的功能。

   NOTE: The default Debian configuration requires the environment variables APACHE_RUN_USER,
   APACHE_RUN_GROUP, and APACHE_PID_FILE to be set in /etc/apache2/envvars.

   The apache2ctl script returns a 0 exit value on success, and >0 if an error  occurs.   For
   more details, view the comments in the script.
Run Code Online (Sandbox Code Playgroud)


She*_*man 5

幸运的是,大多数 Linux 版本都具有“开箱即用”的 OpenSSL。

要验证安装:

openssl version
回复:
OpenSSL 1.0.1t 3 May 2016

注意:版本 OpenSSL 1.0.1 到 1.0.1f(含)
容易受到 OpenSSL Heartbleed Bug 的影响。
1.0.1g 及更高版本是固定的。

有关其他安装信息:

Ubuntu/Debian
dpkg -l | grep -i openssl
响应: 是的,安装了 OpenSSL!
ii libcrypt-openssl-random-perl 0.04-2+b1 amd64 module to access the OpenSSL pseudo-random number generator
ii libcurl3:amd64 7.38.0-4+deb8u5 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour)
ii libgnutls-openssl27:amd64 3.3.8-6+deb8u4 amd64 GNU TLS library - OpenSSL wrapper
ii openssl 1.0.1t-1+deb8u6 amd64 Secure Sockets Layer toolkit - cryptographic utility
ii python-ndg-httpsclient 0.3.2-1 all enhanced HTTPS support for httplib and urllib2 using PyOpenSSL
ii python-openssl 0.14-1 all Python 2 wrapper around the OpenSSL library
ii ssl-cert 1.0.35 all simple debconf wrapper for OpenSSL

如果您没有安装 OpenSSL,请尝试:

Debian/Ubuntu:
sudo apt-get install openssl

红帽/CentOS:
yum install openssl