diff --git a/README.md b/README.md index 0898f36c..9889634e 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,8 @@ If you are reading this it looks like you are looking to add an egg to your serv ## Game Eggs [Among Us Impostor Server](/among_us/impostor_server) +[Cryofall](/cryofall) + [ET Legacy](/enemy_territory/etlegacy) [Factorio](/factorio/factorio) @@ -188,4 +190,6 @@ If you are reading this it looks like you are looking to add an egg to your serv [Xonotic](/xonotic/xonotic) -[Cryofall](/cryofall) +## [Storage](/storage/) +### S3 Storage +* [minio](/storage/minio) diff --git a/storage/minio/README.md b/storage/minio/README.md new file mode 100644 index 00000000..da88976a --- /dev/null +++ b/storage/minio/README.md @@ -0,0 +1,22 @@ +# minio s3 + +## Features +Auto generate keys on server creation bypassing default minio keys + + +Automatic Key rotation using "rotate" startup feature + +## Auto Rotate +It's possible to rotate your keys by changing the startup option to "rotate" + + +Once this is changed restart your server and it will automatically move your current keys to old and create your new keys + + +Be sure to change your startup back to "normal" once you have started your server using "rotate". This will ensure that you don't accidentally rotate your keys twice + +## Known Issues + +Double encryption may occur if you manually manipulate files in the keys directory + +#### Key rotation is handled automatically, DO NOT manually delete files in keys directory diff --git a/storage/minio/egg-minio-s3.json b/storage/minio/egg-minio-s3.json new file mode 100644 index 00000000..246cf00f --- /dev/null +++ b/storage/minio/egg-minio-s3.json @@ -0,0 +1,37 @@ +{ + "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", + "meta": { + "version": "PTDL_v1" + }, + "exported_at": "2020-11-27T21:39:14-05:00", + "name": "Minio S3", + "author": "accounts@bofanodes.io", + "description": "MinIO is a cloud storage server compatible with Amazon S3, released under Apache License v2. As an object store, MinIO can store unstructured data such as photos, videos, log files, backups and container images. The maximum size of an object is 5TB.", + "features": null, + "image": "quay.io\/parkervcp\/pterodactyl-images:ubuntu", + "startup": ".\/minio.sh", + "config": { + "files": "{}", + "startup": "{\r\n \"done\": \"guide\"\r\n}", + "logs": "{\r\n \"custom\": false,\r\n \"location\": \"logs\/latest.log\"\r\n}", + "stop": "^C" + }, + "scripts": { + "installation": { + "script": "#\r\n#\r\napt update\r\napt install -y wget\r\ncd \/mnt\/server\r\nwget https:\/\/dl.min.io\/server\/minio\/release\/linux-amd64\/minio\r\nchmod +x minio\r\nmkdir data\r\nmkdir keys\r\nwget https:\/\/github.com\/tmunsch\/eggs\/raw\/minio\/storage\/minio\/minio.sh\r\nchmod +x minio.sh\r\nexport MINIO_ACCESS_KEY=$(cat \/dev\/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)\r\necho $MINIO_ACCESS_KEY > keys\/key.txt\r\nexport MINIO_SECRET_KEY=$(cat \/dev\/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)\r\necho $MINIO_SECRET_KEY > keys\/secret.txt\r\necho done", + "container": "debian:buster-slim", + "entrypoint": "bash" + } + }, + "variables": [ + { + "name": "Startup Type", + "description": "normal or rotate", + "env_variable": "STARTUP_TYPE", + "default_value": "normal", + "user_viewable": true, + "user_editable": true, + "rules": "required|string|in:normal,rotate" + } + ] +} \ No newline at end of file diff --git a/storage/minio/minio.sh b/storage/minio/minio.sh new file mode 100644 index 00000000..48b5818e --- /dev/null +++ b/storage/minio/minio.sh @@ -0,0 +1,56 @@ +#!/bin/bash +################################## +echo Starting up.... +echo "Startup Type: $STARTUP_TYPE" +if [ -f "keys/key.txt" ]; then +echo "Key file detected..." +export MINIO_ACCESS_KEY=`cat keys/key.txt` +else +echo minioadmin > keys/key.txt +echo "No key file detected...Preparing First Time Boot" +fi +if [ -f "keys/secret.txt" ]; then +echo "Secret file detected..." +export MINIO_SECRET_KEY=`cat keys/secret.txt` +else +echo minioadmin > keys/secret.txt +echo "No secret file detected...Preparing First Time Boot" +fi +if [ -f "keys/oldsecret.txt" ]; then +echo "Old secret file detected..." +export MINIO_SECRET_KEY_OLD=`cat keys/oldsecret.txt` +fi +if [ -f "keys/oldkey.txt" ]; then +echo "Old key file detected..." +export MINIO_ACCESS_KEY_OLD=`cat keys/oldkey.txt` +fi +if [ -f "keys/justrotated.txt" ]; then +echo "Previous key rotation detected...." +echo "Clearing the Lanes...." +unset MINIO_ACCESS_KEY_OLD +unset MINIO_SECRET_KEY_OLD +STARTUP_TYPE=normal +rm keys/justrotated.txt +rm keys/oldsecret.txt +rm keys/oldkey.txt +fi +########################################## +if [ -z "$STARTUP_TYPE" ] || [ "$STARTUP_TYPE" == "rotate" ]; then +touch keys/justrotated.txt +export MINIO_ACCESS_KEY_OLD=$MINIO_ACCESS_KEY +echo $MINIO_ACCESS_KEY_OLD > keys/oldkey.txt +export MINIO_SECRET_KEY_OLD=$MINIO_SECRET_KEY +echo $MINIO_SECRET_KEY_OLD > keys/oldsecret.txt +export MINIO_ACCESS_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) +echo $MINIO_ACCESS_KEY > keys/key.txt +export MINIO_SECRET_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) +echo $MINIO_SECRET_KEY > keys/secret.txt +echo Your New Access Key is: $MINIO_ACCESS_KEY +echo Your New Secret Key is: $MINIO_SECRET_KEY +echo Your Old Access Key is: $MINIO_ACCESS_KEY_OLD +echo Your Old Access Key is: $MINIO_SECRET_KEY_OLD +echo Booting... +./minio server data --address 0.0.0.0:$SERVER_PORT +else +./minio server data --address 0.0.0.0:$SERVER_PORT +fi