Information: Minecraft Server: I started working on my old Minecraft server called Terona. Join our discord if you want :D Join

Configure NetworkLock

Every NetworkLock setting on the proxy and the game server, with its default and what it really does, plus messages and key changes.

NetworkLockChecked

On this page

NetworkLock uses two files:

  • config.yml on every proxy and game server.
  • messages.yml on proxies only.

The default files only contain the settings most people change. Every other setting below has a built-in default; add the line to the file if you want to change it.

How reloading works#

Run /networklock reload after you edit a file. NetworkLock checks the whole file first and only applies it if everything is valid. If anything is wrong, it keeps the old config, lists every problem, and logs each one as Configuration problem: ....

On a proxy, config.yml and messages.yml are checked together and applied together.

Proxy config.yml#

This is the default file in 1.0.1. The key is filled in on first start.

yaml
# NetworkLock - proxy

network:
  id: "proxy-1"            # unique name for this proxy

security:
  # Your key. It is created here automatically on first start.
  # Copy it into trusted-proxies on every server. Keep it private.
  key: ""

protection:
  connection-limit:
    enabled: true
    max-attempts: 10       # logins per IP...
    window-seconds: 10     # ...within this many seconds
  temporary-blocks:
    enabled: true
    duration-seconds: 60
  exempt: []               # IPs or CIDR ranges that are never limited

commands:
  name: "networklock"      # restart the proxy after changing these
  aliases: ["nlock"]

updates:
  check: true              # look for new versions on GitHub
  notify: true             # tell staff with networklock.notify when they join

metrics:
  # Counts this proxy in the public "servers protected by NetworkLock" number, once a day.
  # Sends only an anonymous ID, the plugin version and the platform. Set to false to opt out.
  enabled: true

logging:
  debug: false
SettingDefaultWhat it does
network.idproxy-1The name of this proxy. Game servers list it in trusted-proxies. 1 to 64 characters of A-Z a-z 0-9 . _ -. Use a different id on every proxy.
security.keygenerated on first startThe proxy's secret key: 32 random bytes in base64. It must decode to 32 to 128 bytes. Can also be env:VARIABLE or file:/path.
protection.connection-limit.enabledtrueLimit how often one IP address can try to log in.
protection.connection-limit.max-attempts10Logins allowed per IP within the window. 1 to 10000.
protection.connection-limit.window-seconds10The window in seconds. Allowed logins refill evenly over this time. 1 to 3600.
protection.temporary-blocks.enabledtrueBlock IPs that keep going over the limit.
protection.temporary-blocks.duration-seconds60How long a block lasts. 1 to 86400.
protection.exempt[]IP addresses or ranges that are never limited, for example ["203.0.113.0/24"]. Only IP addresses; host names are rejected.
commands.name, commands.aliasesnetworklock, ["nlock"]See New in 1.0.1.
updates.check, updates.notifytrue, trueSee New in 1.0.1.
metrics.enabledtrueSee Usage statistics.
logging.debugfalseLog every connection the proxy signs, as Signed connection of <name> to <server>.

Extra proxy settings, not in the default file:

SettingDefaultWhat it does
protection.connection-limit.ipv6-prefix-length64IPv6 addresses in the same block of this size count as one address. 32 to 128.
protection.temporary-blocks.violations-before-block5How many times an IP can go over the limit before it is blocked. 1 to 10000.
protection.flood-warning-threshold200Logins per second, across all addresses, that trigger a Connection flood warning in the console. 1 to 1000000.
protection.max-tracked-addresses100000Memory cap for the login limiter. When it is full, new addresses are not limited, and doctor warns. 1000 to 10000000.
logging.security-eventstrueLog limited and blocked logins. At most 20 lines every 10 seconds, then one Suppressed summary.
logging.redact-addressesfalseHide the end of IP addresses in NetworkLock's log lines. IPv4 keeps the first two parts (203.0.x.x), IPv6 the first three groups.

Game server config.yml#

This is the default file in 1.0.1.

yaml
# NetworkLock - server

network:
  server-id: ""            # this server's name in your proxy config, e.g. "lobby"

authentication:
  # Proxies allowed to send players here.
  # Each key is security.key in that proxy's NetworkLock config.yml.
  trusted-proxies: []
  #  - id: "proxy-1"
  #    keys: ["paste the proxy key here"]

# Optional: what refused players see. Also shown by queue plugins like ajQueue.
# Leave these out to use the default text, which the proxy replaces with its messages.yml.
# messages:
#   authentication-failed: "&cPlease join through the network."
#   authentication-timeout: "&cYour connection timed out. Please reconnect."
#   security-error: "&cThis server is not accepting players right now."

commands:
  name: "networklock"      # restart the server after changing these
  aliases: ["nlock"]

updates:
  check: true              # look for new versions on GitHub

metrics:
  # Counts this server in the public "servers protected by NetworkLock" number, once a day.
  # Sends only an anonymous ID, the plugin version and the platform. Set to false to opt out.
  enabled: true

logging:
  debug: false
SettingDefaultWhat it does
network.server-idempty, must be setThis server's name in your proxy config, for example lobby. A signature made for another name is refused. Exactly as written there: no spaces at the start or end, at most 64 characters.
authentication.trusted-proxiesempty, must be setThe proxies allowed to send players here. Each entry has an id (the proxy's network.id) and keys (a list with that proxy's key). Each key can also be env:VARIABLE or file:/path. A single key: instead of keys: is also accepted.
messages.*not setOptional kick texts. See Kick texts on the game server.
commands.name, commands.aliasesnetworklock, ["nlock"]See New in 1.0.1.
updates.checktrueSee New in 1.0.1.
metrics.enabledtrueSee Usage statistics.
logging.debugfalseLog every accepted player, as Accepted <name> (<uuid>) properties=[...].

Extra game server settings, not in the default file:

SettingDefaultWhat it does
authentication.max-token-age-seconds30How long a proxy's signature stays valid. 5 to 300.
authentication.max-clock-skew-seconds5How far ahead a proxy's clock may be. Keep server clocks synced. 0 to 60.
authentication.replay-cache-max-entries100000How many used signatures to remember. If it fills up, logins are refused rather than let through. 1000 to 10000000.
logging.security-eventstrueLog refused logins. At most 20 lines every 10 seconds.
logging.redact-addressesfalseHide the end of IP addresses in log lines.

A game server refuses to start protecting (and lets nobody in) if server-id is empty, has spaces at the start or end, or is longer than 64 characters, trusted-proxies is empty, an id is invalid or listed twice, an entry has no keys, or a key cannot be read. If two proxies share the same key, it logs a warning, because a leak of one would compromise both.

There is no setting to switch the protection off. If you want it off, remove the plugin.

Keys from environment variables or files#

Any key can be written three ways:

ValueWhere the key comes from
"Abc...xyz"The key itself, in base64 or base64url.
"env:NETWORKLOCK_KEY"The environment variable NETWORKLOCK_KEY.
"file:/run/secrets/networklock"The first line of that file, for example a container secret.

The proxy only writes a key into config.yml when security.key is still "". It never overwrites a key, an env: value or a file: value.

messages.yml (proxy only)#

The proxy owns the texts players see. Game servers send a short fixed text with a code, and the proxy replaces it with your text from messages.yml. This is the default file in 1.0.1:

yaml
# NetworkLock - messages
# Colors: &0-&9 &a-&f, styles: &l &o &n &m &k &r, hex: &#ff8800. MiniMessage tags also work.
# A message can be one line, or a list of lines.

prefix: "&8[&bNetworkLock&8] "

messages:
  no-permission: "&cYou do not have permission."
  reloaded: "&aConfiguration reloaded."
  reload-failed: "&cReload failed, the old config is still active. Check the console."
  invalid-command: "&cUnknown command. Use &f/networklock help&c."
  authentication-failed: "&cConnection authentication failed."
  authentication-timeout: "&cAuthentication timed out. Please reconnect."
  connection-limited: "&cToo many connection attempts. Please wait a moment."
  temporarily-blocked: "&cConnection temporarily restricted."
  security-error: "&cUnable to establish a secure connection. Please try again later."

  # /networklock about. Placeholders: %version% %status% %notify% %servers%
  about:
    - "&b&lNetworkLock &7v%version%"
    - "&7Version: %status%"
    - "&7Update notify: &f%notify%"
    - "&7Servers: &f%servers%"
    - "&7Made by &fDarkZmaj &8| &7Support: &bhttps://kori.my"
  status-latest: "&aLATEST"
  status-outdated: "&cOUTDATED &7(newest: &f%latest%&7)"
  status-unknown: "&7not checked"

  # Sent to staff on join when a newer version exists. Placeholders: %current% %latest% %link%
  update-available:
    - "&eA new NetworkLock version is available!"
    - "&7Current: &c%current% &7New: &a%latest%"
    - "&7Download: &b%link%"

