lab7
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
export MC_CONFIG_DIR=/tmp/mc
|
||||
mkdir -p "$MC_CONFIG_DIR/certs/CAs"
|
||||
cp /pki/ca.crt "$MC_CONFIG_DIR/certs/CAs/ca.crt"
|
||||
for attempt in $(seq 1 45); do
|
||||
if mc alias set local https://s3:9000 operator "$(cat /credentials/root)" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
test "$attempt" -lt 45
|
||||
sleep 1
|
||||
done
|
||||
mc mb --ignore-existing local/messenger-attachments >/dev/null
|
||||
mc anonymous set none local/messenger-attachments >/dev/null
|
||||
case "${S3_ROLE:-all}" in
|
||||
all) roles="api worker reconciler" ;;
|
||||
api) roles=api ;;
|
||||
*) exit 2 ;;
|
||||
esac
|
||||
for role in $roles; do
|
||||
mc admin policy create local "messenger-$role" "/policies/$role.json" >/dev/null
|
||||
mc admin user add local "lab-$role" "$(cat "/credentials/$role")" >/dev/null
|
||||
mc admin policy attach local "messenger-$role" --user "lab-$role" >/dev/null
|
||||
done
|
||||
echo 'Private bucket and scoped accounts ready'
|
||||
Reference in New Issue
Block a user