Debian Packaging: From Source to Repository

Publishing and Signing the Repository

A practical Debian packaging course lesson covering publishing and signing the repository.

Publishing and Signing the Repository

A local aptly repository is not yet available to APT clients. To distribute packages, we need to publish it, generate repository metadata, and sign that metadata with a key trusted by clients.

In this lesson, we will publish our Syspeek snapshot and understand the signing process.

Learning Objectives

  • Understand aptly publication.
  • Prepare a signing key.
  • Publish a repository snapshot.
  • Inspect generated repository metadata.
  • Understand how a web server can expose the published files.

1. Check the Snapshot

List the available snapshots:

1
aptly snapshot list

Inspect the snapshot created in the previous lesson:

1
aptly snapshot show syspeek-0.1.0

Make sure it contains the expected Syspeek package.

2. Prepare a GPG Signing Key

List your secret keys:

1
gpg --list-secret-keys --keyid-format long

Choose the key you will use to sign repository metadata.

Record its full fingerprint:

1
gpg --fingerprint

Do not publish your private key. The public key is what clients need in order to verify repository signatures.

For a production repository, use a dedicated signing key with an appropriate lifecycle and secure backup strategy.

3. Publish the Snapshot

Publish the snapshot:

1
2
3
4
5
aptly publish snapshot \
    -distribution=trixie \
    -component=main \
    -gpg-key=YOUR_KEY_FINGERPRINT \
    syspeek-0.1.0

Replace YOUR_KEY_FINGERPRINT with the actual fingerprint of your signing key.

If you are only experimenting and do not yet have a signing key, you can publish without signing for a temporary local test, but do not distribute an unsigned repository as a trusted production repository.

4. Inspect the Published Files

aptly publishes files under its configured public directory, commonly:

1
~/.aptly/public/

Inspect it:

1
find ~/.aptly/public -maxdepth 5 -type f | sort

You should find Release metadata and package indexes under dists/, along with package files under pool/.

A signed repository commonly contains an InRelease file and may also contain Release and Release.gpg.

5. Expose the Repository

The published directory can be served by a web server such as nginx or Apache.

For a quick local experiment, aptly also provides a simple server:

1
aptly serve

This is suitable for local testing, not as a hardened public production service.

For public use, configure a real web server, use HTTPS, restrict write access, and publish only the intended repository directory.

6. Export the Public Key

Export the public key in ASCII-armored form:

1
2
gpg --armor --export YOUR_KEY_FINGERPRINT \
    > syspeek-archive-key.asc

Users need this public key to verify repository metadata.

Before distributing it, communicate its fingerprint through a separate trusted channel so users can verify that they obtained the intended key.

7. Security Considerations

  • Keep the private key off the public web server.
  • Limit who can publish packages.
  • Use HTTPS for transport.
  • Protect the signing key with a strong passphrase and secure backup.
  • Review package contents before publication.
  • Do not overwrite a published release without a deliberate release process.

8. What We Learned

We published an aptly snapshot, signed repository metadata, inspected the generated files, and exported the public key for clients.

Exercises

  1. Inspect the InRelease file.
  2. Verify its signature using GPG.
  3. Record the signing key fingerprint.
  4. Explain why HTTPS and repository signatures solve different security problems.

What’s Next?

The final lesson will configure an APT client to trust our repository, install Syspeek through APT, and verify that upgrades work.

Next: Installing and Updating Syspeek