fix: use directadmin-safe plugin id
This commit is contained in:
@@ -3,8 +3,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
final class Settings
|
final class Settings
|
||||||
{
|
{
|
||||||
public const BASE_DIR = '/usr/local/hitme_plugins/mx_autologin';
|
public const BASE_DIR = '/usr/local/hitme_plugins/mxautologin';
|
||||||
public const PLUGIN_DIR = '/usr/local/directadmin/plugins/mx_autologin';
|
public const PLUGIN_DIR = '/usr/local/directadmin/plugins/mxautologin';
|
||||||
public const SECRET_DIR = self::BASE_DIR . '/secrets';
|
public const SECRET_DIR = self::BASE_DIR . '/secrets';
|
||||||
public const LOG_DIR = self::BASE_DIR . '/logs';
|
public const LOG_DIR = self::BASE_DIR . '/logs';
|
||||||
public const STATE_DIR = self::BASE_DIR . '/state';
|
public const STATE_DIR = self::BASE_DIR . '/state';
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
<a href="/CMD_PLUGINS/mx_autologin/login.raw" target="_top"><img src="/CMD_PLUGINS/mx_autologin/images/user_icon.svg" width="16" height="16" alt="Zaloguj do serwera poczty"/></a>
|
<a href="/CMD_PLUGINS/mxautologin/login.raw" target="_top"><img src="/CMD_PLUGINS/mxautologin/images/user_icon.svg" width="16" height="16" alt="Zaloguj do serwera poczty"/></a>
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
<a href="/CMD_PLUGINS/mx_autologin/login.raw" target="_top">Zaloguj do serwera poczty</a>
|
<a href="/CMD_PLUGINS/mxautologin/login.raw" target="_top">Zaloguj do serwera poczty</a>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Ten plik jest runtime configuration pluginu.
|
# Ten plik jest runtime configuration pluginu.
|
||||||
# Plugin czyta ustawienia bezpośrednio z:
|
# Plugin czyta ustawienia bezpośrednio z:
|
||||||
# /usr/local/directadmin/plugins/mx_autologin/plugin-settings.conf
|
# /usr/local/directadmin/plugins/mxautologin/plugin-settings.conf
|
||||||
|
|
||||||
# Czy plugin jest domyślnie dostępny dla wszystkich użytkowników.
|
# Czy plugin jest domyślnie dostępny dla wszystkich użytkowników.
|
||||||
DEFAULT_ENABLE=true
|
DEFAULT_ENABLE=true
|
||||||
@@ -42,8 +42,8 @@ MAIL_LOGIN_REMOTE_TRANSPORT=ssh
|
|||||||
MAIL_LOGIN_SSH_HOST=mx1.mojserwer.pl
|
MAIL_LOGIN_SSH_HOST=mx1.mojserwer.pl
|
||||||
MAIL_LOGIN_SSH_PORT=22
|
MAIL_LOGIN_SSH_PORT=22
|
||||||
MAIL_LOGIN_SSH_USER=root
|
MAIL_LOGIN_SSH_USER=root
|
||||||
MAIL_LOGIN_SSH_IDENTITY=/usr/local/hitme_plugins/mx_autologin/secrets/mx1_ed25519
|
MAIL_LOGIN_SSH_IDENTITY=/usr/local/hitme_plugins/mxautologin/secrets/mx1_ed25519
|
||||||
MAIL_LOGIN_SSH_KNOWN_HOSTS=/usr/local/hitme_plugins/mx_autologin/secrets/known_hosts
|
MAIL_LOGIN_SSH_KNOWN_HOSTS=/usr/local/hitme_plugins/mxautologin/secrets/known_hosts
|
||||||
MAIL_LOGIN_CONNECT_TIMEOUT_SECONDS=5
|
MAIL_LOGIN_CONNECT_TIMEOUT_SECONDS=5
|
||||||
|
|
||||||
# Limity bezpieczeństwa na źródłowym serwerze DirectAdmin.
|
# Limity bezpieczeństwa na źródłowym serwerze DirectAdmin.
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
name=MX-Autologin
|
name=MX-Autologin
|
||||||
id=mx_autologin
|
id=mxautologin
|
||||||
type=user
|
type=user
|
||||||
author=HITME.PL
|
author=HITME.PL
|
||||||
version=1.0.13
|
version=1.0.14
|
||||||
active=no
|
active=no
|
||||||
installed=no
|
installed=no
|
||||||
user_run_as=root
|
user_run_as=root
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
BASE_DIR="/usr/local/hitme_plugins/mx_autologin"
|
BASE_DIR="/usr/local/hitme_plugins/mxautologin"
|
||||||
PLUGIN_DIR="/usr/local/directadmin/plugins/mx_autologin"
|
PLUGIN_DIR="/usr/local/directadmin/plugins/mxautologin"
|
||||||
|
|
||||||
mkdir -p "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state/rate-limit"
|
mkdir -p "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state/rate-limit"
|
||||||
chmod 700 "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state" "$BASE_DIR/state/rate-limit"
|
chmod 700 "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state" "$BASE_DIR/state/rate-limit"
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
KEY_DIR="${MAIL_LOGIN_KEY_DIR:-/usr/local/hitme_plugins/mx_autologin/secrets}"
|
KEY_DIR="${MAIL_LOGIN_KEY_DIR:-/usr/local/hitme_plugins/mxautologin/secrets}"
|
||||||
KEY_NAME="${MAIL_LOGIN_KEY_NAME:-mx1_ed25519}"
|
KEY_NAME="${MAIL_LOGIN_KEY_NAME:-mx1_ed25519}"
|
||||||
KEY_PATH="$KEY_DIR/$KEY_NAME"
|
KEY_PATH="$KEY_DIR/$KEY_NAME"
|
||||||
MX_MODE="${MX_LOGIN_MODE:-1}"
|
MX_MODE="${MX_LOGIN_MODE:-1}"
|
||||||
SETTINGS_FILE="${MAIL_LOGIN_SETTINGS_FILE:-/usr/local/directadmin/plugins/mx_autologin/plugin-settings.conf}"
|
SETTINGS_FILE="${MAIL_LOGIN_SETTINGS_FILE:-/usr/local/directadmin/plugins/mxautologin/plugin-settings.conf}"
|
||||||
HELPER_COMMAND="${MAIL_LOGIN_HELPER_COMMAND:-/usr/local/hitme_plugins/mail-login-helper/bin/create-login-url}"
|
HELPER_COMMAND="${MAIL_LOGIN_HELPER_COMMAND:-/usr/local/hitme_plugins/mail-login-helper/bin/create-login-url}"
|
||||||
|
|
||||||
config_value() {
|
config_value() {
|
||||||
|
|||||||
+2
-2
@@ -11,7 +11,7 @@ ROOT_DIR="$(cd .. && pwd)"
|
|||||||
ARCHIVE_DIR="$ROOT_DIR/archives/$VERSION"
|
ARCHIVE_DIR="$ROOT_DIR/archives/$VERSION"
|
||||||
mkdir -p "$ARCHIVE_DIR"
|
mkdir -p "$ARCHIVE_DIR"
|
||||||
|
|
||||||
tar -czf "$ARCHIVE_DIR/mx_autologin.tar.gz" \
|
tar -czf "$ARCHIVE_DIR/mxautologin.tar.gz" \
|
||||||
--exclude='./.git' \
|
--exclude='./.git' \
|
||||||
--exclude='./tests' \
|
--exclude='./tests' \
|
||||||
--exclude='./scripts/package.sh' \
|
--exclude='./scripts/package.sh' \
|
||||||
@@ -22,4 +22,4 @@ tar -czf "$ARCHIVE_DIR/mx_autologin.tar.gz" \
|
|||||||
--exclude='./.DS_Store' \
|
--exclude='./.DS_Store' \
|
||||||
.
|
.
|
||||||
|
|
||||||
echo "$ARCHIVE_DIR/mx_autologin.tar.gz"
|
echo "$ARCHIVE_DIR/mxautologin.tar.gz"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
BASE_DIR="/usr/local/hitme_plugins/mx_autologin"
|
BASE_DIR="/usr/local/hitme_plugins/mxautologin"
|
||||||
|
|
||||||
if [ "${PURGE_MAIL_LOGIN_DATA:-0}" = "1" ]; then
|
if [ "${PURGE_MAIL_LOGIN_DATA:-0}" = "1" ]; then
|
||||||
rm -rf "$BASE_DIR"
|
rm -rf "$BASE_DIR"
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
BASE_DIR="/usr/local/hitme_plugins/mx_autologin"
|
BASE_DIR="/usr/local/hitme_plugins/mxautologin"
|
||||||
PLUGIN_DIR="/usr/local/directadmin/plugins/mx_autologin"
|
PLUGIN_DIR="/usr/local/directadmin/plugins/mxautologin"
|
||||||
|
|
||||||
mkdir -p "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state/rate-limit"
|
mkdir -p "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state/rate-limit"
|
||||||
chmod 700 "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state" "$BASE_DIR/state/rate-limit"
|
chmod 700 "$BASE_DIR/secrets" "$BASE_DIR/logs" "$BASE_DIR/state" "$BASE_DIR/state/rate-limit"
|
||||||
|
|||||||
@@ -6,19 +6,19 @@ test('plugin metadata and packaging docs match project rules', function (): void
|
|||||||
$packing = file_get_contents(PROJECT_ROOT . '/PACKING.md') ?: '';
|
$packing = file_get_contents(PROJECT_ROOT . '/PACKING.md') ?: '';
|
||||||
|
|
||||||
assert_contains('name=MX-Autologin', $conf);
|
assert_contains('name=MX-Autologin', $conf);
|
||||||
assert_contains('id=mx_autologin', $conf);
|
assert_contains('id=mxautologin', $conf);
|
||||||
assert_contains('type=user', $conf);
|
assert_contains('type=user', $conf);
|
||||||
assert_contains('version=1.0.13', $conf);
|
assert_contains('version=1.0.14', $conf);
|
||||||
assert_contains('user_run_as=root', $conf);
|
assert_contains('user_run_as=root', $conf);
|
||||||
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/src', $packing);
|
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/src', $packing);
|
||||||
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/archives/X.Y.Z/mx_autologin.tar.gz', $packing);
|
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/archives/X.Y.Z/mxautologin.tar.gz', $packing);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('package source excludes local-only files and dangerous placeholders', function (): void {
|
test('package source excludes local-only files and dangerous placeholders', function (): void {
|
||||||
$package = file_get_contents(PLUGIN_ROOT . '/scripts/package.sh') ?: '';
|
$package = file_get_contents(PLUGIN_ROOT . '/scripts/package.sh') ?: '';
|
||||||
assert_contains("--exclude='./.git'", $package);
|
assert_contains("--exclude='./.git'", $package);
|
||||||
assert_contains("--exclude='./tests'", $package);
|
assert_contains("--exclude='./tests'", $package);
|
||||||
assert_contains('mx_autologin.tar.gz', $package);
|
assert_contains('mxautologin.tar.gz', $package);
|
||||||
assert_true(is_file(PLUGIN_ROOT . '/scripts/keygen.sh'));
|
assert_true(is_file(PLUGIN_ROOT . '/scripts/keygen.sh'));
|
||||||
|
|
||||||
$bad = [];
|
$bad = [];
|
||||||
@@ -45,10 +45,10 @@ test('directadmin entry points use mx autologin directory and display label', fu
|
|||||||
$login = file_get_contents(PLUGIN_ROOT . '/user/login.raw') ?: '';
|
$login = file_get_contents(PLUGIN_ROOT . '/user/login.raw') ?: '';
|
||||||
$index = file_get_contents(PLUGIN_ROOT . '/user/index.html') ?: '';
|
$index = file_get_contents(PLUGIN_ROOT . '/user/index.html') ?: '';
|
||||||
|
|
||||||
assert_contains('/CMD_PLUGINS/mx_autologin/login.raw', $txt);
|
assert_contains('/CMD_PLUGINS/mxautologin/login.raw', $txt);
|
||||||
assert_contains('Zaloguj do serwera poczty', $txt);
|
assert_contains('Zaloguj do serwera poczty', $txt);
|
||||||
assert_contains('/CMD_PLUGINS/mx_autologin/images/user_icon.svg', $img);
|
assert_contains('/CMD_PLUGINS/mxautologin/images/user_icon.svg', $img);
|
||||||
assert_contains('alt="Zaloguj do serwera poczty"', $img);
|
assert_contains('alt="Zaloguj do serwera poczty"', $img);
|
||||||
assert_contains('/usr/local/directadmin/plugins/mx_autologin/php.ini', $login);
|
assert_contains('/usr/local/directadmin/plugins/mxautologin/php.ini', $login);
|
||||||
assert_contains('/CMD_PLUGINS/mx_autologin/login.raw', $index);
|
assert_contains('/CMD_PLUGINS/mxautologin/login.raw', $index);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ test('settings expose secure defaults from plugin-settings.conf', function (): v
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('settings runtime file is the directadmin plugin settings file', function (): void {
|
test('settings runtime file is the directadmin plugin settings file', function (): void {
|
||||||
assert_same('/usr/local/directadmin/plugins/mx_autologin/plugin-settings.conf', Settings::EXTERNAL_SETTINGS);
|
assert_same('/usr/local/directadmin/plugins/mxautologin/plugin-settings.conf', Settings::EXTERNAL_SETTINGS);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('settings reject login key ttl outside production range', function (): void {
|
test('settings reject login key ttl outside production range', function (): void {
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/bin/php -nc/usr/local/directadmin/plugins/mx_autologin/php.ini
|
#!/usr/local/bin/php -nc/usr/local/directadmin/plugins/mxautologin/php.ini
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
@@ -8,5 +8,5 @@ header('Referrer-Policy: no-referrer');
|
|||||||
echo '<!doctype html><html lang="pl"><head><meta charset="utf-8">';
|
echo '<!doctype html><html lang="pl"><head><meta charset="utf-8">';
|
||||||
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
|
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
|
||||||
echo '<title>Zaloguj do serwera poczty</title></head><body>';
|
echo '<title>Zaloguj do serwera poczty</title></head><body>';
|
||||||
echo '<p><a href="/CMD_PLUGINS/mx_autologin/login.raw">Zaloguj do serwera poczty</a></p>';
|
echo '<p><a href="/CMD_PLUGINS/mxautologin/login.raw">Zaloguj do serwera poczty</a></p>';
|
||||||
echo '</body></html>';
|
echo '</body></html>';
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/bin/php -nc/usr/local/directadmin/plugins/mx_autologin/php.ini
|
#!/usr/local/bin/php -nc/usr/local/directadmin/plugins/mxautologin/php.ini
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user