Commit Graph

45 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
6aa2b89fba
Cleanup setup-ip script a bit
There is no longer a case where $INTERFACE is not set.
2020-12-04 03:24:02 +01:00
Marek Marczykowski-Górecki
dd8de797e3
Move network uplink setup to a separate service
Previously, network uplink (eth0) was configured in two places:
 - udev (asynchronously)
 - qubes-misc-post.service - at the very end of the boot process

This caused multiple issues:
1. Depending on udev event processing (non-deterministic), network
   uplink could be enabled too early, for example before setting up
   firewall.
2. Again depending on udev processing, it can be enabled quite late in
   the boot process, after network.target is up and services assume
   network already configured. This for example causes qubes-firewall to
   fail DNS queries.
3. If udev happen try to enable enable networking even earlier, it may
   happend before qubesdb-daemon is started, in which case network setup
   fill fail. For this case, there was network re-setup in
   qubes-misc-post service - much later in the boot.

Fix the above by placing network uplink setup in a dedicated
qubes-network-uplink@${INTERFACE}.service unit ordered after
network-pre.target and pulled in by udev based on vif device existence,
to handle also dynamic network attach/detach.
Then, create qubes-network-uplink.service unit waiting for appropriate
interface-specific unit (if one is expected!) and order it before
network.target.

QubesOS/qubes-issues#5576
2020-12-04 03:24:02 +01:00
Demi Marie Obenour
3e7552856f
Fix running under -euo pipefail
Some qubesdb-read commands are expected to fail.  I ultimately did not
wind up including -e, but this version should be ready for it.
2020-11-11 14:07:55 -05:00
Demi Marie Obenour
0a322958e4
Add gateway IP+MAC, not VM’s own 2020-11-10 22:09:54 -05:00
Demi Marie Obenour
aa71677cbd
Add permanent neighbor entries
This allows network traffic to flow even if ARP and NDP do not work or
ave explicitly been disabled.
2020-11-10 16:28:53 -05:00
Frédéric Pierret (fepitre)
fef261499b
setup-ip: fallback to legacy if nmcli is no present 2020-04-17 15:29:40 +02:00
Frédéric Pierret (fepitre)
dba1020b4c
Handle errors for non-present ip gateways 2019-06-22 17:40:25 +02:00
Frédéric Pierret (fepitre)
cf03ae3e2a
Better use '-z' and '-n' for readibility 2019-06-20 16:32:08 +02:00
Frédéric Pierret (fepitre)
aa7ab25a78
configure_network: use classical function parsing 2019-06-19 21:10:00 +02:00
Frédéric Pierret (fepitre)
1c54101663
Handle legacy non-present /qubes-mac qubesdb entry 2019-06-19 19:21:38 +02:00
Frédéric Pierret (fepitre)
325eff2b13
Refactor and handle new network qubesdb configuration 2019-06-18 18:49:42 +02:00
Frédéric Pierret (fepitre)
27fddadc22
setup-ip: handle default conf if /qubes-mac returns empty value 2019-05-21 17:32:09 +02:00
Frédéric Pierret (fepitre)
f7dd41206d
setup-ip: only assign IP configuration of Qubes managed iface 2019-05-21 17:21:51 +02:00
Marek Marczykowski-Górecki
c281d6454f
network: do not assume IPv6 gateway is a link-local address
If IPv6 gateway address provided by dom0 isn't a link local address, add
a /128 route to it. Also, add this address on backend interfaces (vif*).

This is to allow proper ICMP host unreachable packets forwarding - if
gateway (address on vif* interface) have only fe80: address, it will be
used as a source for ICMP reply. It will be properly delivered to the VM
directly connected there (for example from sys-net to sys-firewall), but
because of being link-local address, it will not be forwarded any
further.
This results timeouts if host doesn't have IPv6 connectivity.
2018-04-02 23:19:31 +02:00
Marek Marczykowski-Górecki
44f8cceb38
network: configure IPv6 when enabled
If dom0 expose IPv6 address settings, configure it on the interface.
Both backend and frontend side. If no IPv6 configuration is provided,
block IPv6 as it was before.

