docker-minecraft-server icon indicating copy to clipboard operation
docker-minecraft-server copied to clipboard

ONLINE_MODE, OPS and WHITELIST don't have effect

Open x1unix opened this issue 1 year ago • 5 comments

Describe the problem

I have a docker-compose file with whitelist and ops values. The second other-user is not known nickname, so I disabled online mode.

Problems:

  • I get complains about other-user nickname although online mode is disabled
    • Invalid parameter provided for 'manage-users' command: Could not resolve user from Playerdb: other-user
  • I can't join game even if I'm in WHITELIST. I'm using Prism Launcher with Microsoft Account logged in.
  • OPS var doesn't work. I'm a regular user even when that value is defined.
    I had to grant myself admin privileges via console as OPS didn't have effect.

Container definition

services:
  mc:
    image: itzg/minecraft-server
    # ...
   environment:
      WHITELIST: |
        x1unix
        other-user
      OPS: x1unix
      ONLINE_MODE: false

Container logs

minecraft  | + mc-image-helper manage-users --version=1.20.6 --output-directory=/data --type=JAVA_WHITELIST --existing=SYNCHRONIZE x1unix other-user
minecraft  | [mc-image-helper] 02:16:23.440 DEBUG : Resolved 'x1unix' from user cache by name: JavaUser(name=x1unix, uuid=d752c00b-765a-3c9f-844e-51530448ab57)
minecraft  | [mc-image-helper] 02:16:23.441 DEBUG : Resolving user=other-user from PlayerDB API
minecraft  | [mc-image-helper] 02:16:23.826 DEBUG : JSON FETCH: uri=https://playerdb.co/api/player/minecraft/peregonb headers=[user-agent: itzg/mc-image-helper/1.39.0 (cmd=manage-users), x-fetch-session: f375488a-b6fe-4a88-b974-32e08fb79654, accept: application/json, host: playerdb.co]
minecraft  | [mc-image-helper] 02:16:23.865 ERROR : Invalid parameter provided for 'manage-users' command: Could not resolve user from Playerdb: other-user
minecraft  | [mc-image-helper] 02:16:23.865 DEBUG : Invalid parameter details
minecraft  | me.itzg.helpers.errors.InvalidParameterException: Could not resolve user from Playerdb: peregonb
minecraft  |    at me.itzg.helpers.users.PlayerdbUserApi.lambda$resolveUser$0(PlayerdbUserApi.java:32)
minecraft  |    at reactor.core.publisher.Mono.lambda$onErrorMap$27(Mono.java:3769)
minecraft  |    at reactor.core.publisher.Mono.lambda$onErrorResume$29(Mono.java:3859)
minecraft  |    at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
minecraft  |    at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondError(MonoFlatMap.java:241)
minecraft  |    at reactor.core.publisher.MonoFlatMap$FlatMapInner.onError(MonoFlatMap.java:315)
minecraft  |    at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onError(FluxContextWrite.java:121)
minecraft  |    at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onError(FluxDoFinally.java:119)
minecraft  |    at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:149)
minecraft  |    at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onNext(FluxDefaultIfEmpty.java:122)
minecraft  |    at reactor.core.publisher.FluxHandle$HandleSubscriber.onNext(FluxHandle.java:129)
minecraft  |    at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onNext(FluxMap.java:224)
minecraft  |    at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:113)
minecraft  |    at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:194)
minecraft  |    at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
minecraft  |    at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2071)
minecraft  |    at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:118)
minecraft  |    at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)
minecraft  |    at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
minecraft  |    at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415)
minecraft  |    at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:446)
minecraft  |    at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:500)
minecraft  |    at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:793)
minecraft  |    at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
minecraft  |    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:289)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
minecraft  |    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
minecraft  |    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
minecraft  |    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
minecraft  |    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
minecraft  |    at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
minecraft  |    at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1338)
minecraft  |    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1387)
minecraft  |    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:530)
minecraft  |    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469)
minecraft  |    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
minecraft  |    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
minecraft  |    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
minecraft  |    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
minecraft  |    at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:801)
minecraft  |    at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:501)
minecraft  |    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:399)
minecraft  |    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
minecraft  |    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
minecraft  |    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
minecraft  |    at java.base/java.lang.Thread.run(Unknown Source)
minecraft  |    Suppressed: java.lang.Exception: #block terminated with an error
minecraft  |            at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:103)
minecraft  |            at reactor.core.publisher.Mono.block(Mono.java:1712)
minecraft  |            at me.itzg.helpers.users.PlayerdbUserApi.resolveUser(PlayerdbUserApi.java:51)
minecraft  |            at me.itzg.helpers.users.ManageUsersCommand.lambda$resolveJavaUserId$1(ManageUsersCommand.java:254)
minecraft  |            at java.base/java.util.Optional.orElseGet(Unknown Source)
minecraft  |            at me.itzg.helpers.users.ManageUsersCommand.resolveJavaUserId(ManageUsersCommand.java:218)
minecraft  |            at me.itzg.helpers.users.ManageUsersCommand.reconcile(ManageUsersCommand.java:165)
minecraft  |            at me.itzg.helpers.users.ManageUsersCommand.processJavaUserIdList(ManageUsersCommand.java:138)
minecraft  |            at me.itzg.helpers.users.ManageUsersCommand.call(ManageUsersCommand.java:101)
minecraft  |            at me.itzg.helpers.users.ManageUsersCommand.call(ManageUsersCommand.java:35)
minecraft  |            at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
minecraft  |            at picocli.CommandLine.access$1500(CommandLine.java:148)
minecraft  |            at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
minecraft  |            at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
minecraft  |            at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
minecraft  |            at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
minecraft  |            at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
minecraft  |            at picocli.CommandLine.execute(CommandLine.java:2174)
minecraft  |            at me.itzg.helpers.McImageHelper.main(McImageHelper.java:159)
minecraft exited with code 0

x1unix avatar Jun 23 '24 02:06 x1unix

Your logs don't match your compose file since it's looking for https://playerdb.co/api/player/minecraft/peregonb

and not "other-user"

Visiting the URL confirms the reported error

{"message":"No Minecraft user could be found.","code":"minecraft.invalid_username","data":{},"success":false,"error":false}

itzg avatar Jun 23 '24 03:06 itzg

@itzg I tried to redact my friend's username but forgot one place :)

Looks like the issue is that mc-image-helper still performs validation even if offline mode is disabled.

x1unix avatar Jun 23 '24 17:06 x1unix

I don't understand. Offline mode or not you're trying to put a username into ops/whitleist. It has to call the 3rd party API to resolve the username. How is the system supposed to convert a name to a UUID otherwise?

itzg avatar Jun 23 '24 17:06 itzg

@itzg is it possible to skip username to UUID conversion step? To just use username instead of UUID.

x1unix avatar Jun 23 '24 22:06 x1unix

Yes, you can provide UUIDs instead of username

https://docker-minecraft-server.readthedocs.io/en/latest/configuration/server-properties/#whitelist-players

itzg avatar Jun 23 '24 23:06 itzg