Merge commit '66b3e628f2bf0ec8f23b0b42484d014e5cad23bf' into conntrack-purge
This commit is contained in:
commit
ae48c7e04d
4
debian/qubes-core-agent-networking.install
vendored
4
debian/qubes-core-agent-networking.install
vendored
@ -11,8 +11,12 @@ etc/xen/scripts/vif-route-qubes
|
|||||||
lib/systemd/system/qubes-firewall.service
|
lib/systemd/system/qubes-firewall.service
|
||||||
lib/systemd/system/qubes-iptables.service
|
lib/systemd/system/qubes-iptables.service
|
||||||
lib/systemd/system/qubes-network.service
|
lib/systemd/system/qubes-network.service
|
||||||
|
lib/systemd/system/qubes-network-uplink.service
|
||||||
|
lib/systemd/system/qubes-network-uplink@.service
|
||||||
lib/systemd/system/qubes-updates-proxy.service
|
lib/systemd/system/qubes-updates-proxy.service
|
||||||
usr/lib/qubes/init/network-proxy-setup.sh
|
usr/lib/qubes/init/network-proxy-setup.sh
|
||||||
|
usr/lib/qubes/init/network-proxy-stop.sh
|
||||||
|
usr/lib/qubes/init/network-uplink-wait.sh
|
||||||
usr/lib/qubes/init/qubes-iptables
|
usr/lib/qubes/init/qubes-iptables
|
||||||
usr/lib/qubes/iptables-updates-proxy
|
usr/lib/qubes/iptables-updates-proxy
|
||||||
usr/lib/qubes/qubes-setup-dnat-to-ns
|
usr/lib/qubes/qubes-setup-dnat-to-ns
|
||||||
|
@ -118,7 +118,7 @@ umount_retry() {
|
|||||||
|
|
||||||
get_mac_from_iface() {
|
get_mac_from_iface() {
|
||||||
local iface="$1"
|
local iface="$1"
|
||||||
local mac
|
local mac=
|
||||||
if [ "x$iface" != "x" ] && [ -e "/sys/class/net/$iface" ]; then
|
if [ "x$iface" != "x" ] && [ -e "/sys/class/net/$iface" ]; then
|
||||||
mac="$(cat "/sys/class/net/$iface/address")"
|
mac="$(cat "/sys/class/net/$iface/address")"
|
||||||
fi
|
fi
|
||||||
@ -127,7 +127,7 @@ get_mac_from_iface() {
|
|||||||
|
|
||||||
get_iface_from_mac() {
|
get_iface_from_mac() {
|
||||||
local mac="$1"
|
local mac="$1"
|
||||||
local iface
|
local iface=
|
||||||
if [ "x$mac" != "x" ]; then
|
if [ "x$mac" != "x" ]; then
|
||||||
iface="$(ip -o link | grep -i "$mac" | awk '{print $2}' | cut -d ':' -f1)"
|
iface="$(ip -o link | grep -i "$mac" | awk '{print $2}' | cut -d ':' -f1)"
|
||||||
fi
|
fi
|
||||||
@ -141,7 +141,7 @@ get_qubes_managed_iface() {
|
|||||||
qubes_iface="$(get_iface_from_mac "$mac")"
|
qubes_iface="$(get_iface_from_mac "$mac")"
|
||||||
if [ "x$qubes_iface" != "x" ]; then
|
if [ "x$qubes_iface" != "x" ]; then
|
||||||
echo "$qubes_iface"
|
echo "$qubes_iface"
|
||||||
else
|
elif [ -e /sys/class/net/eth0 ]; then
|
||||||
echo eth0
|
echo eth0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ COMMIT
|
|||||||
-A INPUT -m state --state INVALID -j DROP
|
-A INPUT -m state --state INVALID -j DROP
|
||||||
-A INPUT -i lo -j ACCEPT
|
-A INPUT -i lo -j ACCEPT
|
||||||
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||||
|
-A INPUT ! -i vif+ -p udp -s fe80::/64 -d fe80::/64 --dport 546 -j ACCEPT
|
||||||
-A INPUT -i vif+ -p icmpv6 --icmpv6-type router-advertisement -j DROP
|
-A INPUT -i vif+ -p icmpv6 --icmpv6-type router-advertisement -j DROP
|
||||||
-A INPUT -i vif+ -p icmpv6 --icmpv6-type redirect -j DROP
|
-A INPUT -i vif+ -p icmpv6 --icmpv6-type redirect -j DROP
|
||||||
-A INPUT -i vif+ -p icmpv6 -j ACCEPT
|
-A INPUT -i vif+ -p icmpv6 -j ACCEPT
|
||||||
|
@ -173,8 +173,15 @@ qubes_ip_change_hook() {
|
|||||||
|
|
||||||
have_qubesdb || exit 0
|
have_qubesdb || exit 0
|
||||||
|
|
||||||
if [ -n "$INTERFACE" ]; then
|
ACTION="$1"
|
||||||
if [ "$ACTION" == "add" ]; then
|
INTERFACE="$2"
|
||||||
|
|
||||||
|
if [ -z "$INTERFACE" ]; then
|
||||||
|
echo "Missing INTERFACE argument" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ACTION" == "add" ]; then
|
||||||
MAC="$(get_mac_from_iface "$INTERFACE")"
|
MAC="$(get_mac_from_iface "$INTERFACE")"
|
||||||
if [ -n "$MAC" ]; then
|
if [ -n "$MAC" ]; then
|
||||||
ip="$(/usr/bin/qubesdb-read "/net-config/$MAC/ip" 2> /dev/null)" || ip=
|
ip="$(/usr/bin/qubesdb-read "/net-config/$MAC/ip" 2> /dev/null)" || ip=
|
||||||
@ -231,9 +238,15 @@ if [ -n "$INTERFACE" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$ACTION" == "remove" ]; then
|
elif [ "$ACTION" == "remove" ]; then
|
||||||
|
# make sure network is disabled, especially on shutdown, to prevent
|
||||||
|
# leaks when firewall will get stopped too
|
||||||
|
ip link set "$INTERFACE" down 2>/dev/null || :
|
||||||
|
|
||||||
# If exists, we delete NetworkManager configuration file to prevent duplicate entries
|
# If exists, we delete NetworkManager configuration file to prevent duplicate entries
|
||||||
nm_config="/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE"
|
nm_config="/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE"
|
||||||
rm -rf "$nm_config"
|
rm -rf "$nm_config"
|
||||||
fi
|
else
|
||||||
|
echo "Invalid action '$ACTION'" >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# old udev has ENV{ID_NET_DRIVER}
|
# old udev has ENV{ID_NET_DRIVER}
|
||||||
SUBSYSTEMS=="xen", KERNEL=="eth*", ACTION=="add", ENV{ID_NET_DRIVER}=="vif", RUN+="/usr/lib/qubes/setup-ip"
|
SUBSYSTEMS=="xen", KERNEL=="eth*", ACTION=="add", ENV{ID_NET_DRIVER}=="vif", ENV{SYSTEMD_WANTS}+="qubes-network-uplink@%k.service"
|
||||||
SUBSYSTEMS=="net", KERNEL=="eth*", ACTION=="remove", ENV{ID_NET_DRIVER}=="vif", RUN+="/usr/lib/qubes/setup-ip"
|
SUBSYSTEMS=="net", KERNEL=="eth*", ACTION=="remove", ENV{ID_NET_DRIVER}=="vif", ENV{SYSTEMD_WANTS}+="qubes-network-uplink@%k.service"
|
||||||
# new udev has DRIVERS
|
# new udev has DRIVERS
|
||||||
SUBSYSTEMS=="xen", KERNEL=="eth*", ACTION=="add", DRIVERS=="vif", RUN+="/usr/lib/qubes/setup-ip"
|
SUBSYSTEMS=="xen", KERNEL=="eth*", ACTION=="add", DRIVERS=="vif", ENV{SYSTEMD_WANTS}+="qubes-network-uplink@%k.service"
|
||||||
|
@ -797,8 +797,12 @@ rm -f %{name}-%{version}
|
|||||||
/lib/systemd/system/qubes-firewall.service
|
/lib/systemd/system/qubes-firewall.service
|
||||||
/lib/systemd/system/qubes-iptables.service
|
/lib/systemd/system/qubes-iptables.service
|
||||||
/lib/systemd/system/qubes-network.service
|
/lib/systemd/system/qubes-network.service
|
||||||
|
/lib/systemd/system/qubes-network-uplink.service
|
||||||
|
/lib/systemd/system/qubes-network-uplink@.service
|
||||||
/lib/systemd/system/qubes-updates-proxy.service
|
/lib/systemd/system/qubes-updates-proxy.service
|
||||||
/usr/lib/qubes/init/network-proxy-setup.sh
|
/usr/lib/qubes/init/network-proxy-setup.sh
|
||||||
|
/usr/lib/qubes/init/network-proxy-stop.sh
|
||||||
|
/usr/lib/qubes/init/network-uplink-wait.sh
|
||||||
/usr/lib/qubes/init/qubes-iptables
|
/usr/lib/qubes/init/qubes-iptables
|
||||||
/usr/lib/qubes/iptables-updates-proxy
|
/usr/lib/qubes/iptables-updates-proxy
|
||||||
/usr/lib/qubes/qubes-setup-dnat-to-ns
|
/usr/lib/qubes/qubes-setup-dnat-to-ns
|
||||||
|
@ -91,6 +91,7 @@ enable qubes-update-check.timer
|
|||||||
enable qubes-misc-post.service
|
enable qubes-misc-post.service
|
||||||
enable qubes-updates-proxy.service
|
enable qubes-updates-proxy.service
|
||||||
enable qubes-network.service
|
enable qubes-network.service
|
||||||
|
enable qubes-network-uplink.service
|
||||||
enable qubes-qrexec-agent.service
|
enable qubes-qrexec-agent.service
|
||||||
enable qubes-mount-dirs.service
|
enable qubes-mount-dirs.service
|
||||||
enable qubes-rootfs-resize.service
|
enable qubes-rootfs-resize.service
|
||||||
|
@ -4,6 +4,8 @@ ConditionPathExists=/var/run/qubes-service/network-manager
|
|||||||
After=qubes-mount-dirs.service
|
After=qubes-mount-dirs.service
|
||||||
# For /var/run/qubes-service
|
# For /var/run/qubes-service
|
||||||
After=qubes-sysinit.service
|
After=qubes-sysinit.service
|
||||||
|
# For configuration of qubes-provided interfaces
|
||||||
|
After=qubes-network-uplink.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=/usr/lib/qubes/network-manager-prepare-conf-dir
|
ExecStartPre=/usr/lib/qubes/network-manager-prepare-conf-dir
|
||||||
|
@ -11,15 +11,6 @@ if [ -n "$(ls -A /usr/local/lib 2>/dev/null)" ] || \
|
|||||||
ldconfig
|
ldconfig
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set IP address again (besides action in udev rules); this is needed by
|
|
||||||
# DispVM (to override DispVM-template IP) and in case when qubes-ip was
|
|
||||||
# called by udev before loading evtchn kernel module - in which case
|
|
||||||
# qubesdb-read fails
|
|
||||||
QUBES_MANAGED_IFACE="$(get_qubes_managed_iface)"
|
|
||||||
if [ "x$QUBES_MANAGED_IFACE" != "x" ]; then
|
|
||||||
INTERFACE="$QUBES_MANAGED_IFACE" ACTION="add" /usr/lib/qubes/setup-ip
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -x /rw/config/rc.local ] ; then
|
if [ -x /rw/config/rc.local ] ; then
|
||||||
/rw/config/rc.local
|
/rw/config/rc.local
|
||||||
fi
|
fi
|
||||||
|
7
vm-systemd/network-proxy-stop.sh
Executable file
7
vm-systemd/network-proxy-stop.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo 0 > /proc/sys/net/ipv4/ip_forward
|
||||||
|
# disable also IPv6 forwarding, if IPv6 applicable
|
||||||
|
if [ -w /proc/sys/net/ipv6/conf/all/forwarding ]; then
|
||||||
|
echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
|
||||||
|
fi
|
16
vm-systemd/network-uplink-wait.sh
Normal file
16
vm-systemd/network-uplink-wait.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Source Qubes library.
|
||||||
|
# shellcheck source=init/functions
|
||||||
|
. /usr/lib/qubes/init/functions
|
||||||
|
|
||||||
|
# Setup IP address at specific time of system boot, instead of asynchronously
|
||||||
|
# by udev
|
||||||
|
QUBES_MANAGED_IFACE="$(get_qubes_managed_iface)"
|
||||||
|
if [ "x$QUBES_MANAGED_IFACE" != "x" ]; then
|
||||||
|
# systemd does not support conditional After= dependencies, nor a tool to
|
||||||
|
# just wait for the unit to be activated
|
||||||
|
# if the network interface is expected, use `systemctl start` to wait for
|
||||||
|
# it to be started - it would be started by udev (SYSTEMD_WANTS) anyway
|
||||||
|
systemctl start "qubes-network-uplink@$QUBES_MANAGED_IFACE.service"
|
||||||
|
fi
|
@ -1,7 +1,7 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Early Qubes VM settings
|
Description=Early Qubes VM settings
|
||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
Before=sysinit.target
|
Before=sysinit.target network-pre.target
|
||||||
After=local-fs.target qubes-db.service
|
After=local-fs.target qubes-db.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
11
vm-systemd/qubes-network-uplink.service
Normal file
11
vm-systemd/qubes-network-uplink.service
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Qubes network uplink wait
|
||||||
|
Before=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/lib/qubes/init/network-uplink-wait.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
11
vm-systemd/qubes-network-uplink@.service
Normal file
11
vm-systemd/qubes-network-uplink@.service
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Qubes network uplink (%i) setup
|
||||||
|
After=network-pre.target qubes-iptables.service
|
||||||
|
After=sys-subsystem-net-devices-%i.device
|
||||||
|
BindsTo=sys-subsystem-net-devices-%i.device
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/lib/qubes/setup-ip add "%i"
|
||||||
|
ExecStop=/usr/lib/qubes/setup-ip remove "%i"
|
@ -8,6 +8,7 @@ After=network-pre.target qubes-iptables.service
|
|||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
ExecStart=/usr/lib/qubes/init/network-proxy-setup.sh
|
ExecStart=/usr/lib/qubes/init/network-proxy-setup.sh
|
||||||
|
ExecStop=/usr/lib/qubes/init/network-proxy-stop.sh
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
Loading…
Reference in New Issue
Block a user