Skip to main content
TRACK A·SECURE AND LAUNCH·Verified June 2026 · Lua 5.4 · ox_lib 3.x
Learning with an AI assistant?
Copies this lesson plus 2026 ground rules (no lua54 'yes', Cfx.re Portal, correct callback signatures) as a ready-to-paste mentor prompt.
Module A3 · Operate & secure

Server security baseline

Most beginner servers are not hacked by geniuses. They leak a license key on Discord. They give every staffer god-mode. They run a random script that has a backdoor. They post their database webhook in a public channel. This baseline closes those four doors. Treat it as a checklist. Run it before you go public, and again after any big change.

You'll do
Lock down the things that get new servers wiped or robbed: admin permissions, secrets, resource trust, and webhook hygiene.
Time
~25 minutes.
You need
A running server with txAdmin and a server.cfg you can edit.
You'll learn
ACE permissions -> secret handling -> txAdmin roles -> resource trust -> a baseline you re-run before every launch
BEFORE YOU START

The baseline

Give permissions by role, not by person

Admin power flows through ACE groups, not hardcoded names.

FiveM grants powers through ACE permissions (Access Control Entries: the server's allow/deny rules for who may run what). Use groups so you can add or remove a staffer in one line. Grant the narrowest power that does the job. Only owners get the parent command object, which covers every server command.

code
add_ace group.admin command allow
add_principal identifier.fivem:00000 group.admin

In txAdmin, give moderators a limited role, not full admin. Review the admin list monthly and remove anyone who left.

Keep secrets out of the repo and out of chat

No key, password, or webhook is ever pasted where others can read it.

Your license key, database password, and Discord webhooks are secrets. Keep each one in a convar (a config variable set in server.cfg, read at runtime). Your server.cfg is not in your public repo, so the values stay private. Never paste a secret in Discord, a screenshot, or a video.

If a secret ever leaks, rotate it the same hour. To rotate means to throw the leaked value away and issue a fresh one, so the old one stops working. Get a new license key at portal.cfx.re and set a new database password.

Trust only resources you can read or vouch for

No unknown script runs with full server access.

Every resource you ensure runs with full server power. (ensure is the server.cfg line that starts a resource and keeps it running.) So a bad script can do anything your server can do. Install from the official author only.

Before you run an unknown script, open its server-side .lua files and look for three red flags:

  • A PerformHttpRequest call to a web address you do not recognise. That is the script phoning out to someone else's server.
  • A long unreadable blob of letters and numbers (base64). Hidden code is often packed this way so you cannot read it.
  • load() or assert(load(...)) running text the script fetched from the internet. That runs code the author can change later, without you seeing it.

If you cannot read it, and you cannot trust who made it, do not run it.

Lock down webhooks and logging

Your Discord logs cannot be spammed or read by outsiders.

A webhook URL is a one-line address Discord gives you that posts messages into a channel. Anyone who has the URL can post to that channel, so treat it like a password. Store webhook URLs in convars, send them only from the server side, and never expose them to clients.

Keep reading the full lesson

Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.

Still ahead in this lesson
  • How the ACE example works
  • Common mistakes
  • What you can do now
  • Prove it on your own server

The remainder of Server security baseline is available to FiveM School members.