Skip to content

feat: add support for signing archlinux packages#1065

Open
flecno wants to merge 2 commits into
goreleaser:mainfrom
flecno:sign-archlinux-packages
Open

feat: add support for signing archlinux packages#1065
flecno wants to merge 2 commits into
goreleaser:mainfrom
flecno:sign-archlinux-packages

Conversation

@flecno

@flecno flecno commented Apr 3, 2026

Copy link
Copy Markdown

Archlinux packages can now be signed with a detached PGP signature, producing a binary .sig file alongside the package — matching the format expected by pacman-key --verify.

The signing reads back the finalized .pkg.tar.zst from disk via info.Target to avoid buffering the entire package in memory. The passphrase is taken from $NFPM_ARCHLINUX_PASSPHRASE with a fallback to $NFPM_PASSPHRASE, consistent with deb/rpm/apk.

Also adds sign.PGPDetachedSignWithKeyID, a streaming variant of PGPSignerWithKeyID that accepts an io.Reader instead of []byte.

See #628

@pull-request-size pull-request-size Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 3, 2026
Comment thread internal/sign/pgp.go
@flecno flecno force-pushed the sign-archlinux-packages branch 2 times, most recently from b1a4386 to 2cebadb Compare April 4, 2026 22:28
@flecno

flecno commented Apr 8, 2026

Copy link
Copy Markdown
Author

@Elara6331 Do you want to take a look at this?

@flecno

flecno commented Apr 27, 2026

Copy link
Copy Markdown
Author

@caarlos0 Is there any chance to get this reviewed and merged? It's a very straight forward change

@caarlos0 caarlos0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good overall, a couple of comments though.

thanks for the PR 🙏🏻

Comment thread arch/arch.go
Comment thread internal/sign/pgp.go
key, err := readSigningKey(keyFile, passphrase)
sig, err := PGPArmoredDetachSignWithKeyID(bytes.NewReader(data), keyFile, passphrase, hexKeyID)
if err != nil {
return nil, &nfpm.ErrSigningFailure{Err: err}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing the error types returned is a breaking change. I don't think its really necessary...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't change the error type here. This is the helper function used as RPM signer that wraps the error. Maybe we should extract it to the RPM module?

Comment thread internal/sign/pgp.go
DefaultHash: crypto.SHA256,
},
); err != nil {
return nil, &nfpm.ErrSigningFailure{Err: err}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment thread arch/arch.go
Comment thread arch/arch.go Outdated
@flecno

flecno commented May 4, 2026

Copy link
Copy Markdown
Author

Thanks! I'll go over it in the next few days

@flecno flecno force-pushed the sign-archlinux-packages branch 2 times, most recently from 3b0eeb6 to 62030db Compare June 20, 2026 15:29
flecno added 2 commits June 20, 2026 17:32
Archlinux packages can now be signed with a detached PGP signature,
producing a binary .sig file alongside the package — matching the
format expected by pacman-key --verify.

The signing reads back the finalized .pkg.tar.zst from disk via
info.Target to avoid buffering the entire package in memory.
The passphrase is taken from $NFPM_ARCHLINUX_PASSPHRASE with a
fallback to $NFPM_PASSPHRASE, consistent with deb/rpm/apk.

Also adds sign.PGPDetachedSignWithKeyID, a streaming variant of
PGPSignerWithKeyID that accepts an io.Reader instead of []byte.

See goreleaser#628
@flecno flecno force-pushed the sign-archlinux-packages branch from 62030db to 4494ec6 Compare June 20, 2026 15:32
@flecno

flecno commented Jun 20, 2026

Copy link
Copy Markdown
Author

@caarlos0 I rebased the branch, fixed your comments and the lint errors and added an acceptance test for signed Arch Linux packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants