feat: implement mail-login directadmin plugin
This commit is contained in:
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
BASE_DIR="/usr/local/hitme_plugins/mail-login"
|
||||
PLUGIN_DIR="/usr/local/directadmin/plugins/mail-login"
|
||||
|
||||
mkdir -p "$BASE_DIR/config" "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state/rate-limit"
|
||||
chmod 700 "$BASE_DIR/config" "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state" "$BASE_DIR/state/rate-limit"
|
||||
|
||||
if [ ! -f "$BASE_DIR/config/plugin-settings.conf" ]; then
|
||||
cp "$PLUGIN_DIR/plugin-settings.conf" "$BASE_DIR/config/plugin-settings.conf"
|
||||
chmod 600 "$BASE_DIR/config/plugin-settings.conf"
|
||||
fi
|
||||
|
||||
touch "$BASE_DIR/logs/audit.log"
|
||||
chmod 600 "$BASE_DIR/logs/audit.log"
|
||||
|
||||
echo "mail-login installed"
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
VERSION="$(awk -F= '$1=="version"{print $2}' plugin.conf)"
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Cannot determine version from plugin.conf" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT_DIR="$(cd .. && pwd)"
|
||||
ARCHIVE_DIR="$ROOT_DIR/archives/$VERSION"
|
||||
mkdir -p "$ARCHIVE_DIR"
|
||||
|
||||
tar -czf "$ARCHIVE_DIR/mail-login.tar.gz" \
|
||||
--exclude='./.git' \
|
||||
--exclude='./tests' \
|
||||
--exclude='./scripts/package.sh' \
|
||||
--exclude='./data' \
|
||||
--exclude='./state' \
|
||||
--exclude='./logs' \
|
||||
--exclude='./*.log' \
|
||||
--exclude='./.DS_Store' \
|
||||
.
|
||||
|
||||
echo "$ARCHIVE_DIR/mail-login.tar.gz"
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
BASE_DIR="/usr/local/hitme_plugins/mail-login"
|
||||
|
||||
if [ "${PURGE_MAIL_LOGIN_DATA:-0}" = "1" ]; then
|
||||
rm -rf "$BASE_DIR"
|
||||
echo "mail-login data purged"
|
||||
else
|
||||
echo "mail-login uninstalled; external data preserved at $BASE_DIR"
|
||||
fi
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
BASE_DIR="/usr/local/hitme_plugins/mail-login"
|
||||
mkdir -p "$BASE_DIR/config" "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state/rate-limit"
|
||||
chmod 700 "$BASE_DIR/config" "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state" "$BASE_DIR/state/rate-limit"
|
||||
touch "$BASE_DIR/logs/audit.log"
|
||||
chmod 600 "$BASE_DIR/logs/audit.log"
|
||||
|
||||
echo "mail-login updated; external configuration preserved"
|
||||
Reference in New Issue
Block a user