システムサービスはFirewall-cmdを実行できません。

システムサービスはFirewall-cmdを実行できません。

私は最近、Fedora-38マシンにワイヤガードを設定し、それを使って始めましたが、systemctl start wg-quick@wg0これまではうまく機能しています。サービスを開始すると、次のエラーメッセージが表示されます。

 wg-quick[943]: [#] firewall-cmd --add-service wireguard && firewall-cmd --add-masquerade
 wg-quick[979]: ERROR:dbus.proxies:Introspect error on :1.8:/org/fedoraproject/FirewallD1: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Sender is not authorized to send message
 wg-quick[979]: Error: Sender is not authorized to send message

これはWireguard設定ファイルです/etc/wireguard/wg0.conf

[Interface]
Address    = 192.168.2.1/24, fd00:7::1/48
PrivateKey = ...
PostUp     = firewall-cmd --add-service wireguard && firewall-cmd --add-masquerade
PostDown   = firewall-cmd --remove-service wireguard && firewall-cmd --remove-masquerade
ListenPort = 51820

[Peer]
PublicKey    = ...
PresharedKey = ...
AllowedIPs   = 192.168.2.2/32, fd00:7::2/48

<more peers>

次の場所にあるサービスファイル。/usr/lib/systemd/system/[email protected]

[Unit]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target
Wants=network-online.target nss-lookup.target
PartOf=wg-quick.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/wg-quick up %i
ExecStop=/usr/bin/wg-quick down %i
ExecReload=/bin/bash -c 'exec /usr/bin/wg syncconf %i <(exec /usr/bin/wg-quick strip %i)'
Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity

[Install]
WantedBy=multi-user.target

編集:SELinuxに関連しています。許可するように設定しwireguard_tたら、次のようsemanage permissive -a wireguard_tな問題を確認できますaudit.log

type=AVC msg=audit(1684943435.472:1978): avc: denied { search } for pid=27556 comm="firewall-cmd" name="pki" dev="dm-0" ino=8390592 scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:object_r:cert_t:s0 tclass=dir permissive=1 
type=AVC msg=audit(1684943435.472:1979): avc: denied { read } for pid=27556 comm="firewall-cmd" name="openssl.cnf" dev="dm-0" ino=16812949 scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:object_r:cert_t:s0 tclass=file permissive=1 
type=AVC msg=audit(1684943435.472:1980): avc: denied { open } for pid=27556 comm="firewall-cmd" path="/etc/pki/tls/openssl.cnf" dev="dm-0" ino=16812949 scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:object_r:cert_t:s0 tclass=file permissive=1 
type=AVC msg=audit(1684943435.472:1981): avc: denied { getattr } for pid=27556 comm="firewall-cmd" path="/etc/pki/tls/openssl.cnf" dev="dm-0" ino=16812949 scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:object_r:cert_t:s0 tclass=file permissive=1 
type=AVC msg=audit(1684943435.472:1982): avc: denied { read } for pid=27556 comm="firewall-cmd" name="possible" dev="sysfs" ino=42 scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=1 
type=AVC msg=audit(1684943435.472:1983): avc: denied { open } for pid=27556 comm="firewall-cmd" path="/sys/devices/system/cpu/possible" dev="sysfs" ino=42 scontext=system_u:system_r:wireguard_t:s0 tcontext=system_u:object_r:sysfs_t:s0 tclass=file permissive=1 

ベストアンサー1

おすすめ記事