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.
On this page
NetworkLock uses two files:
config.ymlon every proxy and game server.messages.ymlon 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.
# 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| Setting | Default | What it does |
|---|---|---|
network.id | proxy-1 | The 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.key | generated on first start | The 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.enabled | true | Limit how often one IP address can try to log in. |
protection.connection-limit.max-attempts | 10 | Logins allowed per IP within the window. 1 to 10000. |
protection.connection-limit.window-seconds | 10 | The window in seconds. Allowed logins refill evenly over this time. 1 to 3600. |
protection.temporary-blocks.enabled | true | Block IPs that keep going over the limit. |
protection.temporary-blocks.duration-seconds | 60 | How 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.aliases | networklock, ["nlock"] | See New in 1.0.1. |
updates.check, updates.notify | true, true | See New in 1.0.1. |
metrics.enabled | true | See Usage statistics. |
logging.debug | false | Log every connection the proxy signs, as Signed connection of <name> to <server>. |
Extra proxy settings, not in the default file:
| Setting | Default | What it does |
|---|---|---|
protection.connection-limit.ipv6-prefix-length | 64 | IPv6 addresses in the same block of this size count as one address. 32 to 128. |
protection.temporary-blocks.violations-before-block | 5 | How many times an IP can go over the limit before it is blocked. 1 to 10000. |
protection.flood-warning-threshold | 200 | Logins per second, across all addresses, that trigger a Connection flood warning in the console. 1 to 1000000. |
protection.max-tracked-addresses | 100000 | Memory cap for the login limiter. When it is full, new addresses are not limited, and doctor warns. 1000 to 10000000. |
logging.security-events | true | Log limited and blocked logins. At most 20 lines every 10 seconds, then one Suppressed summary. |
logging.redact-addresses | false | Hide 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.
# 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| Setting | Default | What it does |
|---|---|---|
network.server-id | empty, must be set | This 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-proxies | empty, must be set | The 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 set | Optional kick texts. See Kick texts on the game server. |
commands.name, commands.aliases | networklock, ["nlock"] | See New in 1.0.1. |
updates.check | true | See New in 1.0.1. |
metrics.enabled | true | See Usage statistics. |
logging.debug | false | Log every accepted player, as Accepted <name> (<uuid>) properties=[...]. |
Extra game server settings, not in the default file:
| Setting | Default | What it does |
|---|---|---|
authentication.max-token-age-seconds | 30 | How long a proxy's signature stays valid. 5 to 300. |
authentication.max-clock-skew-seconds | 5 | How far ahead a proxy's clock may be. Keep server clocks synced. 0 to 60. |
authentication.replay-cache-max-entries | 100000 | How many used signatures to remember. If it fills up, logins are refused rather than let through. 1000 to 10000000. |
logging.security-events | true | Log refused logins. At most 20 lines every 10 seconds. |
logging.redact-addresses | false | Hide 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:
| Value | Where 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:
# 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:
&0to&9and&ato&ffor colours.&lbold,&oitalic,&nunderline,&mstrikethrough,&kobfuscated,&rreset.&#ff8800for 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#
| Code | Reason | Message used |
|---|---|---|
| NL-01 | Player came without a signature (direct connection, or forwarding off) | authentication-failed |
| NL-02 | Signature is wrong, unreadable, from an unknown proxy, or for another server | authentication-failed |
| NL-03 | Signature expired, or the proxy clock is too far ahead | authentication-timeout |
| NL-04 | Signature was already used | authentication-failed |
| NL-05 | Server is locked down, its replay cache is full, or it hit an internal error | security-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:
Unable to verify your connection. Please join through the network. [NL-01]Changing a key without downtime#
- Make a new key, for example with
openssl rand -base64 32. - On every game server, add the new key next to the old one in that proxy's
keyslist, then run/networklock reload. - Put the new key in the proxy's
security.keyand run/networklock reloadthere. - 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.
| Setting | Default | What it does |
|---|---|---|
commands.name | networklock | Name 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.check | true | Look up the newest release on GitHub at startup and every 12 hours, and log a line when a newer version exists. |
updates.notify | true | Proxy only. Tell staff with networklock.notify about a new version when they join. |
metrics.enabled | true | Send one anonymous message a day. See below. |
messages.authentication-failed | not set | Game server only. Your own kick text instead of the built-in one. |
messages.authentication-timeout | not set | Same, for an expired signature. |
messages.security-error | not set | Same, 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.ymlgainsabout,status-latest,status-outdated,status-unknownandupdate-available. Placeholders:abouthas%version%,%status%,%notify%and%servers%;status-outdatedhas%latest%;update-availablehas%current%,%latest%and%link%.- A
network.server-idwith spaces at the start or end, or longer than 64 characters, is a config error at startup. - Changing
max-token-age-secondsorreplay-cache-max-entrieswith 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
velocityorpaper) 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.