-
Notifications
You must be signed in to change notification settings - Fork 704
Local automated upgrade testing #3075
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
Merged
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
1a917c8
Add grsec debian packages to testing
msheiny e1f0203
Allow Jinja-fication of DEBIAN files, use w/ grsec
msheiny f723a7f
Over-load role rsync options for debian building
msheiny 8da833e
init molecule scen. for kick-starting specifc ver of SD
msheiny d6b5c3b
Install python-vagrant dependency for developers
msheiny 60b342b
Add Initial phase 1 working scenario for upgrade testing
msheiny 33537ed
Add docker apt repo on same net as SD vagrant
msheiny 71b474c
Add jdauphant nginx role
msheiny 67253ac
Ditch docker, utilize vagrant box for apt server
msheiny 8477df6
Ensure direct ssh access is enabled
msheiny 0d174db
Ensure previous version of git is being cloned first
msheiny a7773e3
Diverge from custom aws reboot logic
msheiny 1c48596
Utilize private static IPs
msheiny b19d211
Utilize vagrant insecure key for both servers
msheiny 4c2bb45
Move apt-test keys into ./files dir
msheiny af7c11d
Add apt-test pub key to staging boxes
msheiny 22cd840
Add scenario for vagrant builder
msheiny a84e308
Remove un-used ami-builder scenario
msheiny 54c1f79
Provide make shortcut for vagrant packager
msheiny fb553e0
Add logic to push boxes up to S3
msheiny aeef51e
MiTM our SD apt servers with fake local apt
msheiny 9f396be
Repoint molecule config to use hosted boxes
msheiny d000097
Correct flake8 issues, convert mypy syntax to py2
msheiny f9e8d51
Bump vagrant box versions to retain log files
msheiny d61978a
Fail vagrant package script if preceeding logic bombs
msheiny 306cc32
Strengthen logic to ensure existing instance stands up
msheiny d8c1057
Toggle to pull from apt-test.freedom.press
msheiny 642194b
Resolve missing cron-apt log after reboot
msheiny e7de75d
Fix builder tests for grsec package
msheiny 309feb4
Fix ansible task description typo :)
msheiny 8b14958
Ensure that tor server is enabled upon start-up
msheiny 58625d4
Rename make cmd to be more in-line with other cmds
msheiny 0030841
Rename upgrade_test -> upgrade for science
msheiny 563e1ae
Bump vagrant package logic to use 0.6 release
msheiny 5d3ccbf
Make sure tor starts up on reboot
msheiny f2f7b70
Fork vagrant molecule module to add halt functionality
msheiny 57523bb
Add option for vagrant over-ride
msheiny 89543fe
Upload 0.6 vagrant box, peg upgrade module to it
msheiny bd07e8d
Explicitly disable NFS in upgrade scenario
msheiny 3e63b64
Whoopss - Bump expiration for testing CA
msheiny eb43e00
Symlink vagrant molecule into upgrade scenario
msheiny f75c9cd
Make upgrade side-effect explicitly upgrade deps
msheiny 180826c
Remove fork of molecule_vagrant ansible library
msheiny a013de4
Address pathing issue with latest molecule update
msheiny e9c95f4
Ensure pre 0.7 SD, SSH works localnet after reboot
msheiny 5bd3170
Add additional ignore items to docker build
msheiny a3fdcab
Move flake8 configuration to separate file
msheiny e2e3650
Exclude flake8 NITs
msheiny 094dd0f
Optional - apt as a reverse-proxy to apt-test
msheiny 2d05027
Work-around for testinfra 1.12.0 socket bug
msheiny 1baabc3
Fixes for vagrant_packager + updated molecule
msheiny 4800743
Fix timeout on SD 0.6 vagrant_packager on reboot
msheiny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[flake8] | ||
exclude = | ||
config.py, | ||
.venv/, | ||
journalist_gui/journalist_gui/updaterUI.py, | ||
journalist_gui/journalist_gui/resources_rc.py, | ||
.python3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,3 +147,7 @@ raw-test-output/ | |
|
||
# Ignore visual studio code folder | ||
.vscode | ||
|
||
#Ignore vagrant staging files | ||
*.box | ||
*.img |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
molecule test -s vagrant_packager && \ | ||
# Unfortunately since we need to prompt the user for sudo creds.. | ||
# I had to break the actual vagrant package logic outside of molecule | ||
molecule/vagrant_packager/package.py && \ | ||
molecule destroy -s vagrant_packager | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 33 additions & 2 deletions
35
install_files/ansible-base/roles/build-generic-pkg/tasks/main.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...all_files/securedrop-grsec/DEBIAN/control → ..._files/securedrop-grsec/DEBIAN/control.j2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
Package: securedrop-grsec | ||
Source: securedrop-grsec | ||
Version: 4.4.115 | ||
Version: {{ securedrop_pkg_grsec.ver }} | ||
Architecture: amd64 | ||
Maintainer: SecureDrop Team <[email protected]> | ||
Depends: linux-image-3.14.79-grsec,linux-image-4.4.115-grsec | ||
Depends: {{ securedrop_pkg_grsec.depends }} | ||
Section: admin | ||
Priority: optional | ||
Homepage: https://securedrop.org | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
install_local_packages: false | ||
primary_network_iface: eth0 | ||
ssh_users: vagrant | ||
securedrop_app_install_from_repo: true | ||
allow_direct_access: true | ||
ssh_listening_address: 0.0.0.0 | ||
|
||
monitor_ip: "{{ hostvars['mon-staging']['ansible_'+primary_network_iface].ipv4.address }}" | ||
monitor_hostname: "{{ hostvars['mon-staging'].ansible_hostname }}" | ||
app_ip: "{{ hostvars['app-staging']['ansible_'+primary_network_iface].ipv4.address }}" | ||
app_hostname: "{{ hostvars['app-staging'].ansible_hostname }}" | ||
|
||
etc_hosts: | ||
app-staging: | ||
- reg: ^127.0.0.1 | ||
line: 127.0.0.1 app-staging localhost | ||
- reg: securedrop-monitor-server-alias$ | ||
line: "{{ monitor_ip }} mon-staging securedrop-monitor-server-alias" | ||
mon-staging: | ||
- reg: ^127.0.0.1\s+mon | ||
line: 127.0.0.1 mon-staging localhost | ||
- reg: app-staging$ | ||
line: "{{ app_ip }} app-staging" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
|
||
- name: Configure apt-server | ||
hosts: aptservers | ||
become: yes | ||
tasks: | ||
- name: Establish QA strategy | ||
set_fact: | ||
QA_APTTEST: "{{ lookup('env','QA_APTTEST')|bool }}" | ||
|
||
- import_tasks: local_apt_mirror.yml | ||
- import_tasks: local_apt_with_debs.yml | ||
when: not QA_APTTEST | ||
|
||
vars: | ||
molecule_dir: "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}" | ||
dpkg_dir: /var/repos/debs | ||
rep_dist: trusty | ||
rep_component: main | ||
rep_arch: i386 amd64 | ||
release_file: "/var/repos/base/dists/{{ rep_dist }}/Release" | ||
nginx_sites: | ||
default: | ||
- listen 80 | ||
- root "/var/repos/base" | ||
- location / { autoindex on; } | ||
- location /gpg { alias /var/repos/base/; } | ||
encrypted: | ||
- listen 443 ssl | ||
- server_name apt.freedom.press | ||
- ssl_certificate /etc/ssl/certs/apt_freedom_press.pem | ||
- ssl_certificate_key /etc/ssl/private/apt_freedom_press.priv | ||
- root "/var/repos/base" | ||
- location / { {{ "proxy_pass https://apt-test.freedom.press;" if QA_APTTEST else "autoindex on;" }} } | ||
|
||
- name: Configure apt-server | ||
hosts: securedrop | ||
gather_facts: false | ||
become: yes | ||
tasks: | ||
- block: | ||
- name: Redirect to local QA Apt server | ||
set_fact: | ||
apt_key_bits: | ||
- url: "http://{{ hostvars['apt']['ansible_eth0'].ipv4.address }}/gpg/apt-test.pub" | ||
id: 6D65484B | ||
- url: "http://{{ hostvars['apt']['ansible_eth0'].ipv4.address }}/gpg/apt-test-fpf.pub" | ||
id: 4A3BE4A92211B03C | ||
apt_test_etc_line: "{{ hostvars['apt']['ansible_eth0'].ipv4.address }} apt.freedom.press" | ||
|
||
- name: Install testing apt key to keyring | ||
apt_key: | ||
id: "{{ item.id|default(omit) }}" | ||
url: "{{ item.url|default(omit) }}" | ||
data: "{{ item.data|default(omit) }}" | ||
state: present | ||
with_items: "{{ apt_key_bits }}" | ||
|
||
- name: Redirect apt.freedom.press to local apt server | ||
lineinfile: | ||
path: /etc/hosts | ||
regexp: apt.freedom.press$ | ||
line: "{{ apt_test_etc_line }}" | ||
|
||
- name: Add apt-test CA to CA trusted store | ||
copy: | ||
src: cacert.pub | ||
dest: /usr/local/share/ca-certificates/fpf_test_ca.crt | ||
notify: update ca | ||
tags: apt | ||
|
||
handlers: | ||
- name: update ca | ||
command: update-ca-certificates |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
- import_playbook: sd_clone.yml | ||
|
||
- name: Create | ||
hosts: localhost | ||
connection: local | ||
vars: | ||
molecule_file: "{{ lookup('env', 'MOLECULE_FILE') }}" | ||
molecule_instance_config: "{{ lookup('env', 'MOLECULE_INSTANCE_CONFIG') }}" | ||
molecule_yml: "{{ lookup('file', molecule_file) | molecule_from_yaml }}" | ||
tasks: | ||
|
||
- name: Create molecule instance(s) | ||
molecule_vagrant: | ||
instance_name: "{{ item.name }}" | ||
instance_interfaces: "{{ item.interfaces | default(omit) }}" | ||
instance_raw_config_args: "{{ item.instance_raw_config_args | default(omit) }}" | ||
|
||
platform_box: "{{ item.box }}" | ||
platform_box_version: "{{ item.box_version | default(omit) }}" | ||
platform_box_url: "{{ 'file://'+playbook_dir+'/' if item.box_url|default(false) else '' }}{{ item.box_url | default(omit) }}" | ||
|
||
provider_name: "{{ molecule_yml.driver.provider.name }}" | ||
provider_memory: "{{ item.memory | default(omit) }}" | ||
provider_cpus: "{{ item.cpus | default(omit) }}" | ||
provider_override_args: "{{ item.provider_override_args | default(omit) }}" | ||
provider_raw_config_args: "{{ item.raw_config_args | default(omit) }}" | ||
force_stop: yes | ||
|
||
state: up | ||
register: server | ||
with_items: "{{ molecule_yml.platforms }}" | ||
|
||
# Mandatory configuration for Molecule to function. | ||
|
||
- name: Populate instance config dict | ||
set_fact: | ||
instance_conf_dict: { | ||
'instance': "{{ item.Host }}", | ||
'address': "{{ item.HostName }}", | ||
'user': "{{ item.User }}", | ||
'port': "{{ item.Port }}", | ||
'identity_file': "{{ item.IdentityFile }}", } | ||
with_items: "{{ server.results }}" | ||
register: instance_config_dict | ||
when: server.changed | bool | ||
|
||
- name: Convert instance config dict to a list | ||
set_fact: | ||
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}" | ||
when: server.changed | bool | ||
|
||
- name: Dump instance config | ||
copy: | ||
# NOTE(retr0h): Workaround for Ansible 2.2. | ||
# https://github.com/ansible/ansible/issues/20885 | ||
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}" | ||
dest: "{{ molecule_instance_config }}" | ||
when: server.changed | bool |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Ha, I ran into a similar problem over in freedomofpress/ansible-role-grsecurity-build#31, with
vars_prompt
failing to run in non-interactive mode. I wouldn't hesitate to put logic this simple directly in the Makefile, but no objections here.