feat: complete lab 7 grade 4 security controls and report

This commit is contained in:
Dmitrii Grishko
2026-11-15 21:58:27 +03:00
parent c5e3ac3aff
commit c69d735692
52 changed files with 1124 additions and 129 deletions
+3 -5
View File
@@ -3,12 +3,10 @@ set -eu
until rabbitmq-diagnostics -q check_running >/dev/null 2>&1; do sleep 1; done
for role in dispatcher worker; do
username="messenger_$role"
password=$(cat "/run/secrets/broker_${role}_password")
if rabbitmqctl -q list_users | cut -f1 | grep -qx "$username"; then
rabbitmqctl -q change_password "$username" "$password"
else
rabbitmqctl -q add_user "$username" "$password"
if ! rabbitmqctl -q list_users | cut -f1 | grep -qx "$username"; then
rabbitmqctl -q add_user "$username" ""
fi
rabbitmqctl -q clear_password "$username"
if [ "$role" = dispatcher ]; then write='^amq\.default$'; read='^$'
else write='^$'; read='^attachments\.v1$'; fi
rabbitmqctl -q set_permissions "$username" '^attachments\.v1$' "$write" "$read"