forked from mtusi2026/mtusi2026lab7
lab 7 done
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
export MC_CONFIG_DIR=/tmp/mc
|
||||
mkdir -p "$MC_CONFIG_DIR/certs/CAs"
|
||||
cp /trust/ca.crt "$MC_CONFIG_DIR/certs/CAs/lab.crt"
|
||||
mc alias set admin https://minio:9000 "$(cat /bootstrap/admin/S3_ACCESS_KEY)" "$(cat /bootstrap/admin/S3_SECRET_KEY)" >/dev/null
|
||||
mc ready admin >/dev/null
|
||||
mc mb --ignore-existing admin/attachments >/dev/null
|
||||
mc anonymous set none admin/attachments >/dev/null
|
||||
if [ "${1:-}" = worker ]; then
|
||||
old=$(cat /retired/S3_ACCESS_KEY)
|
||||
mc admin user rm admin "$old" >/dev/null
|
||||
set -- worker
|
||||
else
|
||||
set -- api worker operator
|
||||
fi
|
||||
for role do
|
||||
mc admin policy create admin "attachments-$role" "/policies/s3-$role.json" >/dev/null
|
||||
key=$(cat "/bootstrap/$role/S3_ACCESS_KEY")
|
||||
mc admin user add admin "$key" "$(cat "/bootstrap/$role/S3_SECRET_KEY")" >/dev/null
|
||||
mc admin policy attach admin "attachments-$role" --user "$key" >/dev/null
|
||||
done
|
||||
printf '%s\n' 'Private bucket and scoped S3 accounts configured.'
|
||||
Reference in New Issue
Block a user