Compare commits

...

385 Commits

Author SHA1 Message Date
2df917e7a5
dracut: add roadrunner2/macbook12-spi-driver on MacBook HW 2020-02-27 19:26:44 +01:00
3hhh
c600b1b39c
Proper argument escaping for special characters.
Fixes side note of QubesOS/qubes-issues#5562
2020-01-15 15:38:28 +01:00
3hhh
f4f5731bdc
Don't pass stdin to VMs unless necessary.
Fixes QubesOS/qubes-issues#5562
2020-01-15 15:16:41 +01:00
Frédéric Pierret (fepitre)
0d53697917
travis: switch to dom0 Fedora 31
QubesOS/qubes-issues#5529
2020-01-11 11:38:17 +01:00
Marek Marczykowski-Górecki
a4006f5046
version 4.1.3 2020-01-04 20:54:17 +01:00
Marek Marczykowski-Górecki
264ded8101
Merge remote-tracking branch 'origin/pr/53'
* origin/pr/53:
  Added enabling of qrexec-policy-daemon.service
2020-01-04 20:54:05 +01:00
Marek Marczykowski-Górecki
4a88c520ac
kernel-install: consider both grub2 and grub2-efi configs
Since EFI boot now also use grub2, update its config too when present.

Reported-by: @JarrahG
QubesOS/qubes-issues#4902
2019-12-19 05:33:34 +01:00
Marta Marczykowska-Górecka
761b5b1ef4
Added enabling of qrexec-policy-daemon.service
used by https://github.com/QubesOS/qubes-core-qrexec/pull/6
references QubesOS/qubes-issues#5125
2019-12-03 20:01:18 +01:00
Marek Marczykowski-Górecki
257d9e5b78
version 4.1.2 2019-10-28 04:20:28 +01:00
Marek Marczykowski-Górecki
9cf273d187
qubes-dom0-update: fix removing backup template after the operation
qvm-remove got confirmation prompt, add -f to avoid it.
2019-10-21 03:47:39 +02:00
Frédéric Pierret (fepitre)
cf76a3cbbb
travis: switch to bionic
QubesOS/qubes-issues#4613
2019-10-19 21:45:19 +02:00
Marek Marczykowski-Górecki
e5e006d933
Fix various issues with qubes-dom0-update
- fix unescaped dot in package_regex
- if any package fails verification, remove the whole directory, not
only that single package
- abort (and remove the whole directory) on any exception
- don't include file name in the error message, if it failed
verification

This, among other things, fix handling symlinks and directories sent by
potentially malicious UpdateVM. os.remove() can't remove non-empty
directories, so it would fail.
Fortunately metadata is created only after successful verification, so
dnf/yum wouldn't touch packages that failed verification and also
weren't removed. But make the code better handle such situations.

Reported-by: Hans Jerry Illikainen <hji@dyntopia.com>
2019-10-09 04:49:01 +02:00
Marek Marczykowski-Górecki
2dadbcfdcb
version 4.1.1 2019-09-24 03:45:11 +02:00
Marek Marczykowski-Górecki
9962fab124
repos rpc: use dnf native method of writing repository configuration
Since we have new enough dnf version, native write_raw_configfile() can
be used, instead of external iniparse module.

QubesOS/qubes-issues#4550
2019-08-28 16:40:13 +02:00
M. Vefa Bicakci
1089a7a07b
qubes-dom0-update: Quote arguments
This commit ensures that all arguments to qubes-download-dom0-updates.sh
are properly quoted. This allows the use of commands such as

  sudo qubes-dom0-update --action=distro-sync '*'

where, prior to this commit, the asterisk would be expanded in the
update virtual machine's home directory, whereas this commit prevents
the undesirable shell expansion of wildcards.

Fixes QubesOS/qubes-issues#5096
2019-07-20 20:41:54 -04:00
Marek Marczykowski-Górecki
c56c4a7a9d
kernel-install: adjust EFI check to look for xen.cfg
Even if EFI directory is present it may not be populated. kernel-install
part care specifically about xen.cfg file, so check it explicitly. If
grub2-efi is in use, the file wont be there and the script isn't
supposed to do anything.
2019-06-27 14:28:15 +02:00
Marek Marczykowski-Górecki
895415aee1
version 4.1.0 2019-06-08 05:25:20 +02:00
Marek Marczykowski-Górecki
8800a08150
Merge remote-tracking branch 'origin/pr/48'
* origin/pr/48:
  Add some comments to qubes.repos.List
  Don't write a trailing newline in qubes.repos.List
  Add qubes.repos.* services to the RPMs
  Print `ok` for repo enable/disable success
  Use qrexec service arguments
  Properly set the umask for repo files
  Enable/disable repos atomically
  Use Python whitespace conventions
  Rename admin.repos.* to qubes.repos.*
  Add admin.repos.* qrexec services
2019-06-08 05:12:03 +02:00
AJ Jordan
82806b53e2
Add some comments to qubes.repos.List 2019-04-08 12:55:55 -04:00
AJ Jordan
3786197ab2
Don't write a trailing newline in qubes.repos.List
This makes it annoying to parse.
2019-04-08 12:55:54 -04:00
AJ Jordan
75faa22dff
Add qubes.repos.* services to the RPMs 2019-04-08 12:55:52 -04:00
AJ Jordan
2283af8ce5
Print ok for repo enable/disable success 2019-04-08 12:55:50 -04:00
AJ Jordan
00c37b0b5b
Use qrexec service arguments 2019-04-08 12:55:49 -04:00
AJ Jordan
05658f0850
Properly set the umask for repo files 2019-04-08 12:55:48 -04:00
AJ Jordan
0af2769aca
Enable/disable repos atomically 2019-04-08 12:55:46 -04:00
AJ Jordan
529f5a1cd0
Use Python whitespace conventions 2019-04-08 12:55:44 -04:00
AJ Jordan
ce70209310
Rename admin.repos.* to qubes.repos.* 2019-04-08 12:55:43 -04:00
AJ Jordan
888073df05
Add admin.repos.* qrexec services
This is a prerequisite for QubesOS/qubes-issues#4550.
2019-04-08 12:55:41 -04:00
Marek Marczykowski-Górecki
6fa3e19f7e
travis: drop R4.0, switch to xenial
QubesOS/qubes-issues#4613
2019-04-08 16:10:30 +02:00
Marek Marczykowski-Górecki
15c55a4ef5
Remove qrexec related files
Move them to the core-qrexec repository.

QubesOS/qubes-issues#4955
2019-04-08 15:57:45 +02:00
Marek Marczykowski-Górecki
2ec29a4d4c
Cleanup lvm archived metadata files
Those files may easily accumulate in large quantities, to the point
where just listing the /etc/lvm/archive directory takes a long time.
This affects every lvm command call, so every VM start/stop.
Those archive files are rarely useful, as Qubes do multiple LVM
operations at each VM startup, so older data is really out of date very
quickly.

Automatically remove files in /etc/lvm/archive older than one day.

Fixes QubesOS/qubes-issues#4927
Fixes QubesOS/qubes-issues#2963
2019-04-02 18:04:26 +02:00
Marek Marczykowski-Górecki
330f155168
dom0-update: support rpm -K output of rpm 4.14
QubesOS/qubes-issues#4225
2019-04-02 17:58:30 +02:00
Marek Marczykowski-Górecki
fb1c284774
dom0-update: send dnf.conf to updatevm
There may be no yum.conf anymore (fc29), so send dnf.conf as this is the
config that is really used.

QubesOS/qubes-issues#4225
2019-04-02 17:57:07 +02:00
Marek Marczykowski-Górecki
d705fa6ed4
system-config: enable dbus in system- and user- presets
It is no longer enabled by default by systemd package.

QubesOS/qubes-issues#4225
2019-04-01 06:23:21 +02:00
Marek Marczykowski-Górecki
61ec339c2d
qrexec: add version negotiation
Use lower version from (local, remote).

QubesOS/qubes-issues#4909
2019-03-31 19:23:40 +02:00
Marek Marczykowski-Górecki
b6e3f360c9
version 4.0.18 2019-03-09 23:59:36 +01:00
Marek Marczykowski-Górecki
edf406c172
travis: fix R4.1 line 2019-03-02 16:38:44 +01:00
Marek Marczykowski-Górecki
1ffa0d69cb
rpm: add BR: gcc 2019-03-02 16:32:05 +01:00
Marek Marczykowski-Górecki
d5e667d0ee
qvm-copy: fix handling VM names starting with dash
Reported by @v6ak
2019-03-02 16:31:17 +01:00
Marek Marczykowski-Górecki
e5deabe0aa
suspend: let errors be logged into journald
The \0 after error code prevent logging error message which is after it.
This change clobber qubesd-query exit code with tr exit code (mostly 0),
but this is a good thing - failing qubes-suspend service does not
prevent the suspend, but do prevent the stop hooks being called, which
for example breaks time synchronization or may leave some domains
paused.

QubesOS/qubes-issues#3489
2019-02-24 15:51:57 +01:00
Marek Marczykowski-Górecki
59ecf8eb83
dom0-update: fix backup template name calculation
VM name is limited to 31 chars, not 32.

Fixes QubesOS/qubes-issues#4829
2019-02-18 05:05:24 +01:00
Marek Marczykowski-Górecki
72a3459119
version 4.0.17 2018-12-09 18:43:03 +01:00
Marek Marczykowski-Górecki
9c3a4e7b00
dom0-updates: use qvm-run -q
One of the calls missed -q option.
2018-12-08 12:03:33 +01:00
Marek Marczykowski-Górecki
d7c23e1b7f
dom0-updates: fix command line for dnf4
dnf4 (Fedora 29) does not like final coma in --exclude option. If it's
there, the whole --exclude is ignored on misinterpreted (as one long
package name?).
2018-12-06 15:20:22 +01:00
Marek Marczykowski-Górecki
07c286fad5
Merge remote-tracking branch 'origin/pr/47'
* origin/pr/47:
  Fix GCC8 warning
  tracis-ci: add support for fc29 dom0
2018-12-06 14:05:41 +01:00
Marek Marczykowski-Górecki
8555ff4ced
dom-updates: drop 'distroverpkg' from dnf.conf
It does nothing in dnf (was useful in yum era).

QubesOS/qubes-issues#4477
2018-12-04 21:04:14 +01:00
Marek Marczykowski-Górecki
c03fbecb4e
dom0-updates: use qvm-service for disabling dom0 updates check
Use the same mechanism as VMs - first it's compatible with Admin API (in
contrary to flag files); second it ease handling it.

Migrate old setting on package upgrade.
2018-12-04 21:04:09 +01:00
fepitre
b36f298815 Fix GCC8 warning
QubesOS/qubes-issues#4225
2018-11-22 19:30:55 +01:00
Frédéric Pierret (fepitre)
7064279316 tracis-ci: add support for fc29 dom0 2018-11-22 19:30:55 +01:00
Marek Marczykowski-Górecki
10960564cf
dom0-updates: use qvm-features to report dom0 updates
Use the same as thing as VMs.
2018-11-02 01:58:27 +01:00
Kushal Das
0a94e59325
Adds info & search actions for template packages
Now we can do --action=info or --action=search
for a template. This will not shutdown the template and simply
execute search or info command for dnf.
2018-10-30 08:06:15 +05:30
Marek Marczykowski-Górecki
3cc4f5bed3
Merge remote-tracking branch 'origin/pr/44'
* origin/pr/44:
  Error in qubes-dom0-update --gui
2018-09-29 13:52:49 +02:00
Marek Marczykowski-Górecki
4495000703
Fix mock-based build 2018-09-29 02:39:23 +02:00
Marta Marczykowska-Górecka
879b62c353
Error in qubes-dom0-update --gui
Fixed error with zenity in qubes-dom0-update --gui,
in which zenity was called with insufficient parameters.

fixes QubesOS/qubes-issues#4339
2018-09-27 21:05:28 +02:00
Marek Marczykowski-Górecki
912861c8b0
version 4.0.16 2018-09-13 23:39:13 +02:00
Marek Marczykowski-Górecki
b1c038e882
Merge remote-tracking branch 'qubesos/pr/43'
* qubesos/pr/43:
  Fix some references to `yum` instead of `dnf`
2018-09-02 07:41:51 +02:00
Marek Marczykowski-Górecki
a10d724bb1
Add missing R: createrepo_c
Dom0 update scripts need it.

Fixes QubesOS/qubes-issues#4099
2018-09-02 02:04:35 +02:00
AJ Jordan
a5d6dd3001
Fix some references to yum instead of dnf
I didn't change any of the variable names because it made me nervous and I was too lazy to test.
2018-08-18 01:11:50 -04:00
Marta Marczykowska-Górecka
9a039f0753
Added dummy qvm-move/qvm-copy do dom0
While qvm-move and qvm-copy cannot work in dom0, their
absence is confusing. Thus, stub tools that output message
informing the user that these tools are unavailable and
qvm-move-to-vm/qvm-copy-to-vm should be used instead.

fixes QubesOS/qubes-issues#4021
2018-07-16 18:30:36 +02:00
Marek Marczykowski-Górecki
6d08882978
version 4.0.15 2018-07-03 21:08:56 +02:00
Marek Marczykowski-Górecki
9eefe23f4c
kernel-install: fix initramfs copying scripts
Fix current EFI boot dir discovery script.

Also, adjust scripts order:
50-dracut generates initramfs in /boot/(efi/)?/$MACHINE_ID/.../initrd
80-grub2 copies it to /boot/initramfs-....img
90-xen-efi copies it to /boot/efi/EFI/qubes/initramfs-....img

Make the above order explicit, rather than relying on xen sorted later
than grub2.

QubesOS/qubes-issues#3234
2018-06-28 02:56:16 +02:00
Marek Marczykowski-Górecki
53730c4ba2
kernel-install: remove EFI variant of BLS dirs too
Remove also EFI version of BootLoader Specification dirs. This will:
- really force to re-generate initramfs during installation, after all
relevant configs are updated; previously, dracut (called by anaconda
through kernel-install) refuse to update already existing
/boot/efi/.../initrd file.
- save some precious space in /boot/efi

Fixes QubesOS/qubes-issues#3234
2018-06-27 03:59:05 +02:00
Marek Marczykowski-Górecki
861ddc9ce0
kernel-install: cleanup old kernel binary on remove
Don't let kernel images accumulate on EFI partition.
2018-05-22 19:51:47 +02:00
Marek Marczykowski-Górecki
03959b670c
dom0-updates: display GUI notification about no updates
If no updates are available, display some notification about that (when
GUI mode requested). Otherwise user has no idea what happened (update
failed? still doing something?).

Fixes QubesOS/qubes-issues#3751
2018-04-21 02:58:30 +02:00
Frédéric Pierret
ee878fa40a
spec.in: remove useless condition on Fedora 17 which induces problem with Travis 2018-04-04 16:26:14 -04:00
Frédéric Pierret
5b78f21921
spec.in: add changelog placeholder 2018-04-03 22:07:36 +02:00
Frédéric Pierret
a2139b95b5
spec.in for vaio fixes package 2018-04-03 22:07:35 +02:00
Frédéric Pierret
3ae3eae48b
Remove _builddir 2018-04-03 22:07:08 +02:00
Frédéric Pierret
9f591b0578
Create .spec.in and Source0 2018-04-03 22:07:08 +02:00
Marek Marczykowski-Górecki
565fb3dc3a
version 4.0.14 2018-03-28 04:14:02 +02:00
Marek Marczykowski-Górecki
bcf7c9e978
kernel-install: use up to date initramfs
During installation, /usr/lib/kernel/install.d/50-dracut.install
generate initramfs in $BOOT_DIR_ABS. It is important to use that one,
even if there is one in /boot/initramfs-*.img already, because it was
generated later and contains all required config files (including
keyboard layout for entering LUKS passphrase).

This fixes d1f3be0eed "kernel-install:
avoid creating initramfs multiple times".

Fixes QubesOS/qubes-issues#3234
2018-03-27 19:20:36 +02:00
Marek Marczykowski-Górecki
7c1cad00b0
version 4.0.13 2018-03-04 03:47:13 +01:00
Marek Marczykowski-Górecki
bae443dfce
systemd-preset: enable fstrim.timer
On LVM thin it is easy to fill the pool if fstrim (or 'discard' mount
option) isn't used from time to time. Enable fstrim.timer by default,
which will do fstrim once a week.
2018-03-04 03:43:54 +01:00
Marek Marczykowski-Górecki
d924270bb1
version 4.0.12 2018-03-04 02:51:32 +01:00
Marek Marczykowski-Górecki
d1f3be0eed
kernel-install: avoid creating initramfs multiple times
There are multiple places where initramfs can be created:
 - /boot/iniramfs-*.img
 - /boot/$MACHINE_ID/.../initrd (unused on Qubes, but created by Fedora
   scripts)
 - /boot/efi/EFI/.../initramfs-*.img

Do not generate all of those from scratch, but try to reuse existing
image (if exists). Since one dracut call may last even 5 minutes, this
change should greatly reduce installation time.

Fixes QubesOS/qubes-issues#3637
2018-02-27 23:19:50 +01:00
Marek Marczykowski-Górecki
6cef3f3966
Merge remote-tracking branch 'qubesos/pr/38'
* qubesos/pr/38:
  Bad spaces
  Add -p to mkdir to skip error if dir already exists
  Make dir dom0-updates if not exists on UpdateVM

Fixes QubesOS/qubes-issues#3620
2018-02-25 21:26:11 +01:00
Marek Marczykowski-Górecki
cd23a035c5
qrexec: use distinct exit code for timeout
This will allow for better error reporting
2018-02-25 13:12:34 +01:00
donoban
dbb22f6335
Bad spaces 2018-02-25 12:17:48 +01:00
donoban
31548737c6
Add -p to mkdir to skip error if dir already exists 2018-02-25 12:14:39 +01:00
donoban
994bd72363
Make dir dom0-updates if not exists on UpdateVM
https://github.com/QubesOS/qubes-issues/issues/3620
2018-02-23 10:48:06 +01:00
Marek Marczykowski-Górecki
d48f5599d3
Merge remote-tracking branch 'qubesos/pr/37'
* qubesos/pr/37:
  Fix typos in qubes-dom0-update
2018-02-22 21:38:42 +01:00
Marek Marczykowski-Górecki
cfc424667a
version 4.0.11 2018-02-20 01:14:06 +01:00
Marek Marczykowski-Górecki
e8c8515211
rpm: adjust dependencies 2018-02-20 01:13:33 +01:00
Marek Marczykowski-Górecki
c129ce2e4d
qrexec: forbid '$' in target and service name
Those parameters eventually may eventually be passed to a shell script
(at least /usr/lib/qubes/qubes-rpc-multiplexer). While it is possible to
properly escape shell special characters, lets do safer and less fragile
thing: forbid such characters entirely.
In case of target name, qrexec policy keywords are allowed, and after
recent change, those contains '@', so allow this char.
2018-02-19 03:30:26 +01:00
Marek Marczykowski-Górecki
d54d953af1
qrexec: use separate variables for original target type and value
Avoid passing special characters (like '$' or '@') to the service, even
if in environment variable. Use separate variable (and
qubes-rpc-multiplexer argument) to provide type of original target.
There are two:
 - specific VM by name ("name")
 - special name, like $adminvm, $dispvm etc ("keyword")

Then, use separate variables to provide actual value:
 - QREXEC_REQUESTED_TARGET_KEYWORD (if _TYPE == "keyword")
 - QREXEC_REQUESTED_TARGET (if _TYPE == "name")

The later one intentionally is the same as in previous implementation,
to preserve compatibility.
2018-02-19 03:30:04 +01:00
Marek Marczykowski-Górecki
32b0c659a1
qrexec: use exec_qubes_rpc_if_requested() from qubes-utils
This avoids duplicating service call parsing in multiple places. For
dom0 part it was in qrexec-policy tool.
Also, add execl() error handling.
2018-02-16 04:22:48 +01:00
Miguel Jacq
6a792ed056
Fix typos in qubes-dom0-update 2018-02-12 16:48:52 +11:00
Marek Marczykowski-Górecki
bdebfe330a
version 4.0.10 2018-01-19 18:13:44 +01:00
Rusty Bird
629d02948f
Don't let udev parse 'file' driver .img anywhere 2018-01-19 18:04:56 +01:00
Marek Marczykowski-Górecki
da61441bf9
version 4.0.9 2018-01-18 19:49:06 +01:00
Marek Marczykowski-Górecki
21c951201c
Merge remote-tracking branch 'qubesos/pr/36'
* qubesos/pr/36:
  Fix fall through
2018-01-12 17:34:10 +01:00
Marek Marczykowski-Górecki
b07706fd7a
dom0-updates: launch console update in terminal emulator as "GUI"
GUI updaters and Packagekit are confused by networkless dom0 and often
report that:
 - cannot check for updates (because of no network connection)
 - no updates are available, even if they are

The latter happen mostly because PackageKit does not load dnf.conf, so
try to use /etc/yum.repos.d (network repositories) instead of
/etc/yum.real.repos.d (local cache, downloaded by qubes-dom0-update).
Currently PackageKit does not support configuring it, the path is
hardcoded.

Until both of above issues get fixed, prefer console updater.

Fixes QubesOS/qubes-issues#1378
2018-01-12 04:54:07 +01:00
BaN-Co
3a176fa658
Fix fall through
It's necessary to add the break at the end of "case -1" statement else the compiler will treat it as fall through and GCC 7 will throw an error because of -Werror=implicit-fallthrough=.
2018-01-09 15:36:37 +07:00
Marek Marczykowski-Górecki
8689170368
dom0-updates: move PackageKit cache refresh to GUI handling
PackageKit is used only by GUI updaters, refresh its cache only then.
Since PackageKit daemon do not read dnf.conf, it doesn't know  the right
repository location, so try to access network, which results in
timeouts. But at the same time, it invalidate previous cache, which is
what we need.
Do not delay every qubes-dom0-update call by pkcon call.
2018-01-08 01:40:18 +01:00
Marek Marczykowski-Górecki
6c8537fab1
version 4.0.8 2017-12-23 02:53:11 +01:00
Jean-Philippe Ouellet
c69662eb28
Improve qrexec protocol mismatch error dialog
- only have one button, because "yes/no" makes no sense in this context
- inform use to use "-t pv" for xl console, because otherwise it won't
  work for HVM domains.
- use the actual VM name, not "vmname"
2017-12-07 14:42:33 -05:00
Marek Marczykowski-Górecki
be9e759697
Merge remote-tracking branch 'qubesos/pr/33'
* qubesos/pr/33:
  qubes-dom0-update: Adapt template backup failsafe for R4
2017-12-05 23:10:02 +01:00
Marek Marczykowski-Górecki
7902979470
Merge remote-tracking branch 'qubesos/pr/32'
* qubesos/pr/32:
  qubes-dom0-update: Simplify
2017-12-05 23:06:12 +01:00
Jean-Philippe Ouellet
552fd062ea
qubes-dom0-update: Adapt template backup failsafe for R4
Perhaps the UpdateVM template should be temporarily switched to the
backup too. That would make it really failsafe. Currently it requires
manual recovery (by setting template of UpdateVM to the backup).
2017-11-30 08:52:13 -05:00
Jean-Philippe Ouellet
aeb04e24e2
qubes-dom0-update: Simplify
qvm-run auto-starts VMs by default
2017-11-30 08:51:14 -05:00
Jean-Philippe Ouellet
686db90032
qubes-dom0-update: Remove dependency on Xen as vmm 2017-11-30 08:46:28 -05:00
Marek Marczykowski-Górecki
7a644b6d61
version 4.0.7 2017-11-03 22:37:48 +01:00
Marek Marczykowski-Górecki
21df9d55bb
Add qubes-core-dom0 to dnf protected packages set
This will prevent its accidental removal, which would lead to completely
broken system.
2017-11-03 03:27:10 +01:00
Marek Marczykowski-Górecki
b79aa05014
version 4.0.6 2017-10-07 02:35:09 +02:00
Marek Marczykowski-Górecki
68dd013585
Drop dracut workaround for missing LUKS-related modules
It isn't needed for a long time, but at the same time some modules have
changed names, so now it cause errors/warnings.
2017-10-02 21:38:51 +02:00
Marek Marczykowski-Górecki
54d5c7b35c
qrexec: allow ':' in call target specification
':' is used in DispVM special tags, like '$dispvm:something'.

Fixes QubesOS/qubes-issues#3137
2017-10-01 13:19:42 +02:00
Frédéric Pierret
69d230d065
fix fallthrough: add specific error message with respect to 'select' return value 2017-09-26 23:05:09 +02:00
Marek Marczykowski-Górecki
a93a846687
version 4.0.5 2017-09-15 13:43:44 +02:00
Marek Marczykowski-Górecki
6ba03ed65b
Mark /var/lib/qubes to not expose loop devices pointing inside
DM_UDEV_DISABLE_DISK_RULES_FLAG flag sometimes isn't properly
propagated, so just to be sure, add a flag file
/var/lib/qubes/.qubes-exclude-block-devices to exclude that directory.

Fixes 5c84a0b "udev: don't exclude loop devices pointing outside of
/var/lib/qubes"

QubesOS/qubes-issues#3084
2017-09-15 05:15:23 +02:00
Marek Marczykowski-Górecki
1f6546f484
version 4.0.4 2017-09-12 04:25:04 +02:00
Marek Marczykowski-Górecki
5c84a0be92
udev: don't exclude loop devices pointing outside of /var/lib/qubes
Generally list loop devices in qvm-block, but exclude only those
pointing at files in /var/lib/qubes (VM disk images).

Fixes QubesOS/qubes-issues#3084
2017-09-12 04:22:25 +02:00
Andrew (anoa)
02ced3a639
Switch to createrepo_c
Fixes QubesOS/qubes-core-admin-linux#2815
2017-07-31 20:36:20 -07:00
Marek Marczykowski-Górecki
afa673ff46
version 4.0.3 2017-07-18 05:23:29 +02:00
Marek Marczykowski-Górecki
f609afddb6
Merge remote-tracking branch 'qubesos/pr/28' 2017-07-12 12:54:55 +02:00
Marta Marczykowska-Górecka
6d424f91a5
clock synchronization rewrite
clock synchronization mechanism rewritten to use systemd-timesync instead of NtpDate; at the moment, requires:
- modifying /etc/qubes-rpc/policy/qubes.GetDate to redirect GetDate to designated clockvm
- enabling clocksync service in clockvm ( qvm-features clockvm-name service/clocksync true )

Works as specified in issue listed below, except for:
- each VM synces with clockvm after boot and every 6h
- clockvm synces time with the Internet using systemd-timesync
- dom0 synces itself with clockvm every 1h (using cron)

fixes QubesOS/qubes-issues#1230
2017-07-06 23:37:26 +02:00
Marek Marczykowski-Górecki
955762b71e
version 4.0.2 2017-07-06 19:55:44 +02:00
Marek Marczykowski-Górecki
6ffac092ed
udev: exclude LVM volumes for VM images
QubesOS/qubes-issues#2319
2017-07-06 19:41:44 +02:00
Marek Marczykowski-Górecki
e0ce4a8348
version 4.0.1 2017-07-05 14:28:07 +02:00
Marek Marczykowski-Górecki
2fb94bd3e6
qvm-copy-to-vm: use --service option
qvm-run got --service option, so use it. Old method doesn't work
anymore, because qubes.VMShell service is used, instead of qrexec
command directly.
2017-07-05 14:26:11 +02:00
Marek Marczykowski-Górecki
005fed6cdf
Merge remote-tracking branch 'qubesos/pr/27'
* qubesos/pr/27:
  Fix root.img handling bug
2017-06-07 10:09:03 +02:00
Christopher Laprise
6d251d5c58
Fix root.img handling bug
Per issue https://github.com/QubesOS/qubes-issues/issues/2848
2017-06-07 01:35:34 -04:00
Marek Marczykowski-Górecki
51abb471b9
Instruct qubesd to suspend VMs before going to sleep
Move suspend handling into qubesd.
2017-06-06 20:48:12 +02:00
Marek Marczykowski-Górecki
9b75dd1321
systemd: remove qubes-block-cleaner 2017-06-06 01:25:54 +02:00
Marek Marczykowski-Górecki
8719e5d74c
qrexec: fix pending requests cleanup code (cont)
There was a second place with exactly the same bug. See
dad208a "qrexec: fix pending requests cleanup code" for details.

Fixes QubesOS/qubes-issues#2699
2017-05-29 20:51:16 +02:00
Marek Marczykowski-Górecki
e4cf07c107
rpm: add R: qubes-core-admin-client
qubes-dom0-update script use qvm-run tool, which is in
qubes-core-admin-client package (python3-qubesadmin isn't enough).
Also, this should fix package installation order during install:
template needs to be installed after qubes-core-admin-client (for
qvm-template-postprocess tool). But we can't add this dependency there
directly, as it will not work on Qubes < 4.0.
2017-05-29 05:47:36 +02:00
Marek Marczykowski-Górecki
b69f263c10
Merge remote-tracking branch 'qubesos/pr/22'
* qubesos/pr/22:
  Move qvm-xkill to different repo/pkg
2017-05-28 13:13:00 +02:00
Marek Marczykowski-Górecki
e62acf815a
Really disable lesspipe
Only files with .sh suffix are loaded.

Fixes QubesOS/qubes-issues#2808
2017-05-26 05:44:33 +02:00
Marek Marczykowski-Górecki
1447ecad57
dom0-updates: migrate qubes-receive-updates script to use Admin API
Don't import qubes.xml directly.
2017-05-25 02:20:04 +02:00
Marek Marczykowski-Górecki
1057309951
rpm: drop unused python3-PyQt4 dependency
It was used for policy confirmation, but it isn't in this repository
anymore.
2017-05-25 02:20:04 +02:00
Marek Marczykowski-Górecki
e6cd559b82
Merge remote-tracking branch 'qubesos/pr/26'
* qubesos/pr/26:
  Get rid of forked f23 60-persistent-storage.rules
2017-05-20 14:42:18 +02:00
Marek Marczykowski-Górecki
d9202f8d14
Update qubes-dom0-update script
- don't call removed qvm-sync-clock
- use qvm-start --skip-if-running instead of qvm-run ... true, to start
a VM
- update qvm-run options
- use dnf directly, not through compatibility wrapper
2017-05-20 03:46:33 +02:00
Rusty Bird
6c8df74b7f
Get rid of forked f23 60-persistent-storage.rules
Use UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG instead, which is
available since systemd 231.

- Do not merge to branches where dom0 is older than Fedora 25 -
2017-05-18 01:42:08 +00:00
Marek Marczykowski-Górecki
6681ad79bc
version 4.0.0 2017-05-18 01:56:26 +02:00
Marek Marczykowski-Górecki
8fd4d9e853
qrexec: adjust for new qrexec-policy
New qrexec-policy can provide information about original target domain,
even if later overriden by policy (using target= keyword).
2017-05-18 01:44:25 +02:00
Marek Marczykowski-Górecki
ad2a976924
Merge branch 'core3-devel' 2017-05-18 01:26:20 +02:00
Marek Marczykowski-Górecki
e36dba5acb
travis: update for Qubes 4.0 2017-05-18 01:16:53 +02:00
Marek Marczykowski-Górecki
22cf6df02f
Move appmenus/icons related to desktop-linux-common
This is the right place for desktop related files - later it will be
installed in GUI VM (but core-admin-linux will not).

QubesOS/qubes-issues#2735
2017-05-17 15:47:13 +02:00
Marek Marczykowski-Górecki
ea6f47bf33
Move main qrexec binaries to /usr/s?bin
/usr/lib/* is a place only for some auxiliary binaries. While in
majority cases, qrexec-client and qrexec-daemon are called from some
other scripts, it is valid to call them directly too.
2017-05-17 14:30:30 +02:00
Marek Marczykowski-Górecki
1502eb4d59
qrexec: switch to new qrexec policy in core-admin
QubesOS/qubes-issues#910
2017-05-17 13:58:55 +02:00
Marek Marczykowski-Górecki
83308758f0
systemd: enable qubesd.service 2017-05-17 13:54:36 +02:00
Marek Marczykowski-Górecki
b629cbfe9e
Merge remote-tracking branch 'qubesos/pr/24'
* qubesos/pr/24:
  Prompt to create policy file for qubes-rpc if not present.
2017-04-21 16:19:50 +02:00
Marek Marczykowski-Górecki
a86c36ceb1
Merge remote-tracking branch 'qubesos/pr/23'
* qubesos/pr/23:
  Flush dnf configuration on updateVM before starting dom0 update
2017-04-21 16:18:18 +02:00
unman
194e0bc3cc
Prompt to create policy file for qubes-rpc if not present. 2017-04-20 22:27:36 +01:00
unman
fa72d66d5d
Flush dnf configuration on updateVM before starting dom0 update 2017-04-20 14:41:19 +01:00
Jean-Philippe Ouellet
ce56a4cdf3
Move qvm-xkill to different repo/pkg
Tentatively qubes-desktop-linux-common.
2017-03-31 00:55:38 -04:00
Jean-Philippe Ouellet
5e0df3d2cc
Remove dates from man pages
Counterpart to https://github.com/QubesOS/qubes-core-admin/pull/94
2017-03-16 05:44:58 -04:00
Marek Marczykowski-Górecki
9ea58a2ce2
Merge remote-tracking branch 'qubesos/pr/20'
* qubesos/pr/20:
  Fixes
  Starting mods for template upgrade support
2017-03-15 17:43:22 +01:00
Christopher Laprise
25f1801061
Fixes 2017-03-15 10:10:36 -04:00
M. Vefa Bicakci
e6e2404d24
dracut: Do not fail if Xen components are built into the kernel
Prior to this commit, if the Linux kernel's Xen-related components were
built into the kernel (as opposed to the use of kernel modules), then
the dracut module initialization would fail during the generation of the
initial ramdisk image.

This commit corrects this issue by using an if/then block.

Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com>
2017-03-14 17:20:05 +03:00
Christopher Laprise
ad404bfbe6
Starting mods for template upgrade support 2017-03-12 23:15:45 -04:00
Marek Marczykowski-Górecki
eb12a8cfc6
version 3.2.12 2017-03-13 03:32:25 +01:00
Marek Marczykowski-Górecki
dad208a0d5
qrexec: fix pending requests cleanup code
There was a logic error in pending requests cleanup code, causing
policy_pending_max being set to 0, even if there were more pending
requests. This effectively limited maximum pending requests to 1, after
some system uptime, because policy_pending_max set to 0 makes the code
looks only at the first pending request slot.

While at it, remove outdated FIXME comment, actually this bug is in the
code implementing this FIXME.

Fixes QubesOS/qubes-issues#2699
2017-03-13 03:17:27 +01:00
Marek Marczykowski-Górecki
723d32b8b7
qrexec: fix pending requests cleanup code
There was a logic error in pending requests cleanup code, causing
policy_pending_max being set to 0, even if there were more pending
requests. This effectively limited maximum pending requests to 1, after
some system uptime, because policy_pending_max set to 0 makes the code
looks only at the first pending request slot.

While at it, remove outdated FIXME comment, actually this bug is in the
code implementing this FIXME.

Fixes QubesOS/qubes-issues#2699
2017-03-13 03:16:34 +01:00
tasket
05b57f4960 Merge pull request #4 from QubesOS/master
Update from original
2017-03-07 02:15:00 -05:00
Marek Marczykowski-Górecki
452b6c4ae2
dom0-updates: code style fixes 2017-02-27 00:15:40 +01:00
Marek Marczykowski-Górecki
514c27d681
dom0-updates: update qubes-receive-updates to python3 2017-02-27 00:15:39 +01:00
Marek Marczykowski-Górecki
b253fdba33
qrexec: update qrexec-policy to python3 2017-02-22 12:14:50 +01:00
Marek Marczykowski-Górecki
b370eea13c
travis: drop debootstrap workaround
Move to qubes-builder

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2017-01-10 12:15:47 +01:00
Marek Marczykowski-Górecki
4f0878ccbf
version 3.2.11 2016-12-06 01:55:11 +01:00
Marek Marczykowski-Górecki
97c13e15f0
travis: remove debootstrap workaround
Moved to qubes-builder
2016-12-06 01:55:06 +01:00
Rusty Bird
4d18800bc0
v2: (dom0) qvm-move-to-vm: don't "rm -rf" vm name argument
Fixes QubesOS/qubes-issues#2472 from commit
bc29af7c0c
2016-12-04 16:52:18 +00:00
Jean-Philippe Ouellet
c6e1f0536c
Move qvm-xkill to new tools/ dir 2016-11-28 03:56:45 -05:00
Jean-Philippe Ouellet
e59c863c23
Fix a typo
Thanks rustybird for catching it.
2016-11-26 23:50:47 -05:00
Jean-Philippe Ouellet
be1d984364
Mitigate GUI DoS (part 2: qvm-xkill)
Can close windows of a VM while it's paused, and can not accidentally
harm dom0 by errant clicking.

Discussion in https://github.com/QubesOS/qubes-issues/issues/881

Thanks to rustybird for suggested implementation.
2016-11-26 21:59:16 -05:00
Marek Marczykowski-Górecki
73ba5f805b
version 3.2.10 2016-11-18 03:17:29 +01:00
Marek Marczykowski-Górecki
981a11cee1
qrexec: really do not match 'dom0' at '$anyvm', as documented
Design documentation says:
'note string dom0 does not match the $anyvm pattern; all other names do'

This behaviour was broken, because 'is not' in python isn't the same as
string comparison. In theory this could result in some service
erroneously allowed to execute in dom0, but in practice such services are
not installed in dom0 at all, so the only impact was misleading error
message.

Fixes QubesOS/qubes-issues#2031
Reported by @Jeeppler
2016-11-18 02:51:25 +01:00
Jean-Philippe Ouellet
9b7667c3a5
Ignore EFI boot args when parsing for filename
I need to set some flags in order to boot as described here:
https://www.qubes-os.org/doc/uefi-troubleshooting/

My settings look like this:
    $ efibootmgr -v
    BootCurrent: 0000
    Boot0000* Qubes HD(...)/File(\EFI\qubes\xen.efi)p.l.a.c.e.h.o...

which causes awk to get confused and think my $EFI_DIR should be:
    /EFI/qubesp.l.a.c.e.h.o.l.d.e.r. ./.m.a.p.b.s. ./.n.o.e.x.i.t.b.o.o.t.

This causes the script to later bail:
    if [ ! -d "$EFI_DIR" ]; then
        # non-EFI system
        exit 0;
    fi

So my xen.cfg did not get new entries when installing dom0 kernel packages.
2016-11-11 16:22:23 -05:00
Marek Marczykowski-Górecki
c73dcd2786
Merge remote-tracking branch 'qubesos/pr/12'
* qubesos/pr/12:
  Keep Makefile DRY
2016-11-11 14:24:48 +01:00
Jean-Philippe Ouellet
e24f3535ff
Keep Makefile DRY 2016-11-10 06:42:39 -05:00
Marek Marczykowski-Górecki
4efedd2951
appmenus: retrieve appmenus during template installation
Hardcoded call to qvm-sync-appmenus in template post-install is no
longer used, handle appropriate event.

QubesOS/qubes-issues#2412
2016-11-02 23:29:55 +01:00
Marek Marczykowski-Górecki
90b18a1ec1
appmenus: add qvm-sync-appmenus --regenerate-only
This is especially useful when something goes wrong (like accidentally
removing entries).
2016-11-02 23:27:06 +01:00
Marek Marczykowski-Górecki
ef47bda417
appmenus: add few docstrings 2016-11-02 23:26:11 +01:00
Marek Marczykowski-Górecki
85b509cedc
appmenus: fix handling VM name on command line
QubesOS/qubes-issues#2412
2016-11-02 06:36:09 +01:00
Marek Marczykowski-Górecki
35d32aa3d7
version 3.2.9 2016-10-31 14:18:21 +01:00
Marek Marczykowski-Górecki
610902a5c1
Revert "qrexec: fix "yes to all" for qrexec calls with custom argument"
Do not copy policy file at arbitrary time.
This reverts commit 1dff6361b7.
2016-10-31 14:17:54 +01:00
Marek Marczykowski-Górecki
c15841c828
version 3.2.8 2016-10-30 21:32:21 +01:00
Marek Marczykowski-Górecki
1dff6361b7
qrexec: fix "yes to all" for qrexec calls with custom argument
If argument-specific policy file do not exists, create one based on
generic one.

Fixes QubesOS/qubes-issues#2403
Reported by @Rudd-O
2016-10-28 13:28:04 +02:00
Marek Marczykowski-Górecki
2768b22494
version 3.2.7 2016-10-03 11:50:07 +02:00
Marek Marczykowski-Górecki
875866c3c0
Merge remote-tracking branch 'qubesos/pr/11'
* qubesos/pr/11:
  qubes-dom0-update: Show sync and download progress
2016-10-03 11:49:43 +02:00
Marek Marczykowski-Górecki
34ed18527b
Merge branch 'bug1676'
* bug1676:
  install-kernel: handle custom EFI directory
2016-10-03 11:48:19 +02:00
Rusty Bird
be30203d81
qubes-dom0-update: Show sync and download progress
Use "script" (part of util-linux) to fake a dumb terminal in the
updatevm, so dnf will show sync and download progress indicators.
2016-09-05 13:57:07 +00:00
Marek Marczykowski-Górecki
40b139ab82
qrexec-policy: fix handling special target VM names
Function validate_target should return either valid QubesVM object or
None in case of success. And throw an exception in case of failure.
2016-09-05 14:38:47 +02:00
Marek Marczykowski-Górecki
a513b33da3
appmenus: skip VMs without own directory
For example Dom0, or VM not created on disk (mostly while running
tests).
2016-09-05 14:38:46 +02:00
Marek Marczykowski-Górecki
a72d53ae1b
qrexec-policy: fix confirmation dialog call 2016-09-05 14:38:46 +02:00
Marek Marczykowski-Górecki
cce22c9517
qrexec-policy: new DispVM handling - $dispvm:DISP_VM keyword
Add support for `$dispvm:DISP_VM` syntax in target specification. At the
same time update the code for core3 API for handling DispVMs.

QubesOS/qubes-issues#2253
2016-09-05 14:38:46 +02:00
Marek Marczykowski-Górecki
009e2e6adb
qrexec-policy: prefer using VM objects
Pass VM object instead of just name - it will make extending much
easier. For example new DispVM handling.

QubesOS/qubes-issues#2253
2016-09-05 14:38:46 +02:00
Marek Marczykowski-Górecki
1cee27275e
version 3.2.6 2016-08-31 13:14:55 +02:00
Rusty Bird
c7ad14320f
qrexec-client: Also allow the bell character 2016-08-17 13:10:13 +00:00
Rusty Bird
e005836286
qrexec-client: Filter terminal output much more strictly
qrexec-client -t/-T (and therefore, qvm-run --pass-io) only handled the
escape character, \033. Everything else, such as Unicode and obscure
control characters, was passed through from the VM to the dom0 terminal.

Instead, replace all bytes except for a benign subset of ASCII. That's
still enough to allow progress bars to be drawn (tested using
"wget --progress=bar:force" and "pv --force").
2016-08-17 02:41:38 +02:00
Marek Marczykowski-Górecki
849b295384
qrexec: add option to wait for VM-VM connection termination
Normally when qrexec-client setup VM-VM connection it exits
immediatelly. But it may be useful to wait for the connection to
terminate - for example to cleanup DispVM.

qrexec-daemon (the one that allocated vchan port) do receive such
notification, so expose such option to qrexec-client.

QubesOS/qubes-issues#2253
2016-08-17 02:41:22 +02:00
Marek Marczykowski-Górecki
9192bb0d44
qrexec: don't call exit directly from qrexec-policy main
Use `return` instead. This makes possible to implement unit tests on
this function. And also makes static analysis a little happier.
2016-08-17 02:41:22 +02:00
Marek Marczykowski-Górecki
9a5bd57d1b
qrexec: switch to ArgumentParser in qrexec-policy 2016-08-17 02:41:22 +02:00
Marek Marczykowski-Górecki
8a780cb7f5
qrexec: reformat qrexec-policy
No functional change, just make it slightly less painful to read...
2016-08-16 02:58:04 +02:00
Marek Marczykowski-Górecki
92c3ba578a
appmenus: register event handlers on QubesVM, not BaseVM
It is critical to call rename-related events in the right order related
to those in QubesVM, because handler at QubesVM renames VM directory.

After "qubes/events: fix event handlers ordering" in qubes-core-admin it
is (again) possible to deterministically order event handler from
extension in relation to those from the class itself. But since ordering
on object class have higher priority (first from base class), those
handlers needs to be attached to the same class.
2016-08-15 23:53:11 +02:00
Marek Marczykowski-Górecki
da9205c78a
tests/appmenus: fix template cloning code
create_on_disk no longer handle cloning files.
2016-08-15 23:52:35 +02:00
Marek Marczykowski-Górecki
3abee97e13
appmenus: adjust for QubesArgumentParser API change 2016-08-15 23:52:13 +02:00
Marek Marczykowski-Górecki
86ef6906ad
appmenus: don't crash on VM without files on disk
Such VM can still trigger some appmenus-related action, for example
label change. This may happen during tests, or backup restore. And
probably some other cases.
2016-08-15 23:49:59 +02:00
Marek Marczykowski-Górecki
fe209dfd24
appmenus: clone default whitelists for VM type
Don't bother with checking whether it is a template or not - when
cloning VM disk files, copy those files anyway (if exist of course).
2016-08-08 14:38:50 +02:00
Marek Marczykowski-Górecki
daf1fd4759
systemd: enable xen-init-dom0.service
This is the right upstream service to init dom0 entries. Instead of our
own script.
2016-08-08 01:15:56 +02:00
Marek Marczykowski-Górecki
c34427e264
rpm: make sure /usr/bin/python (not /bin/python) is used
Otherwise rpm will fail to resolve dependencies (no package provides
/bin/python).
2016-08-08 00:51:50 +02:00
Marek Marczykowski-Górecki
bf140ae175
appmenus: misc API sync with core-admin
- there is no longer vm.is_netvm/is_disposablevm.
- 'domain-create-on-disk' even have no longer 'source_template' argument
2016-08-08 00:51:49 +02:00
Marek Marczykowski-Górecki
19609705fc
appmenus: do nothing if VM isn't created on disk yet
This may be a case during backup restore - some properties may be
modifier before restoring actual files.

QubesOS/qubes-issues#1897
2016-08-08 00:51:49 +02:00
Marek Marczykowski-Górecki
aef9aa2dd3
appmenus: few more tests
QubesOS/qubes-issues#1897
2016-08-08 00:51:49 +02:00
Marek Marczykowski-Górecki
0fbc644fd9
appmenus: fix handling custom templates
QubesOS/qubes-issues#1897
2016-08-08 00:51:49 +02:00
Marek Marczykowski-Górecki
f688cba49c
appmenus: adjust checking label color
Checking icon color is hard...

QubesOS/qubes-issues#1606
2016-08-08 00:51:48 +02:00
Marek Marczykowski-Górecki
7dccbd1ead
appmenus: convert shell scripts to python
Fixes QubesOS/qubes-issues#1897
2016-08-08 00:51:48 +02:00
Marek Marczykowski-Górecki
9690f52dc5
appmenus: add more tests
QubesOS/qubes-issues#1897
2016-08-08 00:51:48 +02:00
Marek Marczykowski-Górecki
e846f26bd3
appmenus: convert qvm-sync-appmenus to core3 API
QubesOS/qubes-issues#1897
2016-08-08 00:51:48 +02:00
Marek Marczykowski-Górecki
54a5dd92cf
appmenus: indentation
QubesOS/qubes-issues#1897
2016-08-08 00:51:47 +02:00
Marek Marczykowski-Górecki
c32fbe14aa
appmenus: add simple unit tests
QubesOS/qubes-issues#1897
2016-08-08 00:51:47 +02:00
Marek Marczykowski-Górecki
acee13bf53
appmenus: use setuptools for packaging
QubesOS/qubes-issues#1897
2016-08-08 00:51:47 +02:00
Marek Marczykowski-Górecki
d446f849d8
appmenus: initial conversion to core3 API
This commits change code itself for core3 API, but doesn't plug it
anywhere yet.

QubesOS/qubes-issues#1897
2016-08-08 00:51:46 +02:00
Marek Marczykowski-Górecki
b91eace873
dom0-updates: convert to core3 API 2016-08-08 00:47:18 +02:00
Marek Marczykowski-Górecki
0568d2ae3b
qrexec: initial convert qrexec-policy to core3 API 2016-08-08 00:47:18 +02:00
Wojtek Porczyk
6ca61dc709
Renamed imgconverter module 2016-08-08 00:47:18 +02:00
Marek Marczykowski-Górecki
37f92396c4
install-kernel: handle custom EFI directory
Fixes QubesOS/qubes-issues#1676
2016-07-21 14:16:52 +02:00
Marek Marczykowski-Górecki
769e70e76a
version 3.2.5 2016-07-17 04:57:35 +02:00
Marek Marczykowski-Górecki
db32b65d81
appmenus: add xterm in Disposable VM menu entry
Fixes QubesOS/qubes-issues#1612
2016-07-17 00:00:47 +02:00
Marek Marczykowski-Górecki
7080c0371d
appmenus: force X-Qubes-VM category for all VM-related entries
This will ease filtering entries when constructing applications menu.
For example '<OnlyUnallocated/>' key used in Xfce4 before looks to
introduce some problems.

Fixes QubesOS/qubes-issues#2129
2016-07-15 11:31:27 +02:00
Marek Marczykowski-Górecki
e90c8a97ff
appmenus: fix detection of desktop environment
In Fedora 23-based dom0, DESKTOP_SESSION environment contains full path
to session file, instead of just basename.

QubesOS/qubes-issues#1606
2016-07-14 04:32:16 +02:00
Marek Marczykowski-Górecki
6cd45f88c5
Merge remote-tracking branch 'qubesos/pr/8'
* qubesos/pr/8:
  Don't probe disk contents of loop* or xvd*
  Copy unmodified(!) 60-persistent-storage.rules from Fedora 23
2016-06-26 22:03:18 +02:00
Rusty Bird
fe6846d5eb
Add AEM services to 75-qubes-dom0.preset
They will only start if booted with rd.antievilmaid anyway.
2016-06-26 15:17:38 +00:00
Rusty Bird
ae7656e348
Don't probe disk contents of loop* or xvd*
Adds a standalone rule to the very top of 60-persistent-storage.rules.
2016-06-26 12:51:20 +00:00
Rusty Bird
e85363da20
Copy unmodified(!) 60-persistent-storage.rules from Fedora 23 2016-06-26 12:36:31 +00:00
Marek Marczykowski-Górecki
db8aa6cf15
version 3.2.4 2016-06-24 23:07:32 +02:00
Marek Marczykowski-Górecki
d9b37eec6c
dom0-updates: whitespace fixes 2016-06-24 02:24:52 +02:00
Marek Marczykowski-Górecki
3eed63b892
Merge remote-tracking branch 'ttasket/ttasket-patch-3'
Fixes QubesOS/qubes-issues#2061

* ttasket/ttasket-patch-3:
  Fixes
  Re-create private.img if missing
  Try to handle private.img (fail)
  Fix syntax
  Backup root.img
  Update qubes-dom0-update
  Backup root.img
  Backup root.img
  Support in-place template reinstalls - for testing
  Add template reinstall support
2016-06-24 02:22:45 +02:00
ttasket
fbb58918af Fixes
Moved create private.img before yum.
Shutdown templatevm first -- don't want to query possibly compromised vm running old private.img.
Issue #2061
2016-06-21 15:15:34 -04:00
ttasket
ef1ab34234 Re-create private.img if missing
This restores the netvm setting and also re-creates private.img if older rpm scriptlet doesn't create it.
Issue #2061
2016-06-21 10:57:57 -04:00
ttasket
577944c8fb Try to handle private.img (fail)
mv and rm private.img like root.img, but this results in no private.img after reinstall.
do not use.
2016-06-20 14:04:55 -04:00
ttasket
457b275800 Fix syntax
@marmarek This works on my system.
2016-06-20 13:36:30 -04:00
ttasket
32a4269f4a Backup root.img
Just in case template %post scriptlet doesn't unlink during reinstall, or if reinstall fails.
Also preserves Netvm prefs setting.
2016-06-18 12:00:00 -04:00
ttasket
d316624f61 Update qubes-dom0-update 2016-06-18 05:24:18 -04:00
ttasket
8c7a225070 Backup root.img
Just in case template %post scriptlet doesn't unlink during reinstall, or if reinstall fails. Fixed PKGS test.
2016-06-18 04:22:23 -04:00
ttasket
6c7c25d9e7 Backup root.img
Just in case template %post scriptlet doesn't unlink during reinstall, or if reinstall fails.
2016-06-18 03:02:46 -04:00
ttasket
17627cdf3c Support in-place template reinstalls - for testing
This doesn't yet prevent appvms from starting with invalid template during the reinstall, and doesn't deal with the Netvm setting problem.
For issue #2061
2016-06-16 07:59:28 -04:00
ttasket
6b315b1dad Add template reinstall support
Issue #2061
Simple implementation checks for --action=reinstall but adds no sanity checks.
2016-06-12 12:05:28 -04:00
Marek Marczykowski-Górecki
30aac6b6a8
version 3.2.3 2016-06-07 06:13:07 +02:00
Marek Marczykowski-Górecki
60488d4439
system-config: add systemd-preset configuration
Fixes QubesOS/qubes-issues#2049
2016-06-06 02:22:58 +02:00
Marek Marczykowski-Górecki
4d4e7cc5e9
kernel-install: do not add kernel entry if already present
The entry may be already present for example when reinstalling package,
or calling the script multiple times (which apparently is the case
during system installation).
2016-06-03 20:51:18 +02:00
Marek Marczykowski-Górecki
dc9e3c9c11
travis: initial version
QubesOS/qubes-issues#1926
2016-06-03 20:23:10 +02:00
Marek Marczykowski-Górecki
01f357ae3a
dom0-updates: patch dnf.conf to use local repository
Add the same options as for yum. And do that with nice markers, instead
of forcefully overriding the entries.

QubesOS/qubes-issues#1807
2016-06-03 20:21:04 +02:00
Marek Marczykowski-Górecki
21bec492e8
qrexec: add service argument support
Fixes QubesOS/qubes-issues#1876

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2016-05-19 15:39:08 +02:00
Marek Marczykowski-Górecki
c629529565
qrexec: prefer VM-local service file (if present) over default one
This will allow a service to be overridden per-VM.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2016-05-19 15:39:08 +02:00
Wojtek Porczyk
c4cf6b646b
qubes-rpc-multiplexer: deprecate /etc/qubes_rpc, allow /usr/local
/usr/local resides in private.img, so it is possible to define per-appvm RPC

Also, with the upcoming 3.0 release support for old (R1) paths is
removed.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2016-05-19 15:39:08 +02:00
Marek Marczykowski-Górecki
f8d23d0d64
qrexec: execute RPC service directly (without a shell) if it has executable bit set
This will allow to use some different shell/language for a service (for
example python).

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2016-05-19 15:39:07 +02:00
Marek Marczykowski-Górecki
7b582e0339
qrexec: do not leak FDs to logger process
This would prevent qrexec from detecting EOF.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2016-05-19 15:39:07 +02:00
Marek Marczykowski-Górecki
888db2f7cf
version 3.2.2 2016-05-18 02:32:23 +02:00
Marek Marczykowski-Górecki
f7eaa7bec2
kernel-install: don't fail on kernel removal in non-EFI installs
In non-EFI installation /boot/efi/EFI/qubes may not exists. In this case
do not try to touch (non-existing) files there.

Fixes QubesOS/qubes-issues#1829
2016-05-15 11:19:18 +02:00
Marek Marczykowski-Górecki
85effc2946
version 3.2.1 2016-05-05 00:04:44 +02:00
Marek Marczykowski-Górecki
b5101d11d6
appmenus: call appropriate kbuildsycoca version (KDE4/KDE5)
QubesOS/qubes-issues#1807
2016-05-04 01:44:09 +02:00
Marek Marczykowski-Górecki
c9d1f7c98d
version 3.2.0 2016-04-19 23:27:05 +02:00
Marek Marczykowski-Górecki
4694f5f52f
appmenus: force changing appicons when VM label is changed
Fixes QubesOS/qubes-issues#1606
2016-04-19 23:11:10 +02:00
M. Vefa Bicakci
fdc00ad678
dracut: Omit network and kernel-network-modules 2016-04-10 00:00:00 -04:00
Marek Marczykowski-Górecki
0607d9021a
qrexec: add support for service argument
Fixes QubesOS/qubes-issues#1876
2016-03-27 04:31:11 +02:00
Marek Marczykowski-Górecki
ad28f4df62
qrexec: deny spaces in service domain name
Fixes QubesOS/qubes-issues#1877
2016-03-27 04:23:47 +02:00
Galland
3acfb8e4b3 Add colon (:) to trusted characters (for "Code::Blocks" appmenu)
After installing "codeblocks" app in TemplateVM it doesn't appear in Qubes VM Manager's available app shortcuts.
If I run in a Dom0 Terminal: /usr/libexec/qubes-appmenus/qubes-receive-appmenus fedora-23
I get this: "Warning: ignoring key 'Name' of codeblocks.desktop"
The "Name" key in that file has value "Code::Blocks"

The problem comes from line 168, because of the colons in the app Name.

By adding the colon ":" to the std_re used to match valid characters for "Name", the app is correctly parsed and I can add the shortcut to AppVMs
2016-03-16 22:38:38 +01:00
Marek Marczykowski-Górecki
e0c875a367
pm-utils: call qubes.SuspendPreAll/qubes.SuspendPostAll services
Host suspend notification may be useful not only to driver domains. For
example Whonix needs to resync time after suspend.

Thanks @adrelanos for help.

Fixes QubesOS/qubes-issues#1663
2016-03-15 23:13:48 +01:00
Marek Marczykowski-Górecki
6c7443223b
dom0-update: remove cached metadata when --clean is used
Fixes QubesOS/qubes-issues#1748
2016-03-11 15:10:28 +01:00
Marek Marczykowski-Górecki
c87d6c5cb7
version 3.1.9 2016-03-07 03:55:51 +01:00
Marek Marczykowski-Górecki
b19ba4dc2d
pm-utils: do not leave background tasks - will be killed by systemd
qvm-sync-clock running in background is killed as soon as
qubes-suspend.service is terminated.
Additionally restore --verbose option, which was the case (implicitly)
in previous qvm-run based code.

Fixes QubesOS/qubes-issues#1795
2016-02-29 13:31:25 +01:00
Marek Marczykowski-Górecki
01833c698c
version 3.1.8 2016-02-23 16:22:49 +01:00
Marek Marczykowski-Górecki
199d12636b
Merge remote-tracking branch 'qubesos/pr/5'
* qubesos/pr/5:
  Use #!/bin/bash and && in qvm-move-to-vm
  qvm-copy-to-vm: Fix running with multiple file arguments
  qvm-move-to-vm: Remove duplicated code
2016-02-23 03:53:27 +01:00
Marek Marczykowski-Górecki
ee3950a3aa
pm-utils: use qvm-sync-clock --force instead of manual qvm-run
After suspend VMs clocks are desynchronized in most cases (because VMs
were paused). Since directly after suspent there may be no network
access, normal `qvm-sync-clock` call isn't good (it aborts if NTP call
fails). But with new `qvm-sync-clock --force` switch, it sync VMs even
if NTP is unreachable.

QubesOS/qubes-issues#1728
2016-02-22 22:24:04 +01:00
Marek Marczykowski-Górecki
f8d8368b10
qrexec: add timeout for data vchan connection
When qrexec-agent crashes for any reason (for example
QubesOS/qubes-issues#1389), it will never connect back and qrexec-client
will wait forever. In worst case it may happen while holding qubes.xml
write lock (in case of DispVM startup) effectively locking the whole
system.

Fixes QubesOS/qubes-issues#1636
2016-02-22 22:24:04 +01:00
Rusty Bird
6e4d39c7b3
Use #!/bin/bash and && in qvm-move-to-vm
#!/bin/bash because qvm-move-to-vm sources qvm-copy-to-vm, which has
a bashism (-o pipefail).

&& is safer in case qvm-*copy*-to-vm is ever changed to call 'set +e'.
2016-02-16 08:33:54 +00:00
Rusty Bird
c177ae2c7a
qvm-copy-to-vm: Fix running with multiple file arguments 2016-02-13 15:21:39 +00:00
Rusty Bird
bc29af7c0c
qvm-move-to-vm: Remove duplicated code 2016-02-13 15:21:38 +00:00
Marek Marczykowski-Górecki
466acad6fb
version 3.1.7 2016-02-08 05:03:18 +01:00
Marek Marczykowski-Górecki
8c0643092b
Use qubes.SetDateTime instead of direct call in post-suspend time sync
Fixes QubesOS/qubes-issues#1728
2016-02-08 04:49:14 +01:00
Marek Marczykowski-Górecki
2198986d5c
dom0-update: do not output scary messagge about missing repomd.xml
... when no updates are available.

Fixes QubesOS/qubes-issues#1685
2016-02-03 16:46:58 +01:00
Marek Marczykowski-Górecki
fc2e8264d4
Merge remote-tracking branch 'qubesos/pr/4'
* qubesos/pr/4:
  Add qvm-appmenu-replace tool.
2016-01-17 04:34:10 +01:00
Marek Marczykowski-Górecki
74afb8a7cc
version 3.1.6 2015-12-31 02:58:00 +01:00
Marek Marczykowski-Górecki
fa8ebeb42d Fix typo in "d9d48e8 qrexec: use tray notification when..."
Fixes QubesOS/qubes-issues#1446

Thanks HW42 for the report.
2015-12-28 00:59:45 +01:00
Marek Marczykowski-Górecki
ae0cad589e
version 3.1.5 2015-12-26 15:29:27 +01:00
Marek Marczykowski-Górecki
d9d48e8948
qrexec: use tray notification when VM needs to be started
For both successful start and the failed one

Fixes QubesOS/qubes-issues#1446
2015-12-26 02:09:06 +01:00
Marek Marczykowski-Górecki
f66be6c943
dracut: include all USB controllers drivers
dracut in Fedora 20 doesn't know about *-pci modules (which were split
of *-hcd). So add them manually, in all flavors (ehci, ohci, xhci).

Fixes QubesOS/qubes-issues#1517
2015-12-24 03:26:36 +01:00
Marek Marczykowski-Górecki
6921400a7a
dom0-updates: remove "updates pending" flag also when no actual updates were found
This allows to clear the flag when for some reason it wasn't cleared
immediately after installing updates.

Fixes QubesOS/qubes-issues#1511
2015-12-13 02:11:56 +01:00
Marek Marczykowski-Górecki
cb6a52a652
dom0-updates: wait for apper to finish, then remove "updates pending" flag
Unfortunate side effect (to be solved at Qubes Manager side): it will
block Qubes Manager until all updates are installed (not only updater
launched).

Fixes QubesOS/qubes-issues#1511
2015-12-13 02:08:05 +01:00
Marek Marczykowski-Górecki
4a556dcab1
dom0-updates: ensure proper permissions on "updates pending" flag
QubesOS/qubes-issues#1511
2015-12-13 02:07:01 +01:00
Marek Marczykowski-Górecki
d9a2a66073
dom0-updates: remove unused code from cron job 2015-12-13 02:06:36 +01:00
Marek Marczykowski-Górecki
55f67d602e
version 3.1.4 2015-12-06 14:37:56 +01:00
Matt McCutchen
ff02e0da90 Add qvm-appmenu-replace tool.
This can be used to replace the Terminal shortcut
(QubesOS/qubes-issues#1428).
2015-12-05 12:25:29 -05:00
Marek Marczykowski-Górecki
1430861c6b
kernel-install: (EFI) really install kernel image
Not only add it to the configuration.

Fixes QubesOS/qubes-issues#1492
2015-12-05 15:18:08 +01:00
Marek Marczykowski-Górecki
8a9d3de1ef
kernel-install: fix EFI dir path in xen.cfg generation script
Fixes QubesOS/qubes-issues#1492
2015-12-05 15:05:34 +01:00
Marek Marczykowski-Górecki
8efde55755
version 3.1.3 2015-11-27 23:16:35 +01:00
Bahtiar `kalkin-` Gadimov
7f55410a02 Fix test basic/TC_01_Properties/test_000_rename 2015-11-22 22:31:22 +01:00
Bahtiar `kalkin-` Gadimov
6590931fcd Make appmenu paths properties and not config attrs
This fixes a circular dependencies where get_attrs_config() in QubesVm is
executed, before the self.storage is initialised. See also
https://github.com/QubesOS/qubes-core-admin/pull/6#discussion-diff-45008401
2015-11-22 12:31:16 +01:00
Bahtiar `kalkin-` Gadimov
4d94309087 Remove unused imports from qubes-core-appmenus 2015-11-17 21:28:26 +01:00
Marek Marczykowski-Górecki
4d3a7ad5c6
appmenus: remove entries from AppVMs menus when removed from template
Fixes QubesOS/qubes-issues#1411
2015-11-13 02:48:15 +01:00
Marek Marczykowski-Górecki
f10442cc78
version 3.1.2 2015-11-11 06:31:33 +01:00
Marek Marczykowski-Górecki
8f52c83f0b
Require new enough qubes-utils package for updated libqrexec-utils (again)
It is required for additional file-copy functions, moved from
core-agent-linux (qfile-agent).

QubesOS/qubes-issues#1324
2015-11-11 05:12:42 +01:00
Marek Marczykowski-Górecki
4e498c90e6
Implement qvm-copy-to-vm and qvm-move-to-vm utilities
QubesOS/qubes-issues#1324
2015-11-11 05:09:21 +01:00
Marek Marczykowski-Górecki
520e250966
Require new enough qubes-utils package for updated libqrexec-utils
Required by 0c288aa "qrexec: implement buffered write to child stdin to
prevent deadlock"
2015-10-30 15:10:18 +01:00
Marek Marczykowski-Górecki
0c288aa355
qrexec: implement buffered write to child stdin to prevent deadlock
Otherwise if the child process isn't reading its stdin at that time, it
would deadlock the whole qrexec connection (for example preventing
reading the data from the child, which may be a cause of that deadlock).

QubesOS/qubes-issues#1347
2015-10-30 14:16:53 +01:00
Marek Marczykowski-Górecki
4a7c2e2d42
version 3.1.1 2015-10-11 02:57:47 +02:00
Marek Marczykowski-Górecki
c8ce468c7f
qrexec: fallback to kdialog if zenity is not installed
Fixes QubesOS/qubes-issues#1277
2015-10-11 01:55:46 +02:00
Marek Marczykowski-Górecki
63e74a01d3
qrexec: fix handling autostarting RPC target VM
Do not reimplement manual VM state checking in qrexec-policy.
`qubes.xml` is loaded anyway, so just use QubesVM object to check if
domain is running.

Fixes QubesOS/qubes-issues#1283
2015-10-11 01:52:40 +02:00
Marek Marczykowski-Górecki
63dffb48c5
version 3.1.0 2015-09-29 16:48:32 +02:00
Marek Marczykowski-Górecki
867baa7266
kernel-install: add new kernel to xen.cfg for xen.efi
QubesOS/qubes-issues#794
2015-09-26 03:56:16 +02:00
Marek Marczykowski-Górecki
0e733bd0de
kernel-install: call grub2-mkconfig only when it is installed
On systems booting with EFI, there is no grub2 installed at all - the
system is started directly to xen.efi.
2015-09-26 02:54:32 +02:00
Marek Marczykowski-Górecki
71342f4bd2 version 3.0.15 2015-09-05 00:31:10 +02:00
Marek Marczykowski-Górecki
55f9ca5996 Merge remote-tracking branch 'origin/pr/3'
* origin/pr/3:
  filter out tar time wrap warnings using grep
2015-09-04 15:24:27 +02:00
Patrick Schleizer
7d0b2479f5 filter out tar time wrap warnings using grep
https://phabricator.whonix.org/T401#6634
2015-09-04 00:54:50 +00:00
Marek Marczykowski-Górecki
0d69e8fe3e doc: add some more details to qubes-dom0-update --action 2015-09-04 02:11:16 +02:00
Marek Marczykowski-Górecki
5f030b0033 Merge remote-tracking branch 'qubesos/pr/2' 2015-09-04 02:10:19 +02:00
Marek Marczykowski-Górecki
4e1f6b5bd5 core: use vm.absolute_path to parse paths in qubes.xml
This makes easier to handle some corner cases.

qubesos/qubes-issues#1124
Reported by @doncohen, thanks @wyory for providing more details.
2015-09-04 01:57:59 +02:00
Jeppler
7d9751048e Merge pull request #1 from Jeeppler/Jeeppler-patch-1
added the --action parameter description
2015-09-03 23:56:20 +02:00
Jeppler
c88a2dceb9 added the --action parameter description
added the --action parameter description. The --action parameter is implemented since a long time, but was not documented at all.
2015-09-03 23:55:21 +02:00
Marek Marczykowski-Górecki
730db56623 version 3.0.14 2015-09-03 02:45:10 +02:00
Marek Marczykowski-Górecki
ccd8021af9 appmenus: do not create appmenus for DispVMs (#1123)
Fixes qubesos/qubes-issues#1123
2015-09-03 01:18:16 +02:00
Marek Marczykowski-Górecki
079d0b1060
version 3.0.13 2015-08-05 02:02:26 +02:00
Marek Marczykowski-Górecki
c2c34528a2
appmenus: fix broken import 2015-08-03 04:19:49 +02:00
Marek Marczykowski-Górecki
f795e58483
Undo 'Boot Loader Spec' by deleting /boot/MACHINE_ID
The specification doesn't cover how to boot Xen (or any other multiboot
binary), but the sole presence of such directory changes dracut default
path. So get rid of that directory.
2015-08-03 03:00:59 +02:00
Marek Marczykowski-Górecki
c85fc7a098
appmenus: Add offline mode to qubes-receive-appmenus
Will be useful during LiveUSB build - we can't start template at this
stage, but still need to somehow generate appmenus.
2015-08-02 14:43:17 +02:00
Marek Marczykowski-Górecki
5b4b4190a5
version 3.0.12 2015-07-29 21:45:01 +02:00
Marek Marczykowski-Górecki
e062c431dd
rpm: move os-prober removing code to kernel-install subpackage
Main qubes-core-dom0 should not be installed as part of installer image,
but os-prober dependency pulls that in. So move it into
qubes-core-dom0-kernel-install subpackage. After all this is where grub
config regeneration code is placed, so it is more logical place.
2015-07-29 21:35:04 +02:00
Marek Marczykowski-Górecki
a2da1c9e8d version 3.0.11 2015-07-27 17:29:06 +02:00
Marek Marczykowski-Górecki
7fdff6a735 rpm: force removal os-prober package
It can be can be harmful, because it accesses (and mounts) every block
device, including VM controlled /dev/loop*.
2015-07-27 17:27:35 +02:00
Marek Marczykowski-Górecki
c752353471
version 3.0.10 2015-07-15 05:10:28 +02:00
Marek Marczykowski-Górecki
5e6d3a273d
Prevent installing all the qubes packages in the installer image
Split kernel-install hook into separate package, as only this part is
needed by the installer. This will prevent installing all the Qubes/Xen
staff in the installer, especially udev scripts and xenstored, which
doesn't play well with anaconda.
2015-07-14 23:27:03 +02:00
Marek Marczykowski-Górecki
5f1e7a77e6
version 3.0.9 2015-07-13 00:14:17 +02:00
Marek Marczykowski-Górecki
fddeb4a23c
Generate initramfs in kernel-install hook
The default one generates initramfs in location expected by Boot Loader
Specification, which as noted before, isn't useful for Qubes.
2015-07-12 01:54:53 +02:00
Marek Marczykowski-Górecki
f056e0341e
rpm: provide qubes-core-dom0-linux-kernel-install virtual pkg
This is for kernel package dependencies, since we have the same kernel
packages for both R2 and R3.0
2015-07-12 01:53:48 +02:00
Marek Marczykowski-Górecki
2a14ae9c0b
Add kernel post-installation script to regenerate grub2 config
Since we now allow using Fedora kernel, add a script to generate proper
bootloader configuration then. Standard Fedora mechanism relies on
Boot Loader Specification support in grub2, which sadly does not support
Xen, so it is useless in Qubes.
2015-07-10 17:54:24 +02:00
Marek Marczykowski-Górecki
20051e18c9
Update README 2015-07-10 17:50:25 +02:00
Marek Marczykowski-Górecki
c3331645e4 version 3.0.8 2015-07-08 05:57:52 +02:00
Marek Marczykowski-Górecki
cc7075ab65 appmenus: defer menu cache regeneration to speedup qvm-sync-appmenus
Call "xdg-desktop-menu forceupdate" at the end of the process, not for
every single item.
2015-07-08 05:56:38 +02:00
Marek Marczykowski-Górecki
5e3fbb1623 dom0-updates: ensure proper permissions on packages and metadata
This also includes possibly error flag file.
2015-07-08 04:54:34 +02:00
Marek Marczykowski-Górecki
fcd084f908 version 3.0.7 2015-07-01 07:18:18 +02:00
Marek Marczykowski-Górecki
4ce5e04d7e dracut: fix assigning devices to xen-pciback 2015-07-01 07:16:59 +02:00
Marek Marczykowski-Górecki
8acd40905d Disable lesspipe in dom0
It can be dangerous when processing untrusted content (for example VM
logs).
Details:
https://groups.google.com/d/msgid/qubes-users/20150527215812.GA13915%40mail-itl
2015-06-25 02:37:29 +02:00
Marek Marczykowski-Górecki
1288a13520 qrexec: do not terminate before sending all the data
Make sure that all the data from local process is sent (including final
EOF), before handling its exit code - which would include terminating
qrexec-client process.
2015-06-23 02:44:59 +02:00
Marek Marczykowski-Górecki
7ce62cbd98 dracut: support the case when xen-pciback is built-in, not a module
In such case, we can't set module parameters in initramfs. But we can
bind the driver to appropriate devices manually - which is also doable
in case of module.
2015-06-15 03:26:04 +02:00
Marek Marczykowski-Górecki
07de8f7515 appmenus: allow '_' in Exec and other fields 2015-05-17 00:07:01 +02:00
Marek Marczykowski-Górecki
7e80d203ff version 3.0.6 2015-05-15 03:29:37 +02:00
Marek Marczykowski-Górecki
a5650d3251 dom0-update: improve package validation regexp - include DSA case (#988)
Apparently when package is signed with DSA key, rpm -K output is totally
different. This is the case for bumblebee package on rpmfusion.

Fixes qubesos/qubes-issues#988
2015-05-15 03:13:01 +02:00
Marek Marczykowski-Górecki
f2b5cf1cc0 dom0-update: clear error marker before downloading new packages (#987)
Otherwise if some package download fails once - further tries will also
report errors.

Fixes qubesos/qubes-issues#987
2015-05-13 02:34:51 +02:00
Marek Marczykowski-Górecki
4cab815317 dom0-update: prevent template package upgrades (#996)
This would override user changes to the template. Previous method
(Obsoletes: rpm header) doesn't work now, so add explicit exclude list
as yum option

Fixes qubesos/qubes-issues#996
2015-05-13 02:33:12 +02:00
Marek Marczykowski-Górecki
3f29b411d0 qrexec: do not send spurious MSG_SERVICE_REFUSED
This causes closing connection (FD) to still alive client.

Fixes qubesos/qubes-issues#993
2015-05-10 04:36:33 +02:00
Marek Marczykowski-Górecki
0d75af86d8 version 3.0.5 2015-05-03 16:05:37 +02:00
Marek Marczykowski-Górecki
ed363452c9 gitignore 2015-05-03 16:05:02 +02:00
Marek Marczykowski-Górecki
50eb23d60e appmenus: add missing appicons_cleanup function
Commit f05f214f "appmenus: update icons only when changed" introduced
usage of vm.appicons_cleanup, but that function wasn't implemented. That
caused not generating appmenus at all after template update (old
appmenus was removed, but script crashes before adding the new one).
2015-05-02 23:49:40 +02:00
Marek Marczykowski-Górecki
b40008a06d appmenus: do not regenerate all the icons for the template itself 2015-05-02 21:09:42 +02:00
Marek Marczykowski-Górecki
febac40b05 appmenus: convert eval's to lambda's 2015-05-02 21:09:42 +02:00
Marek Marczykowski-Górecki
59d9dc0307 appmenus: minor code style fixes
Use 'in' instead of has_key, remove unused code.
2015-05-02 21:09:42 +02:00
Marek Marczykowski-Górecki
2a08357fa4 appmenus: script formatting
Wrap long lines, fix whitespaces
2015-05-02 21:09:42 +02:00
Marek Marczykowski-Górecki
d43a421dee version 3.0.4 2015-04-28 13:23:31 +02:00
Marek Marczykowski-Górecki
f05f214f6c appmenus: update icons only when changed
Do not regenerate all the icons when the source is unchanged.

Also add preliminary code to support the same improvement for .desktop
files, but it requires some more work, especially because KDE does a lot
of caching and we need to force update sometimes (for example when VM
label color has changed).
2015-04-28 12:45:29 +02:00
Marek Marczykowski-Górecki
d6f0cfcbad qrexec: fix waiting for qrexec-agent data connection
In case of vchan server libvchan_is_open() returns VCHAN_WAITING (2) when
client is not yet connected.
2015-04-20 05:46:47 +02:00
Marek Marczykowski-Górecki
6cf84a7319 version 3.0.3 2015-04-12 03:07:42 +02:00
Marek Marczykowski-Górecki
5d5a33f90b appmenus: fix template's icon 2015-04-12 02:06:26 +02:00
Marek Marczykowski-Górecki
c457b485cb Load xen-acpi-processor module
It is required for cpufreq to work.
2015-04-10 17:56:58 +02:00
Marek Marczykowski-Górecki
5a7813c05c version 3.0.2 2015-04-01 00:12:43 +02:00
Marek Marczykowski-Górecki
5035fc7eed Remove iptables config
Dom0 have no network at all, it isn't needed.
2015-03-31 22:55:25 +02:00
Marek Marczykowski-Górecki
2866196dad version 3.0.1 2015-03-26 23:53:33 +01:00
Marek Marczykowski-Górecki
3c151ca509 dom0-update: allow to specify custom yum action
This can be useful for actions like "downgrade", "reinstall" etc.

Needs additional testing if whole distribution upgrade using
"distro-sync" action will work as expected.
2015-03-26 00:58:10 +01:00
Marek Marczykowski-Górecki
51c736a92c qrexec: enable compiler optimization 2015-03-20 12:16:28 +01:00
Marek Marczykowski-Górecki
18d079a99a qrexec: fix compiler warnings 2015-03-20 12:16:19 +01:00
Marek Marczykowski-Górecki
b07475efea qrexec: make the log writable by qubes group
Otherwise if VM was started as root, it will never start as normal user
again.
2015-03-20 03:06:06 +01:00
Marek Marczykowski-Górecki
04816e014b qrexec: do not exit from qrexec-client until local process exit code is sent 2015-03-17 22:55:15 +01:00
Marek Marczykowski-Górecki
662813dc18 appmenus: recreate appmenus for the template itself after update 2015-03-11 00:00:37 +01:00
Marek Marczykowski-Górecki
735788dbd6 appmenus: do not force GUI connection when retrieving appmenus
There could be no GUI available - for example at firstboot.
2015-03-10 23:59:30 +01:00
Marek Marczykowski-Górecki
e76007fe20 qrexec: periodically check if remote domain/process still exists 2015-02-22 18:25:14 +01:00
Marek Marczykowski-Górecki
9ea5790a9b appmenus: really call kbuildsycoca4 only once after template update (#886) 2015-02-22 02:08:49 +01:00
Marek Marczykowski-Górecki
5645b4c307 qrexec: wait for remote exit code, even when both stdin/out are closed 2015-02-17 03:57:17 +01:00
Marek Marczykowski-Górecki
61eb2e7764 qrexec: fix handling of remote exit code 2015-02-11 16:11:38 +01:00
Marek Marczykowski-Górecki
d031126737 Add "--" to separate options from (untrusted) non-options arguments
This will prevent passing an option instead of command (qvm-run) /
domain name (qrexec-policy). In both cases when VM tries to pass some
option it would fail because missing argument then - VM can not pass
additional arguments, so if one act as an option, one argument will be
missing).
2015-02-10 01:57:33 +01:00
Marek Marczykowski-Górecki
4449d51d98 udev: prevent race with kpartx -d
udevd calls (internal) blkid, which opens the device, so kpartx -d
cannot remove it.
2015-02-01 04:05:05 +01:00
Marek Marczykowski-Górecki
a28e6e1044 appmenus: call kbuildsycoca4 only once after template update (#886) 2015-01-30 01:57:19 +01:00
Marek Marczykowski-Górecki
04770e4037 version 3.0.0 2014-11-22 16:24:11 +01:00
Marek Marczykowski-Górecki
af66472c36 rpm: add missing vchan-devel build requires 2014-11-19 15:23:10 +01:00
Marek Marczykowski-Górecki
1d017449d0 qrexec: fix compile warnings 2014-11-19 15:23:10 +01:00
Marek Marczykowski-Górecki
6efbbb88da qrexec: new protocol - direct data vchan connections 2014-11-19 15:23:10 +01:00
Marek Marczykowski-Górecki
0ba692c85a code style: change tabs to spaces 2014-11-19 15:21:42 +01:00
Marek Marczykowski-Górecki
6e47f12118 Revert "qrexec: fix deadlock in qrexec-client"
This reverts commit 79abec9038.

The problem will not be applicable in new protocol, where vchan
connection is directly between VMs, so there is no longer two connected
qrexec-clients - always one end of data flow in qrexec-client is vchan,
which provide information about amount of data to read or buffer
space to write (lack of the later in case of pipes was a cause of the
original problem).
2014-11-19 15:21:42 +01:00
Marek Marczykowski-Górecki
9a1c071f40 qrexec-policy: remove trailing spaces 2014-11-19 15:21:42 +01:00
Marek Marczykowski-Górecki
29d94c6478 dracut: change the way to include ehci-pci module
Apparently add_drivers doesn't work. Looking at kernel-modules dracut
code, it can only be used for block-device driver and only makes sense
in --host-only mode.
So add additional module, which unconditionally install kernel modules.
2014-11-19 15:21:42 +01:00
Marek Marczykowski-Górecki
76e3a34e7c dracut: include ehci-pci module in initramfs image
In recent kernel releases this additional module is required
to support USB 2.0 controllers.
2014-11-19 15:21:41 +01:00
Marek Marczykowski
0eaae9790c Use QubesVMMConnection object
Introduced in core-admin:
af521bd Wrap all VMM connection related object into QubesVMMConnection
class
2014-11-19 15:21:41 +01:00
Marek Marczykowski
43770dae36 qrexec: handle vchan connect errors 2014-11-19 15:21:41 +01:00
Marek Marczykowski
d08831cc7e qrexec: get domain name from cmdline
libvchan_get_domain_name will be removed
2014-11-19 15:21:41 +01:00
Marek Marczykowski
6d2755abe6 Use libvirt in qrexec-policy
Import connection for core qubes module.
2014-11-19 15:21:41 +01:00
Marek Marczykowski
7bdf7b3f36 use domain name in error messages and log file name
Should be much more convenient than XID.
2014-11-19 15:21:41 +01:00
Marek Marczykowski
9215c09656 update for new vchan API 2014-11-19 15:21:40 +01:00
100 changed files with 968 additions and 2619 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
rpm/
pkgs/

13
.travis.yml Normal file
View File

@ -0,0 +1,13 @@
sudo: required
dist: bionic
language: generic
install: git clone https://github.com/QubesOS/qubes-builder ~/qubes-builder
script: ~/qubes-builder/scripts/travis-build
env:
- DIST_DOM0=fc31 USE_QUBES_REPO_VERSION=4.1 USE_QUBES_REPO_TESTING=1
# don't build tags which are meant for code signing only
branches:
except:
- /.*_.*/
- build

View File

@ -1,5 +1,4 @@
This package contains Linux dom0 files, which aren't exactly part of "Qubes
core" i.e. aren't required for normal Qubes usage.
This package contains Linux dom0 files.
Mostly there are config files for different system services, but also some
"addons" to Qubes core:

View File

@ -1,8 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=Command Prompt
Comment=Use the command line
Categories=GNOME;GTK;Utility;TerminalEmulator;System;
Exec=cmd /c start cmd

View File

@ -1,8 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=Explorer
Comment=Browse files
Categories=Utility;Core;
Exec=explorer

View File

@ -1,8 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=Internet Explorer
Comment=Browse the Web
Categories=Network;WebBrowser;
Exec=C:\\Program Files\\Internet Explorer\\iexplore.exe

View File

@ -1,10 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Exec=qubes-vm-settings %VMNAME% applications
Icon=qubes-logo
Terminal=false
Name=%VMNAME%: Add more shortcuts...
GenericName=%VMNAME%: Add more shortcuts...
StartupNotify=false
Categories=System;

View File

@ -1,10 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Exec=sh -c 'echo firefox | /usr/lib/qubes/qfile-daemon-dvm qubes.VMShell dom0 DEFAULT red'
Icon=dispvm-red
Terminal=false
Name=DispVM: Firefox web browser
GenericName=DispVM: Web browser
StartupNotify=false
Categories=Network;

View File

@ -1,5 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Type=Directory
Name=DisposableVM
Icon=dispvm-red

View File

@ -1,5 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Type=Directory
Name=ServiceVM: %VMNAME%
Icon=%XDGICON%

View File

@ -1,10 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Exec=qvm-start --quiet --tray %VMNAME%
Icon=%XDGICON%
Terminal=false
Name=%VMNAME%: Start
GenericName=%VMNAME%: Start
StartupNotify=false
Categories=System;

View File

@ -1,5 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Type=Directory
Name=Template: %VMNAME%
Icon=qubes-logo

View File

@ -1,5 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Type=Directory
Name=Domain: %VMNAME%
Icon=%XDGICON%

View File

@ -1,16 +0,0 @@
#!/bin/sh
SRC=$1
DSTDIR=$2
VMNAME=$3
VMDIR=$4
XDGICON=$5
DST=$DSTDIR/$VMNAME-$(basename $SRC)
sed \
-e "s/%VMNAME%/$VMNAME/" \
-e "s %VMDIR% $VMDIR " \
-e "s/%XDGICON%/$XDGICON/" \
<$SRC >$DST

View File

@ -1,14 +0,0 @@
#!/bin/sh
SRC=$1
DST=$2
VMNAME=$3
VMDIR=$4
XDGICON=$5
sed \
-e "s/%VMNAME%/$VMNAME/" \
-e "s %VMDIR% $VMDIR " \
-e "s/%XDGICON%/$XDGICON/" \
<$SRC >$DST

View File

@ -1,63 +0,0 @@
#!/bin/sh
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
SRCDIR=$1
VMNAME=$2
VMTYPE=$3
if [ -z "$VMTYPE" ]; then
VMTYPE=appvms
fi
XDGICON=$4
VMDIR=/var/lib/qubes/$VMTYPE/$VMNAME
APPSDIR=$VMDIR/apps
if [ $# -lt 2 ]; then
echo "usage: $0 <apps_templates_dir> <vmname> [appvms|vm-templates|servicevms]"
exit
fi
mkdir -p $APPSDIR
if [ "$SRCDIR" != "none" ]; then
echo "--> Converting Appmenu Templates..."
if [ -r "$VMDIR/whitelisted-appmenus.list" ]; then
cat $VMDIR/whitelisted-appmenus.list | xargs -I{} /usr/libexec/qubes-appmenus/convert-apptemplate2vm.sh $SRCDIR/{} $APPSDIR $VMNAME $VMDIR $XDGICON
else
find $SRCDIR -name "*.desktop" $CHECK_WHITELISTED -exec /usr/libexec/qubes-appmenus/convert-apptemplate2vm.sh {} $APPSDIR $VMNAME $VMDIR $XDGICON \;
fi
/usr/libexec/qubes-appmenus/convert-apptemplate2vm.sh /usr/share/qubes-appmenus/qubes-appmenu-select.desktop $APPSDIR $VMNAME $VMDIR $XDGICON
if [ "$VMTYPE" = "vm-templates" ]; then
DIR_TEMPLATE=/usr/share/qubes-appmenus/qubes-templatevm.directory.template
elif [ "$VMTYPE" = "servicevms" ]; then
DIR_TEMPLATE=/usr/share/qubes-appmenus/qubes-servicevm.directory.template
else
DIR_TEMPLATE=/usr/share/qubes-appmenus/qubes-vm.directory.template
fi
/usr/libexec/qubes-appmenus/convert-dirtemplate2vm.sh $DIR_TEMPLATE $APPSDIR/$VMNAME-vm.directory $VMNAME $VMDIR $XDGICON
fi
echo "--> Adding Apps to the Menu..."
LC_COLLATE=C xdg-desktop-menu install $APPSDIR/*.directory $APPSDIR/*.desktop
if [ -n "$KDE_SESSION_UID" ]; then
kbuildsycoca4
fi

View File

@ -1,276 +0,0 @@
#!/usr/bin/python2
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
# Copyright (C) 2013 Marek Marczykowski <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
import subprocess
import sys
import os
import os.path
import shutil
import dbus
from qubes.qubes import QubesVm,QubesHVm
from qubes.qubes import QubesException,QubesHost,QubesVmLabels
from qubes.qubes import vm_files,system_path,dry_run
import qubes.imgconverter
vm_files['appmenus_templates_subdir'] = 'apps.templates'
vm_files['appmenus_template_icons_subdir'] = 'apps.tempicons'
vm_files['appmenus_icons_subdir'] = 'apps.icons'
vm_files['appmenus_template_templates_subdir'] = 'apps-template.templates'
vm_files['appmenus_whitelist'] = 'whitelisted-appmenus.list'
system_path['appmenu_start_hvm_template'] = '/usr/share/qubes-appmenus/qubes-start.desktop'
system_path['appmenu_create_cmd'] = '/usr/libexec/qubes-appmenus/create-apps-for-appvm.sh'
system_path['appmenu_remove_cmd'] = '/usr/libexec/qubes-appmenus/remove-appvm-appmenus.sh'
def QubesVm_get_attrs_config(self, attrs):
attrs["appmenus_templates_dir"] = { "eval": \
'os.path.join(self.dir_path, vm_files["appmenus_templates_subdir"]) if self.updateable else ' + \
'self.template.appmenus_templates_dir if self.template is not None else None' }
attrs["appmenus_template_icons_dir"] = { "eval": \
'os.path.join(self.dir_path, vm_files["appmenus_template_icons_subdir"]) if self.updateable else ' + \
'self.template.appmenus_template_icons_dir if self.template is not None else None' }
attrs["appmenus_icons_dir"] = { "eval": \
'os.path.join(self.dir_path, vm_files["appmenus_icons_subdir"])' }
return attrs
def QubesTemplateVm_get_attrs_config(self, attrs):
attrs['appmenus_templates_dir'] = { 'eval': 'os.path.join(self.dir_path, vm_files["appmenus_templates_subdir"])' }
attrs['appmenus_template_icons_dir'] = { 'eval': 'os.path.join(self.dir_path, vm_files["appmenus_template_icons_subdir"])' }
return attrs
def QubesVm_appmenus_create(self, verbose=False, source_template = None):
if source_template is None:
source_template = self.template
if self.internal:
return
vmtype = None
if self.is_netvm():
vmtype = 'servicevms'
elif self.is_template():
vmtype = 'vm-templates'
else:
vmtype = 'appvms'
try:
msgoutput = None if verbose else open(os.devnull, 'w')
if source_template is not None:
subprocess.check_call([system_path["appmenu_create_cmd"],
source_template.appmenus_templates_dir,
self.name, vmtype, self.label.icon],
stdout=msgoutput, stderr=msgoutput)
elif self.appmenus_templates_dir is not None:
subprocess.check_call ([system_path["appmenu_create_cmd"],
self.appmenus_templates_dir, self.name,
vmtype, self.label.icon],
stdout=msgoutput, stderr=msgoutput)
else:
# Only add apps to menu
subprocess.check_call ([system_path["appmenu_create_cmd"],
"none", self.name, vmtype,
self.label.icon],
stdout=msgoutput, stderr=msgoutput)
except subprocess.CalledProcessError:
print >> sys.stderr, "Ooops, there was a problem creating appmenus for {0} VM!".format (self.name)
def QubesVm_appmenus_remove(self):
vmtype = None
if self.is_netvm():
vmtype = 'servicevms'
elif self.is_template():
vmtype = 'vm-templates'
else:
vmtype = 'appvms'
subprocess.check_call ([system_path["appmenu_remove_cmd"], self.name,
vmtype], stderr=open(os.devnull, 'w'))
def QubesVm_appicons_create(self, srcdir=None):
if srcdir is None:
srcdir = self.appmenus_template_icons_dir
if srcdir is None:
return
if not os.path.exists(srcdir):
return
whitelist = os.path.join(self.dir_path, vm_files['appmenus_whitelist'])
if os.path.exists(whitelist):
whitelist = [line.strip() for line in open(whitelist)]
else:
whitelist = None
if not os.path.exists(self.appmenus_icons_dir):
os.mkdir(self.appmenus_icons_dir)
elif not os.path.isdir(self.appmenus_icons_dir):
os.unlink(self.appmenus_icons_dir)
os.mkdir(self.appmenus_icons_dir)
for icon in os.listdir(srcdir):
desktop = os.path.splitext(icon)[0] + '.desktop'
if whitelist and desktop not in whitelist:
continue
qubes.imgconverter.tint(os.path.join(srcdir, icon),
os.path.join(self.appmenus_icons_dir, icon),
self.label.color)
def QubesVm_appicons_remove(self):
if not os.path.exists(self.appmenus_icons_dir): return
for icon in os.listdir(self.appmenus_icons_dir):
os.unlink(os.path.join(self.appmenus_icons_dir, icon))
def QubesVm_pre_rename(self, new_name):
self.appmenus_remove()
def QubesVm_post_rename(self, old_name):
old_dirpath = os.path.join(os.path.dirname(self.dir_path), old_name)
if self.appmenus_templates_dir is not None:
self.appmenus_templates_dir = self.appmenus_templates_dir.replace(old_dirpath, self.dir_path)
self.appmenus_create()
def QubesVm_create_on_disk(self, verbose, source_template):
if isinstance(self, QubesHVm) and source_template is None:
if verbose:
print >> sys.stderr, "--> Creating appmenus directory: {0}".format(self.appmenus_templates_dir)
os.mkdir (self.appmenus_templates_dir)
shutil.copy (system_path["appmenu_start_hvm_template"], self.appmenus_templates_dir)
source_whitelist_filename = 'vm-' + vm_files["appmenus_whitelist"]
if self.is_netvm():
source_whitelist_filename = 'netvm-' + vm_files["appmenus_whitelist"]
if source_template and os.path.exists(os.path.join(source_template.dir_path, source_whitelist_filename)):
if verbose:
print >> sys.stderr, "--> Creating default whitelisted apps list: {0}".\
format(self.dir_path + '/' + vm_files["whitelisted_appmenus"])
shutil.copy(os.path.join(source_template.dir_path, source_whitelist_filename),
os.path.join(self.dir_path, vm_files["whitelisted_appmenus"]))
if source_template and self.updateable:
if verbose:
print >> sys.stderr, "--> Copying the template's appmenus templates dir:\n{0} ==>\n{1}".\
format(source_template.appmenus_templates_dir, self.appmenus_templates_dir)
if os.path.isdir(source_template.appmenus_templates_dir):
shutil.copytree (source_template.appmenus_templates_dir, self.appmenus_templates_dir)
else:
os.mkdir(self.appmenus_templates_dir)
if os.path.isdir(source_template.appmenus_template_icons_dir):
shutil.copytree (source_template.appmenus_template_icons_dir, self.appmenus_template_icons_dir)
else:
os.mkdir(self.appmenus_template_icons_dir)
# Create appmenus
self.appicons_create()
self.appmenus_create(verbose=verbose)
def QubesVm_clone_disk_files(self, src_vm, verbose):
if src_vm.updateable and src_vm.appmenus_templates_dir is not None and self.appmenus_templates_dir is not None:
if verbose:
print >> sys.stderr, "--> Copying the template's appmenus templates dir:\n{0} ==>\n{1}".\
format(src_vm.appmenus_templates_dir, self.appmenus_templates_dir)
shutil.copytree (src_vm.appmenus_templates_dir, self.appmenus_templates_dir)
if src_vm.updateable and src_vm.appmenus_template_icons_dir is not None \
and self.appmenus_template_icons_dir is not None and \
os.path.isdir(src_vm.appmenus_template_icons_dir):
if verbose:
print >> sys.stderr, "--> Copying the template's appmenus " \
"template icons dir:\n{0} ==>\n{1}".\
format(src_vm.appmenus_template_icons_dir,
self.appmenus_template_icons_dir)
shutil.copytree (src_vm.appmenus_template_icons_dir,
self.appmenus_template_icons_dir)
for whitelist in (
vm_files["appmenus_whitelist"],
'vm-' + vm_files["appmenus_whitelist"],
'netvm-' + vm_files["appmenus_whitelist"]):
if os.path.exists(os.path.join(src_vm.dir_path, whitelist)):
if verbose:
print >> sys.stderr, "--> Copying whitelisted apps list: {0}".\
format(whitelist)
shutil.copy(os.path.join(src_vm.dir_path, whitelist),
os.path.join(self.dir_path, whitelist))
# Create appmenus
self.appicons_create()
self.appmenus_create(verbose=verbose)
def QubesVm_remove_from_disk(self):
self.appmenus_remove()
def QubesVm_label_setter(self, _):
self.appicons_create()
# Apparently desktop environments heavily caches the icons,
# see #751 for details
if os.environ.get("DESKTOP_SESSION", "") == "kde-plasma":
try:
os.unlink(os.path.expandvars("$HOME/.kde/cache-$HOSTNAME/icon-cache.kcache"))
except:
pass
try:
notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
notify_object.Notify(
"Qubes", 0, self.label.icon, "Qubes",
"You will need to log off and log in again for the VM icons to update in the KDE launcher menu",
[], [], 10000,
dbus_interface="org.freedesktop.Notifications")
except:
pass
elif os.environ.get("DESKTOP_SESSION", "") == "xfce":
self.appmenus_remove()
self.appmenus_create()
def QubesVm_appmenus_recreate(self):
self.appmenus_remove()
self.appicons_remove()
self.appicons_create()
self.appmenus_create()
def QubesVm_set_attr(self, name, newvalue, oldvalue):
if name == 'internal':
if newvalue and not oldvalue:
self.appmenus_remove()
elif not newvalue and oldvalue:
self.appmenus_create()
# new methods
QubesVm.appmenus_create = QubesVm_appmenus_create
QubesVm.appmenus_remove = QubesVm_appmenus_remove
QubesVm.appmenus_recreate = QubesVm_appmenus_recreate
QubesVm.appicons_create = QubesVm_appicons_create
QubesVm.appicons_remove = QubesVm_appicons_remove
# hooks for existing methods
QubesVm.hooks_get_attrs_config.append(QubesVm_get_attrs_config)
QubesVm.hooks_pre_rename.append(QubesVm_pre_rename)
QubesVm.hooks_post_rename.append(QubesVm_post_rename)
QubesVm.hooks_create_on_disk.append(QubesVm_create_on_disk)
QubesVm.hooks_clone_disk_files.append(QubesVm_clone_disk_files)
QubesVm.hooks_remove_from_disk.append(QubesVm_remove_from_disk)
QubesVm.hooks_label_setter.append(QubesVm_label_setter)
QubesVm.hooks_set_attr.append(QubesVm_set_attr)

View File

@ -1,334 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2011 Marek Marczykowski <marmarek@mimuw.edu.pl>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
import subprocess
import re
import os
import sys
import shutil
import pipes
from optparse import OptionParser
from qubes.qubes import QubesVmCollection,QubesException,system_path
from qubes.qubes import QubesHVm
from qubes.qubes import vm_files
import qubes.imgconverter
# fields required to be present (and verified) in retrieved desktop file
required_fields = [ "Name", "Exec" ]
#limits
appmenus_line_size = 1024
appmenus_line_count = 100000
# regexps for sanitization of retrieved values
std_re = re.compile(r"^[/a-zA-Z0-9.,&() -]*$")
fields_regexp = {
"Name": std_re,
"GenericName": std_re,
"Comment": std_re,
"Categories": re.compile(r"^[a-zA-Z0-9/.;:'() -]*$"),
"Exec": re.compile(r"^[a-zA-Z0-9()%&>/{}\"'\\:.= -]*$"),
"Icon": re.compile(r"^[a-zA-Z0-9/_.-]*$"),
}
CATEGORIES_WHITELIST = set([
# Main Categories
# http://standards.freedesktop.org/menu-spec/1.1/apa.html 20140507
'AudioVideo', 'Audio', 'Video', 'Development', 'Education', 'Game',
'Graphics', 'Network', 'Office', 'Science', 'Settings', 'System',
'Utility',
# Additional Categories
# http://standards.freedesktop.org/menu-spec/1.1/apas02.html
'Building', 'Debugger', 'IDE', 'GUIDesigner', 'Profiling',
'RevisionControl', 'Translation', 'Calendar', 'ContactManagement',
'Database', 'Dictionary', 'Chart', 'Email', 'Finance', 'FlowChart', 'PDA',
'ProjectManagement', 'Presentation', 'Spreadsheet', 'WordProcessor',
'2DGraphics', 'VectorGraphics', 'RasterGraphics', '3DGraphics', 'Scanning',
'OCR', 'Photography', 'Publishing', 'Viewer', 'TextTools',
'DesktopSettings', 'HardwareSettings', 'Printing', 'PackageManager',
'Dialup', 'InstantMessaging', 'Chat', 'IRCClient', 'Feed', 'FileTransfer',
'HamRadio', 'News', 'P2P', 'RemoteAccess', 'Telephony', 'TelephonyTools',
'VideoConference', 'WebBrowser', 'WebDevelopment', 'Midi', 'Mixer',
'Sequencer', 'Tuner', 'TV', 'AudioVideoEditing', 'Player', 'Recorder',
'DiscBurning', 'ActionGame', 'AdventureGame', 'ArcadeGame', 'BoardGame',
'BlocksGame', 'CardGame', 'KidsGame', 'LogicGame', 'RolePlaying',
'Shooter', 'Simulation', 'SportsGame', 'StrategyGame', 'Art',
'Construction', 'Music', 'Languages', 'ArtificialIntelligence',
'Astronomy', 'Biology', 'Chemistry', 'ComputerScience',
'DataVisualization', 'Economy', 'Electricity', 'Geography', 'Geology',
'Geoscience', 'History', 'Humanities', 'ImageProcessing', 'Literature',
'Maps', 'Math', 'NumericalAnalysis', 'MedicalSoftware', 'Physics',
'Robotics', 'Spirituality', 'Sports', 'ParallelComputing', 'Amusement',
'Archiving', 'Compression', 'Electronics', 'Emulator', 'Engineering',
'FileTools', 'FileManager', 'TerminalEmulator', 'Filesystem', 'Monitor',
'Security', 'Accessibility', 'Calculator', 'Clock', 'TextEditor',
'Documentation', 'Adult', 'Core', 'KDE', 'GNOME', 'XFCE', 'GTK', 'Qt',
'Motif', 'Java', 'ConsoleOnly',
# Reserved Categories (not whitelisted)
# http://standards.freedesktop.org/menu-spec/1.1/apas03.html
# 'Screensaver', 'TrayIcon', 'Applet', 'Shell',
])
def sanitise_categories(untrusted_value):
untrusted_categories = (c.strip() for c in untrusted_value.split(';') if c)
categories = (c for c in untrusted_categories if c in CATEGORIES_WHITELIST)
return ';'.join(categories) + ';'
def fallback_hvm_appmenulist():
p = subprocess.Popen(["grep", "-rH", "=", "/usr/share/qubes-appmenus/hvm"],
stdout=subprocess.PIPE)
(stdout, stderr) = p.communicate()
return stdout.splitlines()
def get_appmenus(vm):
global appmenus_line_count
global appmenus_line_size
untrusted_appmenulist = []
if vm is None:
while appmenus_line_count > 0:
untrusted_line = sys.stdin.readline(appmenus_line_size)
if untrusted_line == "":
break
untrusted_appmenulist.append(untrusted_line.strip())
appmenus_line_count -= 1
if appmenus_line_count == 0:
raise QubesException("Line count limit exceeded")
else:
p = vm.run('QUBESRPC qubes.GetAppmenus dom0', passio_popen=True)
while appmenus_line_count > 0:
untrusted_line = p.stdout.readline(appmenus_line_size)
if untrusted_line == "":
break
untrusted_appmenulist.append(untrusted_line.strip())
appmenus_line_count -= 1
p.wait()
if p.returncode != 0:
if isinstance(vm, QubesHVm):
untrusted_appmenulist = fallback_hvm_appmenulist()
else:
raise QubesException("Error getting application list")
if appmenus_line_count == 0:
raise QubesException("Line count limit exceeded")
row_no = 0
appmenus = {}
line_rx = re.compile(r"([a-zA-Z0-9.()_-]+.desktop):([a-zA-Z0-9-]+(?:\[[a-zA-Z@_]+\])?)=(.*)")
ignore_rx = re.compile(r".*([a-zA-Z0-9._-]+.desktop):(#.*|\s+)$")
for untrusted_line in untrusted_appmenulist:
# Ignore blank lines and comments
if len(untrusted_line) == 0 or ignore_rx.match(untrusted_line):
continue
# use search instead of match to skip file path
untrusted_m = line_rx.search(untrusted_line)
if untrusted_m:
filename = untrusted_m.group(1)
assert '/' not in filename
assert '\0' not in filename
untrusted_key = untrusted_m.group(2)
assert '\0' not in untrusted_key
assert '\x1b' not in untrusted_key
assert '=' not in untrusted_key
untrusted_value = untrusted_m.group(3)
# TODO add key-dependent asserts
# Look only at predefined keys
if fields_regexp.has_key(untrusted_key):
if fields_regexp[untrusted_key].match(untrusted_value):
# now values are sanitized
key = untrusted_key
if key == 'Categories':
value = sanitise_categories(untrusted_value)
else:
value = untrusted_value
if not appmenus.has_key(filename):
appmenus[filename] = {}
appmenus[filename][key]=value
else:
print >>sys.stderr, "Warning: ignoring key %r of %s" % (untrusted_key, filename)
# else: ignore this key
return appmenus
def create_template(path, values):
# check if all required fields are present
for key in required_fields:
if not values.has_key(key):
print >>sys.stderr, "Warning: not creating/updating '%s' because of missing '%s' key" % (path, key)
return
desktop_file = open(path, "w")
desktop_file.write("[Desktop Entry]\n")
desktop_file.write("Version=1.0\n")
desktop_file.write("Type=Application\n")
desktop_file.write("Terminal=false\n")
desktop_file.write("X-Qubes-VmName=%VMNAME%\n")
if 'Icon' in values:
icon_file = os.path.splitext(os.path.split(path)[1])[0] + '.png'
desktop_file.write("Icon={0}\n".format(os.path.join(
'%VMDIR%', vm_files['appmenus_icons_subdir'], icon_file)))
else:
desktop_file.write("Icon=%XDGICON%\n")
for key in ["Name", "GenericName" ]:
if values.has_key(key):
desktop_file.write("{0}=%VMNAME%: {1}\n".format(key, values[key]))
for key in [ "Comment", "Categories" ]:
if values.has_key(key):
desktop_file.write("{0}={1}\n".format(key, values[key]))
desktop_file.write("Exec=qvm-run -q --tray -a %VMNAME% {0}\n".format(pipes.quote(values['Exec'])))
desktop_file.close()
def main():
env_vmname = os.environ.get("QREXEC_REMOTE_DOMAIN")
usage = "usage: %prog [options] <vm-name>\n"\
"Updates desktop file templates for given StandaloneVM or TemplateVM"
parser = OptionParser (usage)
parser.add_option ("-v", "--verbose", action="store_true", dest="verbose", default=False)
parser.add_option ("--force-root", action="store_true", dest="force_root", default=False,
help="Force to run, even with root privileges")
parser.add_option ("--force-rpc", action="store_true", dest="force_rpc", default=False,
help="Force to start a new RPC call, even if called from existing one")
(options, args) = parser.parse_args ()
if (len (args) != 1) and env_vmname is None:
parser.error ("You must specify at least the VM name!")
if env_vmname:
vmname=env_vmname
else:
vmname=args[0]
if os.geteuid() == 0:
if not options.force_root:
print >> sys.stderr, "*** Running this tool as root is strongly discouraged, this will lead you in permissions problems."
print >> sys.stderr, "Retry as unprivileged user."
print >> sys.stderr, "... or use --force-root to continue anyway."
exit(1)
qvm_collection = QubesVmCollection()
qvm_collection.lock_db_for_reading()
qvm_collection.load()
qvm_collection.unlock_db()
vm = qvm_collection.get_vm_by_name(vmname)
if vm is None:
print >>sys.stderr, "ERROR: A VM with the name '{0}' does not exist in the system.".format(vmname)
exit(1)
if vm.template is not None:
print >>sys.stderr, "ERROR: To sync appmenus for template based VM, do it on template instead"
exit(1)
if not vm.is_running():
print >>sys.stderr, "ERROR: Appmenus can be retrieved only from running VM - start it first"
exit(1)
new_appmenus = {}
if env_vmname is None or options.force_rpc:
new_appmenus = get_appmenus(vm)
else:
options.verbose = False
new_appmenus = get_appmenus(None)
if len(new_appmenus) == 0:
print >>sys.stderr, "ERROR: No appmenus received, terminating"
exit(1)
if not os.path.exists(vm.appmenus_templates_dir):
os.mkdir(vm.appmenus_templates_dir)
if not os.path.exists(vm.appmenus_template_icons_dir):
os.mkdir(vm.appmenus_template_icons_dir)
# Create new/update existing templates
if options.verbose:
print >> sys.stderr, "--> Got {0} appmenus, storing to disk".format(str(len(new_appmenus)))
for appmenu_file in new_appmenus.keys():
if options.verbose:
if os.path.exists(os.path.join(vm.appmenus_templates_dir, appmenu_file)):
print >> sys.stderr, "---> Updating {0}".format(appmenu_file)
else:
print >> sys.stderr, "---> Creating {0}".format(appmenu_file)
if 'Icon' in new_appmenus[appmenu_file]:
# the following line is used for time comparison
# del new_appmenus[appmenu_file]['Icon']
icondest = os.path.join(vm.appmenus_template_icons_dir,
os.path.splitext(appmenu_file)[0] + '.png')
try:
qubes.imgconverter.Image.get_xdg_icon_from_vm(vm,
new_appmenus[appmenu_file]['Icon']).save(icondest)
except Exception, e:
print >> sys.stderr, '----> Failed to get icon for {0}: {1!s}'.format(appmenu_file, e)
if os.path.exists(icondest):
print >> sys.stderr, '-----> Found old icon, using it instead'
else:
del new_appmenus[appmenu_file]['Icon']
create_template(os.path.join(vm.appmenus_templates_dir, appmenu_file),
new_appmenus[appmenu_file])
# Delete appmenus of removed applications
if options.verbose:
print >> sys.stderr, "--> Cleaning old files"
for appmenu_file in os.listdir(vm.appmenus_templates_dir):
if not appmenu_file.endswith('.desktop'):
continue
if not new_appmenus.has_key(appmenu_file):
if options.verbose:
print >> sys.stderr, "---> Removing {0}".format(appmenu_file)
os.unlink(os.path.join(vm.appmenus_templates_dir, appmenu_file))
if isinstance(vm, QubesHVm):
if not os.path.exists(os.path.join(vm.appmenus_templates_dir,
os.path.basename(system_path['appmenu_start_hvm_template']))):
shutil.copy(system_path['appmenu_start_hvm_template'], vm.appmenus_templates_dir)
if hasattr(vm, 'appvms'):
for child_vm in vm.appvms.values():
try:
child_vm.appmenus_recreate()
except Exception, e:
print >> sys.stderr, "---> Failed to recreate appmenus for " \
"'{0}': {1}".format(child_vm.name, str(e))
main()

View File

@ -1 +0,0 @@
/usr/libexec/qubes-appmenus/qubes-receive-appmenus

View File

@ -1,2 +0,0 @@
#!/bin/sh
exec /usr/libexec/qubes-appmenus/qubes-receive-appmenus $@

View File

@ -1,23 +0,0 @@
#!/bin/sh
VMNAME=$1
VMTYPE=$2
if [ -z "$VMTYPE" ]; then
VMTYPE=appvms
fi
VMDIR=/var/lib/qubes/$VMTYPE/$VMNAME
APPSDIR=$VMDIR/apps
if [ $# -lt 1 ]; then
echo "usage: $0 <vmname> [appvms|vm-templates|servicevms]"
exit
fi
if ls $APPSDIR/*.directory $APPSDIR/*.desktop > /dev/null 2>&1; then
LC_COLLATE=C xdg-desktop-menu uninstall $APPSDIR/*.directory $APPSDIR/*.desktop
rm -f $APPSDIR/*.desktop $APPSDIR/*.directory
rm -f $HOME/.config/menus/applications-merged/user-$VMNAME-vm.menu
fi
if [ -n "$KDE_SESSION_UID" ]; then
kbuildsycoca4
fi

View File

@ -21,7 +21,7 @@ install: manpages
manpages: $(TOOLS_DOCS)
preview: $(rst)
pandoc -s -f rst -t man $(rst) | groff -mandoc -Tlatin1 | less -R
$(PANDOC) $(rst) | groff -mandoc -Tlatin1 | less -R
clean:
rm -f $(TOOLS_DOCS)

View File

@ -6,14 +6,14 @@ NAME
====
qubes-dom0-update - update software in dom0
:Date: 2012-04-13
SYNOPSIS
========
| qubes-dom0-update [--clean] [--check-only] [--gui] [<yum opts>] [<pkg list>]
| qubes-dom0-update [--action=ACTION] [--clean] [--check-only] [--gui] [<yum opts>] [<pkg list>]
OPTIONS
=======
--action=ACTION
Allows to pass a yum command, such as "install", "search", "downgrade" etc.
--clean
Clean yum cache before doing anything
--check-only

View File

@ -6,8 +6,6 @@ NAME
====
qvm-sync-appmenus - updates desktop file templates for given StandaloneVM or TemplateVM
:Date: 2012-04-11
SYNOPSIS
========
| qvm-sync-appmenus [options] <vm-name>

View File

@ -0,0 +1,85 @@
#!/bin/sh
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2015 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
BEGIN_MARKER="### QUBES BEGIN ###"
END_MARKER="### QUBES END ###"
set -e
### helper functions begin ###
# set proxy in given config file
update_conf() {
local CONF_PATH="$1"
local CONF_OPTIONS="$2"
# Ensure that Qubes conf markers are present in the file
if ! grep -q "$BEGIN_MARKER" $CONF_PATH; then
if grep -q "$END_MARKER" $CONF_PATH; then
echo "ERROR: found QUBES END marker but not QUBES BEGIN in ${CONF_PATH}" >&2
echo "Fix the file by either removing both of them, or adding missing back and retry" >&2
exit 1
fi
cp $CONF_PATH ${CONF_PATH}.qubes-orig
echo "$BEGIN_MARKER" >> $CONF_PATH
echo "$END_MARKER" >> $CONF_PATH
elif ! grep -q "$END_MARKER" $CONF_PATH; then
echo "ERROR: found QUBES BEGIN marker but not QUBES END in ${CONF_PATH}" >&2
echo "Fix the file by either removing both of them, or adding missing back and retry" >&2
exit 1
fi
# Prepare config block
local tmpfile=`mktemp`
cat > ${tmpfile} <<EOF
# This part of configuration, until QUBES END, is automatically generated by
# $0. All changes here will be overriden.
# If you want to override any option set here, set it again to desired value,
# below this section
$CONF_OPTIONS
EOF
# And insert it between the markers
sed -i -e "/^$BEGIN_MARKER$/,/^$END_MARKER$/{
/^$END_MARKER$/b
/^$BEGIN_MARKER$/!d
r ${tmpfile}
}" ${CONF_PATH}
rm -f ${tmpfile}
}
### helper functions end
if [ -e /etc/dnf/dnf.conf ]; then
update_conf /etc/dnf/dnf.conf "
reposdir=/etc/yum.real.repos.d
installonlypkgs = kernel, kernel-qubes-vm"
fi
if [ -e /etc/yum.conf ]; then
update_conf /etc/yum.conf "
reposdir=/etc/yum.real.repos.d
installonlypkgs = kernel, kernel-qubes-vm
distroverpkg = qubes-release"
fi

View File

@ -1,6 +1,29 @@
#!/bin/bash
UPDATEVM=`qubes-prefs --get updatevm`
escape_args() {
local eargs=""
for arg in "$@"; do
printf -v eargs '%s%q ' "$eargs" "$arg"
done
echo "${eargs%?}"
}
find_regex_in_args() {
local regex="${1}"
shift 1
for arg in "${@}"; do
if echo "${arg}" | grep -q -e "${regex}"; then
return 0
fi
done
return 1
}
UPDATEVM=`qubes-prefs --force-root updatevm`
UPDATES_STAT_FILE=/var/lib/qubes/updates/dom0-updates-available
if [ -z "$UPDATEVM" ]; then
@ -13,22 +36,26 @@ if [ "$1" = "--help" ]; then
echo "it checks for updates for installed packages"
echo ""
echo "Usage: $0 [--clean] [--check-only] [--gui] [<pkg list>]"
echo " --clean clean yum cache before doing anything"
echo " --clean clean dnf cache before doing anything"
echo " --check-only only check for updates (no install)"
echo " --gui use gpk-update-viewer for update selection"
echo " --action=... use specific dnf action, instead of automatic install/update"
echo " <pkg list> download (and install if run by root) new packages"
echo " in dom0 instead of updating"
exit
fi
PKGS=
YUM_OPTS=
PKGS=()
YUM_OPTS=()
GUI=
CHECK_ONLY=
ALL_OPTS=$*
ALL_OPTS=( "${@}" )
YUM_ACTION=
QVMRUN_OPTS=
CLEAN=
# Filter out some yum options and collect packages list
TEMPLATE=
TEMPLATE_BACKUP=
# Filter out some dnf options and collect packages list
while [ $# -gt 0 ]; do
case "$1" in
--enablerepo=*|\
@ -43,32 +70,82 @@ while [ $# -gt 0 ]; do
--check-only)
CHECK_ONLY=1
;;
--action=*)
YUM_ACTION=${1#--action=}
;;
-*)
YUM_OPTS="$YUM_OPTS $1"
YUM_OPTS+=( "${1}" )
;;
*)
PKGS="$PKGS $1"
PKGS+=( "${1}" )
if [ -z "$YUM_ACTION" ]; then
YUM_ACTION=install
fi
;;
esac
shift
done
# Prevent implicit update of template - this would override user changes -
# but do allow explicit template upgrade, downgrade, reinstall
if [ "$YUM_ACTION" == "reinstall" ] || [ "$YUM_ACTION" == "upgrade" ] || [ "$YUM_ACTION" == "upgrade-to" ] \
|| [ "$YUM_ACTION" == "downgrade" ] && find_regex_in_args '^qubes-template-' "${PKGS[@]}"; then
TEMPLATE_EXCLUDE_OPTS=()
echo "WARNING: Replacing a template will erase all files in template's /home and /rw !"
# At least one package name matches the regex '^qubes-template-',
# so if there is only one package name in the array, then the
# code can safely assume that the array includes only a template
# package name.
if [[ ${#PKGS[@]} -eq 1 ]]; then
ONEPKG="$(echo "${PKGS[0]}" | sed -r 's/-[0-9]+(\.[0-9-]+)+(\.noarch)*$//')" # Remove version suffix
TEMPLATE=${ONEPKG#qubes-template-} # Remove prefix
if qvm-shutdown --wait $TEMPLATE ; then
echo "Template VM halted"
fi
# Try to avoid unrecoverable failures when operating on the template of
# the UpdateVM by making a backup first.
UPDATEVM_TEMPLATE=$(qvm-prefs -- "$UPDATEVM" template 2>/dev/null)
if [ X"$UPDATEVM_TEMPLATE" = X"$TEMPLATE" ]; then
TEMPLATE_BACKUP="${TEMPLATE}-backup-$(date +%Y%m%d)-$(mktemp -u XXXX)"
TEMPLATE_BACKUP=${TEMPLATE_BACKUP:0:31}
echo "Attempting to operate on template of UpdateVM... backing up $TEMPLATE to $TEMPLATE_BACKUP"
if ! qvm-clone -- "$TEMPLATE" "$TEMPLATE_BACKUP"; then
echo "ERROR: Unable to make backup of UpdateVM template!" >&2
exit 1
fi
fi
else
echo "ERROR: Specify only one package to reinstall template"
exit 1
fi
elif [ "$YUM_ACTION" == "search" ] || [ "$YUM_ACTION" == "info" ]; then # No need to shutdown for search/info
TEMPLATE_EXCLUDE_OPTS=()
else
TEMPLATE_EXCLUDE_OPTS=( "--exclude=$(rpm -qa --qf '%{NAME},' qubes-template-\*|head -c -1)" )
fi
YUM_OPTS=( "${TEMPLATE_EXCLUDE_OPTS[@]}" "${YUM_OPTS[@]}" )
ALL_OPTS=( "${TEMPLATE_EXCLUDE_OPTS[@]}" "${ALL_OPTS[@]}" )
ID=$(id -ur)
if [ $ID != 0 -a -z "$GUI" -a -z "$CHECK_ONLY" ] ; then
echo "This script should be run as root (when used in console mode), use sudo." >&2
exit 1
fi
if [ "$GUI" == "1" -a -n "$PKGS" ]; then
if [ "$GUI" == "1" -a ${#PKGS[@]} -ne 0 ]; then
echo "ERROR: GUI mode can be used only for updates" >&2
exit 1
fi
if [ "$GUI" == "1" ]; then
apps="yumex apper gpk-update-viewer"
apps="xterm konsole yumex apper gpk-update-viewer"
if [ -n "$KDE_FULL_SESSION" ]; then
apps="apper yumex gpk-update-viewer"
apps="konsole xterm apper yumex gpk-update-viewer"
fi
guiapp=
@ -76,7 +153,9 @@ if [ "$GUI" == "1" ]; then
if type $app &>/dev/null; then
guiapp=$app
case $guiapp in
apper) guiapp="apper --updates" ;;
apper) guiapp="apper --updates --nofork" ;;
xterm) guiapp="xterm -e sudo dnf update" ;;
konsole) guiapp="konsole --hold -e sudo dnf update" ;;
*) guiapp=$app ;;
esac
break;
@ -84,7 +163,7 @@ if [ "$GUI" == "1" ]; then
done
if [ -z "$guiapp" ]; then
message1="You don't have installed any supported yum frontend."
message1="You don't have any supported dnf frontend installed."
message2="Install (using qubes-dom0-update) one of: $apps"
if [ "$KDE_FULL_SESSION" ]; then
@ -101,28 +180,28 @@ if [ "$GUI" != "1" ]; then
QVMRUN_OPTS=--nogui
fi
# Do not start VM automaticaly when running from cron (only checking for updates)
if [ "$CHECK_ONLY" == "1" ] && ! xl domid $UPDATEVM > /dev/null 2>&1; then
# Do not start VM automatically when running from cron (only checking for updates)
if [ "$CHECK_ONLY" == "1" ] && ! qvm-check -q --running $UPDATEVM > /dev/null 2>&1; then
echo "ERROR: UpdateVM not running, not starting it in non-interactive mode" >&2
exit 1
fi
if [ -n "$CLEAN" ]; then
rm -f /var/lib/qubes/updates/rpm/*
rm -f /var/lib/qubes/updates/repodata/*
fi
# We should ensure the clocks in Dom0 and UpdateVM are in sync
# becuase otherwise yum might complain about future timestamps
qvm-sync-clock
rm -f /var/lib/qubes/updates/errors
echo "Using $UPDATEVM as UpdateVM to download updates for Dom0; this may take some time..." >&2
# Start VM if not running already
qvm-run $QVMRUN_OPTS -a $UPDATEVM true || exit 1
# qvm-run by default auto-starts the VM if not running
qvm-run --nogui -q -u root $UPDATEVM 'mkdir -m 775 -p /var/lib/qubes/dom0-updates/' || exit 1
qvm-run --nogui -q -u root $UPDATEVM 'chown user:user /var/lib/qubes/dom0-updates/' || exit 1
qvm-run --nogui -q $UPDATEVM 'rm -rf /var/lib/qubes/dom0-updates/etc' || exit 1
tar c /var/lib/rpm /etc/yum.repos.d /etc/yum.conf /etc/dnf/dnf.conf 2>/dev/null | \
qvm-run --nogui -q --pass-io "$UPDATEVM" 'LC_MESSAGES=C tar x -C /var/lib/qubes/dom0-updates 2>&1 | grep -v -E "s in the future"'
tar c /var/lib/rpm /etc/yum.repos.d /etc/yum.conf 2>/dev/null | qvm-run -p "$UPDATEVM" 'tar x -C /var/lib/qubes/dom0-updates'
qvm-run $QVMRUN_OPTS --pass-io $UPDATEVM "/usr/lib/qubes/qubes-download-dom0-updates.sh --doit --nogui $ALL_OPTS"
qvm-run $QVMRUN_OPTS --pass-io $UPDATEVM "script --quiet --return --command '/usr/lib/qubes/qubes-download-dom0-updates.sh --doit --nogui $(escape_args "${ALL_OPTS[@]}")' /dev/null" < /dev/null
RETCODE=$?
if [ "$CHECK_ONLY" == "1" ]; then
exit $RETCODE
@ -135,23 +214,51 @@ while pidof -x qubes-receive-updates >/dev/null; do sleep 0.5; done
if [ -r /var/lib/qubes/updates/errors ]; then
echo "*** ERROR while receiving updates:" >&2
cat /var/lib/qubes/updates/errors >&2
echo "--> if you want to use packages that were downloaded correctly, use yum directly now" >&2
echo "--> if you want to use packages that were downloaded correctly, use dnf directly now" >&2
exit 1
fi
if [ "x$PKGS" != "x" ]; then
yum $YUM_OPTS install $PKGS
if [ -z "$YUM_ACTION" ]; then
YUM_ACTION=upgrade
fi
if [ ${#PKGS[@]} -gt 0 ]; then
if [ -n "$TEMPLATE" ]; then
TEMPLATE_NETVM=$(qvm-prefs --force-root $TEMPLATE netvm)
fi
dnf "${YUM_OPTS[@]}" $YUM_ACTION "${PKGS[@]}" ; RETCODE=$?
if [ -n "$TEMPLATE_BACKUP" -a "$RETCODE" -eq 0 ]; then
# Remove backup, if we made one. Better to do this only on success and
# potentially leave extra backups around than do it on an exit trap and
# clean up more reliably but potentially brick a system.
qvm-remove -f -- "$TEMPLATE_BACKUP"
fi
if [ -n "$TEMPLATE" -a -n "$TEMPLATE_NETVM" -a x"$TEMPLATE_NETVM" != xNone ]; then
if ! qvm-prefs --force-root -s $TEMPLATE netvm $TEMPLATE_NETVM; then
echo "ERROR: NetVM setting could not be restored!" >&2
exit 1
fi
fi
elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then
# Above file exists only when at least one package was downloaded
if [ "$GUI" == "1" ]; then
# refresh packagekit metadata, GUI utilities use it
pkcon refresh force
$guiapp
else
yum check-update
if [ $? -eq 100 ]; then
yum $YUM_OPTS update
dnf check-update
if [ $? -eq 100 ]; then # Run dnf with options
dnf "${YUM_OPTS[@]}" $YUM_ACTION
fi
fi
yum -q check-update && rm -f $UPDATES_STAT_FILE
dnf -q check-update && qvm-features dom0 updates-available ''
else
echo "No updates avaliable" >&2
qvm-features dom0 updates-available ''
echo "No updates available" >&2
if [ "$GUI" == "1" ]; then
zenity --info --title='Dom0 updates' --text='No updates available'
fi
fi

View File

@ -1,12 +1,6 @@
#!/bin/bash
# Get normal user name
LOCAL_USER=`users | sed -e 's/root *//' | cut -d' ' -f 1`
NOTIFY_ICON=/usr/share/qubes/icons/dom0-update-avail.svg
UPDATES_STAT_FILE=/var/lib/qubes/updates/dom0-updates-available
UPDATES_DISABLE_FLAG=/var/lib/qubes/updates/disable-updates
if [ -f "$UPDATES_DISABLE_FLAG" ]; then
if [ "$(qvm-features dom0 service.qubes-update-check || echo 1)" != 1 ]; then
exit 0
fi
@ -19,10 +13,4 @@ if [ "$RETCODE" -ne 100 ]; then
exit $RETCODE
fi
if [ -z "$LOCAL_USER" ]; then
echo "ERROR: no user logged in, cannot nofity about updates" >&2
exit 1
fi
# Touch stat file for qubes-manager
touch $UPDATES_STAT_FILE
qvm-features dom0 updates-available 1

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/python3
#
# The Qubes OS Project, http://www.qubes-os.org
#
@ -18,44 +18,49 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
import os
import os.path
import re
import sys
import subprocess
import shutil
import glob
import grp
from qubes.qubes import QubesVmCollection
import qubesadmin
updates_dir = "/var/lib/qubes/updates"
updates_rpm_dir = updates_dir + "/rpm"
updates_repodata_dir = updates_dir + "/repodata"
updates_error_file = updates_dir + "/errors"
updates_error_file_handle = None
comps_file = None
if os.path.exists('/usr/share/qubes/Qubes-comps.xml'):
comps_file = '/usr/share/qubes/Qubes-comps.xml'
package_regex = re.compile(r"^[A-Za-z0-9._+-]{1,128}.rpm$")
gpg_ok_regex = re.compile(r"pgp md5 OK$")
package_regex = re.compile(r"^[A-Za-z0-9._+-]{1,128}\.rpm$")
# example valid outputs:
# .....rpm: rsa sha1 (md5) pgp md5 OK
# .....rpm: (sha1) dsa sha1 md5 gpg OK
# .....rpm: digests signatures OK
# example INVALID outputs:
# .....rpm: sha1 md5 OK
# .....rpm: RSA sha1 ((MD5) PGP) md5 NOT OK (MISSING KEYS: (MD5) PGP#246110c1)
# .....rpm: digests OK
gpg_ok_regex = re.compile(r": [a-z0-9() ]* (pgp|gpg|signatures) [a-z0-9 ]*OK$")
def dom0updates_fatal(msg):
print(msg, file=sys.stderr)
with open(updates_error_file, "a") as updates_error_file_handle:
updates_error_file_handle.write(msg + "\n")
shutil.rmtree(updates_rpm_dir)
exit(1)
def dom0updates_fatal(pkg, msg):
global updates_error_file_handle
print >> sys.stderr, msg
if updates_error_file_handle is None:
updates_error_file_handle = open(updates_error_file, "a")
updates_error_file_handle.write(msg + "\n")
os.remove(pkg)
def handle_dom0updates(updatevm):
global updates_error_file_handle
source=os.getenv("QREXEC_REMOTE_DOMAIN")
source = os.getenv("QREXEC_REMOTE_DOMAIN")
if source != updatevm.name:
print >> sys.stderr, 'Domain ' + str(source) + ' not allowed to send dom0 updates'
print('Domain ' + str(source) + ' not allowed to send dom0 updates',
file=sys.stderr)
exit(1)
# Clean old packages
if os.path.exists(updates_rpm_dir):
@ -66,15 +71,18 @@ def handle_dom0updates(updatevm):
os.remove(updates_error_file)
os.environ['LC_ALL'] = 'C'
qubes_gid = grp.getgrnam('qubes').gr_gid
old_umask = os.umask(0o002)
os.mkdir(updates_rpm_dir)
os.chown(updates_rpm_dir, -1, qubes_gid)
os.chmod(updates_rpm_dir, 0775)
subprocess.check_call(["/usr/libexec/qubes/qfile-dom0-unpacker", str(os.getuid()), updates_rpm_dir])
# Verify received files
for untrusted_f in os.listdir(updates_rpm_dir):
if not package_regex.match(untrusted_f):
dom0updates_fatal(updates_rpm_dir + '/' + untrusted_f, 'Domain ' + source + ' sent unexpected file: ' + untrusted_f)
else:
os.chmod(updates_rpm_dir, 0o0775)
try:
subprocess.check_call(["/usr/libexec/qubes/qfile-dom0-unpacker",
str(os.getuid()), updates_rpm_dir])
# Verify received files
for untrusted_f in os.listdir(updates_rpm_dir):
if not package_regex.match(untrusted_f):
raise Exception(
'Domain ' + source + ' sent unexpected file')
f = untrusted_f
assert '/' not in f
assert '\0' not in f
@ -82,45 +90,42 @@ def handle_dom0updates(updatevm):
full_path = updates_rpm_dir + "/" + f
if os.path.islink(full_path) or not os.path.isfile(full_path):
dom0updates_fatal(full_path, 'Domain ' + source + ' sent not regular file')
p = subprocess.Popen (["/bin/rpm", "-K", full_path],
raise Exception(
'Domain ' + source + ' sent not regular file')
p = subprocess.Popen(["/bin/rpm", "-K", full_path],
stdout=subprocess.PIPE)
output = p.communicate()[0]
output = p.communicate()[0].decode('ascii')
if p.returncode != 0:
dom0updates_fatal(full_path, 'Error while verifing %s signature: %s' % (f, output))
raise Exception(
'Error while verifing %s signature: %s' % (f, output))
if not gpg_ok_regex.search(output.strip()):
dom0updates_fatal(full_path, 'Domain ' + source + ' sent not signed rpm: ' + f)
if updates_error_file_handle is not None:
updates_error_file_handle.close()
raise Exception(
'Domain ' + source + ' sent not signed rpm: ' + f)
except Exception as e:
dom0updates_fatal(str(e))
# After updates received - create repo metadata
createrepo_cmd = ["/usr/bin/createrepo"]
createrepo_cmd = ["/usr/bin/createrepo_c"]
if comps_file:
createrepo_cmd += ["-g", comps_file]
createrepo_cmd += ["-q", updates_dir]
old_umask = os.umask(002)
subprocess.check_call(createrepo_cmd)
os.chown(updates_repodata_dir, -1, qubes_gid)
os.chmod(updates_repodata_dir, 0775)
os.chmod(updates_repodata_dir, 0o0775)
# Clean old cache
subprocess.call(["sudo", "/usr/bin/yum", "-q", "clean", "all"], stdout=sys.stderr)
# This will fail because of "smart" detection of no-network, but it will invalidate the cache
try:
null = open('/dev/null','w')
subprocess.call(["/usr/bin/pkcon", "refresh"], stdout=null)
null.close()
except:
pass
subprocess.call(["sudo", "/usr/bin/yum", "-q", "clean", "all"],
stdout=sys.stderr)
os.umask(old_umask)
exit(0)
def main():
qvm_collection = QubesVmCollection()
qvm_collection.lock_db_for_reading()
qvm_collection.load()
qvm_collection.unlock_db()
def main():
app = qubesadmin.Qubes()
updatevm = qvm_collection.get_updatevm_vm()
updatevm = app.updatevm
if updatevm is None:
exit(1)
handle_dom0updates(updatevm)
main()
if __name__ == '__main__':
main()

View File

@ -1,4 +0,0 @@
# Apprently some of the drivers required when using a processor with AESNI for LUKS
# are missing in the initramfs, so lets include them manually here:
add_drivers+=" xts aesni-intel aes-x86_64 crc32c-intel ghash-clmulni-intel salsa20-x86_64 twofish-x86_64 "

View File

@ -0,0 +1,6 @@
# Omission of network and kernel-network-modules is needed
# to avoid letting the initramfs load kernel modules related
# to networking, even if PCI devices are seized by Xen's
# pciback kernel module.
omit_dracutmodules+=" network kernel-network-modules "

View File

@ -3,5 +3,9 @@
installkernel() {
# ehci-hcd split off
instmods ehci-pci ehci-platform || :
hostonly='' instmods ehci-pci ehci-platform || :
# xhci-hcd split off
hostonly='' instmods xhci-pci xhci-plat-hcd || :
# ohci-hcd split off
hostonly='' instmods ohci-pci || :
}

View File

@ -0,0 +1,16 @@
#!/usr/bin/bash
# Add roadrunner2/macbook12-spi-driver drivers to initramfs for supporting keyboard, touchpad, touchbar in the MacBooks.
# Pre-requisite: these drivers need to be included in the Linux kernel package.
check() {
grep -q ^MacBook /sys/devices/virtual/dmi/id/product_name || return 255
}
installkernel() {
hostonly='' instmods intel_lpss intel_lpss_pci spi_pxa2xx_platform spi_pxa2xx_pci applespi apple_ib_tb
}
install() {
echo "options apple_ib_tb fnmode=2" >> "${initdir}/etc/modprobe.d/macbook12-spi-driver.conf"
echo "options applespi fnremap=1" >> "${initdir}/etc/modprobe.d/macbook12-spi-driver.conf"
}

View File

@ -1,3 +1,7 @@
#!/bin/bash
modinfo -k $kernel pciback > /dev/null 2>&1 && instmods pciback
modinfo -k $kernel xen-pciback > /dev/null 2>&1 && instmods xen-pciback
for mod in pciback xen-pciback; do
if modinfo -k "${kernel}" "${mod}" >/dev/null 2>&1; then
instmods "${mod}"
fi
done

View File

@ -8,6 +8,11 @@ install() {
}
installkernel() {
modinfo -k $kernel pciback > /dev/null 2>&1 && hostonly='' instmods pciback
modinfo -k $kernel xen-pciback > /dev/null 2>&1 && hostonly='' instmods xen-pciback
local mod=
for mod in pciback xen-pciback; do
if modinfo -k "${kernel}" "${mod}" >/dev/null 2>&1; then
hostonly='' instmods "${mod}"
fi
done
}

View File

@ -3,14 +3,23 @@
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# Find all networking devices currenly installed...
HIDE_PCI=`lspci -mm -n | grep '^[^ ]* "02'|awk '{ ORS="";print "(" $1 ")";}'`
HIDE_PCI="`lspci -mm -n | grep '^[^ ]* "02'|awk '{print $1}'`"
# ... and optionally all USB controllers...
if getargbool 0 rd.qubes.hide_all_usb; then
HIDE_PCI=$HIDE_PCI`lspci -mm -n | grep '^[^ ]* "0c03'|awk '{ ORS="";print "(" $1 ")";}'`
HIDE_PCI="$HIDE_PCI `lspci -mm -n | grep '^[^ ]* "0c03'|awk '{print $1}'`"
fi
HIDE_PCI=$HIDE_PCI`getarg rd.qubes.hide_pci | tr ',' '\n'|awk '{ ORS="";print "(" $1 ")";}'`
HIDE_PCI="$HIDE_PCI `getarg rd.qubes.hide_pci | tr ',' ' '`"
modprobe xen-pciback 2>/dev/null || :
# ... and hide them so that Dom0 doesn't load drivers for them
modprobe pciback hide=$HIDE_PCI 2> /dev/null || modprobe xen-pciback hide=$HIDE_PCI
for dev in $HIDE_PCI; do
BDF=0000:$dev
if [ -e /sys/bus/pci/devices/$BDF/driver ]; then
echo -n $BDF > /sys/bus/pci/devices/$BDF/driver/unbind
fi
echo -n $BDF > /sys/bus/pci/drivers/pciback/new_slot
echo -n $BDF > /sys/bus/pci/drivers/pciback/bind
done

8
file-copy-vm/Makefile Normal file
View File

@ -0,0 +1,8 @@
CFLAGS=-g -O2 -Wall -Wextra -Werror -I. -fPIC -pie
all: qfile-dom0-agent
qfile-dom0-agent: qfile-dom0-agent.o
$(CC) -pie -g -o $@ $^ -lqubes-rpc-filecopy
clean:
rm -f qfile-dom0-agent *.o

View File

@ -0,0 +1,94 @@
#define _GNU_SOURCE
#include <dirent.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <signal.h>
#include <fcntl.h>
#include <malloc.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <libqubes-rpc-filecopy.h>
void display_error(const char *fmt, va_list args) {
char *dialog_cmd;
char buf[1024];
struct stat st_buf;
int ret;
(void) vsnprintf(buf, sizeof(buf), fmt, args);
ret = stat("/usr/bin/kdialog", &st_buf);
#define KDIALOG_CMD "kdialog --title 'File copy/move error' --sorry "
#define ZENITY_CMD "zenity --title 'File copy/move error' --warning --text "
if (asprintf(&dialog_cmd, "%s '%s: %s (error type: %s)'",
ret==0 ? KDIALOG_CMD : ZENITY_CMD,
program_invocation_short_name, buf, strerror(errno)) < 0) {
fprintf(stderr, "Failed to allocate memory for error message :(\n");
return;
}
#undef KDIALOG_CMD
#undef ZENITY_CMD
fprintf(stderr, "%s\n", buf);
system(dialog_cmd);
}
_Noreturn void gui_fatal(const char *fmt, ...) {
va_list args;
va_start(args, fmt);
display_error(fmt, args);
va_end(args);
exit(1);
}
char *get_abs_path(const char *cwd, const char *pathname)
{
char *ret;
if (pathname[0] == '/')
return strdup(pathname);
if (asprintf(&ret, "%s/%s", cwd, pathname) < 0)
return NULL;
else
return ret;
}
int main(int argc, char **argv)
{
int i;
char *entry;
char *cwd;
char *sep;
int ignore_symlinks = 0;
qfile_pack_init();
register_error_handler(display_error);
cwd = getcwd(NULL, 0);
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "--ignore-symlinks")==0) {
ignore_symlinks = 1;
continue;
}
entry = get_abs_path(cwd, argv[i]);
do {
sep = rindex(entry, '/');
if (!sep)
gui_fatal
("Internal error: nonabsolute filenames not allowed");
*sep = 0;
} while (sep[1] == 0);
if (entry[0] == 0) {
if (chdir("/") < 0) {
gui_fatal("Internal error: chdir(\"/\") failed?!");
}
} else if (chdir(entry))
gui_fatal("chdir to %s", entry);
do_fs_walk(sep + 1, ignore_symlinks);
free(entry);
}
notify_end_and_wait_for_result();
return 0;
}

26
file-copy-vm/qvm-copy Normal file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -e -o pipefail
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2015 Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
echo "${0##*/} is not supported in dom0; use ${0##*/}-to-vm instead."
exit 1

View File

@ -0,0 +1,43 @@
#!/bin/bash
set -e -o pipefail
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2015 Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
if [ $# -lt 2 ] ; then
echo usage: $0 'dest_vmname file [file]+'
exit 1
fi
VM="$1"
shift
TMPDIR=`mktemp -d`
trap 'rm -rf -- "$TMPDIR"' EXIT
RESPONSE=$TMPDIR/response
mkfifo -- "$RESPONSE"
# can't use $@ with --localcmd, and $* would fail on whitespace
/usr/lib/qubes/qfile-dom0-agent "$@" <"$RESPONSE" |
qvm-run --pass-io --service -- "$VM" "qubes.Filecopy" >"$RESPONSE"
if [ "${0##*/}" = "qvm-move-to-vm" ]; then
rm -rf -- "$@"
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

View File

@ -1,10 +0,0 @@
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This copyright and license notice covers the images in this directory.
************************************************************************
TITLE: Crystal Project Icons
AUTHOR: Everaldo Coelho
SITE: http://www.everaldo.com
CONTACT: everaldo@everaldo.com
Copyright (c) 2006-2007 Everaldo Coelho.

View File

@ -1 +0,0 @@
dom0-update-avail icon from gnome-packagekit project distributed under GPLv2

View File

@ -1 +0,0 @@
Color padlock images downloaded from www.openclipart.org

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

View File

@ -1,22 +0,0 @@
#!/bin/sh
sync_qubes_vms_wallclock()
{
# Sync all VMs based on dom0 clock
DATE=$(date)
echo
echo "Syncing VMs clock to: $DATE"
qvm-run --all -u root "date -s \"$DATE\""
# Then try to sync from the network
/usr/bin/qvm-sync-clock &
}
case "$1" in
thaw|resume) sync_qubes_vms_wallclock ;;
# Kill qvm-sync-clock (if running) to not desync time after resume
suspend|hibernate)
killall qvm-sync-clock 2> /dev/null
exit 0
;;
*) exit 0 ;;
esac

