feat: add a dmidecode shim and allow for disabling cleartext session tokens storage

This commit is contained in:
IhToN
2026-01-17 21:10:52 +01:00
parent 439a64e2fc
commit 45ef2258a6
5 changed files with 52 additions and 2 deletions

View File

@@ -42,6 +42,34 @@ COPY --chmod=755 ./entrypoint.sh /entrypoint.sh
# Strip Windows line endings (\r) just in case the file was edited on Windows # Strip Windows line endings (\r) just in case the file was edited on Windows
RUN sed -i 's/\r$//' /entrypoint.sh RUN sed -i 's/\r$//' /entrypoint.sh
# Create dmidecode shim for Docker usage
RUN echo "Creating local dmidecode for Docker usage." && \
cat > /usr/local/bin/dmidecode << 'EOF'
#!/bin/sh
if [ "$1" = "-s" ] && [ "$2" = "system-uuid" ]; then
UUID_FILE="$HOME/.hytale_system_uuid"
if [ -f "$UUID_FILE" ]; then
cat "$UUID_FILE"
else
if command -v uuidgen >/dev/null 2>&1; then
uuidgen | tr "A-Z" "a-z" | tee "$UUID_FILE" >/dev/null
else
cat /proc/sys/kernel/random/uuid | tee "$UUID_FILE" >/dev/null
fi
cat "$UUID_FILE"
fi
printf "\n"
exit 0
fi
echo "dmidecode shim: unsupported args: $*" >&2
exit 1
EOF
RUN chmod +x /usr/local/bin/dmidecode
RUN sed -i 's/\r$//' /entrypoint.sh
# Copy lib directory # Copy lib directory
COPY --chmod=755 ./lib /lib COPY --chmod=755 ./lib /lib
RUN sed -i 's/\r$//' /lib/*.sh RUN sed -i 's/\r$//' /lib/*.sh

View File

@@ -309,6 +309,18 @@
], ],
"sort": 24 "sort": 24
}, },
{
"name": "Unencrypted Auth Session",
"description": "Enable it to store the Authorization Session as a token in the root server. Needed if the server is not able to store an encrypted auth session. Intended for game server providers.",
"env_variable": "UNENCRYPTED_AUTH_SESSION",
"default_value": "0",
"user_viewable": true,
"user_editable": true,
"rules": [
"boolean"
],
"sort": 23
},
{ {
"name": "Patchline", "name": "Patchline",
"description": "What release channel you want to use", "description": "What release channel you want to use",

View File

@@ -260,6 +260,16 @@
"rules": "required|integer|between:1,65535", "rules": "required|integer|between:1,65535",
"field_type": "text" "field_type": "text"
}, },
{
"name": "Unencrypted Auth Session",
"description": "Enable it to store the Authorization Session as a token in the root server. Needed if the server is not able to store an encrypted auth session. Intended for game server providers.",
"env_variable": "UNENCRYPTED_AUTH_SESSION",
"default_value": "0",
"user_viewable": true,
"user_editable": true,
"rules": "required|boolean",
"field_type": "text"
},
{ {
"name": "Override Session Token", "name": "Override Session Token",
"description": "Optional session token used to override the normal server authentication process. This option only takes effect when both override tokens are set. If left empty, the server will request authentication on startup. Intended for game server providers.", "description": "Optional session token used to override the normal server authentication process. This option only takes effect when both override tokens are set. If left empty, the server will request authentication on startup. Intended for game server providers.",

View File

@@ -73,7 +73,7 @@ if [ -n "$OVERRIDE_SESSION_TOKEN" ] && [ -n "$OVERRIDE_IDENTITY_TOKEN" ]; then
logger info "Using provided session and identity tokens..." logger info "Using provided session and identity tokens..."
SESSION_TOKEN="$OVERRIDE_SESSION_TOKEN" SESSION_TOKEN="$OVERRIDE_SESSION_TOKEN"
IDENTITY_TOKEN="$OVERRIDE_IDENTITY_TOKEN" IDENTITY_TOKEN="$OVERRIDE_IDENTITY_TOKEN"
else else if [ "${UNENCRYPTED_AUTH_SESSION}" = "1" ]; then
# Standard mode: perform authentication # Standard mode: perform authentication
if check_cached_tokens && load_cached_tokens; then if check_cached_tokens && load_cached_tokens; then
logger info "Using cached authentication..." logger info "Using cached authentication..."

View File

@@ -4,4 +4,4 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")" PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
echo "Building and pushing dev image..." echo "Building and pushing dev image..."
docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/natroutter/egg-hytale:dev --push "$PROJECT_DIR" docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/ihton/egg-hytale:dev --push "$PROJECT_DIR"