Skip to content

About

bridge gpg verified files from freedom tech projects to hasheus, such as bitcoin core, lnd, and more

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

hasheus / from gpg

bridge gpg verified files from freedom tech projects to hasheus, such as bitcoin core, lnd, and more.

in the future, the hope is that the authors of these packages start publishing directly to hasheus with their own nostr identity. until then, this collection of shell scripts automates the process of verifying their gpg signed files and publishing under a nostr identity you control.

tinfoil hash runs this on a daily basis.

prerequisites

dependencies

the scheduled run also needs git and perl, and an ai's cli.

packages that download over tor (ashigaru, so far) also need tor, running as a socks proxy on 127.0.0.1:9050. to use another, set TOR_PROXY, like socks5h://127.0.0.1:9150 for tor browser's (it has to be socks5h, so tor resolves onion names). the scheduled run starts and stops tor itself when it isn't already running.

the scripts run on linux, and the scheduled run needs systemd. gh must be logged in (gh auth login, or set GH_TOKEN).

import gpg keys

each verify.sh script lists the fingerprints of the keys it trusts, each with the url it's published at. to import them all from those urls:

./check_keys.sh --import

only the listed key is imported from each url, even when the file has others. without --import, it only reports problems: listed keys that aren't imported or are no longer at their url, and keys in a project's key folder that aren't listed (exit status 1). expired keys are reported as warnings, since only their owners can fix them.

a key can be newer on a keyserver than at its listed url. if one is reported as expired, try refreshing it:

gpg --keyserver hkps://keys.openpgp.org --recv-keys {{fingerprint}}

usage

HASHEUS_PUBLIC_KEY={{npub...}} HASHEUS_SECRET_KEY={{nsec...}} ./verify_all.sh

hasheus publishes with the secret key, which has to be an nsec, since an ncryptsec asks for its password. it looks up which files are already published by the public key, so the two have to match, and the public key needs a nostr profile. both use hasheus's default relays, unless HASHEUS_FILE_RELAY_URLS and HASHEUS_USER_RELAY_URLS point elsewhere, like a local relay for testing.

to verify an individual package:

HASHEUS_PUBLIC_KEY={{npub...}} HASHEUS_SECRET_KEY={{nsec...}} ./packages/{{name}}/verify.sh

on the first run, only the last 3 releases of a package are verified. subsequent runs verify up to 30 releases since the previous run. the date/time of the last release verified is stored in ~/.config/hasheus-from-gpg/{{name}}.

a release whose signature isn't from a listed key (or, for projects that sign each file, a file whose signature isn't) stops that package's run without being recorded, so it's tried again on the next run. so does a github release from the last day that's still missing its hashes or signatures, since projects can publish a release before its files are uploaded; an older one is skipped. a file that fails its hash check or has a bad signature isn't published, but it doesn't block the package: the release's other files are published, the release is recorded so the next run checks later releases, and the run exits 1 so the skipped file is reported. a signature only counts if its key isn't revoked and the signature was made before the key's expiry date. gpg only knows a key's current expiry date, so if a key lapses and its owner extends it, signatures made during the lapse count too.

dry run

a dry run does everything except publish events and record the last release, so it's safe to run anywhere. any DRY_RUN value but 0 means a dry run. it only reads from the relay, so it only needs your public key:

DRY_RUN=1 HASHEUS_PUBLIC_KEY={{npub...}} ./verify_all.sh

scheduled run

scheduled_run runs every package on a schedule with a systemd user timer (daily by default) and has an ai triage the results: it opens issues for upstream maintainers, opens fix prs, and opens an issue with each run's summary. its readme covers the requirements and settings. to install it:

./scheduled_run/install.sh

development

tests

the tests use bats. fake gh, hasheus, and curl (in test/fakes) serve fixtures, and gpg keys are generated for each run, so the tests never touch the network or the relay.

the checks also need actionlint, shellcheck, and shfmt.

bats test

linting & formatting

shfmt formats the scripts, with its settings in .editorconfig. shellcheck lints every file shfmt finds, and actionlint lints the workflows, including shellcheck on their scripts.

shfmt -d .
shfmt -f . | xargs shellcheck
actionlint

nothing else checks line length, so ci also fails on lines over 80 characters (lines with a url are exempt):

{ shfmt -f .; ls .github/workflows/*.yml; } | tr '\n' '\0' | xargs -0 awk 'length > 80 && !/:\/\// { print FILENAME ":" FNR ": over 80 characters"; failed = 1 } END { exit failed }'

to fix formatting:

shfmt -w .

About

bridge gpg verified files from freedom tech projects to hasheus, such as bitcoin core, lnd, and more

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages