Commit Graph

217 Commits

Author SHA1 Message Date
Marek Marczykowski-Górecki
0bee339ffb
Cleanup kernel modules loading configuration
qubes-core-agent itself do not use u2mfn module.
2017-06-08 22:11:38 +02:00
Marek Marczykowski-Górecki
7e608a8bb4
Remove DisposableVM savefile related files
In Qubes 4.0 we no longer use two-stage DisposableVM startup.
2017-06-08 22:11:35 +02:00
Marek Marczykowski-Górecki
4514500ee6
Fix detection of PCI passthrough
Do not enable meminfo-writer (and in consequence qmemman) for the VM if
any real PCI device is present. Do not count qemu-emulated devices.
2017-05-26 05:25:30 +02:00
Marek Marczykowski-Górecki
b49ae50ad5
Implement qrexec-based connection to updates proxy
Configure package manager to use 127.0.0.1:8082 as proxy instead of
"magic" IP intercepted later. The listen on this port and whenever
new connection arrives, spawn qubes.UpdatesProxy service call (to
default target domain - subject to configuration in dom0) and connect
its stdin/out to the local TCP connection. This part use systemd.socket
unit in case of systemd, and ncat --exec otherwise.

On the other end - in target domain - simply pass stdin/out to updates
proxy (tinyproxy) running locally.

It's important to _not_ configure the same VM to both be updates proxy and
use it. In practice such configuration makes little sense - if VM can
access network (which is required to run updates proxy), package manager
can use it directly. Even if this network access is through some
VPN/Tor. If a single VM would be configured as both proxy provider and
proxy user, connection would loop back to itself. Because of this, proxy
connection redirection (to qrexec service) is disabled when the same VM
also run updates proxy.

Fixes QubesOS/qubes-issues#1854
2017-05-26 05:25:29 +02:00
Marek Marczykowski-Górecki
34fa6e7ced
debian: make haveged.service patch less intrusive...
...but installed on all Debian versions. This is mostly required by
vebose file list in debian/qubes-core-agent.install. But also make it
use new options when upstream will set them.

QubesOS/qubes-issues#2161
2017-05-22 17:30:06 +02:00
Marek Marczykowski-Górecki
ce70887a57
Merge branch 'core3-devel' 2017-05-20 14:43:53 +02:00
Marek Marczykowski-Górecki
13c99f1f10
systemd: fix race condition between qubes-db and qubes-early-vm-config
qubes-early-vm-config.service depend on qubes-db daemon running, to
retrieve various configuration parameters. But the startup ordering
declaration was missing

Fixes QubesOS/qubes-issues#2750
2017-05-14 23:13:26 +02:00
Marek Marczykowski-Górecki
d177e73bba
Merge remote-tracking branch 'qubesos/pr/43'
* qubesos/pr/43:
  Fix more shellcheck warnings
  Fix handling of binds containing spaces
2017-03-17 11:56:22 +01:00
Robin Schneider
e0814b481f
bind-dirs: Create ro if bind target exists
Before, the script skipped none existing ro paths even if the path
existed below /rw. This would require someone who wants to use bind-dirs
only in TemplateBasedVM to ensure that the paths exist before the
bind-dirs script gets called.

This patch changes this behavior so that if the path exists below /rw, it
is ensured that an (empty) file/directory is present in ro (where the
corresponding path from /rw is then bind mounted over).

Requires: Docs update. I can open a PR when this PRs looks good.
Fixes limitation: "Does not work if the file / folder in question does
  not already exist in the root image. I.e. a file that does not exist in
  the root image cannot be bind mounted in the TemplateBasedVM."
Example use case: https://github.com/debops/ansible-persistent_paths
Tested on: Qubes OS 3.2; Debian 8 TemplateBasedVM (and Template)
Related to: https://github.com/QubesOS/qubes-issues/issues/2661
2017-03-16 12:56:54 +01:00
Robin Schneider
a205c86bfe
Fix more shellcheck warnings 2017-03-14 20:13:23 +01:00
Robin Schneider
0facff3a01
Fix handling of binds containing spaces
```bash
binds+=( '/etc/tmp/s s' )
```

was handled incorrectly before.
2017-03-14 20:10:26 +01:00
unman
1ed2954f91
Stop unnecessary services in Debian 2017-02-16 22:41:14 +00:00
Marek Marczykowski-Górecki
08edfa630d
Merge remote-tracking branch 'qubesos/pr/35'
* qubesos/pr/35:
  Constrain cron and anacron in Ubuntu also
  Stop anacron from starting in Debian using existing constraint on cron
2017-02-12 23:59:43 +01:00
unman
a361fb454c
Stop anacron from starting in Debian using existing constraint on cron 2017-02-05 23:36:27 +00:00
Patrick Schleizer
3cc1a855dc comment 2016-12-21 00:15:12 +01:00
Marek Marczykowski-Górecki
41e3d591ef
Merge remote-tracking branch 'qubesos/pr/25'
* qubesos/pr/25:
  Add systemd override for haveged in xenial and stretch. (#2161) Reenable haveged.service after debian package installation

Fixes QubesOS/qubes-issues#2161
2016-11-28 15:02:32 +01:00
unman
58febd6d20
Add systemd override for haveged in xenial and stretch. (#2161)
Reenable haveged.service after debian package installation
2016-11-14 02:33:20 +00:00
Manuel Amador (Rudd-O)
6ca10b42eb Initialize home_volatile for disposable VMs. 2016-11-13 21:20:46 +00:00
Manuel Amador (Rudd-O)
251ecbd529 Clean up specfile unit activation aspect.
Up until today, Qubes OS would insist on either masking or disabling
or activating units that should get their state properly changed
but only on first package install (when the template is built).

This commit adds the possibility of having two types of unit presets:

* Initial presets: these are only changed state during first package
  installs.
* Upgrade presets: these get their state changed during first
  package installs as well as during upgrades.

All the maintainer has to do is abide by the instructions in the
preset file.  Nothing else is necessary.

Namely, this allows users to enable SSHD on their templates or
standalone VMs and still keep it enabled even after the
qubes-core-vm-systemd package is upgraded.

Matt really wanted that, and so did I, so now we can do it!

:-)
2016-10-28 08:35:36 +00:00
Manuel Amador (Rudd-O)
d15696ebef Fix VM settings running while / is readonly. 2016-10-28 05:21:40 +00: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
b7c7b4ad52
Merge remote-tracking branch 'qubesos/pr/20'
* qubesos/pr/20:
  Eliminate race condition with qubes-setup-dnat-to-ns

Fixes QubesOS/qubes-issues#1067
2016-10-17 21:12:39 +02:00
unman
f04712cf02
Revert version and correct unit files 2016-10-16 13:39:01 +01:00
unman
da82d93780
use bind-dirs to handle crontab persistence 2016-10-16 01:14:02 +01:00
Rudd-O
b7d8d66bb1 Eliminate race condition with qubes-setup-dnat-to-ns
qubes-setup-dnat-to-ns is called multiple times during boot.  Of particular interest are the two invocations done by:

1. `/usr/lib/qubes/init/network-proxy.setup.sh` (`qubes-network.service`)
2. `/usr/lib/qubes/init/misc-post.sh` (`qubes-misc-post.service`)

These can, and do often, run in parallel.  Often enough that the `PR-QBS` `nat` chain can end up with eight rules instead of four, or (worse) zero rules.

This commit represents the proper boot ordering of these services, where the post startup *must* happen after Qubes has already started its iptables, firewall, network setup and netwatcher.

This eliminates the race.
2016-10-12 15:19:46 +00:00
unman
a493b7c121
Remove custom mount when starting cron, in favour of bind-dirs 2016-10-11 11:28:48 +01:00
Marek Marczykowski-Górecki
2c8fe644f3
network: remove qubes-netwatcher
This tool/service is obsolete for a long time (it does nothing on R3.0
and later).
2016-09-12 05:58:26 +02:00
HW42
be0e8a250f
bind-dirs: copy from ro only if bind target doesn't exists
f4d367a6 dropped the check if the bind target exists and added
"--no-clobber" to the cp call. For directories this does not work as
desired: cp checks per (recursive) file instead of once for the
specified directory.
2016-09-01 03:41:31 +02:00
Marek Marczykowski-Górecki
c3d630f288
Disable meminfo-writer if there is any PCI device attached
This code used to be in dom0, but it's easier to maintain it in VM.

QubesOS/qubes-issues#2101
2016-08-17 21:27:28 +02:00
Marek Marczykowski-Górecki
60c30e6cdb
Merge remote-tracking branch 'origin/pr/82'
* origin/pr/82:
  comment legacy function
2016-08-06 18:42:16 +02:00
Marek Marczykowski-Górecki
1fd69636f8
systemd: fix syntax error in preset file
Services needs to be named with full unit name.

Fixes QubesOS/qubes-issues#2188
2016-08-06 18:36:30 +02:00
Patrick Schleizer
15274f8bb8 comment legacy function 2016-07-27 15:07:32 +02:00
Marek Marczykowski-Górecki
441a78df49
Merge remote-tracking branch 'origin/pr/81' 2016-07-27 05:20:13 +02:00
Marek Marczykowski-Górecki
60d16ea587
systemd: improve ordering of systemd units
- qubes-misc-post.service is no longer responsible for mounting /rw
- both qubes-sysinit.service and qubes-mount-dirs.service are part of
  basic.target, so no need to mention them explicitly (as long as
  DefaultDependencies=yes)

QubesOS/qubes-issues#2198
2016-07-27 05:19:47 +02:00
Marek Marczykowski-Górecki
48a35d40d1
systemd: load xen-privcmd module
It is needed for vchan communication. It was loaded implicitly by mount
/proc/xen, but since we're moving away from this legacy interface, load
it explicitly.

QubesOS/qubes-issues#2194
2016-07-27 05:19:46 +02:00
Marek Marczykowski-Górecki
e0e89f153f
systemd: order qubes-mount-dirs.service before local-fs.target
The service is really responsible for mounting /rw and /home, so should
be ordered before local-fs.target - this will allow other services
to use standard ordering targets.

This probably makes Before=qubes-gui-agent.service not needed anymore,
but do not remove it yet without extensive testing to not risk
regression.

Fixes QubesOS/qubes-issues#2194
2016-07-27 05:19:46 +02:00
Patrick Schleizer
67dd174cec empty legacy function
leaving that to Whonix

https://github.com/Whonix/qubes-whonix/blob/master/usr/lib/qubes-bind-dirs.d/41_qubes-whonix-legacy.conf

https://github.com/QubesOS/qubes-issues/issues/2191
2016-07-24 00:09:11 +00:00
Marek Marczykowski-Górecki
65f0b26600
systemd: plug random seed loading into systemd-random-seed
Reuse its dependencies to make sure it is loaded early enough.

Reported by @adrelanos
Fixes QubesOS/qubes-issues#1761
2016-07-17 04:26:01 +02:00
Marek Marczykowski-Górecki
9b362a6d7d
systemd: don't mark updates check service failed
Even if update check fails for some reason (network problem, apt-get lock
being held etc), don't mark the service as failed. The update check
mechanism is designed this way to not worry about such single failures
- other VM(s) may still check and report updates availability.

Fixes QubesOS/qubes-issues#1889
2016-07-16 15:30:40 +02:00
Marek Marczykowski-Górecki
6cf30bff29
Merge remote-tracking branch 'origin/pr/66'
* origin/pr/66:
  fixed qubes-core-agent upgrading double package manager lock

  Fixes QubesOS/qubes-issues#1889
2016-07-13 22:38:25 +02:00
Marek Marczykowski-Górecki
6bd6380918
Merge remote-tracking branch 'qubesos/pr/18'
* qubesos/pr/18:
  Enable xendriverdomain.service in 75-qubes-vm.preset
  Remove 'if true' wrapper from 06a0d30d50
  *Do* block until good random is available again
  dvm, then xendriverdomain, then qrexec-agent
2016-07-10 17:17:11 +02:00
Rusty Bird
0cc4803a9d
Enable xendriverdomain.service in 75-qubes-vm.preset 2016-07-03 05:00:29 +00:00
Rusty Bird
ae1a334a1d
Remove 'if true' wrapper from 06a0d30d50 2016-07-01 16:01:48 +00:00
Rusty Bird
cb55dfa6ae
*Do* block until good random is available again 2016-07-01 16:01:47 +00:00
Rusty Bird
fbf4c93730
dvm, then xendriverdomain, then qrexec-agent
Fixes QubesOS/qubes-issues#2126
Fixes QubesOS/qubes-issues#1990
2016-07-01 16:01:47 +00:00
Rusty Bird
ca03e093f7
Order network management units after network-pre.target
Network management software should order itself after network-pre.target
(man 7 systemd.special) so that other units can order themselves before
the *beginning* of network initialization. (qubes-misc-post too because
it calls setup-ip.)

Relevant for QubesOS/qubes-issues#2108
2016-06-30 16:20:47 +00:00
Patrick Schleizer
191b2a4cd9
Do not start tor@default service in TemplateVM.
Not doing that already for the tor service.

Since the actual tor service was renamed to tor@default by upstream.
2016-06-11 13:46:58 +00:00
Marek Marczykowski-Górecki
817606a09d
Merge remote-tracking branch 'origin/pr/72'
* origin/pr/72:
  systemd: order units checking for qubes-service after qubes-sysinit
2016-05-17 21:16:02 +02:00
Marek Marczykowski-Górecki
5e08e2bc1d
systemd: order units checking for qubes-service after qubes-sysinit
Files in /var/run/qubes-service are created by qubes-sysinit.service. So
defer that condition check after that service start.

Thanks @adrelanos for the report.

Fixes QubesOS/qubes-issues#1985
2016-05-12 00:17:05 +02:00
Patrick Schleizer
23bdcb90a7 minor debug xtrace output 2016-05-03 15:16:59 +02:00