View File

@ -1,37 +0,0 @@
#!/bin/sh
get_running_netvms() {
# Actually get running VMs with PCI devices attached
RUNNING_VMS=`xl list | tail -n +3 | cut -f 1 -d " "`
RUNNING_NETVMS=""
for VM in $RUNNING_VMS; do
if [ -n "`xl pci-list $VM|tail -n +2`" ]; then
echo "$VM"
fi
done
}
suspend_net()
{
for VM in `get_running_netvms`; do
qvm-run -u root --pass-io $VM 'QUBESRPC qubes.SuspendPre dom0'
done
# Ignore exit status from netvm...
return 0
}
resume_net()
{
for VM in `get_running_netvms`; do
qvm-run -u root --pass-io $VM 'QUBESRPC qubes.SuspendPost dom0'
done
# Ignore exit status from netvm...
return 0
}
case "$1" in
resume) resume_net ;;
suspend) suspend_net ;;
*) exit 0 ;;
esac

View File

@ -1,25 +1,12 @@
#!/usr/bin/python
#!/bin/sh
from qubes.qubes import QubesVmCollection,QubesException
import sys
qc = QubesVmCollection()
qc.lock_db_for_reading()
qc.load()
qc.unlock_db()
if sys.argv[1] in ["suspend", "hibernate"]:
for vm in qc.values():
if vm.is_running():
try:
vm.suspend()
except Exception as e:
print >>sys.stderr, "Failed to suspend VM %s: %s" % (vm.name, e.message)
elif sys.argv[1] in ["resume", "thaw"]:
for vm in qc.values():
if vm.get_power_state() in ["Paused", "Suspended"]:
try:
vm.resume()
except Exception as e:
print >>sys.stderr, "Failed to resume VM %s: %s" % (vm.name, e.message)
case "$1" in
suspend|hibernate)
qubesd-query -e --fail -c /var/run/qubesd.internal.sock \
dom0 internal.SuspendPre dom0 | tr '\0' ' '
;;
resume|thaw)
qubesd-query -e --fail -c /var/run/qubesd.internal.sock \
dom0 internal.SuspendPost dom0 | tr '\0' ' '
;;
esac

