diff --git a/config/runtime.exs b/config/runtime.exs index 65c6018..0b68390 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -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. diff --git a/lib/servers/handhsake.ex b/lib/servers/handhsake.ex index f174daf..a4014f9 100644 --- a/lib/servers/handhsake.ex +++ b/lib/servers/handhsake.ex @@ -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) diff --git a/lib/servers/login.ex b/lib/servers/login.ex index 46a520e..3d87307 100644 --- a/lib/servers/login.ex +++ b/lib/servers/login.ex @@ -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