我的同事在我们的一台testing服务器上安装了Jenkins。 当我访问服务器的IP和端口8080,jenkins正在运行,即99.999.999.999:8080
我想将Jenkins应用程序locking到外部世界,并且只能从内部IP地址获得它。
所以我在apache中设置了一个VirtualHost,如下所示:
<VirtualHost *:80> ServerName jenkins.mytestserver.com ErrorLog logs/jenkins.mytestserver.com-error_log CustomLog logs/jenkins.mytestserver.com-access_log common #ProxyPass /usr/share/tomcat6/webapps/ ajp://127.0.0.1:8080/usr/share/tomcat6/webapps/ #ProxyPassReverse /usr/share/tomcat6/webapps/ ajp://127.0.0.1:8080/usr/share/tomcat6/webapps/ #ProxyRequests Off ProxyPass / http://localhost:8080/ nocanon ProxyPassReverse / http://localhost:8080/ ProxyRequests Off ProxyPreserveHost On <Location /> order deny,allow deny from all Allow from 11.111.111.111 </Location> </VirtualHost>
Vhost的作品,我可以通过jenkins.mytestserver.com访问jenkins,并从外部世界阻止。
如何通过99.999.999.999:8080阻止外部世界访问它?
我有一种感觉,我已经做了ReverseProxy上面的方式是不正确的,因为它只是传递请求到http:// localhost:8080 /这是一样的http://99.999.999.999:8080
我一直在引用下面的文档:
https://wiki.jenkins-ci.org/display/JENKINS/Apache+frontend+for+security
https://www.mulesoft.com/tcat/tomcat-connectors (我认为我的问题的答案是在这个文档,但我不明白)。
任何帮助赞赏。
问候,斯蒂芬
一个简单的方法来阻止与iptables交通
IPTables如何TO是一个相当不错的如何
如何阻止的基本思路是
sudo iptables -A INPUT -s 192.168.xx -p tcp --dport 8080 -j ACCEPT所有的networkingsudo iptables -A INPUT -p tcp --dport 8080 -j REJECT拒绝所有其他networking
由于您将来自apache web服务器的stream量代理到http://localhost:8080/ ,您可以在tomcat 连接器中configuration它应该绑定到address=127.0.0.1而不是绑定到所有接口的默认行为。
这样,只有通过你的代理服务器(当然,除非你从运行jenkins的同一台机器上连接)
如果你想在configuration中包含SSL,那么你也可以使用proxyPass,但是对于在443上侦听的端口,并且把你的SSLconfiguration也放到apache httpd中(并且从80到443有一个redirect)。