View File

@ -7,12 +7,8 @@ StopWhenUnneeded=yes
Type=oneshot
RemainAfterExit=yes
StandardOutput=syslog
ExecStartPre=/usr/lib64/pm-utils/sleep.d/01qubes-sync-vms-clock suspend suspend
ExecStartPre=/usr/lib64/pm-utils/sleep.d/51qubes-suspend-netvm suspend suspend
ExecStart=/usr/lib64/pm-utils/sleep.d/52qubes-pause-vms suspend suspend
ExecStop=/usr/lib64/pm-utils/sleep.d/52qubes-pause-vms resume suspend
ExecStopPost=/usr/lib64/pm-utils/sleep.d/51qubes-suspend-netvm resume suspend
ExecStopPost=/usr/lib64/pm-utils/sleep.d/01qubes-sync-vms-clock resume suspend
[Install]
WantedBy=sleep.target

View File

@ -1,12 +0,0 @@
CC=gcc
CFLAGS+=-I. -g -Wall -Wextra -Werror -pie -fPIC
XENLIBS=-lvchan -lxenstore -lxenctrl
LIBS=$(XENLIBS) -lqrexec-utils
all: qrexec-daemon qrexec-client
qrexec-daemon: qrexec-daemon.o
$(CC) -pie -g -o qrexec-daemon qrexec-daemon.o $(LIBS)
qrexec-client: qrexec-client.o
$(CC) -pie -g -o qrexec-client qrexec-client.o $(LIBS) -lpthread
clean:
rm -f *.o *~ qrexec-daemon qrexec-client

