Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully power off workstation after lid close #473

Merged
merged 2 commits into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions dom0/sd-clean-all.sls
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :

{% import_json "sd/config.json" as d %}

set-fedora-as-default-dispvm:
cmd.run:
- name: qvm-check fedora-30-dvm && qubes-prefs default_dispvm fedora-30-dvm || qubes-prefs default_dispvm ''
Expand Down Expand Up @@ -29,16 +31,24 @@ remove-dom0-sdw-config-files:
- /home/{{ gui_user }}/Desktop/securedrop-launcher.desktop
- /home/{{ gui_user }}/.securedrop_launcher

sd-cleanup-crontab:
sd-cleanup-etc-changes:
file.replace:
- name: /etc/crontab
- names:
- /etc/crontab
- /etc/systemd/logind.conf
- pattern: '### BEGIN securedrop-workstation ###.*### END securedrop-workstation ###\s*'
- flags:
- MULTILINE
- DOTALL
- repl: ''
- backup: no

{% if d.environment == "prod" or d.environment == "staging" %}
apply-systemd-changes:
cmd.run:
- name: sudo systemctl restart systemd-logind
{% endif %}

sd-cleanup-sys-firewall:
cmd.run:
- names:
Expand Down
23 changes: 23 additions & 0 deletions dom0/sd-dom0-systemd.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :
##
# Updates to systemd configuration in dom0
##

{% import_json "sd/config.json" as d %}
{% if d.environment == "prod" or d.environment == "staging" %}
# Power off instead of suspend on lid close, for security reasons, but only in
# prod and staging, to avoid interfering with developer workflows
dom0-poweroff:
file.blockreplace:
- name: /etc/systemd/logind.conf
- append_if_not_found: True
- marker_start: "### BEGIN securedrop-workstation ###"
- marker_end: "### END securedrop-workstation ###"
- content: |
HandleLidSwitch=poweroff

apply-systemd-changes:
cmd.run:
- name: sudo systemctl restart systemd-logind
{% endif %}
1 change: 1 addition & 0 deletions dom0/sd-workstation.top
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ base:
- sd-sys-vms
- sd-dom0-files
- sd-dom0-crontab
- sd-dom0-systemd
- sd-workstation-template
- sd-upgrade-templates
- sd-dom0-qvm-rpc
Expand Down