Files
Cockatrice/servatrice/servatrice.ini.example
BruebachL ed4eb1cb31
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Desktop / Debian 13 (push) Has been cancelled
Build Desktop / Debian 12 (push) Has been cancelled
Build Desktop / Fedora 44 (push) Has been cancelled
Build Desktop / Fedora 43 (push) Has been cancelled
Build Desktop / Servatrice_Debian 12 (push) Has been cancelled
Build Desktop / Ubuntu 26.04 (push) Has been cancelled
Build Desktop / Ubuntu 24.04 (push) Has been cancelled
Build Desktop / Arch (push) Has been cancelled
Build Desktop / macOS 15 (push) Has been cancelled
Build Desktop / macOS 13 Intel (push) Has been cancelled
Build Desktop / macOS 14 (push) Has been cancelled
Build Desktop / macOS 15 Debug (push) Has been cancelled
Build Desktop / Windows 10 (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
[Server/Client/Protocol] Reporting users + moderation queue functionality (#7091)
* [Server/Client/Protocol] Reporting users + moderation queue functionality

Took 6 minutes

Took 3 minutes

Took 8 seconds

Took 11 minutes

Took 12 minutes

Took 7 minutes

Took 15 seconds

Took 2 minutes

Took 1 minute


Took 30 seconds

Took 16 seconds

* CI Fix

Took 6 minutes

* CI Fix

Took 6 minutes

* [Protocol] Add moderation investigation commands

Adds the protocol layer for the moderation investigation suite:
- Command_GetUserSessions/GetUserAlts/GetModeratorLastLogins/ResetUserPassword/RemoveUserAvatar (1013-1017)
- Response extensions 1215-1219 with ServerInfo messages for sessions, alts, and staff logins
- last_login on Response_ReportUserInfo and warning_il on Response_WarnList

Took 2 minutes

* [Utility] Add warning categories parser with infraction levels

Parses the server's 'officialwarnings' setting (comma-separated, optional
'|IL' suffix) into WarningCategory structs so the client can display the
infraction level of each warning category. Includes GTest coverage.

* [Server] Add moderation investigation tools

Implements the server side of the moderation suite:
- getUserSessions/getUserAlts/getModeratorLastLogins/removeUserAvatar DB methods
- Handlers for all five new commands with audit records (PASSWORD_RESET,
  REMOVE_USER_AVATAR); password resets return a generated temporary password
- cmdGetWarnList now reports per-category infraction levels from the
  officialwarnings setting; cmdReportUserInfo reports last_login
- Update servatrice.ini.example with the warning taxonomy
- Password/avatar mutations report RespNameNotFound when the user does not exist

* [Client] Add moderation tab with investigate, password reset, and avatar removal

- New Moderation tab: search a user to show account info, alternate
  accounts, login sessions, and staff last logins; actions to reset the
  user's password (shows the generated temporary password) and remove the
  user's avatar
- 'Investigate user' entry in the user context menu opens the tab pre-loaded
  for that user
- Warning dialog shows the infraction level of each warning category
- Tab wired into TabSupervisor with a moderator-gated menu action, shortcut,
  and tabs.ini persistence (default closed)

* [Server/Client/Protocol] Address PR #7091 review: security, bug, and perf fixes

Security:
- Promote RESET_USER_PASSWORD to admin-only dispatch (was moderator-accessible)
- Reject password reset on users with equal/higher privilege than caller
- Notify affected user via Event_NotifyUser::CUSTOM when password is reset
- Add server-side category whitelist for reports
- Drop reporter name fallback in comment/details authorization (ID-only)
- Force password change: new DB column + login enforcement + client disconnect

Bugs:
- XSS via QTextEdit::append() → insertPlainText() in report tab and utils
- allNotified initialized to true even with empty recipients list
- Warning combo box: use currentData() instead of baked-in display text
- Report resolution now records who resolved (resolved_by column + audit)

Performance:
- IP-correlation subquery: add 6-month window + LIMIT 200
- getUserSessions: clamp limit to 500

Non-blocking:
- Palette-aware colors in report_utils.cpp (dark/light mode)
- Report list pagination: offset/limit fields + total_count in response
- SessionCommand enum gap comment for reserved values 1201-1203

Schema: 36→37 (force_password_change), 37→38 (resolved_by)

Took 12 minutes


Took 16 seconds

* Fix macOs pedantry

Took 5 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-08-21 15:00:13 +02:00

442 lines
19 KiB
Plaintext

; Servatrice configuration file
;
; This is the main configuration file for Servatrice; while using a configuration is not mandatory,
; you may want to customize some aspects of your servatrice instance, like its name, port or the way
; users can authenticate to the server.
;
; Can be passed to servatrice with --config /path/to/servatrice.ini
[server]
; This is the name that servatrice exposes to the users; the default value is pretty boring
name="My Cockatrice server"
; Multiple servatrice servers can run on the same host using the same database; each server instance
; must have a different id; the default id is 1
id=1
; The IP address servatrice will listen on for clients; defaults to "any" to listen on all the interfaces,
; a specific IPv4/v6 addresses can be used, eg for localhost-only 127.0.0.1 for IPv4 or ::1 for IPv6.
host=any
; The TCP port number Servatrice will listen on for clients; default is 4747;
; Will be removed in the future, use websocket connection instead
port=4747
; Servatrice can scale up to serve big number of users using more than one parallel thread of execution;
; If your server is hosting a lot of players and they frequently report of being unable to login or
; long delays (lag), you may want to try increasing this value; default is 1.
; Set to 0 to disable the tcp server.
number_pools=1
; Servatrice can listen for clients on websockets, too. Multiple connection pools are available but
; unfortunately, due to a Qt limitation, they must run in the same execution thread.
; Set to 0 to disable the websocket server.
websocket_number_pools=1
; The IP address servatrice will listen on for websockets clients; defaults to "any"
websocket_host=any
; The TCP port number servatrice will listen on for websockets clients; default is 4748
websocket_port=4748
; When database is enabled, servatrice writes the server status in the "update" database table; this
; setting defines every how many milliseconds servatrice will update its status; default is 15000 (15 secs)
statusupdate=15000
; Do you want servatrice to write important events and errors to a logfile? Default is 1 (yes).
writelog=1
; Choose a name for the log file, if enabled; you can specify an absolute path or a path relative to
; the servatrice executable; the default file name is server.log (in the same path as servatrice)
; Note: When running servatrice under windows you will need to use double backslashes between folder locations
; [ex: C:\\Temp\\server.log ]
logfile=server.log
; You may want to log only certain messages in the logfile. The default log level is extremely verbose.
; This setting should contain a comma-separated list of strings that will be selectively logged.
; All other lines will be excluded from the log. Default is empty; example: "Registration,_Login,foobar"
logfilters=""
; Set the time interval in seconds that servatrice will use to communicate with each connected client
; to verify the client has not timed out. Defaults is 1 seconds
clientkeepalive=1
; Maximum time in seconds a player can stay inactive with there client not even responding to pings, before is
; considered disconnected; default is 15
max_player_inactivity_time=15
; More modern clients generate client IDs based on specific client side information. Enable this option to
; require that clients report the client ID in order to log into the server. Default is false
requireclientid=false
; You can limit the types of clients that connect to the server by requiring different features be available
; on the client. This setting can contain a comma-seperated list of features. if any of the features
; listed in this line are not available on the client the client will be denied access to the server upon
; attempting to log in. Example: "client_id,client_ver,websocket"
requiredfeatures=""
; You can define custom warnings that users are sent when the moderation staff uses the right client warn user
; menu option. This list is comma seperated that each item will appear in the drop down list for staff members
; to choose from. Each entry may optionally carry a recommended starting intervention level (see the moderator
; guide) by appending "|" and the level number. Entries without an explicit level default to intervention
; level 1. Example: "Flaming,Foul Language"
officialwarnings="Abusive Language|1,Calling Out User|1,Causing Drama|1,Cheating|2,Disrespecting Staff|1,Disrupting a Draft|1,Inappropriate Avatar|3,Inappropriate Game Name|1,Kicking Without Valid Reason|1,Spamming|1,Targeted Harassment|2"
; Maximum time in seconds a player can stay connected but idle. Default is 3600 (0 = disabled)
; Clients will be notified at the 90% time period of pending disconnection if they do not take action.
idleclienttimeout=3600
[authentication]
; Servatrice can authenticate users connecting. It currently supports 3 different authentication methods:
; * none: no authentication, accept every user;
; * password: require users to specify a common password to log in;
; * sql: authenticate users against the "users" table of the database;
; Please note that only the "sql" method permits to have registered users and store their data on the server.
method=none
; if the chosen authentication method is password, here you can define the password your users will use to log in
password=123456
; Accept only registered users? default is false (accept unregistered users)
regonly=false
[users]
; The minimum length a username can be
minnamelength=6
; The maximum length a username can be
maxnamelength=12
; If a username should be allowed to contain lowercase chars [a-z]
allowlowercase=true
; If a username should be allowed to conatain uppercase chars [A-Z]
allowuppercase=true
; If a username should be allowed to contain numbers [0-9]
allownumerics=true
; Define punctuation allowed in usernames
allowedpunctuation=_.-
; If a username can begin with punctuation defined in allowedpunctuation
allowpunctuationprefix=false
; Disallow usernames containing these words. This list is comma seperated, e.g.
; "admin,user,name"
disallowedwords="admin"
; Overwrite the words shown to the user when they enter a wrong username,
; use \n to start a new line. Neither the real wordlist nor the disallowed
; expressions will be sent to the user if this is set.
; In the old versions of the client this list will be prefaced with
; "can not contain any of the following words:"
; example:
;displaydisallowedwords="no attempts at impersonating staff\nno unparliamentary language\nno references to controversial figures\nstaff reserves the right to remove accounts deemed inappropriate"
; Setting it to nothing will simply hide the list:
;displaydisallowedwords=
; Disallow usernames matching these regular expressions. This list is comma
; separated, e.g. "\\w+\\d+,\\d{2}user", hence you cannot use commas in your
; expressions. Backslashes must be escaped, so `\w+\d+` becomes `\\w+\\d+`.
; WARNING: Complex expressions can be harmful to performance. Please make sure
; your expressions are considered well formed. See this page for info:
; http://www.regular-expressions.info/catastrophic.html
disallowedregexp=""
; Define minimum password length
; Default 6.
minpasswordlength = 6
[registration]
; Servatrice can process registration requests to add new users on the fly.
; Enable this feature? Default false.
;enabled=false
; Require users to provide an email address in order to register. Default true.
;requireemail=true
; Require email activation. Newly registered users will receive an activation token by email,
; and will be required to input back this token on cockatrice at the first login to get their
; account activated. Default true.
;requireemailactivation=true
; Set this number to the maximum number of accounts any one user can use to create new accounts
; using the same email address. 0 = Unlimited number of accounts (default).
;maxaccountsperemail=0
; You can prevent users from using certain mail domains for registration. This setting contains a
; comma-seperated list of email provider domains that you would like to prevent users from using
; during registration. Comparison's are implicit, so placing an entry such as mail.com will also
; prevent users from registering accounts with providers such as gmail.com and hotmail.com
; Example: "10minutemail.com,gmail.com"
;emailproviderblacklist=""
; You can require users to only use certain email domains for registration. This setting is a
; comma-separated list of email provider domains that you have explicitly audited and require
; the use of in order to create an account. Comparison's are explicit, so you must specify the
; domain in completion, such as gmail.com and hotmail.com. Email whitelist is checked before
; Email blacklist is checked, so an email cannot be in both setting configurations.
; Example: "gmail.com,hotmail.com,icloud.com"
;emailproviderwhitelist=""
[forgotpassword]
; Servatrice can process reset password requests allowing users to reset their account
; passwords in the event they forget it. Should this feature be enabled? Default: false.
; enable=false
; Reset password request should not be allowed to stay valid forever. This settings
; informs servatrice how long a players reset password reset token is valid for (in minutes).
; Default: 60
; tokenlife=60
; Servatrice can challenge users that are making reset password requests to answer
; questions in regards to their account to help validate they are the true owner of the account.
; Should this feature be enabled? Default: false
; enablechallenge=false
; Email subject for the reset password emails
; subject="Cockatrice reset password token"
; Reset password email body. You can use these tags here: %username %token
; They will be substituted with the actual values in the email
;
; body="Hi %username,\r\nthanks for reaching out to us with your password reset request for our Cockatrice server.\r\nHere's your unique token in order to reset your account password in the app:\r\n\r\n%token\r\n\r\nHappy gaming!"
[smtp]
; Enable the internal smtp client to send registration emails. If you would like to
; use some other method to send email activation tokens set this value to false. Otherwise
; setting it to true (default) the server will send canned generated emails containing
; activation tokens for you during update intervals. Setting this to false will require
; you to either manually activate user accounts or manually send users the activation token
; by whatever means.
enableinternalsmtpclient=true
; Connectin type: currently supported method are "tcp" and "ssl"; tls is autodetected if available
connection=tcp
; Accept all certificates: in ssl mode, enable this if your server is using an invalid/self signed certificate
acceptallcerts=false;
; Hostname or IP addres of the smtp server
host=localhost
; Smtp port number of the smtp server. Usual values are 25 or 587 for tcp, 465 for ssl
port=25
; Username: this typically matches the "from" email address
username=root@localhost
; Password for the username
password=foobar
; Sender email address: the "from" email address
email=root@localhost
; Sender email name
name="Cockatrice server"
; Email subject
subject="Cockatrice server account activation token"
; Email body. You can use these tags here: %username %token
; They will be substituted with the actual values in the email
;
body="Hi %username, thank our for registering on our Cockatrice server\r\nHere's the activation token you need to supply for activating your account:\r\n\r\n%token\r\n\r\nHappy gaming!"
[database]
; Database type. Valid values are:
; * none: no database;
; * mysql: mysql or compatible database;
type=none
; Prefix used in he database for table names; default is cockatrice
prefix=cockatrice
; Database connection parameter: server hostname or IP
hostname=localhost
; Database connection parameter: database name
database=servatrice
; Database connection parameter: database user
user=servatrice
; Database connection parameter: database user's password
password=foobar
[rooms]
; A servatrice server can expose to the users different "rooms" to chat and create games. Rooms can be defined
; with two different methods:
; config: rooms are defined in this configuration (see the following example)
; sql: rooms are defined in the "rooms" table of the database
method=config
; Example configuration for a server with rooms configured in the configuration file. Number of rooms defined
roomlist\size=1
; Room name for the room number 1
roomlist\1\name="General room"
; Room description for the room number 1
roomlist\1\description="Play anything here."
; Rooms can restrict the level of user that can join. Current supported options are none, registered, moderator, administrator.
; Default is none.
roomlist\1\permissionlevel=none
; Rooms can restrict the permission level of users that can join, Currnetly supported options are none, privileged, vip, and donator.
; Default is none.
roomlist\1\privilegelevel=none
; Wether to make users autojoin this room when connected to the server
roomlist\1\autojoin=true
; Message displayed to each user when he joins room number 1
roomlist\1\joinmessage="This message is only here to show that rooms can have a join message."
; The number of chat history messages to save that gets presented to a user joining the room
roomlist\1\chathistorysize=100
; Number of game types allowed (defined) in the room number 1
roomlist\1\game_types\size=3
; Name of the three game types for the room number 1
roomlist\1\game_types\1\name="GameType1"
roomlist\1\game_types\2\name="GameType2"
roomlist\1\game_types\3\name="GameType3"
[game]
; Maximum time in seconds all players in a game can stay inactive before the game is automatically closed;
; default is 120
max_game_inactivity_time=120
; All actions during a game are recorded and stored in the database as a replay that all participants of
; the game can go back to and review after the game is closed. This can require a fairly large amount of
; storage to save all the information. Disable this option to prevent the storing of replay data in
; the database. Default value is true.
store_replays=true
; Allow users to create a new game and join it as a judge. The host will be able to execute any action on
; the cards of every player. This is needed in order to support some games (eg. Werewolf).
; Default off to prevent abuse on servers that are mostly running other games.
allow_create_as_judge=false
[security]
; You may want to restrict the number of users that can connect to your server at any given time.
enable_max_user_limit=false
; Maximum number of users that can connect to the server, default is 500.
max_users_total=500
; Maximum number of users that can connect to the server using a tcp connection, default is 500.
max_users_tcp=500
; Maximum number of users that can connect to the server using a websocket connection, default is 500.
max_users_websocket=500
; Maximum number of users that can connect from the same IP address; useful to avoid bots, default is 4
max_users_per_address=4
; You may want to allow an unlimited number of users from a trusted source. This setting can contain a
; comma-separed list of IP addresses which will allow an unlimited number of connections from each of the
; IP addresses listed (ignoring the max_users_per_address). Default is "127.0.0.1,::1"; example: "192.73.233.244,81.4.100.74"
trusted_sources="127.0.0.1,::1"
; Servatrice can avoid users from flooding rooms with large number of messages in an interval of time.
; This setting defines the length in seconds of the considered interval; default is 10
message_counting_interval=10
; Maximum size in characters of all messages in an interval before new messages gets dropped; default is 1000
max_message_size_per_interval=1000
; Maximum number of messages in an interval before new messages gets dropped; default is 10
max_message_count_per_interval=10
; Maximum number of games a single user can create; default is 5; set to -1 to disable; 0 disallows game creation
max_games_per_user=5
; Servatrice can avoid users from flooding games with large number of game commands in an interval of time.
; This setting defines the length in seconds of the considered interval; default is 10
command_counting_interval=10
; Maximum number of game commands in an interval before new commands gets dropped; default is 20
max_command_count_per_interval=20
[reporting]
; Maximum number of user reports a single user can file per day; default is 10; set to 0 to disable the limit
max_reports_per_day=10
; Maximum number of report comments a single user can post per hour; default is 30; set to 0 to disable the limit
max_comments_per_hour=30
[logging]
; Admin/Moderators can query the stored logs for information when looking up reports by various players. This
; option can allow or disallow them from doing so.
; !!NOTE!! Enabling this feature puts a very high CPU and DISK load on the server, enable with caution.
enablelogquery=false
; Servatrice can log user messages to the database table cockatrice_log.
; These messages can come from different sources; each source can be enabled separately.
; Log user messages inside chat rooms
log_user_msg_room=false
; Log user messages inside games
log_user_msg_game=false
; Log user messages in private chats
log_user_msg_chat=false
; Log user messages coming from other servers in the network
log_user_msg_isl=false
[audit]
; Servatrice can record certain actions being performed in the database for server operators to better understand
; if some one may be abusing application functionality. Enabling auditing will allow servatrice to record any
; of the below enabled audit functionality to be recorded.
; Default: true
enable_audit=true
; Servatrice can record when users attempt a new account registration. Should we enable auditing for this action?
; Default: true
enable_registration_audit=true
; Servatrice can record when a users attempts to reset the account password. Should we enable auditing for this action?
; Default: true
enable_forgotpassword_audit=true
; EXPERIMENTAL - NOT WORKING YET
; The following settings are relative to the server network functionality, that is not yet complete.
; Avoid enabling it unless you are willing to test it and help its development.
[servernetwork]
; Servatrice servers can connect themselves and build a network. This settins enable the ability of servatrice
; of waiting for other server's connections and connect to other servers. Other servers can be defined in the
; "servers" table of the database. Default is 0 (disabled)
active=0
; The TCP port number Servatrice will listen on for other servers; default is 14747
port=14747
; Server-to-server communication needs a valid certificate in PEM format. Enter its filename in this setting
ssl_cert=ssl_cert.pem
; Filename of the private key for the server-to-server certificate
ssl_key=ssl_key.pem