View File

@ -1,64 +0,0 @@
Currently (after commit 2600134e3bb781fca25fe77e464f8b875741dc83),
qrexec_agent can request a service (specified by a "exec_index") to be
executed on a different VM or dom0. Access control is enforced in dom0 via
files in /etc/qubes_rpc/policy. File copy, Open in Dispvm, sync appmenus,
upload updates to dom0 - they all have been ported to the new API.
See the quick HOWTO section on how to add a new service. Note we have
qvm-open-in-vm utility practically for free.
CHANGES
Besides flexibility offered by /etc/qubes_rpc/policy, writing a client
is much simpler now. The workflow used to be (using "filecopy" service as
an example):
a) "filecopy_ui" process places job description in some spool directory,
signals qrexec_agent to signal qrexec_daemon
b) qrexec_daemon executes "qrexec_client -d domain filecopy_worker ...."
and "filecopy_worker" process needed to parse spool and retrieve job
description from there. Particularly, "filecopy_ui" had no connection to
remote.
Now, the flow is:
a) qrexec_client_vm process obtains 3 unix socket descriptors from
qrexec_agent, dup stdin/out/err to them; forms "existing_process_handle" from
them
b) qrexec_client_vm signals qrexec_agent to signal qrexec_daemon, with a
"exec_index" (so, type of service) as an argument
c) qrexec_daemon executed "qrexec_client -d domain -c existing_process_handle ...."
d) qrexec_client_vm execve filecopy_program.
Thus, there is only one service program, and it has direct access to remote via
stdin/stdout.
HOWTO
Let's add a new "test.Add" service, that will add two numbers. We need the
following files in the template fs:
==========================
/usr/bin/our_test_add_client:
#!/bin/sh
echo $1 $2
exec cat >&2
# more correct: exec cat >&$SAVED_FD_1, but do not scare the reader
==========================
/usr/bin/our_test_add_server:
#!/bin/sh
read arg1 arg2
echo $(($arg1+$arg2))
==========================
/etc/qubes_rpc/test.Add:
/usr/bin/our_test_add_server
Now, on the client side, we start the client via
/usr/lib/qubes/qrexec_client_vm target_vm test.Add /usr/bin/our_test_add_client 11 22
Because there is no policy yet, dom0 will ask you to create one (of cource you
can do it before the first run of our_test_add_client). So, in dom0, create (by now,
with a file editor) the /etc/qubes_rpc/policy/test.Add file with
anyvm anyvm ask
content. The format of the /etc/qubes_rpc/policy/* files is
srcvm destvm (allow|deny|ask)[,user=user_to_run_as][,target=VM_to_redirect_to]
You can specify srcvm and destvm by name, or by one of "anyvm", "dispvm", "dom0"
reserved keywords.
Then, when you confirm the operation, you will get the result in the client vm.

View File

@ -1,314 +0,0 @@
/*
* The Qubes OS Project, http://www.qubes-os.org
*
* Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
#include <pthread.h>
#include "qrexec.h"
#include "libqrexec-utils.h"
// whether qrexec-client should replace ESC with _ before printing the output
int replace_esc_stdout = 0;
int replace_esc_stderr = 0;
int connect_unix_socket(const char *domname)
{
int s, len;
struct sockaddr_un remote;
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
perror("socket");
return -1;
}
remote.sun_family = AF_UNIX;
snprintf(remote.sun_path, sizeof remote.sun_path,
QREXEC_DAEMON_SOCKET_DIR "/qrexec.%s", domname);
len = strlen(remote.sun_path) + sizeof(remote.sun_family);
if (connect(s, (struct sockaddr *) &remote, len) == -1) {
perror("connect");
exit(1);
}
return s;
}
void do_exec(const char *prog)
{
execl("/bin/bash", "bash", "-c", prog, NULL);
}
static int local_stdin_fd, local_stdout_fd;
void do_exit(int code)
{
int status;
// sever communication lines; wait for child, if any
// so that qrexec-daemon can count (recursively) spawned processes correctly
close(local_stdin_fd);
close(local_stdout_fd);
waitpid(-1, &status, 0);
exit(code);
}
void prepare_local_fds(const char *cmdline)
{
int pid;
if (!cmdline) {
local_stdin_fd = 1;
local_stdout_fd = 0;
return;
}
do_fork_exec(cmdline, &pid, &local_stdin_fd, &local_stdout_fd,
NULL);
}
void send_cmdline(int s, int type, const char *cmdline)
{
struct client_header hdr;
hdr.type = type;
hdr.len = strlen(cmdline) + 1;
if (!write_all(s, &hdr, sizeof(hdr))
|| !write_all(s, cmdline, hdr.len)) {
perror("write daemon");
do_exit(1);
}
}
void handle_input(int s)
{
char buf[MAX_DATA_CHUNK];
int ret;
ret = read(local_stdout_fd, buf, sizeof(buf));
if (ret < 0) {
perror("read");
do_exit(1);
}
if (ret == 0) {
close(local_stdout_fd);
local_stdout_fd = -1;
shutdown(s, SHUT_WR);
if (local_stdin_fd == -1) {
// if pipe in opposite direction already closed, no need to stay alive
do_exit(0);
}
}
if (!write_all(s, buf, ret)) {
if (errno == EPIPE) {
// daemon disconnected its end of socket, so no future data will be
// send there; there is no sense to read from child stdout
//
// since AF_UNIX socket is buffered it doesn't mean all data was
// received from the agent
close(local_stdout_fd);
local_stdout_fd = -1;
if (local_stdin_fd == -1) {
// since child does no longer accept data on its stdin, doesn't
// make sense to process the data from the daemon
//
// we don't know real exit VM process code (exiting here, before
// MSG_SERVER_TO_CLIENT_EXIT_CODE message)
do_exit(1);
}
} else
perror("write daemon");
}
}
void do_replace_esc(char *buf, int len) {
int i;
for (i = 0; i < len; i++)
if (buf[i] == '\033')
buf[i] = '_';
}
void handle_daemon_data(int s)
{
int status;
struct client_header hdr;
char buf[MAX_DATA_CHUNK], *bufptr=buf;
if (!read_all(s, &hdr, sizeof hdr)) {
perror("read daemon");
do_exit(1);
}
if (hdr.len > MAX_DATA_CHUNK) {
fprintf(stderr, "client_header.len=%d\n", hdr.len);
do_exit(1);
}
if (!read_all(s, buf, hdr.len)) {
perror("read daemon");
do_exit(1);
}
switch (hdr.type) {
case MSG_SERVER_TO_CLIENT_STDOUT:
if (replace_esc_stdout)
do_replace_esc(buf, hdr.len);
if (local_stdin_fd == -1)
break;
if (hdr.len == 0) {
close(local_stdin_fd);
local_stdin_fd = -1;
} else if (!write_all(local_stdin_fd, buf, hdr.len)) {
if (errno == EPIPE) {
// remote side have closed its stdin, handle data in oposite
// direction (if any) before exit
local_stdin_fd = -1;
} else {
perror("write local stdout");
do_exit(1);
}
}
break;
case MSG_SERVER_TO_CLIENT_STDERR:
if (replace_esc_stderr)
do_replace_esc(buf, hdr.len);
write_all(2, buf, hdr.len);
break;
case MSG_SERVER_TO_CLIENT_EXIT_CODE:
status = *(unsigned int *) bufptr;
if (WIFEXITED(status))
do_exit(WEXITSTATUS(status));
else
do_exit(255);
break;
default:
fprintf(stderr, "unknown msg %d\n", hdr.type);
do_exit(1);
}
}
// perhaps we could save a syscall if we include both sides in both
// rdset and wrset; to be investigated
void handle_daemon_only_until_writable(int s)
{
fd_set rdset, wrset;
do {
FD_ZERO(&rdset);
FD_ZERO(&wrset);
FD_SET(s, &rdset);
FD_SET(s, &wrset);
if (select(s + 1, &rdset, &wrset, NULL, NULL) < 0) {
perror("select");
do_exit(1);
}
if (FD_ISSET(s, &rdset))
handle_daemon_data(s);
} while (!FD_ISSET(s, &wrset));
}
void *input_process_loop(void *arg) {
int s = *(int*)arg;
while (local_stdout_fd != -1)
handle_input(s);
return NULL;
}
void select_loop(int s)
{
pthread_t input_thread;
if (pthread_create(&input_thread, NULL, input_process_loop, &s) != 0) {
perror("pthread_create");
do_exit(1);
}
for (;;) {
handle_daemon_data(s);
}
pthread_join(input_thread, NULL);
}
void usage(const char *name)
{
fprintf(stderr,
"usage: %s -d domain_num [-l local_prog] -e -t -T -c remote_cmdline\n"
"-e means exit after sending cmd, -c: connect to existing process\n"
"-t enables replacing ESC character with '_' in command output, -T is the same for stderr\n",
name);
exit(1);
}
int main(int argc, char **argv)
{
int opt;
char *domname = NULL;
int s;
int just_exec = 0;
int connect_existing = 0;
char *local_cmdline = NULL;
while ((opt = getopt(argc, argv, "d:l:ectT")) != -1) {
switch (opt) {
case 'd':
domname = strdup(optarg);
break;
case 'l':
local_cmdline = strdup(optarg);
break;
case 'e':
just_exec = 1;
break;
case 'c':
connect_existing = 1;
break;
case 't':
replace_esc_stdout = 1;
break;
case 'T':
replace_esc_stderr = 1;
break;
default:
usage(argv[0]);
}
}
if (optind >= argc || !domname)
usage(argv[0]);
register_exec_func(&do_exec);
s = connect_unix_socket(domname);
setenv("QREXEC_REMOTE_DOMAIN", domname, 1);
prepare_local_fds(local_cmdline);
if (just_exec)
send_cmdline(s, MSG_CLIENT_TO_SERVER_JUST_EXEC,
argv[optind]);
else {
int cmd;
if (connect_existing)
cmd = MSG_CLIENT_TO_SERVER_CONNECT_EXISTING;
else
cmd = MSG_CLIENT_TO_SERVER_EXEC_CMDLINE;
send_cmdline(s, cmd, argv[optind]);
select_loop(s);
}
return 0;
}

View File

@ -1,717 +0,0 @@
/*
* The Qubes OS Project, http://www.qubes-os.org
*
* Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include <sys/select.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <string.h>
#include "qrexec.h"
#include "libqrexec-utils.h"
enum client_flags {
CLIENT_INVALID = 0, // table slot not used
CLIENT_CMDLINE = 1, // waiting for cmdline from client
CLIENT_DATA = 2, // waiting for data from client
CLIENT_DONT_READ = 4, // don't read from the client, the other side pipe is full, or EOF (additionally marked with CLIENT_EOF)
CLIENT_OUTQ_FULL = 8, // don't write to client, its stdin pipe is full
CLIENT_EOF = 16, // got EOF
CLIENT_EXITED = 32 // only send remaining data from client and remove from list
};
struct _client {
int state; // combination of above enum client_flags
struct buffer buffer; // buffered data to client, if any
};
/*
The "clients" array is indexed by client's fd.
Thus its size must be equal MAX_FDS; defining MAX_CLIENTS for clarity.
*/
#define MAX_CLIENTS MAX_FDS
struct _client clients[MAX_CLIENTS]; // data on all qrexec_client connections
int max_client_fd = -1; // current max fd of all clients; so that we need not to scan all the "clients" table
int qrexec_daemon_unix_socket_fd; // /var/run/qubes/qrexec.xid descriptor
const char *default_user = "user";
const char default_user_keyword[] = "DEFAULT:";
#define default_user_keyword_len_without_colon (sizeof(default_user_keyword)-2)
int opt_quiet = 0;
#ifdef __GNUC__
# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
#else
# define UNUSED(x) UNUSED_ ## x
#endif
/*
we need to track the number of children, so that excessive QREXEC_EXECUTE_*
commands do not fork-bomb dom0
*/
volatile int children_count;
void sigusr1_handler(int UNUSED(x))
{
if (!opt_quiet)
fprintf(stderr, "connected\n");
exit(0);
}
void sigchld_parent_handler(int UNUSED(x))
{
children_count--;
/* starting value is 0 so we see dead real qrexec-daemon as -1 */
if (children_count < 0) {
if (!opt_quiet)
fprintf(stderr, "failed\n");
else
fprintf(stderr, "Connection to the VM failed\n");
exit(1);
}
}
void sigchld_handler(int x);
const char *remote_domain_name; // guess what
int remote_domain_xid; // guess what
void unlink_qrexec_socket()
{
char socket_address[40];
char link_to_socket_name[strlen(remote_domain_name) + sizeof(socket_address)];
snprintf(socket_address, sizeof(socket_address),
QREXEC_DAEMON_SOCKET_DIR "/qrexec.%d", remote_domain_xid);
snprintf(link_to_socket_name, sizeof link_to_socket_name,
QREXEC_DAEMON_SOCKET_DIR "/qrexec.%s", remote_domain_name);
unlink(socket_address);
unlink(link_to_socket_name);
}
int create_qrexec_socket(int domid, const char *domname)
{
char socket_address[40];
char link_to_socket_name[strlen(domname) + sizeof(socket_address)];
snprintf(socket_address, sizeof(socket_address),
QREXEC_DAEMON_SOCKET_DIR "/qrexec.%d", domid);
snprintf(link_to_socket_name, sizeof link_to_socket_name,
QREXEC_DAEMON_SOCKET_DIR "/qrexec.%s", domname);
unlink(link_to_socket_name);
if (symlink(socket_address, link_to_socket_name)) {
fprintf(stderr, "symlink(%s,%s) failed: %s\n", socket_address,
link_to_socket_name, strerror (errno));
}
atexit(unlink_qrexec_socket);
return get_server_socket(socket_address);
}
#define MAX_STARTUP_TIME_DEFAULT 60
/* do the preparatory tasks, needed before entering the main event loop */
void init(int xid)
{
char qrexec_error_log_name[256];
int logfd;
int i;
pid_t pid;
int startup_timeout = MAX_STARTUP_TIME_DEFAULT;
const char *startup_timeout_str = NULL;
if (xid <= 0) {
fprintf(stderr, "domain id=0?\n");
exit(1);
}
startup_timeout_str = getenv("QREXEC_STARTUP_TIMEOUT");
if (startup_timeout_str) {
startup_timeout = atoi(startup_timeout_str);
if (startup_timeout <= 0)
// invalid or negative number
startup_timeout = MAX_STARTUP_TIME_DEFAULT;
}
signal(SIGUSR1, sigusr1_handler);
signal(SIGCHLD, sigchld_parent_handler);
switch (pid=fork()) {
case -1:
perror("fork");
exit(1);
case 0:
break;
default:
if (getenv("QREXEC_STARTUP_NOWAIT"))
exit(0);
if (!opt_quiet)
fprintf(stderr, "Waiting for VM's qrexec agent.");
for (i=0;i<startup_timeout;i++) {
sleep(1);
if (!opt_quiet)
fprintf(stderr, ".");
if (i==startup_timeout-1) {
break;
}
}
fprintf(stderr, "Cannot connect to qrexec agent for %d seconds, still trying in the background\n", startup_timeout);
exit(1);
}
close(0);
snprintf(qrexec_error_log_name, sizeof(qrexec_error_log_name),
"/var/log/qubes/qrexec.%s.log", remote_domain_name);
umask(0007); // make the log readable by the "qubes" group
logfd =
open(qrexec_error_log_name, O_WRONLY | O_CREAT | O_TRUNC,
0640);
if (logfd < 0) {
perror("open");
exit(1);
}
dup2(logfd, 1);
dup2(logfd, 2);
chdir("/var/run/qubes");
if (setsid() < 0) {
perror("setsid()");
exit(1);
}
peer_client_init(xid, REXEC_PORT);
if (setgid(getgid()) < 0) {
perror("setgid()");
exit(1);
}
if (setuid(getuid()) < 0) {
perror("setuid()");
exit(1);
}
/* When running as root, make the socket accessible; perms on /var/run/qubes still apply */
umask(0);
qrexec_daemon_unix_socket_fd =
create_qrexec_socket(xid, remote_domain_name);
umask(0077);
signal(SIGPIPE, SIG_IGN);
signal(SIGCHLD, sigchld_handler);
signal(SIGUSR1, SIG_DFL);
kill(getppid(), SIGUSR1); // let the parent know we are ready
}
void handle_new_client(void)
{
int fd = do_accept(qrexec_daemon_unix_socket_fd);
if (fd >= MAX_CLIENTS) {
fprintf(stderr, "too many clients ?\n");
exit(1);
}
clients[fd].state = CLIENT_CMDLINE;
buffer_init(&clients[fd].buffer);
if (fd > max_client_fd)
max_client_fd = fd;
}
void terminate_client_and_flush_data(int fd)
{
int i;
struct server_header s_hdr;
if (!(clients[fd].state & CLIENT_EXITED) && fork_and_flush_stdin(fd, &clients[fd].buffer))
children_count++;
close(fd);
clients[fd].state = CLIENT_INVALID;
buffer_free(&clients[fd].buffer);
if (max_client_fd == fd) {
for (i = fd; i >= 0 && clients[i].state == CLIENT_INVALID;
i--);
max_client_fd = i;
}
s_hdr.type = MSG_SERVER_TO_AGENT_CLIENT_END;
s_hdr.client_id = fd;
s_hdr.len = 0;
write_all_vchan_ext(&s_hdr, sizeof(s_hdr));
}
int get_cmdline_body_from_client_and_pass_to_agent(int fd, struct server_header
*s_hdr)
{
int len = s_hdr->len;
char buf[len];
int use_default_user = 0;
if (!read_all(fd, buf, len)) {
terminate_client_and_flush_data(fd);
return 0;
}
if (!strncmp(buf, default_user_keyword, default_user_keyword_len_without_colon+1)) {
use_default_user = 1;
s_hdr->len -= default_user_keyword_len_without_colon; // -1 because of colon
s_hdr->len += strlen(default_user);
}
write_all_vchan_ext(s_hdr, sizeof(*s_hdr));
if (use_default_user) {
write_all_vchan_ext(default_user, strlen(default_user));
write_all_vchan_ext(buf+default_user_keyword_len_without_colon, len-default_user_keyword_len_without_colon);
} else
write_all_vchan_ext(buf, len);
return 1;
}
void handle_cmdline_message_from_client(int fd)
{
struct client_header hdr;
struct server_header s_hdr;
if (!read_all(fd, &hdr, sizeof hdr)) {
terminate_client_and_flush_data(fd);
return;
}
switch (hdr.type) {
case MSG_CLIENT_TO_SERVER_EXEC_CMDLINE:
s_hdr.type = MSG_SERVER_TO_AGENT_EXEC_CMDLINE;
break;
case MSG_CLIENT_TO_SERVER_JUST_EXEC:
s_hdr.type = MSG_SERVER_TO_AGENT_JUST_EXEC;
break;
case MSG_CLIENT_TO_SERVER_CONNECT_EXISTING:
s_hdr.type = MSG_SERVER_TO_AGENT_CONNECT_EXISTING;
break;
default:
terminate_client_and_flush_data(fd);
return;
}
s_hdr.client_id = fd;
s_hdr.len = hdr.len;
if (!get_cmdline_body_from_client_and_pass_to_agent(fd, &s_hdr))
// client disconnected while sending cmdline, above call already
// cleaned up client info
return;
clients[fd].state = CLIENT_DATA;
set_nonblock(fd); // so that we can detect full queue without blocking
if (hdr.type == MSG_CLIENT_TO_SERVER_JUST_EXEC)
terminate_client_and_flush_data(fd);
}
/* handle data received from one of qrexec_client processes */
void handle_message_from_client(int fd)
{
struct server_header s_hdr;
char buf[MAX_DATA_CHUNK];
unsigned int len;
int ret;
if (clients[fd].state == CLIENT_CMDLINE) {
handle_cmdline_message_from_client(fd);
return;
}
// We have already passed cmdline from client.
// Now the client passes us raw data from its stdin.
len = buffer_space_vchan_ext();
if (len <= sizeof s_hdr)
return;
/* Read at most the amount of data that we have room for in vchan */
ret = read(fd, buf, len - sizeof(s_hdr));
if (ret < 0) {
perror("read client");
terminate_client_and_flush_data(fd);
return;
}
s_hdr.client_id = fd;
s_hdr.len = ret;
s_hdr.type = MSG_SERVER_TO_AGENT_INPUT;
write_all_vchan_ext(&s_hdr, sizeof(s_hdr));
write_all_vchan_ext(buf, ret);
if (ret == 0) // EOF - so don't select() on this client
clients[fd].state |= CLIENT_DONT_READ | CLIENT_EOF;
if (clients[fd].state & CLIENT_EXITED)
//client already exited and all data sent - cleanup now
terminate_client_and_flush_data(fd);
}
/*
Called when there is buffered data for this client, and select() reports
that client's pipe is writable; so we should be able to flush some
buffered data.
*/
void write_buffered_data_to_client(int client_id)
{
switch (flush_client_data
(client_id, client_id, &clients[client_id].buffer)) {
case WRITE_STDIN_OK: // no more buffered data
clients[client_id].state &= ~CLIENT_OUTQ_FULL;
break;
case WRITE_STDIN_ERROR:
// do not write to this fd anymore
clients[client_id].state |= CLIENT_EXITED;
if (clients[client_id].state & CLIENT_EOF)
terminate_client_and_flush_data(client_id);
else
// client will be removed when read returns 0 (EOF)
// clear CLIENT_OUTQ_FULL flag to no select on this fd anymore
clients[client_id].state &= ~CLIENT_OUTQ_FULL;
break;
case WRITE_STDIN_BUFFERED: // no room for all data, don't clear CLIENT_OUTQ_FULL flag
break;
default:
fprintf(stderr, "unknown flush_client_data?\n");
exit(1);
}
}
/*
The header (hdr argument) is already built. Just read the raw data from
the packet, and pass it along with the header to the client.
*/
void get_packet_data_from_agent_and_pass_to_client(int client_id, struct client_header
*hdr)
{
int len = hdr->len;
char buf[sizeof(*hdr) + len];
/* make both the header and data be consecutive in the buffer */
memcpy(buf, hdr, sizeof(*hdr));
read_all_vchan_ext(buf + sizeof(*hdr), len);
if (clients[client_id].state & CLIENT_EXITED)
// ignore data for no longer running client
return;
switch (write_stdin
(client_id, client_id, buf, len + sizeof(*hdr),
&clients[client_id].buffer)) {
case WRITE_STDIN_OK:
break;
case WRITE_STDIN_BUFFERED: // some data have been buffered
clients[client_id].state |= CLIENT_OUTQ_FULL;
break;
case WRITE_STDIN_ERROR:
// do not write to this fd anymore
clients[client_id].state |= CLIENT_EXITED;
// if already got EOF, remove client
if (clients[client_id].state & CLIENT_EOF)
terminate_client_and_flush_data(client_id);
break;
default:
fprintf(stderr, "unknown write_stdin?\n");
exit(1);
}
}
/*
The signal handler executes asynchronously; therefore all it should do is
to set a flag "signal has arrived", and let the main even loop react to this
flag in appropriate moment.
*/
int child_exited;
void sigchld_handler(int UNUSED(x))
{
child_exited = 1;
signal(SIGCHLD, sigchld_handler);
}
/* clean zombies, update children_count */
void reap_children(void)
{
int status;
while (waitpid(-1, &status, WNOHANG) > 0)
children_count--;
child_exited = 0;
}
/* too many children - wait for one of them to terminate */
void wait_for_child(void)
{
int status;
waitpid(-1, &status, 0);
children_count--;
}
#define MAX_CHILDREN 10
void check_children_count_and_wait_if_too_many(void)
{
if (children_count > MAX_CHILDREN) {
fprintf(stderr,
"max number of children reached, waiting for child exit...\n");
wait_for_child();
fprintf(stderr, "now children_count=%d, continuing.\n",
children_count);
}
}
void sanitize_name(char * untrusted_s_signed)
{
unsigned char * untrusted_s;
for (untrusted_s=(unsigned char*)untrusted_s_signed; *untrusted_s; untrusted_s++) {
if (*untrusted_s >= 'a' && *untrusted_s <= 'z')
continue;
if (*untrusted_s >= 'A' && *untrusted_s <= 'Z')
continue;
if (*untrusted_s >= '0' && *untrusted_s <= '9')
continue;
if (*untrusted_s == '$' || *untrusted_s == '_' || *untrusted_s == '-' || *untrusted_s == '.' || *untrusted_s == ' ')
continue;
*untrusted_s = '_';
}
}
#define ENSURE_NULL_TERMINATED(x) x[sizeof(x)-1] = 0
/*
Called when agent sends a message asking to execute a predefined command.
*/
void handle_execute_predefined_command(void)
{
int i;
struct trigger_connect_params untrusted_params, params;
check_children_count_and_wait_if_too_many();
read_all_vchan_ext(&untrusted_params, sizeof(params));
/* sanitize start */
ENSURE_NULL_TERMINATED(untrusted_params.exec_index);
ENSURE_NULL_TERMINATED(untrusted_params.target_vmname);
ENSURE_NULL_TERMINATED(untrusted_params.process_fds.ident);
sanitize_name(untrusted_params.exec_index);
sanitize_name(untrusted_params.target_vmname);
sanitize_name(untrusted_params.process_fds.ident);
params = untrusted_params;
/* sanitize end */
switch (fork()) {
case -1:
perror("fork");
exit(1);
case 0:
break;
default:
children_count++;
return;
}
for (i = 3; i < MAX_FDS; i++)
close(i);
signal(SIGCHLD, SIG_DFL);
signal(SIGPIPE, SIG_DFL);
execl("/usr/lib/qubes/qrexec-policy", "qrexec-policy",
remote_domain_name, params.target_vmname,
params.exec_index, params.process_fds.ident, NULL);
perror("execl");
_exit(1);
}
void check_client_id_in_range(unsigned int untrusted_client_id)
{
if (untrusted_client_id >= MAX_CLIENTS) {
fprintf(stderr, "from agent: client_id=%d\n",
untrusted_client_id);
exit(1);
}
}
void sanitize_message_from_agent(struct server_header *untrusted_header)
{
switch (untrusted_header->type) {
case MSG_AGENT_TO_SERVER_TRIGGER_CONNECT_EXISTING:
break;
case MSG_AGENT_TO_SERVER_STDOUT:
case MSG_AGENT_TO_SERVER_STDERR:
case MSG_AGENT_TO_SERVER_EXIT_CODE:
check_client_id_in_range(untrusted_header->client_id);
if (untrusted_header->len > MAX_DATA_CHUNK) {
fprintf(stderr, "agent feeded %d of data bytes?\n",
untrusted_header->len);
exit(1);
}
break;
case MSG_XOFF:
case MSG_XON:
check_client_id_in_range(untrusted_header->client_id);
break;
default:
fprintf(stderr, "unknown mesage type %d from agent\n",
untrusted_header->type);
exit(1);
}
}
void handle_message_from_agent(void)
{
struct client_header hdr;
struct server_header s_hdr, untrusted_s_hdr;
read_all_vchan_ext(&untrusted_s_hdr, sizeof untrusted_s_hdr);
/* sanitize start */
sanitize_message_from_agent(&untrusted_s_hdr);
s_hdr = untrusted_s_hdr;
/* sanitize end */
// fprintf(stderr, "got %x %x %x\n", s_hdr.type, s_hdr.client_id,
// s_hdr.len);
if (s_hdr.type == MSG_AGENT_TO_SERVER_TRIGGER_CONNECT_EXISTING) {
handle_execute_predefined_command();
return;
}
if (s_hdr.type == MSG_XOFF) {
clients[s_hdr.client_id].state |= CLIENT_DONT_READ;
return;
}
if (s_hdr.type == MSG_XON) {
clients[s_hdr.client_id].state &= ~CLIENT_DONT_READ;
return;
}
switch (s_hdr.type) {
case MSG_AGENT_TO_SERVER_STDOUT:
hdr.type = MSG_SERVER_TO_CLIENT_STDOUT;
break;
case MSG_AGENT_TO_SERVER_STDERR:
hdr.type = MSG_SERVER_TO_CLIENT_STDERR;
break;
case MSG_AGENT_TO_SERVER_EXIT_CODE:
hdr.type = MSG_SERVER_TO_CLIENT_EXIT_CODE;
break;
default: /* cannot happen, already sanitized */
fprintf(stderr, "from agent: type=%d\n", s_hdr.type);
exit(1);
}
hdr.len = s_hdr.len;
if (clients[s_hdr.client_id].state == CLIENT_INVALID) {
// benefit of doubt - maybe client exited earlier
// just eat the packet data and continue
char buf[MAX_DATA_CHUNK];
read_all_vchan_ext(buf, s_hdr.len);
return;
}
get_packet_data_from_agent_and_pass_to_client(s_hdr.client_id,
&hdr);
if (s_hdr.type == MSG_AGENT_TO_SERVER_EXIT_CODE)
terminate_client_and_flush_data(s_hdr.client_id);
}
/*
Scan the "clients" table, add ones we want to read from (because the other
end has not send MSG_XOFF on them) to read_fdset, add ones we want to write
to (because its pipe is full) to write_fdset. Return the highest used file
descriptor number, needed for the first select() parameter.
*/
int fill_fdsets_for_select(fd_set * read_fdset, fd_set * write_fdset)
{
int i;
int max = -1;
FD_ZERO(read_fdset);
FD_ZERO(write_fdset);
for (i = 0; i <= max_client_fd; i++) {
if (clients[i].state != CLIENT_INVALID
&& !(clients[i].state & CLIENT_DONT_READ)) {
FD_SET(i, read_fdset);
max = i;
}
if (clients[i].state != CLIENT_INVALID
&& clients[i].state & CLIENT_OUTQ_FULL) {
FD_SET(i, write_fdset);
max = i;
}
}
FD_SET(qrexec_daemon_unix_socket_fd, read_fdset);
if (qrexec_daemon_unix_socket_fd > max)
max = qrexec_daemon_unix_socket_fd;
return max;
}
int main(int argc, char **argv)
{
fd_set read_fdset, write_fdset;
int i, opt;
int max;
sigset_t chld_set;
while ((opt=getopt(argc, argv, "q")) != -1) {
switch (opt) {
case 'q':
opt_quiet = 1;
break;
default: /* '?' */
fprintf(stderr, "usage: %s [-q] domainid domain-name [default user]\n", argv[0]);
exit(1);
}
}
if (argc - optind < 2 || argc - optind > 3) {
fprintf(stderr, "usage: %s [-q] domainid domain-name [default user]\n", argv[0]);
exit(1);
}
remote_domain_name = argv[optind+1];
if (argc - optind >= 3)
default_user = argv[optind+2];
remote_domain_xid = atoi(argv[optind]);
init(remote_domain_xid);
sigemptyset(&chld_set);
sigaddset(&chld_set, SIGCHLD);
/*
The main event loop. Waits for one of the following events:
- message from client
- message from agent
- new client
- child exited
*/
for (;;) {
max = fill_fdsets_for_select(&read_fdset, &write_fdset);
if (buffer_space_vchan_ext() <=
sizeof(struct server_header))
FD_ZERO(&read_fdset); // vchan full - don't read from clients
sigprocmask(SIG_BLOCK, &chld_set, NULL);
if (child_exited)
reap_children();
wait_for_vchan_or_argfd(max, &read_fdset, &write_fdset);
sigprocmask(SIG_UNBLOCK, &chld_set, NULL);
if (FD_ISSET(qrexec_daemon_unix_socket_fd, &read_fdset))
handle_new_client();
while (read_ready_vchan_ext())
handle_message_from_agent();
for (i = 0; i <= max_client_fd; i++)
if (clients[i].state != CLIENT_INVALID
&& FD_ISSET(i, &read_fdset))
handle_message_from_client(i);
for (i = 0; i <= max_client_fd; i++)
if (clients[i].state != CLIENT_INVALID
&& FD_ISSET(i, &write_fdset))
write_buffered_data_to_client(i);
}
}

