-
Notifications
You must be signed in to change notification settings - Fork 47
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
Updates Whonix-based templates 14 -> 15 #358
Changes from all commits
24e6c22
8468657
4ea1524
15f5914
d49f1d9
17adecb
760168b
a1768ec
e6798e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: set syntax=yaml ts=2 sw=2 sts=2 et : | ||
|
||
include: | ||
# Import the upstream Qubes-maintained anon-whonix settings. | ||
# The anon-whoni config pulls in sys-whonix and sys-firewall, | ||
# as well as ensures the latest versions of Whonix are installed. | ||
- qvm.anon-whonix | ||
|
||
# The Qubes logic is too polite about enforcing template | ||
# settings, using "present" rather than "prefs". Below | ||
# we force the template updates. | ||
sys-whonix-template-config: | ||
qvm.vm: | ||
- name: sys-whonix | ||
- prefs: | ||
- template: whonix-gw-15 | ||
- require: | ||
- sls: qvm.anon-whonix | ||
|
||
anon-whonix-template-config: | ||
qvm.vm: | ||
- name: anon-whonix | ||
- prefs: | ||
- template: whonix-ws-15 | ||
- require: | ||
- sls: qvm.anon-whonix |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,61 +12,90 @@ TASK=${1:-default} | |
# 2. The AppVM must not be a DispVM template that used as the default DispVM | ||
# for an AppVM, nor the system default DispVM. | ||
if [[ $TASK == "prepare" ]]; then | ||
# sd-svs, we simply shutdown the machine as we want to preserve the data | ||
if qvm-check sd-svs --quiet; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-svs template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
if qvm-check --running sd-svs; then | ||
qvm-shutdown --wait sd-svs | ||
fi | ||
fi | ||
fi | ||
# sd-svs, we simply shutdown the machine as we want to preserve the data | ||
if qvm-check sd-svs --quiet; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-svs template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
if qvm-check --running sd-svs; then | ||
qvm-shutdown --wait sd-svs | ||
fi | ||
fi | ||
fi | ||
|
||
# For sd-svs-disp and sd-export-usb-dvm, DispVM templates. We can delete both | ||
# VMs since they contain no persistent data. The installer will re-create them | ||
# as part of the provisioning process. | ||
# We set the default DispVM to empty string to ensure nothing is opened in an | ||
# insecure (unmanaged or not yet updated) or networked vm, until the | ||
# provisioning process runs again and sets that value to sd-svs-disp | ||
if qvm-check --quiet sd-svs-disp; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-svs-disp template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
qubes-prefs default_dispvm '' | ||
qvm-shutdown --wait sd-svs-disp | ||
qvm-remove -f sd-svs-disp | ||
fi | ||
fi | ||
# For sd-svs-disp and sd-export-usb-dvm, DispVM templates. We can delete both | ||
# VMs since they contain no persistent data. The installer will re-create them | ||
# as part of the provisioning process. | ||
# We set the default DispVM to empty string to ensure nothing is opened in an | ||
# insecure (unmanaged or not yet updated) or networked vm, until the | ||
# provisioning process runs again and sets that value to sd-svs-disp | ||
if qvm-check --quiet sd-svs-disp; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-svs-disp template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
qubes-prefs default_dispvm '' | ||
qvm-shutdown --wait sd-svs-disp | ||
qvm-remove -f sd-svs-disp | ||
fi | ||
fi | ||
|
||
if qvm-check --quiet sd-export-usb; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-export-usb-dvm template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
qvm-shutdown --wait sd-export-usb | ||
qvm-shutdown --wait sd-export-usb-dvm | ||
qvm-remove -f sd-export-usb | ||
qvm-remove -f sd-export-usb-dvm | ||
fi | ||
fi | ||
if qvm-check --quiet sd-export-usb; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-export-usb-dvm template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
qvm-shutdown --wait sd-export-usb | ||
qvm-shutdown --wait sd-export-usb-dvm | ||
qvm-remove -f sd-export-usb | ||
qvm-remove -f sd-export-usb-dvm | ||
fi | ||
fi | ||
|
||
# Finally for sd-gpg, we simply shutdown the machine | ||
if qvm-check --quiet sd-gpg; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-gpg template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
qvm-shutdown --wait sd-gpg | ||
fi | ||
fi | ||
# For Whonix VMs, shut them down, so we can upate the TemplateVM settings. | ||
# We shut down sd-proxy before sd-whonix, since its netvm is sd-whonix, which won't | ||
# shutdown if a client is connected. | ||
if qvm-check --quiet sd-proxy; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-proxy template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
qvm-shutdown --wait sd-proxy | ||
fi | ||
fi | ||
|
||
if qvm-check --quiet sd-whonix; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-whonix template) | ||
if [[ ! $BASE_TEMPLATE =~ "15" ]]; then | ||
qvm-shutdown --wait sd-whonix | ||
fi | ||
fi | ||
|
||
# Kill sys-whonix, to make sure connected clients don't prevent shutdown. | ||
if qvm-check --quiet sys-whonix; then | ||
BASE_TEMPLATE=$(qvm-prefs sys-whonix template) | ||
if [[ ! $BASE_TEMPLATE =~ "15" ]]; then | ||
if qvm-check --quiet --running sys-whonix; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: weird indentation for sys-whonix here, makes it a bit hard to read There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @emkll Ack, this is tabs-versus-spaces. Most of the scripts in the repo use 4 spaces for bash scripts, but this one and only this one uses tabs instead—I wasn't careful about making sure to force use of tabs when editing the script. Agreed, we should indeed clean it up to avoid large amounts of frustration. 😃 |
||
qvm-kill sys-whonix | ||
# Wait for machine to stop fully, since qvm-kill doesn't block | ||
sleep 5 | ||
fi | ||
fi | ||
fi | ||
|
||
# Finally for sd-gpg, we simply shutdown the machine | ||
if qvm-check --quiet sd-gpg; then | ||
BASE_TEMPLATE=$(qvm-prefs sd-gpg template) | ||
if [[ ! $BASE_TEMPLATE =~ "buster" ]]; then | ||
qvm-shutdown --wait sd-gpg | ||
fi | ||
fi | ||
elif [[ $TASK == "remove" ]]; then | ||
# For each template, ensure the TemplateVM exists, that it is shut down | ||
# before deleting it. | ||
for template in sd-svs-template sd-svs-disp-template sd-export-template | ||
do | ||
if qvm-check "${template}" --quiet; then | ||
if qvm-check --running "${template}"; then | ||
qvm-shutdown --wait "${template}" | ||
fi | ||
qvm-remove -f "${template}" | ||
fi | ||
done | ||
# For each template, ensure the TemplateVM exists, that it is shut down | ||
# before deleting it. | ||
for template in sd-svs-template sd-svs-disp-template sd-export-template sd-proxy-template | ||
do | ||
if qvm-check "${template}" --quiet; then | ||
if qvm-check --running "${template}"; then | ||
qvm-shutdown --wait "${template}" | ||
fi | ||
qvm-remove -f "${template}" | ||
fi | ||
done | ||
else | ||
echo "Please specify prepare or remove" | ||
exit 1 | ||
echo "Please specify prepare or remove" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we must require sls sd-upgrade-templates here , to ensure the template update was successful before cloning whonix-ws-15 to sd-proxy-buster-template