I migrated from R4.1 to 4.2.3 recently.
I reviewed my firewall configuration and converted to nftables (adapted from the new nftables one. see below).
The only issue left seems that /rw/config/rc.local is not executed at start and when I reboot dom0, I have to re-executed it manually.
rc.local does not match anything in /etc/
and `/rw/config/rc.local` doesn't seem to be working seems to go in same direction
service is present but dead as depending on missing file
[user@VPN ~]$ systemctl status rc-local.service
○ rc-local.service - /etc/rc.d/rc.local Compatibility
Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
Drop-In: /usr/lib/systemd/system/service.d
└─10-timeout-abort.conf
Active: inactive (dead)
Docs: man:systemd-rc-local-generator(8)
[user@VPN ~]$ grep ExecStart /usr/lib/systemd/system/rc-local.service
ExecStart=/etc/rc.d/rc.local start
[user@VPN ~]$ ls -l /etc/rc.d/rc.local
ls: cannot access '/etc/rc.d/rc.local': No such file or directory
/rw/config/rc.local is run by the qubes-misc-post systemd service.
You can try to check the status of the service and see if it shows any errors with sudo journalctl -u qubes-misc-post.
For firewall rules, you should try to use /rw/config/qubes-firewall-user-script instead.
Ah. Thanks.
This point to a permission denied for an openvpn file “openvpn[1142]: Options error: --ca fails with ‘ca.crt’: Permission denied (errno=13)”.
Strangely no issue with same config in interactive. and file is in 0644… directories are ok too. can cat the file as user nobody. Systemd unit does not list any restrictions or specific user. Don’t know from where does this come from.
it is a fedora. always selinux but not sure why change from past fedora38 template to 40.
from ls -Z /rw/config/vpn/, I get two different permission set system_u:object_r:initrc_exec_t:s0 or unconfined_u:object_r:etc_t:s0. No idea where the initrc_exec comes from… matchpathcon -V DIR seems to say initrc_exec should be used. restorecon -v FILE puts everything under initrc_exec except ovpn config file which is unconfined_u:object_r:initrc_exec_t. still not working.
if forcing sudo chcon -u system_u -t initrc_exec_t FILE.ovpn… still get error
“VPN misc-post.sh[1202]: Options error: In [CMD-LINE]:1: Error opening configuration file: FILE.ovpn”
if sudo chcon -u system_u -t etc_t FILE.ovpn (type that I see for other files in same directory), same
if sudo chcon -u unconfined_u -t etc_t FILE.{ovpn,key,crt,ca}, fails on “openvpn[1153]: WARNING: Failed running command (–up/–down): could not execute external program”
from sudo semanage fcontext -l | grep -e vpn, script should be system_u:object_r:openvpn_unconfined_script_exec_t:s0 and config system_u:object_r:openvpn_etc_t:s0 but getting same issue than above with nft.
any default policy doing both openvpn and iptables/nft?
I saw “qubes-vpn-handler” in your message which should come from GitHub - tasket/Qubes-vpn-support: VPN configuration in Qubes OS so I tried it (from this pull request for nftables support) with a fresh fedora 40 template and had some problems with selinux as expected.
This is what I did to get my openvpn connection to work (example using mullvad openvpn config):
Move the file to /home or /rw to make the file persistent within the vpn qube and put the install command in rc.local before calling the vpn/firewall commands.
and adding semodule -i /rw/config/path/myopenvpn.pp in /rw/config/rc.local
Still openvpn does not start at boot even if no more avc denied logs. Openvpn log returns:
[...]
2024-12-04 21:17:35 TUN/TAP device tun0 opened
2024-12-04 21:17:35 net_iface_mtu_set: mtu 1500 for tun0
2024-12-04 21:17:35 net_iface_up: set tun0 up
2024-12-04 21:17:35 net_addr_ptp_v4_add: 10.1.0.2 peer 10.1.0.1 dev tun0
2024-12-04 21:17:35 qubes-vpn-handler.sh up tun0 1500 0 10.1.0.2 10.1.0.1 init
netlink: Error: Could not process rule: Permission denied
2024-12-04 21:17:35 WARNING: Failed running command (--up/--down): external program exited with error status: 1
2024-12-04 21:17:35 Exiting due to fatal error
I have a hard time understanding why so different between system/rc.local execution and my interactive run (from standard user + sudo). Or is there a systemd slice adding some restrictions? but nothing in /usr/lib/systemd/system/qubes-misc-post.service and else, under system.slice.
And are there so few people using external script with openvpn and Fedora/RedHat?
A friend of mine said, about 18-odd-ish years ago: “in 20 years, we’ll be still struggling with SELinux”
Seems that it was a really good prediction.
Mind you, I’m all for SELinux… but my $GOD… it does confuse the non-technical, and even slightly technical, people.