View File

@ -1,217 +0,0 @@
#!/usr/bin/python
import sys
import os
import os.path
import subprocess
import xen.lowlevel.xl
import qubes.guihelpers
from optparse import OptionParser
import fcntl
POLICY_FILE_DIR="/etc/qubes-rpc/policy"
# XXX: Backward compatibility, to be removed soon
DEPRECATED_POLICY_FILE_DIR="/etc/qubes_rpc/policy"
QREXEC_CLIENT="/usr/lib/qubes/qrexec-client"
class UserChoice:
ALLOW=0
DENY=1
ALWAYS_ALLOW=2
def line_to_dict(line):
tokens=line.split()
if len(tokens) < 3:
return None
if tokens[0][0] == '#':
return None
dict={}
dict['source']=tokens[0]
dict['dest']=tokens[1]
dict['full-action']=tokens[2]
action_list=tokens[2].split(',')
dict['action']=action_list.pop(0)
for iter in action_list:
paramval=iter.split("=")
dict["action."+paramval[0]]=paramval[1]
# Warn if we're ignoring extra data after a space, such as:
# vm1 vm2 allow, user=foo
if len(tokens) > 3:
print >>sys.stderr, "Trailing data ignored in %s" % line
return dict
def read_policy_file(exec_index):
policy_file=POLICY_FILE_DIR+"/"+exec_index
if not os.path.isfile(policy_file):
policy_file=DEPRECATED_POLICY_FILE_DIR+"/"+exec_index
if not os.path.isfile(policy_file):
return None
print >>sys.stderr, "RPC service '%s' uses deprecated policy location, please move to %s" % (exec_index, POLICY_FILE_DIR)
policy_list=list()
f = open(policy_file)
fcntl.flock(f, fcntl.LOCK_SH)
for iter in f.readlines():
dict = line_to_dict(iter)
if dict is not None:
policy_list.append(dict)
f.close()
return policy_list
def is_match(item, config_term):
return (item is not "dom0" and config_term == "$anyvm") or item == config_term
def get_default_policy():
dict={}
dict["action"]="deny"
return dict
def find_policy(policy, domain, target):
for iter in policy:
if not is_match(domain, iter["source"]):
continue
if not is_match(target, iter["dest"]):
continue
return iter
return get_default_policy()
def is_domain_running(target):
xl_ctx = xen.lowlevel.xl.ctx()
domains = xl_ctx.list_domains()
for dominfo in domains:
domname = xl_ctx.domid_to_name(dominfo.domid)
if domname == target:
return True
return False
def validate_target(target):
# special targets
if target in ['$dispvm', 'dom0']:
return True
from qubes.qubes import QubesVmCollection
qc = QubesVmCollection()
qc.lock_db_for_reading()
qc.load()
qc.unlock_db()
return qc.get_vm_by_name(target) is not None
def spawn_target_if_necessary(target):
if is_domain_running(target):
return
null=open("/dev/null", "r+")
subprocess.call(["qvm-run", "-a", "-q", target, "true"], stdin=null, stdout=null)
null.close()
def do_execute(domain, target, user, exec_index, process_ident):
if target == "dom0":
cmd="/usr/lib/qubes/qubes-rpc-multiplexer "+exec_index + " " + domain
elif target == "$dispvm":
cmd = "/usr/lib/qubes/qfile-daemon-dvm " + exec_index + " " + domain + " " +user
else:
# see the previous commit why "qvm-run -a" is broken and dangerous
# also, dangling "xl" would keep stderr open and may prevent closing connection
spawn_target_if_necessary(target)
cmd= QREXEC_CLIENT + " -d " + target + " '" + user
cmd+=":QUBESRPC "+ exec_index + " " + domain + "'"
# stderr should be logged in source/target VM
null = open(os.devnull, 'w')
os.dup2(null.fileno(), 2)
os.execl(QREXEC_CLIENT, "qrexec-client", "-d", domain, "-l", cmd, "-c", process_ident)
def confirm_execution(domain, target, exec_index):
text = "Do you allow domain \"" +domain + "\" to execute " + exec_index
text+= " operation on the domain \"" + target +"\"?<br>"
text+= " \"Yes to All\" option will automatically allow this operation in the future."
return qubes.guihelpers.ask(text, yestoall=True)
def add_always_allow(domain, target, exec_index, options):
policy_file=POLICY_FILE_DIR+"/"+exec_index
if not os.path.isfile(policy_file):
return None
f = open(policy_file, 'r+')
fcntl.flock(f, fcntl.LOCK_EX)
lines = []
for l in f.readlines():
lines.append(l)
lines.insert(0, "%s\t%s\tallow%s\n" % (domain, target, options))
f.seek(0)
f.write("".join(lines))
f.close()
def policy_editor(domain, target, exec_index):
text = "No policy definition found for " + exec_index + " action. "
text+= "Please create a policy file in Dom0 in " + POLICY_FILE_DIR + "/" + exec_index
subprocess.call(["/usr/bin/zenity", "--info", "--text", text])
def main():
usage = "usage: %prog [options] <src-domain> <target-domain> <service> <process-ident>"
parser = OptionParser (usage)
parser.add_option ("--assume-yes-for-ask", action="store_true", dest="assume_yes_for_ask", default=False,
help="Allow run of service without confirmation if policy say 'ask'")
parser.add_option ("--just-evaluate", action="store_true", dest="just_evaluate", default=False,
help="Do not run the service, only evaluate policy; retcode=0 means 'allow'")
(options, args) = parser.parse_args ()
domain=args[0]
target=args[1]
exec_index=args[2]
process_ident=args[3]
if not validate_target(target):
print >> sys.stderr, "Rpc failed (unknown domain):", domain, target, exec_index
text = "Domain '%s' doesn't exist (service %s called by domain %s)." % (
target, exec_index, domain)
subprocess.call(["/usr/bin/zenity", "--error", "--text", text])
os.execl(QREXEC_CLIENT, "qrexec-client", "-d", domain, "-l", "/bin/false", "-c", process_ident)
policy_list=read_policy_file(exec_index)
if policy_list==None:
policy_editor(domain, target, exec_index)
policy_list=read_policy_file(exec_index)
if policy_list==None:
policy_list=list()
policy_dict=find_policy(policy_list, domain, target)
if policy_dict["action"] == "ask" and options.assume_yes_for_ask:
policy_dict["action"] = "allow"
if policy_dict["action"] == "ask":
user_choice = confirm_execution(domain, target, exec_index)
if user_choice == UserChoice.ALWAYS_ALLOW:
add_always_allow(domain, target, exec_index, policy_dict["full-action"].lstrip('ask'))
policy_dict["action"] = "allow"
elif user_choice == UserChoice.ALLOW:
policy_dict["action"] = "allow"
else:
policy_dict["action"] = "deny"
if options.just_evaluate:
if policy_dict["action"] == "allow":
exit(0)
else:
exit(1)
if policy_dict["action"] == "allow":
if policy_dict.has_key("action.target"):
target=policy_dict["action.target"]
if policy_dict.has_key("action.user"):
user=policy_dict["action.user"]
else:
user="DEFAULT"
print >> sys.stderr, "Rpc allowed:", domain, target, exec_index
do_execute(domain, target, user, exec_index, process_ident)
print >> sys.stderr, "Rpc denied:", domain, target, exec_index
os.execl(QREXEC_CLIENT, "qrexec-client", "-d", domain, "-l", "/bin/false", "-c", process_ident)
main()

View File

