Disable encryption for now
All checks were successful
Build & Test / nix-build (push) Successful in 1m7s

This commit is contained in:
Kodi Craft 2024-07-09 14:18:48 +02:00
parent 099d2a3a68
commit 9291af2bc8
Signed by: kodi
GPG Key ID: 69D9EED60B242822
3 changed files with 9 additions and 8 deletions

View File

@ -2,5 +2,5 @@ import Config
config :amethyst,
port: 25599, # Bogus port for testing, avoids unexpected conflicts
encryption: true, # Whether or not to enable encryption, this should almost always be 'true' for security reasons
auth: true # Whether or not users should be authenticated.
encryption: false, # Whether or not to request encryption from clients.
auth: false # Whether or not users should be authenticated with Mojang.

View File

@ -49,8 +49,8 @@ defmodule Amethyst.Server.Handshake do
## HANDLING
# Handshake https://wiki.vg/Protocol#Handshake
@spec handle(any(), any()) :: no_return()
def handle({:handshake, ver, addr, port, next}, client) do
Logger.info("Got handshake, version #{ver} on #{addr}:#{port}. Wants to move to #{next}")
def handle({:handshake, 767, addr, port, next}, client) do
Logger.info("Got handshake, version 767 on #{addr}:#{port}. Wants to move to #{next}")
case next do
:status -> Amethyst.Server.Status.serve(client)
:login -> Amethyst.Server.Login.serve(client)

View File

@ -107,10 +107,11 @@ defmodule Amethyst.Server.Login do
def handle({:login_start, name, uuid}, client) do
Logger.info("Logging in #{name} (#{uuid})")
if Application.fetch_env!(:amethyst, :encryption) do
verify_token = :crypto.strong_rand_bytes(4)
pubkey = Amethyst.Keys.get_pub()
auth = Application.fetch_env!(:amethyst, :auth)
transmit({:encryption_request, "amethyst", pubkey, verify_token, auth}, client)
raise RuntimeError, "Encryption is currently unsupported." # TODO: Implement encryption
# verify_token = :crypto.strong_rand_bytes(4)
# pubkey = Amethyst.Keys.get_pub()
# auth = Application.fetch_env!(:amethyst, :auth)
# transmit({:encryption_request, "amethyst", pubkey, verify_token, auth}, client) # This is broken for some reason? java.lang.IllegalStateException: Protocol Error
else
transmit({:login_success, uuid, name, [], false}, client)
end