Skip to content

Commit

Permalink
Apply conditional logic for yum repo
Browse files Browse the repository at this point in the history
rely on config.json instead of env vars. We can rely on
env vars as jinja templates are evaluated before runtime
(https://docs.saltstack.com/en/latest/topics/jinja/index.html)

Adds production SD release signing key

Necessary for the prod logic. We don't have packages hosted in these
prod URLs yet.

Adds validate check for target config item

Determines the "environment", e.g. dev/prod
  • Loading branch information
emkll authored and Conor Schaefer committed Jan 25, 2020
1 parent 824e658 commit 17c3ea4
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 23 deletions.
4 changes: 3 additions & 1 deletion dom0/fpf-apt-test-repo.sls
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#
include:
- update.qubes-vm
- sd-default-config
# - sd-default-config

{% from 'sd-default-config.sls' import sdvars with context %}

# That's right, we need to install a package in order to
# configure a repo to install another package
Expand Down
16 changes: 4 additions & 12 deletions dom0/sd-default-config.sls
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
# -*- coding: utf-8 -*-
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :

# DEBUGGING
{% set sd_env = salt['environ.get']('SECUREDROP_ENV', default='dev') %}
# See references:
#
# - https://docs.saltstack.com/en/latest/topics/tutorials/states_pt3.html
#


# Example loading taking from Qubes /srv/salt/top.sls

{% load_yaml as sdvars_defaults %}
{% include "sd-default-config.yml" %}
{% endload %}

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

{% if sd_env == "prod" %}
{% set sdvars = sdvars_defaults['prod'] %}
{% if d.target == "dev" %}
{% set sdvars = sdvars_defaults['dev'] %}
{% else %}
{% set sdvars = sdvars_defaults['dev'] %}
{% set sdvars = sdvars_defaults['prod'] %}
{% endif %}
17 changes: 8 additions & 9 deletions dom0/sd-default-config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
securedrop_defaults:
prod:
dom0_yum_repo_url: "https://yum.securedrop.org/workstation/dom0/f25"
apt_repo_url: "https://apt.freedom.press"
signing_key_filename: "securedrop-release-signing-pubkey.asc"
dev:
dom0_yum_repo_url: "https://yum-test.securedrop.org/workstation/dom0/f25"
apt_repo_url: "https://apt-test-qubes.freedom.press"
signing_key_filename: "apt-test-pubkey.asc"
prod:
dom0_yum_repo_url: "https://yum.securedrop.org/workstation/dom0/f25"
apt_repo_url: "https://apt.freedom.press"
signing_key_filename: "securedrop-release-signing-pubkey.asc"
dev:
dom0_yum_repo_url: "https://yum-test.securedrop.org/workstation/dom0/f25"
apt_repo_url: "https://apt-test-qubes.freedom.press"
signing_key_filename: "apt-test-pubkey.asc"
13 changes: 12 additions & 1 deletion dom0/sd-dom0-files.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@
# Installs dom0 config scripts specific to tracking updates
# over time. These scripts should be ported to an RPM package.
##
# See references:
#
# - https://docs.saltstack.com/en/latest/topics/tutorials/states_pt3.html
#


# Example loading taking from Qubes /srv/salt/top.sls


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
# import vars
- sd-default-config
#
# - sd-default-config

{% from 'sd-default-config.sls' import sdvars with context %}


dom0-rpm-test-key:
Expand Down
9 changes: 9 additions & 0 deletions scripts/validate-config
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class SDWConfigValidator(object):
self.confirm_onion_config_valid()
self.confirm_submission_privkey_file()
self.confirm_submission_privkey_fingerprint()
self.confirm_environment_valid()
self.validate_existing_size()

def confirm_config_file_exists(self):
Expand All @@ -42,6 +43,14 @@ class SDWConfigValidator(object):
msg += "Create from config.json.example"
raise AssertionError(msg)

def confirm_environment_valid(self):
"""
The 'target' config item is required to determine
whether prod or dev URLs are used for installing packages.
"""
assert "target" in self.config
assert self.config["target"] in ("prod", "dev")

def confirm_onion_config_valid(self):
"""
We support both v2 and v3 Onion Services, so if the values
Expand Down
43 changes: 43 additions & 0 deletions sd-workstation/securedrop-release-signing-pubkey.asc
Original file line number Diff line number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