@ -1,30 +0,0 @@
#!/bin/sh
mkfifo /tmp/qrexec-rpc-stderr.$$
logger -t "$1-$2" -f /tmp/qrexec-rpc-stderr.$$ &
exec 2>/tmp/qrexec-rpc-stderr.$$
rm -f /tmp/qrexec-rpc-stderr.$$
QUBES_RPC=/etc/qubes-rpc
# XXX: Backward compatibility
DEPRECATED_QUBES_RPC=/etc/qubes_rpc
if ! [ $# = 2 ] ; then
echo $0: bad argument count >&2
exit 1
fi
export QREXEC_REMOTE_DOMAIN="$2"
CFG_FILE=$QUBES_RPC/"$1"
if [ -s "$CFG_FILE" ] ; then
exec /bin/sh "$CFG_FILE"
echo "$0: failed to execute handler for" "$1" >&2
exit 1
fi
CFG_FILE=$DEPRECATED_QUBES_RPC/"$1"
if [ -s "$CFG_FILE" ] ; then
echo "$0: RPC service '$1' uses deprecated directory, please move to $QUBES_RPC" >&2
exec /bin/sh "$CFG_FILE"
echo "$0: failed to execute handler for" "$1" >&2
exit 1
fi
echo "$0: nonexistent or empty" "$CFG_FILE" file >&2
exit 1

View File

@ -0,0 +1,7 @@
## Note that policy parsing stops at the first match,
## so adding anything below "$anyvm $anyvm action" line will have no effect
## Please use a single # to start your custom comments
dom0 dom0 allow
$anyvm $anyvm deny

View File

@ -0,0 +1,7 @@
## Note that policy parsing stops at the first match,
## so adding anything below "$anyvm $anyvm action" line will have no effect
## Please use a single # to start your custom comments
dom0 dom0 allow
$anyvm $anyvm deny

View File

@ -0,0 +1,7 @@
## Note that policy parsing stops at the first match,
## so adding anything below "$anyvm $anyvm action" line will have no effect
## Please use a single # to start your custom comments
dom0 dom0 allow
$anyvm $anyvm deny

24
qubes-rpc/qubes.repos.Disable Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/python3
# `ok` on stdout indicates success; any stderr output indicates an error
# (probably an exception)
import dnf
import os
import sys
os.umask(0o022)
base = dnf.Base()
base.read_all_repos()
reponame = sys.argv[1]
repo = base.repos[reponame]
base.conf.write_raw_configfile(repo.repofile,
repo.id,
base.conf.substitutions,
{'enabled': '0'})
print('ok')

24
qubes-rpc/qubes.repos.Enable Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/python3
# `ok` on stdout indicates success; any stderr output indicates an error
# (probably an exception)
import dnf
import os
import sys
os.umask(0o022)
base = dnf.Base()
base.read_all_repos()
reponame = sys.argv[1]
repo = base.repos[reponame]
base.conf.write_raw_configfile(repo.repofile,
repo.id,
base.conf.substitutions,
{'enabled': '1'})
print('ok')

17
qubes-rpc/qubes.repos.List Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/python3
# Records in the output are separated by newlines; fields are separated by \0
# Each record is unique_id:pretty_name:enabled
import dnf
base = dnf.Base()
base.read_all_repos()
first = True
for repo in base.repos.all():
l = [repo.id, repo.name, 'enabled' if repo.enabled else 'disabled']
if not first: print()
first = False
print('\0'.join(l), end='')

View File

@ -24,15 +24,10 @@
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%{!?version: %define version %(cat version)}
%define _dracutmoddir /usr/lib/dracut/modules.d
%if %{fedora} < 17
%define _dracutmoddir /usr/share/dracut/modules.d
%endif
Name: qubes-core-dom0-linux
Version: %{version}
Version: @VERSION@
Release: 1%{?dist}
Summary: Linux-specific files for Qubes dom0
@ -43,57 +38,57 @@ URL: http://www.qubes-os.org
BuildRequires: ImageMagick
BuildRequires: pandoc
BuildRequires: qubes-utils-devel >= 2.0.5
BuildRequires: qubes-utils-devel >= 3.1.3
BuildRequires: gcc
Requires: qubes-core-dom0
Requires: qubes-utils >= 2.0.6
Requires: python3-qubesadmin
Requires: qubes-core-qrexec-dom0
Requires: qubes-core-admin-client
Requires: qubes-utils >= 3.1.3
Requires: qubes-utils-libs >= 4.0.16
Conflicts: qubes-core-dom0 < 4.0.23
Requires: %{name}-kernel-install
Requires: xdotool
Requires: createrepo_c
%define _builddir %(pwd)
Source0: %{name}-%{version}.tar.gz
%description
Linux customizations required to use system as Qubes dom0.
Additionally some graphical elements for every Linux desktop envirnment (icons,
appmenus etc).
%package kernel-install
Summary: Kernel install hook for Xen-based system
# get rid of os-prober, it tries to mount and parse all the block devices in
# the system, including loop*
Provides: os-prober
Obsoletes: os-prober
%description kernel-install
Kernel install hook for Xen-based system.
%prep
# we operate on the current directory, so no need to unpack anything
# symlink is to generate useful debuginfo packages
rm -f %{name}-%{version}
ln -sf . %{name}-%{version}
%setup -T -D
%setup -q
%build
python -m compileall appmenus-scripts
python -O -m compileall appmenus-scripts
export BACKEND_VMM=@BACKEND_VMM@
(cd dom0-updates; make)
(cd qrexec; make)
(cd file-copy-vm; make)
(cd doc; make manpages)
%install
### Appmenus
mkdir -p $RPM_BUILD_ROOT%{python_sitearch}/qubes/modules
cp appmenus-scripts/qubes-core-appmenus.py $RPM_BUILD_ROOT%{python_sitearch}/qubes/modules/10appmenus.py
cp appmenus-scripts/qubes-core-appmenus.pyc $RPM_BUILD_ROOT%{python_sitearch}/qubes/modules/10appmenus.pyc
cp appmenus-scripts/qubes-core-appmenus.pyo $RPM_BUILD_ROOT%{python_sitearch}/qubes/modules/10appmenus.pyo
mkdir -p $RPM_BUILD_ROOT/usr/libexec/qubes-appmenus
cp appmenus-scripts/*.sh $RPM_BUILD_ROOT/usr/libexec/qubes-appmenus/
cp appmenus-scripts/qubes-receive-appmenus $RPM_BUILD_ROOT/usr/libexec/qubes-appmenus/
install -D appmenus-scripts/qvm-sync-appmenus $RPM_BUILD_ROOT/usr/bin/qvm-sync-appmenus
mkdir -p $RPM_BUILD_ROOT/etc/qubes-rpc/policy
cp appmenus-scripts/qubes.SyncAppMenus $RPM_BUILD_ROOT/etc/qubes-rpc/
cp appmenus-scripts/qubes.SyncAppMenus.policy $RPM_BUILD_ROOT/etc/qubes-rpc/policy/qubes.SyncAppMenus
mkdir -p $RPM_BUILD_ROOT/usr/share/qubes-appmenus/
cp -r appmenus-files/* $RPM_BUILD_ROOT/usr/share/qubes-appmenus/
## Appmenus
install -d $RPM_BUILD_ROOT/etc/qubes-rpc/policy
cp qubesappmenus/qubes.SyncAppMenus.policy $RPM_BUILD_ROOT/etc/qubes-rpc/policy/qubes.SyncAppMenus
### Dom0 updates
install -D dom0-updates/qubes-dom0-updates.cron $RPM_BUILD_ROOT/etc/cron.daily/qubes-dom0-updates.cron
install -D dom0-updates/qubes-dom0-update $RPM_BUILD_ROOT/usr/bin/qubes-dom0-update
install -D dom0-updates/qubes-receive-updates $RPM_BUILD_ROOT/usr/libexec/qubes/qubes-receive-updates
install -D dom0-updates/patch-dnf-yum-config $RPM_BUILD_ROOT/usr/lib/qubes/patch-dnf-yum-config
install -m 0644 -D dom0-updates/qubes-cached.repo $RPM_BUILD_ROOT/etc/yum.real.repos.d/qubes-cached.repo
install -D dom0-updates/qfile-dom0-unpacker $RPM_BUILD_ROOT/usr/libexec/qubes/qfile-dom0-unpacker
install -m 0644 -D dom0-updates/qubes.ReceiveUpdates $RPM_BUILD_ROOT/etc/qubes-rpc/qubes.ReceiveUpdates
@ -101,19 +96,14 @@ install -m 0664 -D dom0-updates/qubes.ReceiveUpdates.policy $RPM_BUILD_ROOT/etc/
install -d $RPM_BUILD_ROOT/var/lib/qubes/updates
# Qrexec
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes/
cp qrexec/qrexec-daemon $RPM_BUILD_ROOT/usr/lib/qubes/
cp qrexec/qrexec-client $RPM_BUILD_ROOT/usr/lib/qubes/
# XXX: Backward compatibility
ln -s qrexec-client $RPM_BUILD_ROOT/usr/lib/qubes/qrexec_client
cp qrexec/qrexec-policy $RPM_BUILD_ROOT/usr/lib/qubes/
cp qrexec/qubes-rpc-multiplexer $RPM_BUILD_ROOT/usr/lib/qubes
# Qrexec services
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes/qubes-rpc $RPM_BUILD_ROOT/etc/qubes-rpc/policy
cp qubes-rpc/* $RPM_BUILD_ROOT/usr/lib/qubes/qubes-rpc/
for i in qubes-rpc/*; do ln -s ../../usr/lib/qubes/$i $RPM_BUILD_ROOT/etc/qubes-rpc/$(basename $i); done
cp qubes-rpc-policy/* $RPM_BUILD_ROOT/etc/qubes-rpc/policy/
### pm-utils
mkdir -p $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d
cp pm-utils/01qubes-sync-vms-clock $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
cp pm-utils/51qubes-suspend-netvm $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
cp pm-utils/52qubes-pause-vms $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system
cp pm-utils/qubes-suspend.service $RPM_BUILD_ROOT/usr/lib/systemd/system/
@ -129,21 +119,37 @@ cp -r dracut/modules.d/* $RPM_BUILD_ROOT%{_dracutmoddir}/
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
install -m 0644 -D system-config/limits-qubes.conf $RPM_BUILD_ROOT/etc/security/limits.d/99-qubes.conf
install -D system-config/cpufreq-xen.modules $RPM_BUILD_ROOT/etc/sysconfig/modules/cpufreq-xen.modules
cp system-config/iptables $RPM_BUILD_ROOT/etc/sysconfig
cp system-config/ip6tables $RPM_BUILD_ROOT/etc/sysconfig
install -m 0440 -D system-config/qubes.sudoers $RPM_BUILD_ROOT/etc/sudoers.d/qubes
install -D system-config/polkit-1-qubes-allow-all.rules $RPM_BUILD_ROOT/etc/polkit-1/rules.d/00-qubes-allow-all.rules
install -D system-config/qubes-dom0.modules $RPM_BUILD_ROOT/etc/sysconfig/modules/qubes-dom0.modules
install -D system-config/qubes-sync-clock.cron $RPM_BUILD_ROOT/etc/cron.d/qubes-sync-clock.cron
install -D system-config/lvm-cleanup.cron-daily $RPM_BUILD_ROOT/etc/cron.daily/lvm-cleanup
install -d $RPM_BUILD_ROOT/etc/udev/rules.d
install -m 644 system-config/00-qubes-ignore-devices.rules $RPM_BUILD_ROOT/etc/udev/rules.d/
install -m 644 system-config/60-persistent-storage.rules $RPM_BUILD_ROOT/etc/udev/rules.d/
install -m 644 system-config/12-qubes-ignore-lvm-devices.rules $RPM_BUILD_ROOT/etc/udev/rules.d/
install -m 644 -D system-config/disable-lesspipe.sh $RPM_BUILD_ROOT/etc/profile.d/zz-disable-lesspipe.sh
install -m 755 -D system-config/kernel-grub2.install $RPM_BUILD_ROOT/usr/lib/kernel/install.d/80-grub2.install
install -m 755 -D system-config/kernel-xen-efi.install $RPM_BUILD_ROOT/usr/lib/kernel/install.d/90-xen-efi.install
install -m 755 -D system-config/kernel-remove-bls.install $RPM_BUILD_ROOT/usr/lib/kernel/install.d/99-remove-bls.install
install -m 644 -D system-config/75-qubes-dom0.preset \
$RPM_BUILD_ROOT/usr/lib/systemd/system-preset/75-qubes-dom0.preset
install -m 644 -D system-config/75-qubes-dom0-user.preset \
$RPM_BUILD_ROOT/usr/lib/systemd/user-preset/75-qubes-dom0-user.preset
install -m 644 -D system-config/99-qubes-default-disable.preset \
$RPM_BUILD_ROOT/usr/lib/systemd/system-preset/99-qubes-default-disable.preset
install -d $RPM_BUILD_ROOT/etc/dnf/protected.d
install -m 0644 system-config/dnf-protected-qubes-core-dom0.conf \
$RPM_BUILD_ROOT/etc/dnf/protected.d/qubes-core-dom0.conf
### Icons
mkdir -p $RPM_BUILD_ROOT/usr/share/qubes/icons
for icon in icons/*.png; do
convert -resize 48 $icon $RPM_BUILD_ROOT/usr/share/qubes/$icon
done
touch $RPM_BUILD_ROOT/var/lib/qubes/.qubes-exclude-block-devices
# file copy to VM
install -m 755 file-copy-vm/qfile-dom0-agent $RPM_BUILD_ROOT/usr/lib/qubes/
install -m 755 file-copy-vm/qvm-copy-to-vm $RPM_BUILD_ROOT/usr/bin/
install -m 755 file-copy-vm/qvm-copy $RPM_BUILD_ROOT/usr/bin/
ln -s qvm-copy-to-vm $RPM_BUILD_ROOT/usr/bin/qvm-move-to-vm
ln -s qvm-copy $RPM_BUILD_ROOT/usr/bin/qvm-move
### Documentation
(cd doc; make DESTDIR=$RPM_BUILD_ROOT install)
@ -155,34 +161,22 @@ fi
%post
for i in /usr/share/qubes/icons/*.png ; do
xdg-icon-resource install --noupdate --novendor --size 48 $i
done
xdg-icon-resource forceupdate
xdg-desktop-menu install /usr/share/qubes-appmenus/qubes-dispvm.directory /usr/share/qubes-appmenus/qubes-dispvm-firefox.desktop
sed '/^reposdir\s*=/d' -i /etc/yum.conf
echo reposdir=/etc/yum.real.repos.d >> /etc/yum.conf
sed '/^installonlypkgs\s*=/d' -i /etc/yum.conf
echo 'installonlypkgs = kernel, kernel-qubes-vm' >> /etc/yum.conf
sed '/^distroverpkg\s*=/d' -i /etc/yum.conf
echo 'distroverpkg = qubes-release' >> /etc/yum.conf
/usr/lib/qubes/patch-dnf-yum-config
systemctl enable qubes-suspend.service >/dev/null 2>&1
# migrate dom0-updates check disable flag
if [ $1 -ge 2 ]; then
if [ -e /var/lib/qubes/updates/disable-updates ]; then
qvm-features dom0 service.qubes-update-check ''
rm -f /var/lib/qubes/updates/disable-updates
fi
fi
%preun
if [ "$1" = 0 ] ; then
# no more packages left
for i in /usr/share/qubes/icons/*.png ; do
xdg-icon-resource uninstall --novendor --size 48 $i
done
xdg-desktop-menu uninstall /usr/share/qubes-appmenus/qubes-dispvm.directory /usr/share/qubes-appmenus/qubes-dispvm-firefox.desktop
systemctl disable qubes-suspend.service > /dev/null 2>&1
fi
@ -198,68 +192,64 @@ rm -f /lib/udev/rules.d/69-xorg-vmmouse.rules
chmod -x /etc/grub.d/10_linux
%files
%attr(2775,root,qubes) %dir /etc/qubes-rpc
%attr(2775,root,qubes) %dir /etc/qubes-rpc/policy
/etc/qubes-rpc/policy/qubes.SyncAppMenus
/etc/qubes-rpc/qubes.SyncAppMenus
%{python_sitearch}/qubes/modules/10appmenus.py
%{python_sitearch}/qubes/modules/10appmenus.pyc
%{python_sitearch}/qubes/modules/10appmenus.pyo
/usr/libexec/qubes-appmenus/convert-apptemplate2vm.sh
/usr/libexec/qubes-appmenus/convert-dirtemplate2vm.sh
/usr/libexec/qubes-appmenus/create-apps-for-appvm.sh
/usr/libexec/qubes-appmenus/qubes-receive-appmenus
/usr/libexec/qubes-appmenus/remove-appvm-appmenus.sh
/usr/share/qubes-appmenus/qubes-appmenu-select.desktop
/usr/share/qubes-appmenus/qubes-dispvm-firefox.desktop
/usr/share/qubes-appmenus/qubes-dispvm.directory
/usr/share/qubes-appmenus/qubes-servicevm.directory.template
/usr/share/qubes-appmenus/qubes-start.desktop
/usr/share/qubes-appmenus/qubes-templatevm.directory.template
/usr/share/qubes-appmenus/qubes-vm.directory.template
/usr/share/qubes-appmenus/hvm
/usr/share/qubes/icons/*.png
/usr/bin/qvm-sync-appmenus
# Dom0 updates
/etc/cron.daily/qubes-dom0-updates.cron
/etc/yum.real.repos.d/qubes-cached.repo
/usr/bin/qubes-dom0-update
/usr/lib/qubes/patch-dnf-yum-config
%attr(4750,root,qubes) /usr/libexec/qubes/qfile-dom0-unpacker
/usr/libexec/qubes/qubes-receive-updates
/etc/qubes-rpc/qubes.ReceiveUpdates
%attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.ReceiveUpdates
%attr(0770,root,qubes) %dir /var/lib/qubes/updates
# Qrexec services
/etc/qubes-rpc/qubes.repos.*
/usr/lib/qubes/qubes-rpc/qubes.repos.*
%attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.repos.List
%attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.repos.Enable
%attr(0664,root,qubes) %config(noreplace) /etc/qubes-rpc/policy/qubes.repos.Disable
# Dracut module
/etc/dracut.conf.d/*
%dir %{_dracutmoddir}/90macbook12-spi-driver
%{_dracutmoddir}/90macbook12-spi-driver/*
%dir %{_dracutmoddir}/90qubes-pciback
%{_dracutmoddir}/90qubes-pciback/*
%dir %{_dracutmoddir}/90extra-modules
%{_dracutmoddir}/90extra-modules/*
# Qrexec
%attr(4750,root,qubes) /usr/lib/qubes/qrexec-daemon
/usr/lib/qubes/qrexec-client
/usr/lib/qubes/qrexec_client
/usr/lib/qubes/qubes-rpc-multiplexer
/usr/lib/qubes/qrexec-policy
# file copy
/usr/bin/qvm-copy-to-vm
/usr/bin/qvm-move-to-vm
/usr/bin/qvm-copy
/usr/bin/qvm-move
/usr/lib/qubes/qfile-dom0-agent
# pm-utils
/usr/lib64/pm-utils/sleep.d/01qubes-sync-vms-clock
/usr/lib64/pm-utils/sleep.d/51qubes-suspend-netvm
/usr/lib64/pm-utils/sleep.d/52qubes-pause-vms
/usr/lib/systemd/system/qubes-suspend.service
# Others
/etc/sysconfig/iptables
/etc/sysconfig/ip6tables
/etc/sysconfig/modules/qubes-dom0.modules
/etc/sysconfig/modules/cpufreq-xen.modules
/etc/sudoers.d/qubes
/etc/polkit-1/rules.d/00-qubes-allow-all.rules
/etc/security/limits.d/99-qubes.conf
%config /etc/udev/rules.d/00-qubes-ignore-devices.rules
%config(noreplace) /etc/udev/rules.d/60-persistent-storage.rules
%config /etc/udev/rules.d/12-qubes-ignore-lvm-devices.rules
%attr(0644,root,root) /etc/cron.d/qubes-sync-clock.cron
/etc/cron.daily/lvm-cleanup
%config(noreplace) /etc/profile.d/zz-disable-lesspipe.sh
%config(noreplace) /etc/dnf/protected.d/qubes-core-dom0.conf
/usr/lib/systemd/system-preset/75-qubes-dom0.preset
/usr/lib/systemd/system-preset/99-qubes-default-disable.preset
/usr/lib/systemd/user-preset/75-qubes-dom0-user.preset
/var/lib/qubes/.qubes-exclude-block-devices
# Man
%{_mandir}/man1/qvm-*.1*
%{_mandir}/man1/qubes-*.1*
%files kernel-install
/usr/lib/kernel/install.d/80-grub2.install
/usr/lib/kernel/install.d/90-xen-efi.install
/usr/lib/kernel/install.d/99-remove-bls.install
%changelog
@CHANGELOG@

View File

@ -1,7 +1,5 @@
%{!?version: %define version %(cat version_vaio_fixes)}
Name: qubes-core-dom0-vaio-fixes
Version: %{version}
Version: @VERSION1@
Release: 1%{?dist}
Summary: Additional scripts for supporting suspend on Vaio Z laptops
Requires: alsa-utils
@ -11,7 +9,7 @@ Vendor: Invisible Things Lab
License: GPL
URL: http://www.qubes-os.org
%define _builddir %(pwd)
Source0: qubes-core-dom0-linux-@VERSION@.tar.gz
%description
Additional scripts for supporting suspend on Vaio Z laptops.
@ -19,14 +17,20 @@ Additional scripts for supporting suspend on Vaio Z laptops.
Due to broken Linux GPU drivers we need to do some additional actions during
suspend/resume.
%prep
%setup -q -n qubes-core-dom0-linux-@VERSION@
%install
mkdir -p $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d
cp vaio-fixes/00sony-vaio-audio $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
cp vaio-fixes/99sony-vaio-audio $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
install -D vaio-fixes/00sony-vaio-audio $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
install -D vaio-fixes/99sony-vaio-audio $RPM_BUILD_ROOT/usr/lib64/pm-utils/sleep.d/
mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d/
cp vaio-fixes/snd-hda-intel-sony-vaio.conf $RPM_BUILD_ROOT/etc/modprobe.d/
install -D vaio-fixes/snd-hda-intel-sony-vaio.conf $RPM_BUILD_ROOT/etc/modprobe.d/
%files
/usr/lib64/pm-utils/sleep.d/00sony-vaio-audio
/usr/lib64/pm-utils/sleep.d/99sony-vaio-audio
/etc/modprobe.d/snd-hda-intel-sony-vaio.conf
%changelog
@CHANGELOG@

View File

@ -1,6 +1,11 @@
# do not edit this file, it will be overwritten on update
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="loop*", ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1"
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="loop*", ATTR{loop/backing_file}=="*/appvms/*/*.img*|*/vm-templates/*/*.img*", ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1", ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}="1"
ACTION!="remove", SUBSYSTEM=="block", KERNEL=="xvd*", ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1", ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}="1"
# ENV{DM_NAME} not available yet
# Template VM disks
ACTION!="remove", SUBSYSTEM=="block", ATTR{dm/name}=="snapshot-*", ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1"
ACTION!="remove", SUBSYSTEM=="block", ATTR{dm/name}=="origin-*", ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1"
# kpartx used for creating empty volatile.img, udevd tries to access the device
# and prevent kpartx from removing them
ACTION!="remove", SUBSYSTEM=="block", ATTR{dm/name}=="loop*p*", ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1"

View File

@ -0,0 +1,4 @@
# do not edit this file, it will be overwritten on update
# Skip VM images managed by lvm storage pool
ACTION!="remove", SUBSYSTEM=="block", ENV{DM_LV_NAME}=="vm-*", ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}="1", ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}="1"

View File

@ -1,87 +0,0 @@
# do not edit this file, it will be overwritten on update
# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path}
# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
# forward scsi device event to corresponding block device
ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change"
ACTION=="remove", GOTO="persistent_storage_end"
# enable in-kernel media-presence polling
ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000"
SUBSYSTEM!="block", GOTO="persistent_storage_end"
# skip rules for inappropriate block devices
KERNEL=="loop*|fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*|zram*", GOTO="persistent_storage_end"
# ignore partitions that span the entire disk
TEST=="whole_disk", GOTO="persistent_storage_end"
# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
# virtio-blk
KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"
KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n"
# ATA devices using the "scsi" subsystem
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode"
# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $devnode"
# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures)
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $devnode"
# Otherwise, fall back to using usb_id for USB devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id"
# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="scsi"
KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="cciss"
KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
# firewire
KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}"
KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n"
KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}"
KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n"
KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}"
KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n"
# by-path (parent device path)
ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
# skip unpartitioned removable media devices from drivers which do not send "change" events
ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end"
# probe filesystem metadata of optical drives which have a media inserted
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \
IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}"
# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \
IMPORT{builtin}="blkid --noraid"
# probe filesystem metadata of disks
KERNEL!="sr*", IMPORT{builtin}="blkid"
# watch metadata changes by tools closing the device after writing
KERNEL!="sr*", OPTIONS+="watch"
# by-label/by-uuid links (filesystem metadata)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
# by-id (World Wide Name)
ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}"
ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n"
# by-partlabel/by-partuuid links (partition metadata)
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}"
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}"
LABEL="persistent_storage_end"

View File

@ -0,0 +1,2 @@
enable dbus.socket
enable dbus-daemon.service

View File

@ -0,0 +1,55 @@
enable gdm.service
enable lightdm.service
enable slim.service
enable lxdm.service
enable sddm.service
enable kdm.service
enable xdm.service
disable systemd-timesyncd.service
disable systemd-networkd.service
disable systemd-resolved.service
# Locally-running services
enable lvm2-monitor.*
enable lvm2-lvmetad.*
enable dm-event.*
enable dmraid-activation.service
enable fstrim.timer
enable dbus.socket
enable dbus-daemon.service
enable abrtd.service
enable abrt-ccpp.service
enable abrt-oops.service
enable abrt-xorg.service
enable abrt-vmcore.service
enable xenstored.service
enable xenstored.socket
enable xenstored_ro.socket
enable xenconsoled.service
enable xen-init-dom0.service
enable libvirtd.service
enable virlockd.socket
enable upower.service
enable crond.service
# Qubes services
enable qubes-core.service
enable qubes-netvm.service
enable qubes-meminfo-writer-dom0.service
enable qubes-db-dom0.service
enable qubes-qmemman.service
enable qubes-suspend.service
enable qubes-setupdvm.service
enable qubes-qrexec-policy-daemon.service
enable qubesd.service
enable anti-evil-maid-unseal.service
enable anti-evil-maid-check-mount-devs.service
enable anti-evil-maid-seal.service

View File

@ -0,0 +1 @@
disable *

View File

@ -7,6 +7,7 @@ if modinfo cpufreq-xen > /dev/null 2>&1; then
for f in /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor; do
echo xen > $f
done
fi
if modinfo xen-acpi-processor &>/dev/null; then
modprobe xen-acpi-processor
fi

View File

@ -0,0 +1 @@
unset LESSOPEN LESSCLOSE

View File

@ -0,0 +1 @@
qubes-core-dom0

View File

@ -1,8 +0,0 @@
# Generated by ip6tables-save v1.4.14 on Tue Sep 25 16:00:20 2012
*filter
:INPUT DROP [1:72]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT
COMMIT
# Completed on Tue Sep 25 16:00:20 2012

View File

@ -1,30 +0,0 @@
# Generated by iptables-save v1.4.5 on Mon Sep 6 08:57:46 2010
*nat
:PREROUTING ACCEPT [85:5912]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:PR-QBS - [0:0]
:PR-QBS-SERVICES - [0:0]
-A PREROUTING -j PR-QBS
-A PREROUTING -j PR-QBS-SERVICES
-A POSTROUTING -o vif+ -j ACCEPT
-A POSTROUTING -o lo -j ACCEPT
-A POSTROUTING -j MASQUERADE
COMMIT
# Completed on Mon Sep 6 08:57:46 2010
# Generated by iptables-save v1.4.5 on Mon Sep 6 08:57:46 2010
*filter
:INPUT ACCEPT [168:11399]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [128:12536]
-A INPUT -i vif+ -p udp -m udp --dport 68 -j DROP
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i vif+ -o vif+ -j DROP
-A FORWARD -i vif+ -j ACCEPT
-A FORWARD -j DROP
COMMIT
# Completed on Mon Sep 6 08:57:46 2010

View File

@ -0,0 +1,28 @@
#!/bin/sh
COMMAND="$1"
KVER="$2"
BOOT_DIR_ABS="$3"
case "$COMMAND" in
add)
# use newer image if available
if [ -e "$BOOT_DIR_ABS"/initrd ]; then
cp -u "$BOOT_DIR_ABS"/initrd "/boot/initramfs-${KVER}.img"
fi
if [ ! -e "/boot/initramfs-${KVER}.img" ]; then
dracut "/boot/initramfs-${KVER}.img" "$KVER"
fi
;;
remove)
rm -f "/boot/initramfs-${KVER}.img"
;;
esac
if [ -x /usr/sbin/grub2-mkconfig ]; then
if [ -e /boot/grub2/grub.cfg ]; then
grub2-mkconfig -o /boot/grub2/grub.cfg
fi
if [ -e /boot/efi/EFI/qubes/grub.cfg ]; then
grub2-mkconfig -o /boot/efi/EFI/qubes/grub.cfg
fi
fi

View File

@ -0,0 +1,21 @@
#!/bin/sh
# The Boot Loader Specification is not useful for Qubes OS, because it handles
# only direct Linux boot, not Xen or any other multiboot application (like
# tboot).
# Because of that Qubes OS still uses generated grub2 configuration.
# Unfortunately the sole existence of /boot/${MACHINE_ID} changes behaviour of
# some tools - for example default output file in dracut. So forcibly remove
# the directory (which was just created...).
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
rm -rf /boot/${MACHINE_ID}
fi
if [[ $MACHINE_ID ]] && ( [[ -d /boot/efi/${MACHINE_ID} ]] || [[ -L /boot/efi/${MACHINE_ID} ]] ); then
rm -rf /boot/efi/${MACHINE_ID}
rm -f /boot/efi/loader/entries/${MACHINE_ID}-*.conf
# remove only when empty
rmdir /boot/efi/loader/entries /boot/efi/loader || :
fi

View File

@ -0,0 +1,110 @@
#!/bin/sh
set -e
COMMAND="$1"
KVER="$2"
ESP_MOUNTPOINT=/boot/efi
EFI_DIR=$(efibootmgr -v 2>/dev/null | awk '
/^BootCurrent:/ { current=$2; }
/^Boot....\* .*xen\.efi/ {
if ("Boot" current "*" == $1) {
sub(".*File\\(", "");
sub("\\\\xen.efi\\).*", "");
gsub("\\\\", "/");
print;
}
}')
if [ -z "$EFI_DIR" ]; then
EFI_DIR="$ESP_MOUNTPOINT/EFI/qubes"
else
EFI_DIR="$ESP_MOUNTPOINT$EFI_DIR"
fi
if [ ! -r "$EFI_DIR/xen.cfg" ]; then
# non-EFI system
exit 0;
fi
case "$COMMAND" in
add)
if ! fgrep -q "[${KVER}]" $EFI_DIR/xen.cfg; then
# take the default section and use it as a template for the new entry
awk -F = --assign "kver=${KVER}" '
/^\[/ {
# section header - previous section (if any) ended
# if default section already processed, that is all
if (in_default) exit;
in_global=0;
in_default=0;
}
/\[global\]/ {
in_global=1;
}
/^\[/ {
if ("[" default_name "]" == $0) {
in_default=1;
print "[" kver "]";
next;
}
}
/^default=/ {
if (in_global)
default_name=$2;
}
/^kernel=/ {
if (in_default) {
sub("=[^ ]*", "=vmlinuz-" kver);
}
}
/^ramdisk=/ {
if (in_default) {
sub("=[^ ]*", "=initramfs-" kver ".img");
}
}
{
if (in_default) {
print;
}
}' $EFI_DIR/xen.cfg >> $EFI_DIR/xen.cfg
# then change the default
sed -e "s/default=.*/default=$KVER/" -i $EFI_DIR/xen.cfg
fi
cp "/boot/vmlinuz-$KVER" "$EFI_DIR/"
if [ -e "/boot/initramfs-${KVER}.img" ]; then
cp -f "/boot/initramfs-${KVER}.img" "$EFI_DIR/"
else
dracut -f "$EFI_DIR/initramfs-${KVER}.img" "$KVER"
fi
;;
remove)
# don't care about changing default= line - yum should prevent removing
# currently running kernel
if [ -r $EFI_DIR/xen.cfg ]; then
awk -F = --assign "kver=${KVER}" '
/^\[/ {
# section header - previous section (if any) ended
in_current=0;
}
/^\[/ {
if ($0 == "[" kver "]")
in_current=1;
}
{
if (!in_current) {
print;
}
}' $EFI_DIR/xen.cfg > $EFI_DIR/xen.cfg.new
mv $EFI_DIR/xen.cfg.new $EFI_DIR/xen.cfg
fi
rm -f "$EFI_DIR/initramfs-${KVER}.img"
rm -f "$EFI_DIR/vmlinuz-${KVER}"
;;
esac

View File

@ -0,0 +1,3 @@
#!/bin/sh
find /etc/lvm/archive/ -type f -mtime +1 -name '*.vg' -delete

View File

@ -1 +1 @@
*/6 * * * * root /usr/bin/qvm-sync-clock > /dev/null 2>&1 || true
0 */1 * * * root /usr/bin/qvm-sync-clock > /dev/null 2>&1 || true

View File

@ -1 +1,2 @@
2.0.24
4.1.3
1.6.1

View File

@ -1 +0,0 @@
1.6.1