itzg / minecraft-server-charts

MIT License
269 stars 142 forks source link

whitelist var does not enable the whitelist - minecraft java chart ONLY #85

Open tculp opened 3 years ago

tculp commented 3 years ago

For the minecraft java edition chart, the whitelist var appears to only add users to the whitelist, not actually turn the whitelist on.

The bedrock edition chart appears to have separate whitelist and whitelist-users vars.

itzg commented 3 years ago

Ah, it looks like the chart is missing an easy way to set OVERRIDE_SERVER_PROPERTIES. I'm guessing it is skipping the modification of server.properties since the file already exists. For now you can set that to "true" via "extraEnvs".

merkinbob commented 2 years ago

Adding link to #101

yizhexu commented 2 years ago

Hey I tried this temporary solution by setting ENABLE_WHITELIST and ENFORCE_WHITELIST under extraEnv. But players who are not in the white list are still getting in.

itzg commented 2 years ago

OVERRIDE_SERVER_PROPERTIES also needs to be enabled or it won't change the enforce property.

itzg commented 2 years ago

and with https://github.com/itzg/minecraft-server-charts/releases/tag/minecraft-3.6.7 that can now actually be set

zamazan4ik commented 2 years ago

@itzg I am using the latest Helm chart. I have setted the following variables:

extraEnv:
  # recommended rolling logs for saving disk
  ENABLE_ROLLING_LOGS: true
  ENABLE_WHITELIST: true
  ENFORCE_WHITELIST: true
  FORCE_WORLD_COPY: false
  # if this is true then minecraftServer properties above are always applied
  # on every restart, if false they only apply at first run
  OVERRIDE_SERVER_PROPERTIES: true

Also, I have filled whitelist variable with some nicknames. After the helm upgrade minecraft -f minecraft-helm-config.yaml minecraft-server-charts/minecraft I still have enforce_whitelist=false in server.properties.

Is it a problem with the Helm chart or something on my side?

itzg commented 2 years ago

@zamazan4ik , it seems like you're doing things right. Can you provide the container logs?

zamazan4ik commented 2 years ago

Sure.