Fixes QubesOS/qubes-issues#718
2017-12-07 01:30:05 +01:00
Marek Marczykowski-Górecki
bb220ce2eb
network: fix issues found by shellcheck 2017-09-30 04:43:04 +02:00
Gregorio Guidi
1ca110a9fd
Restore functionality of disable-default-route and disable-dns-server. 2017-02-12 23:53:43 +01:00
Manuel Amador (Rudd-O)
59aec8e5eb Clean up early initialization and setup of /rw 2016-10-23 20:19:51 +00:00
Marek Marczykowski-Górecki
8afc07c513
network: minor setup-ip fix
Don't exit with non-zero exit code just because custom hook isn't
installed
2016-09-19 01:04:25 +02:00
Marek Marczykowski-Górecki
d99a563542
network: reload NM connection after setting it up
Apparently NM monitor only its main configuration for changes, but not
connection files. Force reloading it.
2016-08-02 02:08:36 +02:00
Patrick Schleizer
3db93cdc87 fix indent 2016-05-19 21:12:16 +02:00
Marek Marczykowski-Górecki
fb9b3b62c0
network: use qubes-primary-dns QubesDB entry if present
For a long time the DNS address was the same as default gateway. This is
still the case in R3.x, but using `qubes-gateway` configuration
parameter for it is misleading. It should be up to dom0 to provide DNS
address (whether the value is the same as gateway or not).

