我在运行CentOS 6.2的服务器上设置OpenVPN时遇到了麻烦。 我以前在这个服务器上使用过OpenVPN,它工作的时候(虽然这是Ubuntu的,现在我使用的是CentOS)。 我只是重新格式化硬盘驱动器,并试图让OpenVPN启动并再次运行。 我在我的OpenVPNconfiguration文件中使用up和down指令来设置我的网桥。 出于某种原因,当运行up脚本时,我尝试执行brctl时遇到拒绝权限错误。 这是我的configuration文件:
mode server tls-server local 192.168.1.93 ##ip of server port 1194 proto tcp dev tap0 up "/etc/openvpn/up.sh br0" down "/etc/openvpn/down.sh br0" persist-key persist-tun ca ca.crt cert server.crt key server.key dh dh1024.pem #tls-auth ta.key 0 cipher BF-CBC comp-lzo ifconfig-pool-persist ipp.txt server-bridge 192.168.1.93 255.255.255.0 192.168.1.110 192.168.1.120 push "dhcp-option DNS 192.168.1.1" push "dhcp-option DOMAIN nyc.rr.com" max-clients 10 user nobody group nogroup keepalive 10 120 status openvpn-status.log verb 3
这里是up.sh脚本:
#!/bin/sh BR=$1 DEV=$2 MTU=$3 /sbin/ifconfig $DEV mtu $MTU promisc up /usr/sbin/brctl addif $BR $DEV
brctl在这个脚本之外工作正常。 我能够手动执行它。
我以root身份启动OpenVPN,所以我不认为在这个问题上的权限,所以这就是为什么我很困惑。
谢谢你的帮助。
编辑:这是回声的错误:
[root@server openvpn]# /etc/init.d/openvpn start Starting openvpn: /etc/openvpn/up.sh: line 7: /usr/sbin/brctl: Permission denied [FAILED]
我相信你打这个bug 。
创build文件openvpnlocal.te:
module openvpnlocal 1.0; require { type openvpn_t; type brctl_exec_t; class file { read execute open execute_no_trans }; } #============= openvpn_t ============== allow openvpn_t brctl_exec_t:file { read execute open execute_no_trans };
然后运行:
checkmodule -M -m -o openvpnlocal.mod openvpnlocal.te semodule_package -o openvpnlocal.pp -m openvpnlocal.mod semodule -i openvpnlocal.pp