chmod: changing permissions of '/data': Operation not permitted
[init] Running as uid=1000 gid=1000 with /data as 'drwxrwxrwx 7 0 0 4096 Apr  7 15:38 /data'
[init] Resolved version given LATEST into 1.18.2 and major version 1.18
[init] Resolving type given VANILLA
[init] server.properties already created, skipping
[init] Updating whitelist
[mc-image-helper] 16:30:11.459 ERROR : 'get' command failed: Failed to download https://playerdb.co/api/player/minecraft/for974972d606f74: status code: 500, reason phrase: Internal Server Error
[mc-image-helper] 16:30:12.804 ERROR : 'get' command failed: Failed to download https://playerdb.co/api/player/minecraft/fsdfa922cf763d54: status code: 500, reason phrase: Internal Server Error
[mc-image-helper] 16:30:14.042 ERROR : 'get' command failed: Failed to download https://playerdb.co/api/player/minecraft/GRNf8e6058518cd4: status code: 500, reason phrase: Internal Server Error
[mc-image-helper] 16:30:15.523 ERROR : 'get' command failed: Failed to download https://playerdb.co/api/player/minecraft/Ban8a6d5b041aa45: status code: 500, reason phrase: Internal Server Error
[init] log4j2.xml already created, skipping
[init] Checking for JSON files.
[init] Setting initial memory to 4096M and max to 4096M
[init] Starting the Minecraft server...
Starting net.minecraft.server.Main
[16:30:23] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[16:30:25] [ServerMain/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:30:25] [ServerMain/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:30:25] [ServerMain/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[16:30:25] [ServerMain/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[16:30:25] [ServerMain/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:30:26] [Worker-Main-2/INFO]: Loaded 7 recipes
[16:30:26] [Worker-Main-2/INFO]: Loaded 1141 advancements
[16:30:28] [Server thread/INFO]: Starting minecraft server version 1.18.2
[16:30:28] [Server thread/INFO]: Loading properties
[16:30:28] [Server thread/INFO]: Default game type: SURVIVAL
[16:30:28] [Server thread/INFO]: Generating keypair
[16:30:28] [Server thread/INFO]: Starting Minecraft server on *:25565
[16:30:28] [Server thread/INFO]: Using epoll channel type
[16:30:28] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[16:30:28] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[16:30:28] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[16:30:28] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.
[16:30:28] [Server thread/INFO]: Preparing level "world"
[16:30:34] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[16:30:35] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:35] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:35] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:38] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:38] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:38] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:38] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:38] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:38] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:39] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:39] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:41] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:41] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:41] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:41] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:42] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:42] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:43] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:30:43] [Worker-Main-2/INFO]: Preparing spawn area: 5%
[16:30:44] [Worker-Main-2/INFO]: Preparing spawn area: 17%
[16:30:44] [Worker-Main-2/INFO]: Preparing spawn area: 35%
[16:30:45] [Worker-Main-2/INFO]: Preparing spawn area: 56%
[16:30:45] [Worker-Main-2/INFO]: Preparing spawn area: 72%
[16:30:47] [Server thread/INFO]: Time elapsed: 12600 ms
[16:30:47] [Server thread/INFO]: Done (18.931s)! For help, type "help"
[16:30:47] [Server thread/INFO]: Starting remote control listener
[16:30:47] [Server thread/INFO]: Thread RCON Listener started
[16:30:47] [Server thread/INFO]: RCON running on 0.0.0.0:25575
[16:30:48] [Server thread/INFO]: forforforfor[/10.42.0.1:17738] logged in with entity id 51 at (-444.3168093382005, 69.5625, -286.6578040018599)
[16:30:49] [Server thread/INFO]: forforforfor joined the game

There are some errors like "get command failed" but they should not affect the file state.

itzg commented 2 years ago
[init] server.properties already created, skipping

indicates that the server.properties file isn't going to get updated. Use minecraftServer.overrideServerProperties in the values rather than the extraEnv. I suspect that one is masking the other you're setting.

Yeah, the playerdb 500's is indeed something separate I need to look at.

zamazan4ik commented 2 years ago

@itzg I have changed my Helm config as you said (added overrideServerProperties: true to Helm config under minecraftServer) - it did not help.

