Skip to content

Commit 9049c4a

Browse files
committed
Extend default debian/gbp.conf with extra security config tips
When creating a new package, populate the git-buildpackage with additional configs and in-line comments on why and how to use them. This will make go packaging easier, more consistent and more secure as the best practices flow to all packages via good defaults. Also add comment to explain why pristine-tar is beneficial.
1 parent 568ca8e commit 9049c4a

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

template.go

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,40 @@ func writeDebianGbpConf(dir string, dep14, pristineTar bool) error {
341341
fmt.Fprintf(f, "dist = DEP14\n")
342342
}
343343
if pristineTar {
344-
fmt.Fprintf(f, "pristine-tar = True\n")
344+
fmt.Fprintf(f, `
345+
# Always use pristine tar to improve supply chain security and auditability
346+
pristine-tar = True
347+
348+
`)
345349
}
350+
351+
// Additional text to the template which is useful for 99% of the go packages
352+
fmt.Fprint(f, `
353+
# Lax requirement to use branch name 'debian/latest' so that git-buildpackage
354+
# will always build using the currently checked out branch as the Debian branch.
355+
# This makes it easier for contributors to work with feature and bugfix
356+
# branches.
357+
ignore-branch = True
358+
359+
# Configure the upstream tag format below, so that 'gbp import-orig' will run
360+
# correctly, and link tarball import branch ('upstream/latest') with the
361+
# equivalent upstream release tag, showing a complete audit trail of what
362+
# upstream released and what was imported into Debian.
363+
#
364+
# Most Go packages have tags of form 'v1.0.0'
365+
upstream-vcs-tag = v%(version%~%-)s
366+
367+
# If upstream publishes tarball signatures, git-buildpackage will by default
368+
# import and use the them. Change this to 'on' to make 'gbp import-orig' abort
369+
# if the signature is not found or is not valid.
370+
#
371+
# Most Go packages don't publish signatures for the tarball releases, so this is
372+
# not enabled by default.
373+
#upstream-signatures = on
374+
375+
# Ensure the Debian maintainer signs git tags automatically
376+
sign-tags = True
377+
`)
346378
return nil
347379
}
348380

0 commit comments

Comments
 (0)