@@ -53,15 +53,37 @@ export vault="VAULT_ADDRESS"
53
53
WORKING_DIRECTORY=WORKDIR
54
54
mkdir -p ${WORKING_DIRECTORY}
55
55
56
- # Bring LUMI-SD logic
56
+ # Clone HPCS repository if not already available
57
+ echo -e " ${YELLOW} [LUMI-SD]${NC}${BLUE} [Job]${NC} Cloning HPCS repository if it doesn't already exist"
58
+
59
+ if ! [ -d ~ /HPCS ]; then
60
+ git clone https://github.com/CSCfi/HPCS.git ~ /HPCS
61
+ fi
62
+
63
+ echo -e " ${YELLOW} [LUMI-SD]${NC}${BLUE} [Job]${NC} Getting age and gocryptfs as static binaries"
64
+ cd ~ /HPCS || exit 1
65
+ PATH=$PATH :$HOME /HPCS/bin
66
+
67
+ if ! which age ; then
68
+ mkdir -p bin
69
+ curl -O -L https://github.com/FiloSottile/age/releases/download/v1.1.1/age-v1.1.1-linux-amd64.tar.gz || exit 1
70
+ tar xvf age-v1.1.1-linux-amd64.tar.gz
71
+ mv age/age ./bin/
72
+ rm -r age*
73
+ fi
74
+
75
+ if ! which gocryptfs ; then
76
+ mkdir -p bin
77
+ curl -O -L https://github.com/rfjakob/gocryptfs/releases/download/v2.4.0/gocryptfs_v2.4.0_linux-static_amd64.tar.gz || exit 1
78
+ tar xvf gocryptfs_v2.4.0_linux-static_amd64.tar.gz
79
+ mv gocryptfs ./bin/
80
+ rm -r gocryptfs*
81
+ fi
57
82
58
- # # Clone repo in common directory if it doesn't already exists
59
- # ## For the moment : assume it's already cloned in ~/LUMI-secure-processing
60
83
61
84
echo -e " ${YELLOW} [LUMI-SD]${NC}${BLUE} [Job]${NC} Running agent registration"
62
85
63
86
# Spawn spire-agent
64
- cd ~ /HPCS || exit 1
65
87
python3 ./utils/spawn_agent.py --config ~ /.config/hpcs-client.conf -cn > $WORKING_DIRECTORY /agent.log 2> $WORKING_DIRECTORY /agent.log &
66
88
spire_agent_pid=$!
67
89
@@ -96,7 +118,7 @@ echo "$data_key" > /tmp/container_key
96
118
echo " Decrypting container image ..."
97
119
98
120
# Decrypt the container image
99
- ~ /HPCS/client/container_preparation/input_logic/ age --decrypt -i /tmp/container_key -o $WORKING_DIRECTORY /app.sif APPLICATION_PATH || exit 1
121
+ age --decrypt -i /tmp/container_key -o $WORKING_DIRECTORY /app.sif APPLICATION_PATH || exit 1
100
122
101
123
echo -e " ${YELLOW} [LUMI-SD]${NC}${BLUE} [Job]${NC} Creating encrypted volumes"
102
124
@@ -110,17 +132,17 @@ password_in=$(tr -dc 'A-Za-z0-9!?%=' < /dev/urandom | head -c 25)
110
132
password_out=$( tr -dc ' A-Za-z0-9!?%=' < /dev/urandom | head -c 25)
111
133
112
134
# Setup encrypted volumes
113
- /users/etellier/ gocryptfs -q -init --extpass echo --extpass " $password_out " output
114
- /users/etellier/ gocryptfs -q -init --extpass echo --extpass " $password_in " input
135
+ gocryptfs -q -init --extpass echo --extpass " $password_out " output
136
+ gocryptfs -q -init --extpass echo --extpass " $password_in " input
115
137
116
138
# Mounting cipher version of the output encrypted filesystem to write final encrypted results
117
139
# Mounting the encrypted input data tgz to the container to decrypt it in the input encrypted filesystem
118
140
BASIC_FLAGS=" --bind ./output:/tmp/output --bind DATA_PATH:/sd-container/input/data.tgz:rw"
119
141
120
142
# Encrypted binds inside of the container
121
143
BIND_ENCRYPTED_VOLUME_FLAG=" --fusemount host:"
122
- BIND_ENCRYPTED_VOLUME_FLAG_MOUNT_INPUT=" /users/etellier/ gocryptfs -q --extpass echo --extpass ${password_in} ${WORKING_DIRECTORY} /input /sd-container/encrypted"
123
- BIND_ENCRYPTED_VOLUME_FLAG_MOUNT_OUTPUT=" /users/etellier/ gocryptfs -q --extpass echo --extpass ${password_out} ${WORKING_DIRECTORY} /output /sd-container/output"
144
+ BIND_ENCRYPTED_VOLUME_FLAG_MOUNT_INPUT=" gocryptfs -q --extpass echo --extpass ${password_in} ${WORKING_DIRECTORY} /input /sd-container/encrypted"
145
+ BIND_ENCRYPTED_VOLUME_FLAG_MOUNT_OUTPUT=" gocryptfs -q --extpass echo --extpass ${password_out} ${WORKING_DIRECTORY} /output /sd-container/output"
124
146
BIND_INPUT=" INPUT_SCRIPTS_DIR"
125
147
BIND_OUTPUT=" OUTPUT_SCRIPTS_DIR"
126
148
0 commit comments