Skip to content

Commit

Permalink
Persist signing key in schroot config
Browse files Browse the repository at this point in the history
Take `sbuild-update --keygen` command out of Dockerfile and put into
chroot.

Try to persist keys, since they oughtn't to change (and take a long
time to create).  If found in chroot, copy locally, and vice-versa.

See #9
  • Loading branch information
zultron committed Apr 6, 2015
1 parent 9ade94f commit a3ee06b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ RUN rmdir /etc/schroot/chroot.d && \
# - bind mounts
RUN echo "/srv\t\t/srv\t\tnone\trw,bind\t\t0\t0" \
>> /etc/schroot/default/fstab
# - signing key
RUN sbuild-update --keygen

# - aufs on tmpfs config
ADD schroot-04tmpfs /etc/schroot/setup.d/04tmpfs

Expand Down
1 change: 1 addition & 0 deletions scripts/base-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ GPG_KEY_SERVER=hkp://keys.gnupg.net

# Generated config directory
CONFIG_DIR=$BASE_DIR/configs
GNUPGHOME=$CONFIG_DIR/gpg

# Scripts and configs directories
SCRIPTS_DIR=scripts
Expand Down
1 change: 0 additions & 1 deletion scripts/debian-pkg-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ debug " Sourcing debian-pkg-repo.sh"
deb_repo_init() {
REPO_DIR_ABS=$(readlink -f $REPO_DIR)
debug " Apt repo dir: $REPO_DIR_ABS"
GNUPGHOME=$CONFIG_DIR/gpg
debug " GPG key dir: $GNUPGHOME"
if ! test -f $GNUPGHOME/trustdb.gpg; then
debug " Setting up GPG package signing keys"
Expand Down
25 changes: 25 additions & 0 deletions scripts/sbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@ sbuild_chroot_init() {
fi
}

sbuild_chroot_install_keys() {
if test -f /var/lib/sbuild/apt-keys/sbuild-key.sec; then
if test -f $GNUPGHOME/sbuild-key.sec; then
debug " (sbuild package keys installed; doing nothing)"
else
debug " Copying signing keys from chroot into $GNUPGHOME"
mkdir -p $GNUPGHOME; chmod 700 $GNUPGHOME
cp /var/lib/sbuild/apt-keys/sbuild-key.* $GNUPGHOME
fi
else
if ! test -f $GNUPGHOME/sbuild-key.sec; then
debug " Generating new sbuild keys"
sbuild-update --keygen
mkdir -p $GNUPGHOME; chmod 700 $GNUPGHOME
cp /var/lib/sbuild/apt-keys/sbuild-key.* $GNUPGHOME
else
debug " Copying signing keys from $GNUPGHOME into chroot"
cp $GNUPGHOME/sbuild-key.* /var/lib/sbuild/apt-keys
fi
fi
}

sbuild_chroot_setup() {
msg "Creating sbuild chroot, distro $CODENAME, arch $HOST_ARCH"
sbuild_chroot_init
Expand All @@ -47,6 +69,9 @@ sbuild_chroot_setup() {
# FIXME
#sbuild-adduser 1000

debug " Setting up signing keys"
sbuild_chroot_install_keys

# Remove default apt sources and configure new
> $CHROOT_DIR/etc/apt/sources.list
distro_configure_repos
Expand Down

0 comments on commit a3ee06b

Please sign in to comment.