Skip to content

Commit

Permalink
Switch to secure APT
Browse files Browse the repository at this point in the history
http://packages.maruos.com/debian now uses signed Release files so we
can drop the --allow-unauthenticated flag and cryptographically verify
packages against the Maru signing key.

Signed-off-by: Preetam D'Souza <preetamjdsouza@gmail.com>
  • Loading branch information
pdsouza committed May 26, 2017
1 parent 89195ff commit 0b9be9e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
24 changes: 20 additions & 4 deletions blueprint/debian/chroot-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#

set -e
set -u

readonly RECOMMENDS_MIN="xfce4-terminal
vim-tiny
Expand All @@ -37,7 +38,7 @@ install () {
dpkg -i maru_* || true

# install all missing packages in "Depends"
apt-get -y --allow-unauthenticated install -f
apt-get -y install -f
}

install_minimal () {
Expand All @@ -48,7 +49,7 @@ install_minimal () {
dpkg -i maru_* || true

# install all missing packages in "Depends"
apt-get -y --allow-unauthenticated install --no-install-recommends -f
apt-get -y install --no-install-recommends -f

# HACK for now to skip libreoffice launcher icons
mv /home/maru/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel-minimal.xml \
Expand All @@ -57,11 +58,11 @@ install_minimal () {
}

OPT_MINIMAL=false
while true; do
while [ $# -gt 0 ]; do
case "$1" in
-m|--minimal) OPT_MINIMAL=true; shift ;;
--) shift; break ;;
*-) echo >&2 "Unrecognized option $1"; exit 2 ;;
-*) echo >&2 "Unrecognized option $1"; exit 2 ;;
*) break;
esac
done
Expand All @@ -84,12 +85,23 @@ fi

apt-get clean && apt-get update

# add maru apt repository for installing dependencies
apt-get install -y curl
curl -fsSL https://maruos.com/static/gpg.txt | apt-key add -
cat > /etc/apt/sources.list.d/maruos.list <<EOF
deb http://packages.maruos.com/debian testing/
EOF
apt-get update

if [ "$OPT_MINIMAL" = true ] ; then
install_minimal
else
install
fi

# delete maru apt repository for now (upgrades not tested)
rm /etc/apt/sources.list.d/maruos.list

# get rid of xscreensaver and annoying warning
apt-get -y purge xscreensaver xscreensaver-data

Expand All @@ -105,5 +117,9 @@ apt-get clean
# clean package lists (this can be recreated with apt-get update)
rm -rf /var/lib/apt/lists/*

#
# final prep
#

# root acount is unnecessary since default account + sudo is all set up
passwd -dl root
11 changes: 0 additions & 11 deletions blueprint/debian/plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ readonly BLUEPRINT_NAME="DEBIAN"
readonly DEFAULT_RELEASE="jessie"
readonly DEFAULT_ARCH="armhf"

readonly DEFAULT_MARU_RELEASE="testing"

# tweaks to upstream template, must be absolute path
# note: this is only used because older versions of LXC do not support
# cross-debootstrapping in the debian template
Expand Down Expand Up @@ -84,11 +82,6 @@ EOF
# make sure we have a dynamic mirror for installing packages
cat > "${rootfs}/etc/apt/sources.list" <<EOF
deb http://httpredir.debian.org/debian ${release} main
EOF

# add maru apt repository for installing dependencies
cat > "${rootfs}/etc/apt/sources.list.d/maruos.list" <<EOF
deb http://packages.maruos.com/debian ${DEFAULT_MARU_RELEASE}/
EOF

# disable any default.target
Expand Down Expand Up @@ -116,10 +109,6 @@ EOF
fi

chroot "$rootfs" bash -c "cd /tmp && ./${CHROOT_SCRIPT} $script_args"

# delete maru apt repository for now (upgrades not tested)
rm "${rootfs}/etc/apt/sources.list.d/maruos.list"

}

blueprint_build () {
Expand Down

0 comments on commit 0b9be9e

Please sign in to comment.