有没有一个封装,将阻止可执行文件侦听端口? 或者,是否有一个包装将重新映射端口,以便可执行文件认为它正在侦听80,但实际上正在侦听8080
我的梦想指挥线将是:
server:~ # remapper -f 80 -t 8080 /usr/bin/some_binary
在SELinux,AppArmor(或者我相信,Solaris Trusted Extensions)中创build强制访问控制器策略是确保应用程序不被允许绑定到策略中未明确指定的端口的唯一方法。 如果要将一个端口映射到另一个端口以进行连接,则在系统防火墙/数据包筛选器级别完成 – Linux上的iptables,Solaris中的ipf等。
不过,Benoit的问题仍然存在,你想要做的事情可能是过度的。
您运行端口80上运行Web服务器,只能执行某些脚本types。 然后你可以允许用户上传到networking服务器,通过网页浏览器执行他们的脚本,从而强制它只能通过http访问。 只是一个想法。
例如,从cgi-bin执行:
#!/bin/bash # get today's date OUTPUT="$(date)" # You must add following two lines before # outputting data to the web browser from shell # script echo "Content-type: text/html" echo "" echo "<html><head><title>Demo</title></head><body>" echo "Today is $OUTPUT <br>" echo "Current directory is $(pwd) <br>" echo "Shell Script name is $0" echo "</body></html>"