diff --git a/README.md b/README.md index 8c040ee..73b5bb7 100644 --- a/README.md +++ b/README.md @@ -320,6 +320,14 @@ alert templates already do it. `sudo -n fix-lxc-apparmor.sh` automatically and only falls back to the manual instructions above if that sudoers rule isn't present yet. + **Revoking it again:** run `cleanup-host.sh` as root once the deployment + is done - it removes both the sudoers rule and the script, so the + elevated grant only stands for the duration of an active deployment + rather than indefinitely. `create-graylog-lxc.sh` degrades cleanly back + to the manual fallback if it's ever run again without the automation in + place; re-run `bootstrap-host.sh` whenever you need it back (e.g. before + recreating a container from scratch). + - **`vm.max_map_count`**: OpenSearch requires >= 262144. This is a host-wide kernel parameter, not namespaced per LXC, so it can't be set from inside the container either. `install-graylog.sh` only verifies it diff --git a/README.uk.md b/README.uk.md index a8276aa..1d0ec1a 100644 --- a/README.uk.md +++ b/README.uk.md @@ -324,6 +324,14 @@ Graylog відхиляє його з помилкою Jackson-поліморфі сам викликає `sudo -n fix-lxc-apparmor.sh` і повертається до ручної інструкції вище лише якщо цього sudoers-правила ще немає. + **Відкликання назад:** запустіть `cleanup-host.sh` від root, коли + деплой завершено — він видаляє і sudoers-правило, і скрипт, тож + підвищений грант існує лише на час активного деплою, а не постійно. + `create-graylog-lxc.sh` коректно повертається до ручного fallback, якщо + запуститься без цієї автоматизації; запускайте `bootstrap-host.sh` + повторно, коли знадобиться знову (наприклад, перед пересозданням + контейнера з нуля). + - **`vm.max_map_count`**: OpenSearch вимагає >= 262144. Це загальносистемний параметр ядра хоста, не прив'язаний до конкретного LXC, тож встановити його зсередини контейнера теж неможливо. diff --git a/cleanup-host.sh b/cleanup-host.sh new file mode 100644 index 0000000..17bdb3d --- /dev/null +++ b/cleanup-host.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Run as root after deployment is done - reverses bootstrap-host.sh by +# removing the temporary AppArmor-fix automation (sudoers rule + script). +# Keeps the elevated grant's lifetime scoped to "while actively deploying" +# rather than standing indefinitely. +# +# Safe to run even if bootstrap-host.sh was never run (both rm -f calls are +# no-ops on missing files). After this, create-graylog-lxc.sh falls back to +# printing the manual AppArmor fix instructions again, same as before +# bootstrap-host.sh existed - re-run bootstrap-host.sh whenever you need the +# automated path again (e.g. before recreating a container from scratch). +set -euo pipefail + +[ "$(id -u)" -eq 0 ] || { echo "Must run as root." >&2; exit 1; } + +rm -f /etc/sudoers.d/claude-deploy-apparmor +rm -f /usr/local/sbin/fix-lxc-apparmor.sh + +echo "Removed AppArmor-fix automation (sudoers rule + script)."