在 Linux 系统上,我需要阻止对除 Web 服务器 192.168.1.253 之外的所有 http 和 https 流量的出站访问。系统还应该阻止除 ssh 之外的所有传入流量。
我将如何配置它?
我有一个网站(apache web 服务器,ubuntu 14.04)设置http://example.com并配置了端口 1996 和 1980。
这些链接适用于http
http://example.com/myproject
http://example.com:1996/
http://example.com:1980/
然后我安装了 SSL 证书并将此服务器配置为使用https
.
但是这些链接不起作用
https://example.com:1996
https://example.com:1980
如何https
在同一个域中配置多个端口?
默认配置:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName example.com
SSLEngine on
SSLCertificateFile /home/ubuntu/ssl_cert/signed_cert.crt
SSLCertificateKeyFile /home/ubuntu/ssl_cert/server.key
</VirtualHost>
端口.conf:
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
我公司的防火墙阻止了端口 80 上的密钥服务器,而我希望支持的一些发行版还没有使用 HKPS 来通过 TLS 获取。
是否有密钥服务器可以通过 HTTPS 提供给定密钥的简单下载?例如,我可以在https://keybase.io/naftulikay/pgp_keys.asc的 keybase 上获取我自己的个人密钥
是否有资源可以在不使用密钥服务器协议的情况下通过 HTTPS 获取密钥?我正在编写 Ansible,因此很容易通过 HTTPS 获取内容。
我使用Let's Encrypt 推荐使用这个 Makefile为 foo.localhost 创建了一个自签名证书:
include ../.env
configuration = csr.cnf
certificate = self-signed.crt
key = self-signed.key
.PHONY: all
all: $(certificate)
$(certificate): $(configuration)
openssl req -x509 -out $@ -keyout $(key) -newkey rsa:2048 -nodes -sha256 -subj '/CN=$(HOSTNAME)' -extensions EXT -config $(configuration)
$(configuration):
printf "[dn]\nCN=$(HOSTNAME)\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:$(HOSTNAME)\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth" > $@
.PHONY: clean
clean:
$(RM) $(configuration)
然后,我将其分配给 Web 服务器。我已验证服务器返回相关证书:
$ openssl s_client -showcerts -connect foo.localhost:8443 < /dev/null
CONNECTED(00000003)
depth=0 CN = foo.localhost
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = foo.localhost
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
0 s:/CN=foo.localhost
i:/CN=foo.localhost
-----BEGIN CERTIFICATE-----
[…]
-----END CERTIFICATE-----
---
Server certificate
subject=/CN=foo.localhost
issuer=/CN=foo.localhost
---
No client certificate CA names sent
Peer signing digest: SHA512
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 1330 bytes and written 269 bytes
Verification error: unable to verify the first certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES128-GCM-SHA256
Session-ID: […]
Session-ID-ctx:
Master-Key: […]
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket:
[…]
Start Time: 1529622990
Timeout : 7200 (sec)
Verify return code: 21 (unable to verify the first certificate)
Extended master secret: no
---
DONE
如何在不修改 /etc 中的任何内容的情况下让 cURL 信任它? --cacert
不起作用,大概是因为没有CA :
$ curl --cacert tls/foo.localhost.crt 'https://foo.localhost:8443/'
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
目标是在开发过程中启用 HTTPS:
curl -k
就像catch (Exception e) {}
在这种情况下一样 - 完全不像浏览器与 Web 服务器通信。换句话说,当我跑步时,curl [something] https://project.local/api/foo
我想确信
使用 HTTP 或--insecure
不符合第二个标准。