mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Add Version back to sig files
This commit is contained in:
@@ -51,22 +51,61 @@ manager_check() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
manager_check
|
manager_check
|
||||||
|
|
||||||
|
# Let's make sure we have the public key
|
||||||
|
curl -sSL https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/master/KEYS | gpg --import -
|
||||||
|
|
||||||
|
CONTAINER_REGISTRY=quay.io
|
||||||
|
SIGNPATH=/root/sosigs
|
||||||
|
rm -rf $SIGNPATH
|
||||||
|
mkdir -p $SIGNPATH
|
||||||
|
if [ -z "$BRANCH" ]; then
|
||||||
|
BRANCH="master"
|
||||||
|
fi
|
||||||
|
|
||||||
VERSION=$(lookup_pillar soversion)
|
VERSION=$(lookup_pillar soversion)
|
||||||
# Modify global.sls to enable Features
|
# Modify global.sls to enable Features
|
||||||
sed -i 's/features: False/features: True/' $local_salt_dir/pillar/global.sls
|
|
||||||
SUFFIX="-features"
|
SUFFIX="-features"
|
||||||
TRUSTED_CONTAINERS=( \
|
TRUSTED_CONTAINERS=( \
|
||||||
"so-elasticsearch:$VERSION$SUFFIX" \
|
"so-elasticsearch" \
|
||||||
"so-filebeat:$VERSION$SUFFIX" \
|
"so-filebeat" \
|
||||||
"so-kibana:$VERSION$SUFFIX" \
|
"so-kibana" \
|
||||||
"so-logstash:$VERSION$SUFFIX" )
|
"so-logstash" )
|
||||||
|
|
||||||
for i in "${TRUSTED_CONTAINERS[@]}"
|
for i in "${TRUSTED_CONTAINERS[@]}"
|
||||||
do
|
do
|
||||||
# Pull down the trusted docker image
|
# Pull down the trusted docker image
|
||||||
echo "Downloading $i"
|
echo "Downloading $i"
|
||||||
docker pull --disable-content-trust=false docker.io/$IMAGEREPO/$i
|
docker pull $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION$SUFFIX
|
||||||
# Tag it with the new registry destination
|
|
||||||
docker tag $IMAGEREPO/$i $HOSTNAME:5000/$IMAGEREPO/$i
|
# Get signature
|
||||||
docker push $HOSTNAME:5000/$IMAGEREPO/$i
|
curl https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/$BRANCH/sigs/images/$VERSION/$i:$VERSION$SUFFIX.sig --output $SIGNPATH/$i:$VERSION$SUFFIX.sig
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Unable to pull signature file for $i:$VERSION$SUFFIX"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Dump our hash values
|
||||||
|
DOCKERINSPECT=$(docker inspect $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION$SUFFIX)
|
||||||
|
|
||||||
|
echo "$DOCKERINSPECT" | jq ".[0].RepoDigests[] | select(. | contains(\"$CONTAINER_REGISTRY\"))" > $SIGNPATH/$i:$VERSION$SUFFIX.txt
|
||||||
|
echo "$DOCKERINSPECT" | jq ".[0].Created, .[0].RootFS.Layers" >> $SIGNPATH/$i:$VERSION$SUFFIX.txt
|
||||||
|
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Unable to inspect $i:$VERSION:$SUFFIX"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
GPGTEST=$(gpg --verify $SIGNPATH/$i:$VERSION$SUFFIX.sig $SIGNPATH/$i:$VERSION$SUFFIX.txt 2>&1)
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
# Tag it with the new registry destination
|
||||||
|
docker tag $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION$SUFFIX $HOSTNAME:5000/$IMAGEREPO/$i:$VERSION$SUFFIX
|
||||||
|
docker push $HOSTNAME:5000/$IMAGEREPO/$i:$VERSION$SUFFIX
|
||||||
|
else
|
||||||
|
echo "There is a problem downloading the $i:$VERSION$SUFFIX image. Details: "
|
||||||
|
echo ""
|
||||||
|
echo $GPGTEST
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
sed -i 's/features: False/features: True/' $local_salt_dir/pillar/global.sls
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ update_docker_containers() {
|
|||||||
docker pull $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION
|
docker pull $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION
|
||||||
|
|
||||||
# Get signature
|
# Get signature
|
||||||
curl https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/$BRANCH/sigs/images/$VERSION/$i.sig --output $SIGNPATH/$i.sig
|
curl https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/$BRANCH/sigs/images/$VERSION/$i:$VERSION.sig --output $SIGNPATH/$i:$VERSION.sig
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Unable to pull signature file for $i:$VERSION"
|
echo "Unable to pull signature file for $i:$VERSION"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -114,14 +114,14 @@ update_docker_containers() {
|
|||||||
# Dump our hash values
|
# Dump our hash values
|
||||||
DOCKERINSPECT=$(docker inspect $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION)
|
DOCKERINSPECT=$(docker inspect $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION)
|
||||||
|
|
||||||
echo "$DOCKERINSPECT" | jq ".[0].RepoDigests[] | select(. | contains(\"$CONTAINER_REGISTRY\"))" > $SIGNPATH/$i.txt
|
echo "$DOCKERINSPECT" | jq ".[0].RepoDigests[] | select(. | contains(\"$CONTAINER_REGISTRY\"))" > $SIGNPATH/$i:$VERSION.txt
|
||||||
echo "$DOCKERINSPECT" | jq ".[0].Created, .[0].RootFS.Layers" >> $SIGNPATH/$i.txt
|
echo "$DOCKERINSPECT" | jq ".[0].Created, .[0].RootFS.Layers" >> $SIGNPATH/$i:$VERSION.txt
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Unable to inspect $i:$VERSION"
|
echo "Unable to inspect $i:$VERSION"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
GPGTEST=$(gpg --verify $SIGNPATH/$i.sig $SIGNPATH/$i.txt 2>&1)
|
GPGTEST=$(gpg --verify $SIGNPATH/$i:$VERSION.sig $SIGNPATH/$i:$VERSION.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:$VERSION $HOSTNAME:5000/$IMAGEREPO/$i:$VERSION
|
docker tag $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION $HOSTNAME:5000/$IMAGEREPO/$i:$VERSION
|
||||||
|
|||||||
@@ -952,7 +952,7 @@ docker_seed_registry() {
|
|||||||
docker pull $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION
|
docker pull $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION
|
||||||
|
|
||||||
# Get signature
|
# Get signature
|
||||||
curl https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/$BRANCH/sigs/images/$VERSION/$i.sig --output $SIGNPATH/$i.sig
|
curl https://raw.githubusercontent.com/Security-Onion-Solutions/securityonion/$BRANCH/sigs/images/$VERSION/$i:$VERSION.sig --output $SIGNPATH/$i:$VERSION.sig
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Unable to pull signature file for $i:$VERSION"
|
echo "Unable to pull signature file for $i:$VERSION"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -960,14 +960,14 @@ docker_seed_registry() {
|
|||||||
# Dump our hash values
|
# Dump our hash values
|
||||||
DOCKERINSPECT=$(docker inspect $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION)
|
DOCKERINSPECT=$(docker inspect $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION)
|
||||||
|
|
||||||
echo "$DOCKERINSPECT" | jq ".[0].RepoDigests[] | select(. | contains(\"$CONTAINER_REGISTRY\"))" > $SIGNPATH/$i.txt
|
echo "$DOCKERINSPECT" | jq ".[0].RepoDigests[] | select(. | contains(\"$CONTAINER_REGISTRY\"))" > $SIGNPATH/$i:$VERSION.txt
|
||||||
echo "$DOCKERINSPECT" | jq ".[0].Created, .[0].RootFS.Layers" >> $SIGNPATH/$i.txt
|
echo "$DOCKERINSPECT" | jq ".[0].Created, .[0].RootFS.Layers" >> $SIGNPATH/$i:$VERSION.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.sig $SIGNPATH/$i.txt 2>&1)
|
GPGTEST=$(gpg --verify $SIGNPATH/$i:$VERSION.sig $SIGNPATH/$i:$VERSION.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:$VERSION $HOSTNAME:5000/$IMAGEREPO/$i:$VERSION
|
docker tag $CONTAINER_REGISTRY/$IMAGEREPO/$i:$VERSION $HOSTNAME:5000/$IMAGEREPO/$i:$VERSION
|
||||||
|
|||||||
Reference in New Issue
Block a user