Formatting:

  • &0 to &9 and &a to &f for colours.
  • &l bold, &o italic, &n underline, &m strikethrough, &k obfuscated, &r reset.
  • &#ff8800 for any hex colour.
  • MiniMessage tags such as <aqua> also work, and you can mix them with & codes. On BungeeCord and Waterfall, click and hover tags are removed.

If a message is missing from the file, the built-in text is used.

Which message players see#

CodeReasonMessage used
NL-01Player came without a signature (direct connection, or forwarding off)authentication-failed
NL-02Signature is wrong, unreadable, from an unknown proxy, or for another serverauthentication-failed
NL-03Signature expired, or the proxy clock is too far aheadauthentication-timeout
NL-04Signature was already usedauthentication-failed
NL-05Server is locked down, its replay cache is full, or it hit an internal errorsecurity-error

On the proxy itself, connection-limited and temporarily-blocked are shown when the login limit refuses someone, and security-error when the proxy's own config is broken.

A player who connects straight to a game server never reaches the proxy, so they see the game server's built-in text:

text
Unable to verify your connection. Please join through the network. [NL-01]

Changing a key without downtime#

  1. Make a new key, for example with openssl rand -base64 32.
  2. On every game server, add the new key next to the old one in that proxy's keys list, then run /networklock reload.
  3. Put the new key in the proxy's security.key and run /networklock reload there.
  4. Remove the old key from the game servers and reload again.

While a proxy has more than one key, doctor reminds you to remove the old one.

If a key leaks, remove it (or the whole proxy entry) from every game server and run /networklock reload. It stops working straight away. Other proxies are not affected.

New in 1.0.1#

These settings are new in 1.0.1 and are in the default files above. 1.0.0 ignores them. If you upgrade from 1.0.0, your old file keeps working and these settings use their defaults until you add them.

SettingDefaultWhat it does
commands.namenetworklockName of the command. 1 to 32 characters of a-z 0-9 _ -. An invalid value falls back to the default. Restart to apply.
commands.aliases["nlock"]Other names for the command. Restart to apply.
updates.checktrueLook up the newest release on GitHub at startup and every 12 hours, and log a line when a newer version exists.
updates.notifytrueProxy only. Tell staff with networklock.notify about a new version when they join.
metrics.enabledtrueSend one anonymous message a day. See below.
messages.authentication-failednot setGame server only. Your own kick text instead of the built-in one.
messages.authentication-timeoutnot setSame, for an expired signature.
messages.security-errornot setSame, when this server is locked down.

Other 1.0.1 changes:

  • Every refused login is logged with the reason and what to fix, for example reason=WRONG_TARGET: signed for server 'smp', but this server's network.server-id is 'bloodysmp'.
  • Any message can be a list of lines, and links in messages become clickable.
  • messages.yml gains about, status-latest, status-outdated, status-unknown and update-available. Placeholders: about has %version%, %status%, %notify% and %servers%; status-outdated has %latest%; update-available has %current%, %latest% and %link%.
  • A network.server-id with spaces at the start or end, or longer than 64 characters, is a config error at startup.
  • Changing max-token-age-seconds or replay-cache-max-entries with a reload can no longer let an already-used signature through again.

Kick texts on the game server#

Queue plugins like ajQueue send players with their own connection method, which the proxy cannot intercept, so they show the game server's text as it is. Since 1.0.1 you can set that text under messages: in the game server's config.yml. When a game server has its own text, the proxy shows that text instead of its messages.yml one.

Usage statistics#

With metrics.enabled: true, each proxy and game server sends one small message a day over HTTPS to the NetworkLock stats API (api.kori.my). It contains:

  • An anonymous ID: a one-way hash, so the same server is only counted once. It cannot be turned back into anything, and it cannot be worked out from the key fingerprints shown in logs.
  • The NetworkLock version.
  • The platform (for example velocity or paper) and whether it is a proxy or a game server.

It never contains IP addresses, player names, server names or keys. Set metrics.enabled: false and run /networklock reload to turn it off. If the API cannot be reached, nothing else is affected.

Your likes

Only what this browser did. Your data on this device