Fixes QubesOS/qubes-issues#1817
2016-03-07 13:37:45 +01:00
Marek Marczykowski-Górecki
a11897a1d0
Revert "network: use drop-ins for NetworkManager configuration (#1176)"
Apparently unmanaged devices are loaded only from main
NetworkManager.conf. Exactly the same line pasted (not typed!) to main
NetworkManager.conf works, but in
/etc/NetworkManager/conf.d/30-qubes.conf it doesn't.
BTW There was a typo in option name ("unmanaged_devices" instead of
"unmanaged-devices", but it wasn't the cause).

This reverts commit 6c4831339c.

QubesOS/qubes-issues#1176
2015-11-28 17:43:15 +01:00
Marek Marczykowski-Górecki
d23f3d8ddb
network: let NetworkManager configure VM uplink, if enabled
Previously even if NetworkManager was enabled, our script manually
configured network parameters. This apparently have negative effects,
because NetworkManager tries to configure some things differently - for
example use metric 1024 for default gateway.

Fixes QubesOS/qubes-issues#1052
2015-11-13 04:26:23 +01:00
Patrick Schleizer
2eb0ed2be1
removed trailing spaces 2015-10-15 04:34:55 +02:00
Marek Marczykowski-Górecki
580d21acdc
network: fix 'qubes-uplink-eth0' NetworkManager connection (#1280)
According to the specification[1], the setting name is 'addresses', not
'address'.  The later apparently worked on some NetworkManager versions,
but for example not on the one in Debian wheezy. Also fix value
format (IP;netmask;gateway).

[1] htts://developer.gnome.org/NetworkManager/unstable/ref-settings.html

Fixes QubesOS/qubes-issues#1280
2015-10-06 15:29:30 +02:00
Marek Marczykowski-Górecki
6c4831339c
network: use drop-ins for NetworkManager configuration (#1176)
Do not modify main /etc/NetworkManager/NetworkManager.conf as it would
cause conflicts during updates. Use
/etc/NetworkManager/conf.d/30-qubes.conf instead.
Also remove some dead code for dynamically generated parts (no longer
required to "blacklist" eth0 in VMs - we have proper connection
generated for it). It was commented out for some time already

Fixes QubesOS/qubes-issues#1176
2015-10-06 15:15:26 +02:00
Jason Mehring
4373cda566 Changed location of PROTECTED_FILE_LIST to /etc/qubes/protected-files.d 2015-04-25 02:36:43 +02:00
Jason Mehring
56b0685aaa whonix: Added protected-files file used to prevent scripts from modifying files that need to be protected
A file is created in /var/lib/qubes/protected-files.  Scripts can grep this file before modifying
        known files to be protected and skip any modifications if the file path is within protected-files.

        Usage Example:
            if ! grep -q "^/etc/hostname$" "${PROTECTED_FILE_LIST}" 2>/dev/null; then

        Also cleaned up maintainer scripts removing unneeded systemd status functions and streamlined
        the enable/disable systemd unit files functions
2015-04-25 02:36:43 +02:00
Marek Marczykowski-Górecki
19a4c6d0dd network: support for not setting DNS and/or default gateway (v2)
This patch introduces two new qvm-services:
 - disable-default-route
 - disable-dns-server
Both disabled by default. You can enable any of them to not set default
route and/or DNS servers in the VM. Those settings have no effect on
NetVM, where such settings are controlled by NetworkManager.

This is based on patch sent by Joonas Lehtonen
<joonas.lehtonen@openmailbox.org>
https://groups.google.com/d/msgid/qubes-devel/54C7FB59.2020603%40openmailbox.org

Conflicts:
	network/setup-ip
	vm-init.d/qubes-core
	vm-systemd/qubes-sysinit.sh
2015-01-30 00:52:31 +01:00
Marek Marczykowski-Górecki
4637735882 network: support for not setting DNS and/or default gateway
This patch introduces two new qvm-services:
 - set-default-route
 - set-dns-server
Both enabled by default. You can disable any of them to not set default
route and/or DNS servers in the VM. Those settings have no effect on
NetVM, where such settings are controlled by NetworkManager.

This is based on patch sent by Joonas Lehtonen
<joonas.lehtonen@openmailbox.org>
https://groups.google.com/d/msgid/qubes-devel/54C39656.3090303%40openmailbox.org

Conflicts:
	network/setup-ip
	vm-init.d/qubes-core
	vm-systemd/qubes-sysinit.sh
2015-01-30 00:48:55 +01:00
Marek Marczykowski-Górecki
0be213200a network: fix NM config preparation
The same variables are reused to configure downlink in ProxyVM, so
create NM config before they got overrided.

Conflicts:
	network/setup-ip
2015-01-30 00:43:29 +01:00
Marek Marczykowski-Górecki
b3429b596d network: set uplink configuration based on MAC (NetworkManager) 2015-01-30 00:39:37 +01:00
Marek Marczykowski-Górecki
9130636c88 Merge branch 'debian'
Conflicts:
	misc/qubes-r2.list.in
	misc/qubes-trigger-sync-appmenus.sh
	network/30-qubes-external-ip
	network/qubes-firewall
	vm-systemd/network-proxy-setup.sh
	vm-systemd/prepare-dvm.sh
	vm-systemd/qubes-sysinit.sh
2015-01-30 00:30:24 +01:00
Marek Marczykowski
db35abadc8 Use Qubes DB instead of Xenstore 2014-11-19 15:34:33 +01:00
Marek Marczykowski-Górecki
ea4eef7de8 network: fix indentation 2014-11-13 23:19:34 +01:00
Marek Marczykowski-Górecki
427decd793 network: fix NM uplink config permissions
Otherwise NM will not use the file.
2014-11-09 05:35:07 +01:00
Marek Marczykowski-Górecki
7027633e80 network: do not use ifcfg-rh NM plugin
Apparently eth0 in ProxyVM can be configured using plain keyfile plugin,
which is present on all distributions.
2014-11-09 05:31:22 +01:00
Marek Marczykowski-Górecki
a288939156 Revert "network: use the same gateway IP generation method as backend"
This reverts commit 4ef785a016.
Actually this change was wrong - the frontend IP was correct, the
problem was with backend IP.
2014-08-13 08:58:10 +02:00
Marek Marczykowski-Górecki
4ef785a016 network: use the same gateway IP generation method as backend
Backend domain generates its IP address based on frontend IP, not
settings given from dom0. So change frontend method to the same (for
DispVM it makes a difference). Now "qubes-gateway" xenstore entry is
basically primary DNS address only.
2014-08-13 08:12:37 +02:00
Davíð Steinn Geirsson
e5fa610b0d Use xenstore.h instead of xs.h when xen >= 4.2 2014-07-23 05:13:06 +02:00
Davíð Steinn Geirsson
2ddea415b2 Check for xenstore-read in /usr/sbin as well (default on debian) 2014-07-23 05:11:31 +02:00
Marek Marczykowski-Górecki
510edfb071 network: setup NM connection when its active in the ProxyVM 2014-05-22 01:36:15 +02:00
Marek Marczykowski
30ca124784 The Underscores Revolution: xenstore paths 2013-03-14 04:29:15 +01:00
Marek Marczykowski
ecc812f350 The Underscores Revolution: filenames
Get rid of underscores in filenames, use dashes instead.
This is first part of cleanup in filenames.
"qubes_rpc" still untouched - will be in separate commit.
2013-03-14 01:07:49 +01:00