chmod: changing permissions of '/data': Operation not permitted
[init] Running as uid=1000 gid=1000 with /data as 'drwxrwxrwx 7 0 0 4096 Apr  7 15:38 /data'
[init] Resolved version given LATEST into 1.18.2 and major version 1.18
[init] Resolving type given VANILLA
[init] server.properties already created, skipping
[init] Updating whitelist
[mc-image-helper] 19:50:52.733 ERROR : 'get' command failed: Failed to download https://playerdb.co/api/player/minecraft/for974972d606f74: status code: 500, reason phrase: Internal Server Error
[mc-image-helper] 19:50:54.260 ERROR : 'get' command failed: Failed to download https://playerdb.co/api/player/minecraft/fsdfa922cf763d54: status code: 500, reason phrase: Internal Server Error
[mc-image-helper] 19:50:55.839 ERROR : 'get' command failed: Failed to download https://playerdb.co/api/player/minecraft/GRNf8e6058518cd4: status code: 500, reason phrase: Internal Server Error
[mc-image-helper] 19:50:57.403 ERROR : 'get' command failed: Failed to download https://playerdb.co/api/player/minecraft/Ban8a6d5b041aa45: status code: 500, reason phrase: Internal Server Error
[init] log4j2.xml already created, skipping
[init] Checking for JSON files.
[init] Setting initial memory to 4096M and max to 4096M
[init] Starting the Minecraft server...
Starting net.minecraft.server.Main
[19:51:06] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[19:51:07] [ServerMain/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[19:51:07] [ServerMain/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[19:51:07] [ServerMain/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[19:51:07] [ServerMain/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[19:51:07] [ServerMain/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[19:51:08] [Worker-Main-2/INFO]: Loaded 7 recipes
[19:51:09] [Worker-Main-2/INFO]: Loaded 1141 advancements
[19:51:10] [Server thread/INFO]: Starting minecraft server version 1.18.2
[19:51:10] [Server thread/INFO]: Loading properties
[19:51:10] [Server thread/INFO]: Default game type: SURVIVAL
[19:51:10] [Server thread/INFO]: Generating keypair
[19:51:11] [Server thread/INFO]: Starting Minecraft server on *:25565
[19:51:11] [Server thread/INFO]: Using epoll channel type
[19:51:11] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[19:51:11] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[19:51:11] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[19:51:11] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.
[19:51:11] [Server thread/INFO]: Preparing level "world"
[19:51:17] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld

And in server.properties I still have enforce-whitelist=false

zamazan4ik commented 2 years ago

Yeah, the playerdb 500's is indeed something separate I need to look at.

No, that is my playing with changing user nicknames before actual login. Don't waste your time on it)

zamazan4ik commented 2 years ago

Possibly related to the issue parts of my helm chart values file:

# Common minecraft server settings
minecraftServer:
  # This must be overridden, since we can't accept this for the user.
  eula: true
  # may be SNAPSHOT or a specific version number
  version: LATEST
  # allowed players' names comma separated, leave blank to allow any players
  whitelist: nick1,nick2
  # comma separated admin players' names
  ops:
  # always set game mode when a player connects
  forcegameMode: true
  # choose a seed for the starting world
  levelSeed:
  # size of the world in blocks radius from spawn point (default is 29999984)
  maxWorldSize: 10000
  # One of: peaceful, easy, normal, and hard
  difficulty: hard
  # default game mode for players creative,adventure,survival or spectator
  gameMode: survival
  # message in the launcher
  motd: "Welcome to Minecraft from zamazan4ik"
  # player vs player enabled
  pvp: true
  # REQUIRED this means you get nodePort exposed on all nodes and will get
  # directed to the correct node if you connect to any
  serviceType: NodePort
  # restore the world from a backup on first execution (requires NFS volume - see below)
  downloadWorldUrl:
  # external port must be unique across all mc server instances on a given node
  nodePort: 25565
  # how far from the player are chunks rendered on the server
  # 10 is default, larger is nice on high spec hardware
  # I believe 25 is the client max so larger is wasted
  viewDistance: 10
  # Check accounts against Minecraft account service.
  onlineMode: false
  # If you adjust this, you may need to adjust resources.requests above to match.
  memory: 4096M
  overrideServerProperties: true

extraEnv:
  # recommended rolling logs for saving disk
  ENABLE_ROLLING_LOGS: true
  ENABLE_WHITELIST: true
  ENFORCE_WHITELIST: true
  FORCE_WORLD_COPY: false
itzg commented 2 years ago

Strange. To narrow down where it gets dropped it would be interesting to run helm with --dry-run --debug. Also a kubectl describe of deployment would be helpful.

zamazan4ik commented 2 years ago

Helm Dry run output: https://pastebin.com/9PiLpbkm Kubectl deployment describe: https://pastebin.com/8x1yiRhE

itzg commented 2 years ago

Comparing those two files it disappeared somewhere between helm's rendering of the deployment and the deployment object itself. Perhaps double check you're running the helm upgrade as you're expecting.

zamazan4ik commented 2 years ago

Hmmm... Not a professional Helm user. Is helm upgrade minecraft -f minecraft-helm-config.yaml minecraft-server-charts/minecraft a right command for the upgrade?

Helm version is 3.3.4, just in case

itzg commented 2 years ago

Honestly I don't use helm much myself, but that seems right other than I believe minecraft-server-charts/minecraft doesn't need to be there for an upgrade. With that, watch the logs to confirm it is modifying the deployment as expected.