Skip to content

Commit

Permalink
fix: Print server without RPC service
Browse files Browse the repository at this point in the history
- Install RPC service to template;
- Move qube configuration to template configuration;
- Start server after the Qubes Services are created;
- Qrexec policy ask to both app and disposable qube; and
- Rename systemd service to qusal prefix instead of qubes.
  • Loading branch information
ben-grande committed Jun 19, 2024
1 parent bf0a4bc commit f30bd20
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 39 deletions.
3 changes: 1 addition & 2 deletions salt/sys-print/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ qube that has access to the printer.
- Top:
```sh
sudo qubesctl top.enable sys-print
sudo qubesctl --targets=tpl-sys-print,sys-print state.apply
sudo qubesctl --targets=tpl-sys-print state.apply
sudo qubesctl top.disable sys-print
sudo qubesctl state.apply sys-print.appmenus
```
Expand All @@ -53,7 +53,6 @@ sudo qubesctl state.apply sys-print.appmenus
```sh
sudo qubesctl state.apply sys-print.create
sudo qubesctl --skip-dom0 --targets=tpl-sys-print state.apply sys-print.install
sudo qubesctl --skip-dom0 --targets=dvm-sys-print,sys-print state.apply sys-print.configure
sudo qubesctl state.apply sys-print.appmenus
```
<!-- pkg:end:post-install -->
Expand Down
24 changes: 0 additions & 24 deletions salt/sys-print/configure.sls

This file was deleted.

9 changes: 0 additions & 9 deletions salt/sys-print/configure.top

This file was deleted.

6 changes: 6 additions & 0 deletions salt/sys-print/create.sls
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ features:
- service.evolution-data-server
- set:
- menu-items: "system-config-printer.desktop simple-scan.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes.start.desktop"
tags:
- add:
- "print-server"
{%- endload %}
{{ load(defaults) }}
Expand Down Expand Up @@ -120,6 +123,9 @@ features:
- service.evolution-data-server
- set:
- menu-items: "system-config-printer.desktop simple-scan.desktop qubes-run-terminal.desktop qubes-open-file-manager.desktop qubes.start.desktop"
tags:
- add:
- "print-server"
{%- endload %}
{{ load(defaults) }}
Expand Down
1 change: 1 addition & 0 deletions salt/sys-print/files/admin/policy/default.policy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

## Do not modify this file, create a new policy with with a lower number in the
## file name instead. For example `30-user.policy`.
qusal.Print * @anyvm @tag:print-server ask
qusal.Print * @anyvm @default ask default_target=sys-print
qusal.Print * @anyvm @anyvm deny
## vim:ft=qrexecpolicy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

[Unit]
Description=Print over Qrexec
After=qubes-sysinit.service
After=qubes-qrexec-agent.service
ConditionPathExists=/var/run/qubes-service/print-setup

Expand Down
2 changes: 0 additions & 2 deletions salt/sys-print/init.top
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ base:
- sys-print.create
'tpl-sys-print':
- sys-print.install
'dvm-sys-print,sys-print':
- sys-print.configure
8 changes: 6 additions & 2 deletions salt/sys-print/install-client.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ SPDX-License-Identifier: AGPL-3.0-or-later

"{{ slsdotpath }}-client-systemd-print-forwarder":
file.managed:
- name: /usr/lib/systemd/system/qubes-print-forwarder.service
- source: salt://{{ slsdotpath }}/files/client/systemd/qubes-print-forwarder.service
- name: /usr/lib/systemd/system/qusal-print-forwarder.service
- source: salt://{{ slsdotpath }}/files/client/systemd/qusal-print-forwarder.service
- mode: '0644'
- user: root
- group: root
- makedirs: True

"{{ slsdotpath }}-enable-systemd-service-print-forwarder":
service.enabled:
- name: qusal-print-forwarder.service
18 changes: 18 additions & 0 deletions salt/sys-print/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,22 @@ include:
- addusers:
- user

"{{ slsdotpath }}-rpc":
file.managed:
- name: /etc/qubes-rpc/qusal.Print
- source: salt://{{ slsdotpath }}/files/server/rpc/qusal.Print
- mode: '0755'
- user: root
- group: root
- makedirs: True

"{{ slsdotpath }}-bind-dirs":
file.managed:
- name: /etc/qubes-bind-dirs.d/50-sys-print.conf
- source: salt://{{ slsdotpath }}/files/server/qubes-bind-dirs.d/50-sys-print.conf
- mode: '0644'
- user: root
- group: root
- makedirs: True

{% endif -%}

0 comments on commit f30bd20

Please sign in to comment.