# Security

URL: https://zerodev.ca/docs/medusa/modules/security

> Member verification, an account age gate, anti-raid lockdowns and ghost ping detection.



Security keeps bad accounts out and stops mention abuse. Each part has its own settings and can be turned on separately.

## Verification

New members get the **Unverified Role** and must pass a check to get the **Verified Role**. **Verification Mode** picks the check:

| Mode                    | What the member does                                                   |
| ----------------------- | ---------------------------------------------------------------------- |
| Interactive Button      | Presses the button.                                                    |
| Distorted Image Captcha | Types the code from an image. **Captcha Code Length** sets its length. |
| Secret Passphrase       | Types the **Verification Passphrase**.                                 |

Post the panel from the dashboard **Post** page or with `/post`. Its title, description, color and button label are set under **Panel**. The description can use `%server%`.

## Gatekeeper

Accounts younger than **Minimum Account Age in Days** get the **Enforcement Action** when they join: kick, give the **Quarantine Role**, or only log it. **Direct Message Explanation** tells them why. Bots are skipped while **Exempt Applications** is on.

## Anti-Raid

When **Join Threshold Count** members join within **Window Duration in Seconds**, raid mode starts and **Staff Alert Roles** are pinged. The **Raid Action** decides what happens:

| Action              | What happens                                               |
| ------------------- | ---------------------------------------------------------- |
| Channel Lockdown    | Everyone loses Send Messages in the **Lockdown Channels**. |
| Auto-Kick New Joins | Everyone who joins during the raid is kicked.              |
| Audit Log Only      | The raid is only logged.                                   |

Raid mode stays on until staff run `/security raid action:deactivate`, which also unlocks the channels.

## Anti-Ping

* **Ghost pings**: when a message that mentioned members is deleted or edited to remove the mention, Medusa posts an alert in the channel and logs it.
* **Mass mentions**: messages with more than **Maximum Mentions Per Message** get the **Mass Mention Action**: delete the message, delete it and time the author out for 10 minutes, or warn the author.

Administrators and **Exempt Roles** are skipped.

<Callout type="warn">
  Medusa's highest role must be above the verified, unverified and quarantine roles.
</Callout>

## Settings

**Verification Settings**

| Setting                        | Default                 | What it does                             |
| ------------------------------ | ----------------------- | ---------------------------------------- |
| Enable Verification            | On                      | Turns verification on or off.            |
| Verification Mode              | Interactive Button      | The check members must pass.             |
| Verified Role                  | None                    | Given after passing.                     |
| Unverified Role                | None                    | Given on join and removed after passing. |
| Verification Channel           | None                    | Where the panel lives.                   |
| Verification Passphrase        | None                    | Used in passphrase mode.                 |
| Captcha Code Length            | 5                       | Characters in a captcha.                 |
| Direct Message on Verification | On                      | DMs the member after they pass.          |
| Panel Title                    | Member Verification     | Title of the panel.                      |
| Panel Description              | Welcome to %server%!... | Text of the panel.                       |
| Panel Color                    | `#22c55e`               | Color of the panel.                      |
| Button Label                   | Verify                  | Text on the button.                      |

**Gatekeeper Settings**

| Setting                     | Default     | What it does                           |
| --------------------------- | ----------- | -------------------------------------- |
| Enable Gatekeeper           | Off         | Turns the age check on or off.         |
| Minimum Account Age in Days | 7           | Accounts younger than this are caught. |
| Enforcement Action          | Kick Member | Kick, quarantine or log only.          |
| Quarantine Role             | None        | Role used for quarantine.              |
| Direct Message Explanation  | On          | DMs the member the reason.             |
| Exempt Applications         | On          | Skips bots.                            |

**Anti-Raid Settings**

| Setting                    | Default          | What it does                           |
| -------------------------- | ---------------- | -------------------------------------- |
| Enable Anti-Raid           | Off              | Turns raid detection on or off.        |
| Join Threshold Count       | 10               | Joins that count as a raid.            |
| Window Duration in Seconds | 10               | Time those joins must happen in.       |
| Raid Action                | Channel Lockdown | Lock channels, kick joins or log only. |
| Lockdown Channels          | None             | Channels locked during a raid.         |
| Staff Alert Roles          | None             | Roles pinged when a raid starts.       |

**Anti-Ping Settings**

| Setting                           | Default             | What it does                     |
| --------------------------------- | ------------------- | -------------------------------- |
| Enable Anti-Ping Protection       | On                  | Turns anti-ping on or off.       |
| Alert in Channel on Ghost Ping    | On                  | Posts an alert in the channel.   |
| Log Ghost Pings to Security Audit | On                  | Logs each ghost ping.            |
| Maximum Mentions Per Message      | 5                   | Mentions allowed in one message. |
| Mass Mention Action               | Delete Message Only | What happens over the limit.     |
| Exempt Roles                      | None                | Roles that are never checked.    |

## Commands

| Command                       | What it does                                                                                  |
| ----------------------------- | --------------------------------------------------------------------------------------------- |
| `/security verify <user>`     | Verify a member by hand.                                                                      |
| `/security unverify <user>`   | Remove a member's verification.                                                               |
| `/security raid [action]`     | Show raid status, or start or end a lockdown.                                                 |
| `/security antiping [action]` | Show anti-ping status, or send a test alert.                                                  |
| Verify Member                 | Right-click a member, then **Apps > Verify Member**. Off by default on the **Commands** page. |

These belong to the Admin rank by default. The **Security Events** log records verifications, gatekeeper kicks, raids, ghost pings and blocked mass mentions.
