mornedhels / enshrouded-server

Enshrouded Dedicated Server with autoupdate (supervisord)
MIT License
133 stars 8 forks source link

Password not set correctly using docker compose #100

Open webs397 opened 3 weeks ago

webs397 commented 3 weeks ago

Is there an existing issue for this?

Used image version

sha256:d97d8c0bb6e0dc749fa0df1db410e7509d51c30d530ac7c73d3b69fb25b4687d

Used docker compose file or docker command

services: enshrouded: image: mornedhels/enshrouded-server:latest container_name: enshrouded hostname: enshrouded restart: unless-stopped stop_grace_period: 90s ports:

What you expected to see, versus what you actually saw

This leads to the this output in the server.json file:

_CommonRedist enshrouded_server_023.dat enshrouded_server_000.dat enshrouded_server_024.dat enshrouded_server_001.dat enshrouded_server_025.dat enshrouded_server_002.dat enshrouded_server_026.dat enshrouded_server_003.dat enshrouded_server_027.dat enshrouded_server_004.dat enshrouded_server_028.dat enshrouded_server_005.dat enshrouded_server_029.dat enshrouded_server_006.dat enshrouded_server_030.dat enshrouded_server_007.dat enshrouded_server_031.dat enshrouded_server_008.dat enshrouded_server.exe enshrouded_server_009.dat enshrouded_server.json enshrouded_server_010.dat enshrouded_server.kfc enshrouded_server_011.dat enshrouded_server_readme.txt enshrouded_server_012.dat logs enshrouded_server_013.dat savegame enshrouded_server_014.dat steam_api64.dll enshrouded_server_015.dat steam_appid.txt enshrouded_server_016.dat steamapps enshrouded_server_017.dat steamclient64.dll enshrouded_server_018.dat steamclient.dll enshrouded_server_019.dat tier0_s64.dll enshrouded_server_020.dat tier0_s.dll enshrouded_server_021.dat vstdlib_s64.dll enshrouded_server_022.dat vstdlib_s.dll root@debian:/data/compose/34/game/server# cat enshrouded_server.json { "name": "Test", "saveDirectory": "./savegame", "logDirectory": "./logs", "ip": "0.0.0.0", "queryPort": 15637, "slotCount": 16, "gameSettingsPreset": "Default", "gameSettings": { "playerHealthFactor": 1, "playerManaFactor": 1, "playerStaminaFactor": 1, "enableDurability": true, "enableStarvingDebuff": false, "foodBuffDurationFactor": 1, "fromHungerToStarving": 600000000000, "shroudTimeFactor": 1, "tombstoneMode": "AddBackpackMaterials", "miningDamageFactor": 1, "plantGrowthSpeedFactor": 1, "resourceDropStackAmountFactor": 1, "factoryProductionSpeedFactor": 1, "perkUpgradeRecyclingFactor": 0.500000, "perkCostFactor": 1, "experienceCombatFactor": 1, "experienceMiningFactor": 1, "experienceExplorationQuestsFactor": 1, "randomSpawnerAmount": "Normal", "aggroPoolAmount": "Normal", "enemyDamageFactor": 1, "enemyHealthFactor": 1, "enemyStaminaFactor": 1, "enemyPerceptionRangeFactor": 1, "bossDamageFactor": 1, "bossHealthFactor": 1, "threatBonus": 1, "pacifyAllEnemies": false, "dayTimeDuration": 1800000000000, "nightTimeDuration": 720000000000 }, "userGroups": [ { "name": "Default", "password": "yqf)er-T", "canKickBan": false, "canAccessInventories": true, "canEditBase": true, "canExtendBase": true, "reservedSlots": 0 } ], "password": "password123" }

Note: I had to manually change the password from the user group to my requested password to gain access to the server. Not sure if this is the intended behaviour but would make more sense to have the password variable transferred to the default user group password.

Logs from the container

No response

cp-fabian-pittroff commented 3 weeks ago

Hey @webs397, yes thats the reason why this env var is deprecated. It worked for update 2 and also for the initial update 3 - maybe a patch broke that?!

Anyhow, to automatically set the first userGroup is not a viable solution - because it doesn't have to be the default group. So to set the server password you basically have to set it in the config file itself or use the server_roles env vars.

Do you have other suggestions how to handle the server password variable?

webs397 commented 3 weeks ago

I don't really know to be honest. Thats how I fixed it for me.

For the vast majority of users the default user should be what they are looking for. Requiring users to go into the container files and reading through the json is much harder for the average user. Just wanted to make this issue known.

webs397 commented 3 weeks ago

Oops didnt mean to close this, but feel free to do so again if there is no real fix. My recommended work around would be to set the default user password as the "server password" as this will be the case for most users (as I also saw in a few issues)

cp-fabian-pittroff commented 3 weeks ago

Hey @webs397,

I implemented a fallback mechanism if you are using the SERVER_PASSWORD env var. Basically it checks if the first server-role exists and the name is Default. If yes, it updates the value for password.

If no server-roles are defined (inside of enshrouded_server.json), I create one with the desired password.

And finally if the first server-role hasn't the name Default I skip the update with a warning.

WARN - SERVER_PASSWORD is deprecated, pls consider using SERVER_ROLE_<index>_PASSWORD instead
WARN - falling back to "Default" server role password

# message if server-role 0 is not the Default one
WARN - default group (index: 0) has not the name "Default". Skipping password update!

I'll test it a little bit further and merge the changes to main. You can test it than with the dev-proton or dev-wine tags.

Would that meet your requirements?

cp-fabian-pittroff commented 3 weeks ago

fix is now available with the dev-tags

cp-fabian-pittroff commented 3 weeks ago

and is also released with version 1.4.0.