From 710125cc4c725afcbd29653f307010b0a0d5977c Mon Sep 17 00:00:00 2001
From: Igor Witz <igor.witz@etu.utc.fr>
Date: Wed, 29 May 2019 14:05:16 +0200
Subject: [PATCH] Update pica-etherpad/clair-whitelist.yml, decrypt-secrets.sh
 files

---
 decrypt-secrets.sh                | 13 +++++++++----
 pica-etherpad/clair-whitelist.yml |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/decrypt-secrets.sh b/decrypt-secrets.sh
index 4cd80593..f6241001 100644
--- a/decrypt-secrets.sh
+++ b/decrypt-secrets.sh
@@ -1,8 +1,14 @@
 #!/bin/sh
 
 # import the PGP key for the right environment
-echo "$PRIVATE_GPG_KEY_TEST" > /tmp/test
-cat  /tmp/test | gpg --import
+if [ $PICA_ENVIRONMENT -eq "TEST" ];
+then
+    echo "$PRIVATE_GPG_KEY_TEST" > /tmp/pgp-key
+elif [ $PICA_ENVIRONMENT -eq "PRODUCTION" ]
+else
+    exit -1
+fi
+cat  /tmp/pgp-key | gpg --import
 
 # decrypt the secrets
 SECRETS_PATH=$MODIFIED_IMAGE/secrets/encrypted-variables-$(echo $PICA_ENVIRONMENT | tr '[:upper:]' '[:lower:]')
@@ -17,7 +23,6 @@ do
         SECRET_NAME=$(basename $encrypted_secret) 
         ( echo -n "$SECRET_NAME=" ; gpg --quiet  --decrypt  $encrypted_secret ) >> $MODIFIED_IMAGE/secrets/$CONTAINER_NAME.secrets
     done
-    cat $MODIFIED_IMAGE/secrets/$CONTAINER_NAME.secrets
 done
 
-ls -al $MODIFIED_IMAGE/secrets/
+ls -al pica-etherpad/secrets/
\ No newline at end of file
diff --git a/pica-etherpad/clair-whitelist.yml b/pica-etherpad/clair-whitelist.yml
index 3e2f6a71..4fafe750 100644
--- a/pica-etherpad/clair-whitelist.yml
+++ b/pica-etherpad/clair-whitelist.yml
@@ -20,4 +20,4 @@ generalwhitelist:
     CVE-2017-12424: shadow -> Pas de contre mesure
     CVE-2018-6954: systemd -> Pas de contre mesure
     CVE-2018-15686: systemd -> Pas de contre mesure
-    CVE-2018-6797: Perl est une dépendance du client mysql et la version non vulnérable dans stretch n'a pas été backportée -> Pas de contre-mesure 
\ No newline at end of file
+    CVE-2018-6797: Perl est une dépendance du client mysql et la version non vulnérable dans stretch n'a pas été backportée -> Pas de contre-mesure
\ No newline at end of file
-- 
GitLab