我需要一个静态IP地址来处理来自已知来源(伙伴)的SSLstream量。 IP需要保持静态的原因是合作伙伴需要这样做才能保持PCI合规性。
我们的服务器位于AWS Elastic Load Balancer(ELB)之后,无法提供静态IP地址; 这里有很多线索。
我的想法是在EC2中创build一个实例,其唯一目的是作为具有自己IP地址的反向代理服务器; 接受HTTPS请求并将其转发给负载均衡器。
有更好的解决scheme吗?
最后,我实现了我们合作伙伴的要求如下:
这是一个示例Apache虚拟主机configuration。 我closures了 NameVirtualHost
并指定了EIP的地址。 我也禁用了默认主机。 如果合作伙伴需要,我将添加一个<Directory>
块,只接受来自其 IP范围的请求。
<IfModule mod_ssl.c> # Catch non-SSL requests and redirect to SSL <VirtualHost 12.34.567.890:80> ServerName our-static-ip-a-record.example.com Redirect / https://our-elb-cname.example.com </VirtualHost> # Handle SSL requests on the static IP <VirtualHost 12.34.567.890:443> ServerAdmin [email protected] ServerName our-static-ip-a-record.example.com # SSL Configuration SSLEngine on SSLProxyEngine on SSLProxyCACertificateFile /etc/apache2/ssl/gd_bundle.crt SSLCertificateFile /etc/apache2/ssl/example.com.crt SSLCertificateKeyFile /etc/apache2/ssl/private.key # Additional defaults, eg ciphers, defined in apache's ssl.conf # Where the magic happens ProxyPass / https://our-elb-cname.example.com/ ProxyPassReverse / https://our-elb-cname.example.com/ # Might want this on; sets X-Forwarded-For and other useful headers ProxyVia off # This came from an example I found online, handles broken connections from IE BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost> </IfModule>
希望将来可以节省一些时间:-)
您不需要“静态”IP地址来实施SSL; 您需要在DNS中为SSL证书颁发名称。
对此的典型解决scheme是在DNS中创build一个名称,然后将其作为Elastic Load Balancer的DNS名称的CNAME 。