From: bones_was_here Date: Sat, 12 Apr 2025 11:29:43 +0000 (+1000) Subject: vote master: support player ID (pubkey) authentication X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0aa79449425a9851655c4739e5a8b7156c92f583;p=xonotic%2Fxonotic-data.pk3dir.git vote master: support player ID (pubkey) authentication --- diff --git a/commands.cfg b/commands.cfg index c1392b0943..1259567886 100644 --- a/commands.cfg +++ b/commands.cfg @@ -386,6 +386,7 @@ set sv_vote_limit 160 "maximum allowed length of a vote command" set sv_vote_master_commands "movetored movetoblue movetoyellow movetopink movetospec" "extra commands which vote masters can execute by themselves, along with the normal sv_vote_commands" // maybe add kickban here (but then sv_vote_master 0) set sv_vote_master 0 "allows the use of the vote master system" set sv_vote_master_callable 0 "when set, users can use \"vmaster\" to call a vote to become master of voting commands" +set sv_vote_master_ids "" "space-separated list of player IDs (signed public key fingerprints) which will be logged in as master automatically" set sv_vote_master_password "" "when set, users can use \"vlogin PASSWORD\" to log in as master, then run master commands directly using vdo" set sv_vote_master_playerlimit 2 "minimum number of players needed for a player to be allowed to vote for master" set sv_vote_no_stops_vote 1 "allow the vote caller to stop their own vote simply by voting no" diff --git a/qcsrc/common/checkextension.qc b/qcsrc/common/checkextension.qc index 9f10501ef7..9ff685d7d3 100644 --- a/qcsrc/common/checkextension.qc +++ b/qcsrc/common/checkextension.qc @@ -36,7 +36,7 @@ void CheckEngineExtensions(void) LOG_WARN("Engine lacks HTTP support, XonStat and map downloads are unavailable."); if (!checkextension("DP_CRYPTO")) - LOG_WARN("Engine lacks DP_CRYPTO, Player IDs (required for XonStat and CTS/CTF records) are unavailable."); + LOG_WARN("Engine lacks DP_CRYPTO, Player IDs (required for XonStat, CTS/CTF records and pubkey authentication) are unavailable."); #ifdef SVQC // change to GAMEQC if/when we use nudgeoutofsolid in CSQC if (checkextension("DP_QC_NUDGEOUTOFSOLID")) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 5367d48fe4..664855fed8 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1238,6 +1238,11 @@ void ClientConnect(entity this) if (get_nextmap() != "") Send_NextMap_To_Player(this); + + // cvar hook/callback TODO: recheck this when the cvar is changed + if (autocvar_sv_vote_master_ids != "" && this.crypto_idfp_signed) + if (strstrofs(autocvar_sv_vote_master_ids, this.crypto_idfp, 0) >= 0) + this.vote_master = true; } .string shootfromfixedorigin; diff --git a/qcsrc/server/command/vote.qh b/qcsrc/server/command/vote.qh index 98dec6b7d3..47b6417c6a 100644 --- a/qcsrc/server/command/vote.qh +++ b/qcsrc/server/command/vote.qh @@ -11,6 +11,7 @@ float autocvar_sv_vote_majority_factor_of_voted; bool autocvar_sv_vote_master; bool autocvar_sv_vote_master_callable; string autocvar_sv_vote_master_commands; +string autocvar_sv_vote_master_ids; string autocvar_sv_vote_master_password; int autocvar_sv_vote_master_playerlimit; bool autocvar_sv_vote_no_stops_vote; diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 5e4bc9c69a..34820c684f 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -231,6 +231,7 @@ void cvar_changes_init() BADCVAR("serverconfig"); BADCVAR("sv_autoscreenshot"); BADCVAR("sv_heartbeatperiod"); + BADCVAR("sv_vote_master_ids"); BADCVAR("sv_vote_master_password"); BADCVAR("sys_colortranslation"); BADCVAR("sys_specialcharactertranslation"); @@ -525,9 +526,7 @@ void cvar_changes_init() BADCVAR("sv_vote_call"); BADCVAR("sv_vote_commands"); BADCVAR("sv_vote_majority_factor"); - BADCVAR("sv_vote_master"); - BADCVAR("sv_vote_master_commands"); - BADCVAR("sv_vote_master_password"); + BADPREFIX("sv_vote_master"); BADCVAR("sv_vote_simple_majority_factor"); BADVALUE("sys_ticrate", "0.0078125"); BADVALUE("sys_ticrate", "0.015625");