mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 01:32:47 +01:00
Hash and sig update
This commit is contained in:
@@ -101,18 +101,18 @@ update_docker_containers() {
|
|||||||
docker pull $CONTAINER_REGISTRY/$IMAGEREPO/$i
|
docker pull $CONTAINER_REGISTRY/$IMAGEREPO/$i
|
||||||
|
|
||||||
# Get signature
|
# Get signature
|
||||||
curl https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/$BRANCH/sigs/images/$i.gpg --output $SIGNPATH/$i.gpg
|
curl https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/$BRANCH/sigs/images/$i.sig --output $SIGNPATH/$i.gpg
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Unable to pull signature file for $i"
|
echo "Unable to pull signature file for $i"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Dump our hash values
|
# Dump our hash values
|
||||||
docker inspect $CONTAINER_REGISTRY/$IMAGEREPO/$i | jq '.[0].Created, .[0].Id, .[0].Size, .[0].RootFS.Layers' > $SIGNPATH/$i.txt
|
docker inspect $CONTAINER_REGISTRY/$IMAGEREPO/$i | jq '.[0].Created, .[0].RepoDigests, .[0].Size, .[0].RootFS.Layers' > $SIGNPATH/$i.txt
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Unable to inspect $i"
|
echo "Unable to inspect $i"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
GPGTEST=$(gpg --verify $SIGNPATH/$i.gpg $SIGNPATH/$i.txt 2>&1)
|
GPGTEST=$(gpg --verify $SIGNPATH/$i.sig $SIGNPATH/$i.txt 2>&1)
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
# Tag it with the new registry destination
|
# Tag it with the new registry destination
|
||||||
docker tag $CONTAINER_REGISTRY/$IMAGEREPO/$i $HOSTNAME:5000/$IMAGEREPO/$i
|
docker tag $CONTAINER_REGISTRY/$IMAGEREPO/$i $HOSTNAME:5000/$IMAGEREPO/$i
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ source ./so-whiptail
|
|||||||
source ./so-variables
|
source ./so-variables
|
||||||
source ./so-common-functions
|
source ./so-common-functions
|
||||||
|
|
||||||
|
CONTAINER_REGISTRY=quay.io
|
||||||
|
|
||||||
SOVERSION=$(cat ../VERSION)
|
SOVERSION=$(cat ../VERSION)
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
@@ -932,21 +934,47 @@ docker_seed_registry() {
|
|||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
local percent=25
|
local percent=25
|
||||||
|
# Let's make sure we have the public key
|
||||||
|
curl -sSL https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/master/KEYS | gpg --import -
|
||||||
|
|
||||||
|
SIGNPATH=/root/sosigs
|
||||||
|
rm -rf $SIGNPATH
|
||||||
|
mkdir -p $SIGNPATH
|
||||||
|
if [ -z "$BRANCH" ]; then
|
||||||
|
BRANCH="master"
|
||||||
|
fi
|
||||||
for i in "${TRUSTED_CONTAINERS[@]}"; do
|
for i in "${TRUSTED_CONTAINERS[@]}"; do
|
||||||
if [ "$install_type" != 'HELIXSENSOR' ]; then ((percent=percent+1)); else ((percent=percent+6)); fi
|
if [ "$install_type" != 'HELIXSENSOR' ]; then ((percent=percent+1)); else ((percent=percent+6)); fi
|
||||||
# Pull down the trusted docker image
|
# Pull down the trusted docker image
|
||||||
set_progress_str "$percent" "Downloading $i"
|
set_progress_str "$percent" "Downloading $i"
|
||||||
{
|
{
|
||||||
|
echo "Downloading $i"
|
||||||
if ! docker pull --disable-content-trust=false docker.io/$IMAGEREPO/"$i"; then
|
docker pull $CONTAINER_REGISTRY/$IMAGEREPO/$i
|
||||||
sleep 5
|
|
||||||
docker pull --disable-content-trust=false docker.io/$IMAGEREPO/"$i"
|
# Get signature
|
||||||
fi
|
curl https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/$BRANCH/sigs/images/$i.sig --output $SIGNPATH/$i.gpg
|
||||||
# Tag it with the new registry destination
|
if [[ $? -ne 0 ]]; then
|
||||||
docker tag $IMAGEREPO/"$i" "$HOSTNAME":5000/$IMAGEREPO/"$i"
|
echo "Unable to pull signature file for $i"
|
||||||
docker push "$HOSTNAME":5000/$IMAGEREPO/"$i"
|
exit 1
|
||||||
#docker rmi $IMAGEREPO/"$i"
|
fi
|
||||||
} >> "$setup_log" 2>&1
|
# Dump our hash values
|
||||||
|
docker inspect $CONTAINER_REGISTRY/$IMAGEREPO/$i | jq '.[0].Created, .[0].RepoDigests, .[0].Size, .[0].RootFS.Layers' > $SIGNPATH/$i.txt
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Unable to inspect $i"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
GPGTEST=$(gpg --verify $SIGNPATH/$i.sig $SIGNPATH/$i.txt 2>&1)
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
# Tag it with the new registry destination
|
||||||
|
docker tag $CONTAINER_REGISTRY/$IMAGEREPO/$i $HOSTNAME:5000/$IMAGEREPO/$i
|
||||||
|
docker push $HOSTNAME:5000/$IMAGEREPO/$i
|
||||||
|
else
|
||||||
|
echo "There is a problem downloading the $i image. Details: "
|
||||||
|
echo ""
|
||||||
|
echo $GPGTEST
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
} >> "$setup_log" 2>&1
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
tar xvf /nsm/docker-registry/docker/registry.tar -C /nsm/docker-registry/docker >> "$setup_log" 2>&1
|
tar xvf /nsm/docker-registry/docker/registry.tar -C /nsm/docker-registry/docker >> "$setup_log" 2>&1
|
||||||
|
|||||||
Reference in New Issue
Block a user