22 lines
753 B
Bash
Raw Normal View History

2023-11-13 14:33:28 +00:00
#!/bin/sh
2023-11-13 18:18:06 +00:00
# SPDX-FileCopyrightText: 2022 - 2023 unman <unman@thirdeyesecurity.org>
2024-01-29 16:49:54 +01:00
# SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
2023-11-13 14:33:28 +00:00
#
# SPDX-License-Identifier: AGPL-3.0-or-later
set -eu
## Change the netvm of every qube that has (disp-)sys-firewall to pihole.
2023-11-13 14:33:28 +00:00
for qube in $(qvm-ls --raw-data --fields=NAME,NETVM |
awk -F '|' '/\|(disp-)?sys-firewall$/{print $1}')
2023-11-13 14:33:28 +00:00
do
## Avoid overwriting netvm to sys-pihole when instead it should use the
## default_netvm, so better to prevent overwriting user choices.
qvm-prefs "$qube" | grep -q "^netvm[[:space:]]\+D" && continue
## Set netvm for qubes that were using (disp-)sys-firewall to sys-pihole.
2023-11-13 14:33:28 +00:00
qvm-prefs "$qube" netvm sys-pihole
done
exit 0