freebsd刑務所でKillswitchを使用してopenvpnを設定する

freebsd刑務所でKillswitchを使用してopenvpnを設定する

OpenVPNを無効にすると、他のすべての接続がブロックされるようにKillスイッチを設定しようとします。適応しようとしています。これLinuxの設定は問題ありませんが、FreeBSDでは動作しないようです。

これは私のopenvpn.configです。

group openvpn
dev tun
remote url.xxx.com 443
resolv-retry infinite
nobind
persist-key
persist-tun
auth-nocache
verb 3
explicit-exit-notify 5
rcvbuf 262144
sndbuf 262144
push-peer-info
setenv UV_IPV6 yes
ca ".../keys/ca.crt"
cert ".../keys/user.crt"
key ".../keys/user.key"
remote-cert-tls server
cipher AES-256-CBC
comp-lzo no
proto udp
tls-auth ".../keys/ta.key" 1

これは私のipfw設定スクリプトです。

#!/bin/bash
ipfw -q -f flush
cmd="ipfw -q add"
$cmd 00001 allow all from any to any via lo0
$cmd 00010 allow all from any to any via tun0 # the vpn interface
$cmd 00101 allow all from me to 192.168.0.0/16
$cmd 00102 allow all from 192.168.0.0/16 to me
$cmd 00103 allow all from any to any gid openvpn 
$cmd 00104 allow all from any to any established
$cmd 00110 allow tcp from any to any dst-port 53 out setup keep-state
$cmd 00111 allow udp from any to any dst-port 53 out keep-state
$cmd 00201 deny all from any to any

残念ながら、OpenVPNはこの設定を使用して接続を確立できません。

Mon Jul 20 22:13:17 2020 WARNING: file '/opt/openvpn/keys/user.key' is group or others accessible
Mon Jul 20 22:13:17 2020 WARNING: file '/opt/openvpn/keys/ta.key' is group or others accessible
Mon Jul 20 22:13:17 2020 OpenVPN 2.4.9 amd64-portbld-freebsd11.3 [SSL (OpenSSL)] [LZO] [LZ4] [MH/RECVDA] [AEAD] built on Jun 12 2020
Mon Jul 20 22:13:17 2020 library versions: OpenSSL 1.0.2u-freebsd  20 Dec 2019, LZO 2.10
Mon Jul 20 22:13:17 2020 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Jul 20 22:13:17 2020 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Jul 20 22:13:17 2020 TCP/UDP: Preserving recently used remote address: [AF_INET]184.75.221.34:443
Mon Jul 20 22:13:17 2020 Socket Buffers: R=[42080->262144] S=[9216->262144]
Mon Jul 20 22:13:17 2020 UDP link local: (not bound)
Mon Jul 20 22:13:17 2020 UDP link remote: [AF_INET]184.75.221.34:443
Mon Jul 20 22:13:17 2020 NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
Mon Jul 20 22:13:17 2020 write UDP: Permission denied (code=13)
Mon Jul 20 22:13:19 2020 write UDP: Permission denied (code=13)

freebsdのopenvpnがルート/ホイールで始まるようです。どのADに関係なく、最初の接続が正常に確立された後にのみカスタムグループにダウングレードされます。この問題を解決する方法はありますか?

また、url.xxx.comとの接続を許可するようにipfwを設定しようとしましたが、ipfwはそのURLをサポートしていないようです。

FreeBSDでKillswitchを正常に設定した人はいますか?

ベストアンサー1

おすすめ記事