-
Notifications
You must be signed in to change notification settings - Fork 3
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
Creates scripts for regenerating rulesets #23
Changes from all commits
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,53 @@ | ||
#!/bin/bash | ||
# Utility script to generate the SecureDrop HTTPS Everywhere rulesets, | ||
# used for managing Onion Names for SecureDrop instances. | ||
# | ||
# Much of the business logic is taken verbatim from the EFF HTTPSE repo: | ||
# | ||
# https://github.com/EFForg/https-everywhere/blob/master/docs/en_US/ruleset-update-channels.md#signing | ||
# | ||
set -e | ||
set -u | ||
set -o pipefail | ||
|
||
|
||
# We need the upstream repo by EFF for a few select scripts. | ||
https_everywhere_repo="https-everywhere" | ||
if [[ ! -d "$https_everywhere_repo" ]]; then | ||
echo "Cloning upstream https-everywhere repo for scripts..." | ||
echo "WARNING: Can take a long time! ~10m even on fast connections." | ||
git clone https://github.com/EFForg/https-everywhere | ||
else | ||
echo "Found https-everywhere repo locally, reusing..." | ||
fi | ||
|
||
# Generate the SD rulesets | ||
echo "Generating SecureDrop Onion Name rulesets..." | ||
python3 sddir.py | ||
|
||
# The EFF scripts require paths to be relative, so copy into subdirs. | ||
echo "Copying SecureDrop Onion Name rulesets ..." | ||
rm -f "${https_everywhere_repo}/rules/"*.xml | ||
cp rulesets/*.xml "${https_everywhere_repo}/rules/" | ||
cp public_release.pem "${https_everywhere_repo}/" | ||
|
||
# Switch to upstream subdir, for access to tooling | ||
pushd "$https_everywhere_repo" | ||
sd_rules_dir="securedrop-rules" | ||
rm -rf "$sd_rules_dir" | ||
mkdir "$sd_rules_dir" | ||
python3 utils/merge-rulesets.py | ||
echo "Preparing rulesets for airgapped signature request..." | ||
./utils/sign-rulesets/async-request.sh public_release.pem "$sd_rules_dir" | ||
|
||
# Return to SD ruleset repo root | ||
popd | ||
echo "Copying rules to SecureDrop ruleset repo..." | ||
cp -v "${https_everywhere_repo}/${sd_rules_dir}/"* . | ||
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. I think there's one last step (that is always forgotten): update_index.sh which will update index.html 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. Aye, I've forgotten that one too. Opened #21 so CI nags us about it, but let's just add it to the script to avoid in the future. 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. Done. 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: git adding the files could potentially be useful here 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. Should have been more explicit: I agree with you that adding would be helpful, but adding via glob right now may introduce problems given #20 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. Added some helpful messaging to the script with instructions on next steps. Not automatically 'git add'ing due to #20, but still an improvement, thanks for recommending. |
||
|
||
echo "Updating index for SecureDrop rules..." | ||
./update_index.sh | ||
|
||
echo "Finished. Please review local changes, and commit as appropriate." | ||
# TODO: Not automatically running 'git add *' due to | ||
# https://github.com/freedomofpress/securedrop-https-everywhere-ruleset/issues/20 |
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.
this won't update/pull latest changes to the ruleset merge logic and the signing script, but i think it's fine given our test plan usually consists of the reviewer adding a new channel in the browser.