Skip to content

Commit

Permalink
Update generate-and-sign to use forked scripts
Browse files Browse the repository at this point in the history
Same commands, just less moving of files around.
  • Loading branch information
legoktm committed Dec 18, 2023
1 parent 49b77f5 commit 6f83cc1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 35 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ private.pem
test-key.jwk
public.pem

# Ignore upstream EFF repo
https-everywhere/
# Generated files
rulesets/default.rulesets
rulesets/default.rulesets.json

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
35 changes: 3 additions & 32 deletions scripts/generate-and-sign
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,15 @@
#
# 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
set -euo pipefail

# 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
python3 upstream/merge-rulesets.py --source_dir rulesets
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}/"* .
./upstream/async-request.sh public_release.pem .

echo "Updating index for SecureDrop rules..."
./update_index.sh
Expand Down
2 changes: 1 addition & 1 deletion upstream/async-request.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ $# -ne 2 ]; then
fi


RULESETS_FILE=rules/default.rulesets
RULESETS_FILE=rulesets/default.rulesets

SIGNED_SHA256SUM_BASE64=`mktemp /tmp/ruleset-signature.sha256.base64.XXXXXXXX`
trap 'rm $SIGNED_SHA256SUM_BASE64' EXIT
Expand Down

0 comments on commit 6f83cc1

Please sign in to comment.