在我的开发盒上有这个限制是非常烦人的,因为除了我之外不会有任何用户.
我知道标准的解决方法,但它们都没有完全符合我的要求:
是否有一些简单的sysctl变量允许非root进程绑定到Linux上的"特权"端口(端口小于1024),或者我只是运气不好?
编辑:在某些情况下,您可以使用功能来执行此操作.
我分别在端口8006和8007上托管特殊的HTTP和HTTPS服务.我用iptables来"激活"服务器; 即路由传入的HTTP和HTTPS端口:
iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 443 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 8006 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 8007 -j ACCEPT
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8006
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8007
iptables -A OUTPUT -t …Run Code Online (Sandbox Code Playgroud) 我用最少的配置安装了CentOS 7(os + dev工具).我正在尝试打开80端口进行httpd服务,但是我的iptables服务有问题......它出了什么问题?我究竟做错了什么?
# ifconfig/sbin/service iptables save
bash: ifconfig/sbin/service: No such file or directory
# /sbin/service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
# sudo service iptables status
Redirecting to /bin/systemctl status iptables.service
iptables.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
# /sbin/service iptables save
The service command supports only basic LSB actions (start, stop, …Run Code Online (Sandbox Code Playgroud) 我从来没有使用iptables,在线文档似乎有点不透明.
我想阻止我的服务器上的所有端口8000请求,除了那些来自特定IP地址的请求.我如何使用iptables做到这一点?
我有一个Linode服务器运行Ubuntu 12.04 LTS和MongoDB实例(服务正在运行并且CAN本地连接),我无法从外部源连接.
我已将这两个规则添加到我的IP表中,其中<ip address>是我想要连接FROM的服务器(如本MongoDB参考中所述):
iptables -A INPUT -s < ip-address > -p tcp --destination-port 27017 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -d < ip-address > -p tcp --source-port 27017 -m state --state ESTABLISHED -j ACCEPT
我看到我的IP表中的规则允许27017与<ip address>之间的连接,但是当我尝试使用如下命令从<ip address>连接到我的mongo数据库时:
mongo databasedomain/databasename -u username -p password
我收到此错误:
2014-07-22T23:54:03.093+0000 warning: Failed to connect to databaseserverip:27017, reason: errno:111 Connection refused
2014-07-22T23:54:03.094+0000 Error: couldn't connect to server < ip address >:27017 (databaseserverip), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed
任何帮助都非常赞赏!!!! …
我需要查询现有规则,以及能够轻松添加和删除规则.我没有找到任何API来做这件事.有什么东西我不见了吗?
我最接近解决方案的是使用iptables-save | iptables-xml查询和手动调用iptables命令本身来添加/删除规则.我考虑的另一个解决方案是简单地从我的应用程序数据库中重新生成整个规则集并刷新整个链,然后再次应用它.但我想避免这种情况,因为我不想丢弃任何数据包 - 除非有一种方法可以原子地执行此操作.我想知道是否有更好的方法.
C中的API会很棒; 但是,因为我打算将它构建成一个独立的suid程序,所以用任何语言执行此操作的库也可以.
我正在尝试将http流量重定向到同一台计算机上的端口8080,并且iptables规则在下面工作.
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080
Run Code Online (Sandbox Code Playgroud)
我正在试图弄清楚如何在系统重新启动时永久性地进行此更改.
我正在使用Ubuntu 11.10服务器.
我想删除下面的POSTROUTING规则,
[root@hostname ~]# service iptables status
Table: nat
Chain PREROUTING (policy ACCEPT)
num target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
num target prot opt source destination
1 MASQUERADE all -- 192.168.1.0/24 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
Run Code Online (Sandbox Code Playgroud)
然后我输入下面,
[root@hostname ~]# iptables -D POSTROUTING 1
iptables: No chain/target/match by that name
Run Code Online (Sandbox Code Playgroud)
有什么不对的吗?
我有Android 4.3强制通过IPTABLES使用Charles代理.查尔斯证书安装在手机上.我能够在浏览器中捕获正常的SSL流量,如https网站.所有POST和GET方法似乎都能正常工作.在特定应用程序中,使用SSL CONNECT方法时失败.
请帮忙!
我刚尝试了Docker.它真棒,但似乎与ufw不太合作.默认情况下,docker会稍微操纵iptables.结果不是错误,而是我所期望的.有关详细信息,请阅读UFW + Docker的危险
我的目标是建立一个类似的系统
Host (running ufw) -> docker container 1 - nginx (as a reverse proxy)
-> docker container 2 - node web 1
-> docker container 3 - node web 2
-> .......
Run Code Online (Sandbox Code Playgroud)
我想通过ufw管理传入流量(例如限制访问),因此我不希望docker触摸我的iptables.这是我的测试
环境:
--iptables=false 已添加到Docker守护程序中.第一次尝试
docker run --name ghost -v /home/xxxx/ghost_content:/var/lib/ghost -d ghost
docker run --name nginx -p 80:80 -v /home/xxxx/nginx_site_enable:/etc/nginx/conf.d:ro --link ghost:ghost -d nginx
Run Code Online (Sandbox Code Playgroud)
没运气.第一个命令没问题,但第二个命令会抛出错误
Error response from daemon: Cannot start container
Run Code Online (Sandbox Code Playgroud)
第二次尝试
然后我发现了这个:无法用--iptables = …