apache2 debian 上的 ssl 安全,没有用于 cURL 设置的公开认可的 CA
ssl on apache2 debian safe without publicly recognised CA for cURL setup
我有两台服务器,A 和 B。它们都 运行 在相同的代码库上,运行 在带有 apache2 的 debian 上。
我需要安全地定期检查来自服务器 A 和服务器 B 的 REST 响应。
我已经构建了一个简单的 cURL 脚本来使用基本身份验证从服务器 B 连接到服务器 A:
<?php
$url = 'http://mydomain/restpath/get';
$ch = curl_init($url);
$username = 'username';
$password = 'password';
// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0 );
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//set the basic auth to any then set the creds
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status code
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
这里的凭据将以明文形式传递..为了安全我打算使用 HTTPS 连接。
## 我对 https 证书的了解是初学者 ##
仅使用随 apache 提供的示例 ssl vhost conf 中声明的默认证书是否安全:
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
或者我还需要做更多的事情吗?
谢谢,
约翰
在写问题的时候意识到正确的问题应该是什么,这里已经回答了:
我有两台服务器,A 和 B。它们都 运行 在相同的代码库上,运行 在带有 apache2 的 debian 上。
我需要安全地定期检查来自服务器 A 和服务器 B 的 REST 响应。
我已经构建了一个简单的 cURL 脚本来使用基本身份验证从服务器 B 连接到服务器 A:
<?php
$url = 'http://mydomain/restpath/get';
$ch = curl_init($url);
$username = 'username';
$password = 'password';
// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0 );
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//set the basic auth to any then set the creds
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status code
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
这里的凭据将以明文形式传递..为了安全我打算使用 HTTPS 连接。
## 我对 https 证书的了解是初学者 ##
仅使用随 apache 提供的示例 ssl vhost conf 中声明的默认证书是否安全:
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
或者我还需要做更多的事情吗?
谢谢, 约翰
在写问题的时候意识到正确的问题应该是什么,这里已经回答了: