diff --git a/.gitignore b/.gitignore index 30887bc..48cbcbb 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,7 @@ config.yaml registrations.json banned_emails.txt banned_ips.txt -banned_usernames.txt +refresh_token.shbanned_usernames.txt # Backup directories backup/ diff --git a/banned_usernames.txt b/banned_usernames.txt new file mode 100644 index 0000000..a2a5cb3 --- /dev/null +++ b/banned_usernames.txt @@ -0,0 +1,5 @@ +.*admin.* +.*loli.* +.*shota.* +.*pedo.* +.*pthc.* diff --git a/example-refresh_token.sh b/example-refresh_token.sh new file mode 100755 index 0000000..8dcabac --- /dev/null +++ b/example-refresh_token.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# Path configuration +TOKEN_FILE="/path/to/hand_of_morpheus/.registration_token" +LOG_FILE="/path/to/hand_of_morpheus/token_refresh.log" + +# Function to log with timestamp +log() { + echo "$(date --iso-8601=seconds) $1" >> "$LOG_FILE" +} + +# Generate new token (32 random hex characters) +NEW_TOKEN=$(openssl rand -hex 16) + +# Write new token to file +echo "$NEW_TOKEN" > "$TOKEN_FILE" +if [ $? -ne 0 ]; then + log "ERROR: Failed to write new token to $TOKEN_FILE" + exit 1 +fi + +log "Generated new registration token" + +# Recreate conduwuit container +docker stop conduwuit +docker rm conduwuit + +docker run -d \ + -p 127.0.0.1:8448:6167 \ + -v db:/var/lib/conduwuit/ \ + -v /path/to/hand_of_morpheus/.registration_token:/registration_token:ro \ + -e CONDUWUIT_SERVER_NAME="your.domain" \ + -e CONDUWUIT_DATABASE_PATH="/var/lib/conduwuit/conduwuit.db" \ + -e CONDUWUIT_DATABASE_BACKUP_PATH="/var/lib/conduwuit/backup" \ + -e CONDUWUIT_ALLOW_REGISTRATION=true \ + -e CONDUWUIT_REGISTRATION_TOKEN_FILE="/registration_token" \ + -e CONDUWUIT_PORT=6167 \ + -e CONDUWUIT_ADDRESS="0.0.0.0" \ + -e CONDUWUIT_NEW_USER_DISPLAYNAME_SUFFIX="" \ + -e CONDUWUIT_ALLOW_PUBLIC_ROOM_DIRECTORY_OVER_FEDERATION=true \ + -e CONDUWUIT_ALLOW_PUBLIC_ROOM_DIRECTORY_WITHOUT_AUTH=true \ + -e CONDUWUIT_ALLOW_FEDERATION=true \ + -e CONDUWUIT_AUTO_JOIN_ROOMS='["#community:your.domain","#welcome:your.domain"]' \ + --name conduwuit \ + --restart unless-stopped \ + ghcr.io/girlbossceo/conduwuit:v0.5.0-rc2-e5049cae4a3890dc5f61ead53281f23b36bf4c97 + +if [ $? -ne 0 ]; then + log "ERROR: Failed to create new conduwuit container" + exit 1 +fi + +log "Successfully recreated conduwuit container with new token"