From 69d0eb78ed7a7f217feae9eec98e6dfece76833f Mon Sep 17 00:00:00 2001 From: BongaTheProto <93835010+BongaTheProto@users.noreply.github.com> Date: Sun, 21 Aug 2022 21:33:31 -0500 Subject: [PATCH] you ahelp for vpn now because some people apparently need em --- code/modules/admin/admin_verbs.dm | 6 +++ config/splurt/connections.txt | 6 +++ .../entries/splurt_connections.dm | 20 ++++++++++ .../code/modules/admin/verbs/discordbunker.dm | 4 +- .../code/modules/admin/verbs/vpnbunker.dm | 37 +++++++++++++++++++ .../code/modules/client/client_procs.dm | 10 ++++- tgstation.dme | 1 + 7 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 modular_splurt/code/modules/admin/verbs/vpnbunker.dm diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index c11db249ed..acc431a40c 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -89,6 +89,8 @@ GLOBAL_PROTECT(admin_verbs_admin) /client/proc/revokebunkerbypass, //CIT /client/proc/adddiscordbypass, //SPLURT /client/proc/revokediscordbypass, //SPLURT + /client/proc/addvpnbypass, //SPLURT + /client/proc/revokevpnbypass, //SPLURT /datum/admins/proc/open_borgopanel ) GLOBAL_LIST_INIT(admin_verbs_ban, list(/client/proc/unban_panel, /client/proc/DB_ban_panel, /client/proc/stickybanpanel)) @@ -149,6 +151,7 @@ GLOBAL_PROTECT(admin_verbs_server) /client/proc/adminchangemap, /client/proc/panicbunker, /client/proc/discordbunker, // SPLURT + /client/proc/vpnbunker, //SPLURT // /client/proc/toggle_interviews, /client/proc/toggle_hub, /client/proc/toggle_cdn @@ -279,10 +282,13 @@ GLOBAL_LIST_INIT(admin_verbs_hideable, list( /client/proc/reload_admins, /client/proc/panicbunker, /client/proc/discordbunker, // SPLURT + /client/proc/vpnbunker, // SPLURT /client/proc/addbunkerbypass, //CIT /client/proc/revokebunkerbypass, //CIT /client/proc/adddiscordbypass, //SPLURT /client/proc/revokediscordbypass, //SPLURT + /client/proc/addvpnbypass, //SPLURT + /client/proc/revokevpnbypass, //SPLURT // /client/proc/toggle_interviews, /client/proc/admin_change_sec_level, /client/proc/toggle_nuke, diff --git a/config/splurt/connections.txt b/config/splurt/connections.txt index 561a04cf8a..e9036bd515 100644 --- a/config/splurt/connections.txt +++ b/config/splurt/connections.txt @@ -7,3 +7,9 @@ # Uncomment to kick players who are probably trying to connect using a vpn # Keep in mind this depends on your ipintel configuration and can potentially kick players not actually using a vpn #KICK_VPN + +# VPN bypass ckeys +## Use these if you activate the option above but have some people that for one reason or another should be allowed to bypass it ## +#VPN_BYPASS test_ckey1 +#VPN_BYPASS test_ckey2 +#VPN_BYPASS test_ckey3 diff --git a/modular_splurt/code/controllers/configuration/entries/splurt_connections.dm b/modular_splurt/code/controllers/configuration/entries/splurt_connections.dm index e49f263b2e..5f713e7e9d 100644 --- a/modular_splurt/code/controllers/configuration/entries/splurt_connections.dm +++ b/modular_splurt/code/controllers/configuration/entries/splurt_connections.dm @@ -1,3 +1,23 @@ /datum/config_entry/flag/need_discord_to_join /datum/config_entry/flag/kick_vpn + +/datum/config_entry/multi_keyed_flag/vpn_bypass + postload_required = TRUE + +/datum/config_entry/multi_keyed_flag/vpn_bypass/OnPostload() + var/list/new_entries = list() + for(var/key in config_entry_value) + new_entries[ckey(key)] = world.realtime + config_entry_value = new_entries + +/datum/config_entry/multi_keyed_flag/vpn_bypass/proc/add_bypass(ckeytobypass) + if(IsAdminAdvancedProcCall()) + return + config_entry_value |= ckey(ckeytobypass) + config_entry_value[ckey(ckeytobypass)] = world.realtime + +/datum/config_entry/multi_keyed_flag/vpn_bypass/proc/rev_bypass(ckeytobypass) + if(IsAdminAdvancedProcCall()) + return + config_entry_value -= ckey(ckeytobypass) diff --git a/modular_splurt/code/modules/admin/verbs/discordbunker.dm b/modular_splurt/code/modules/admin/verbs/discordbunker.dm index 46d5db257b..149479289a 100644 --- a/modular_splurt/code/modules/admin/verbs/discordbunker.dm +++ b/modular_splurt/code/modules/admin/verbs/discordbunker.dm @@ -10,8 +10,8 @@ log_admin("[key_name(usr)] has toggled the Discord Bunker, it is now [new_dbun ? "on" : "off"]") message_admins("[key_name_admin(usr)] has toggled the Discord Bunker, it is now [new_dbun ? "enabled" : "disabled"].") - SSblackbox.record_feedback("nested tally", "discord_toggle", 1, list("Toggle Panic Bunker", "[new_dbun ? "Enabled" : "Disabled"]")) - send2adminchat("Discord Bunker", "[key_name(usr)] has toggled the Panic Bunker, it is now [new_dbun ? "enabled" : "disabled"].") + SSblackbox.record_feedback("nested tally", "discord_toggle", 1, list("Toggle Discord Bunker", "[new_dbun ? "Enabled" : "Disabled"]")) + send2adminchat("Discord Bunker", "[key_name(usr)] has toggled the Discord Bunker, it is now [new_dbun ? "enabled" : "disabled"].") /client/proc/adddiscordbypass(ckeytobypass as text) // In case someone's too lazy to verify on discord set category = "Special Verbs" diff --git a/modular_splurt/code/modules/admin/verbs/vpnbunker.dm b/modular_splurt/code/modules/admin/verbs/vpnbunker.dm new file mode 100644 index 0000000000..af09e96427 --- /dev/null +++ b/modular_splurt/code/modules/admin/verbs/vpnbunker.dm @@ -0,0 +1,37 @@ +/client/proc/vpnbunker() + set category = "Server" + set name = "Toggle VPN Blocker" + + var/new_vpnbun = !CONFIG_GET(flag/kick_vpn) + CONFIG_SET(flag/kick_vpn, new_vpnbun) + + log_admin("[key_name(usr)] has toggled the VPN Blocker, it is now [new_vpnbun ? "on" : "off"]") + message_admins("[key_name_admin(usr)] has toggled the VPN Blocker, it is now [new_vpnbun ? "enabled" : "disabled"].") + SSblackbox.record_feedback("nested tally", "vpn_toggle", 1, list("Toggle VPN Blocker", "[new_vpnbun ? "Enabled" : "Disabled"]")) + send2adminchat("VPN Blocker", "[key_name(usr)] has toggled the VPN Bunker, it is now [new_vpnbun ? "enabled" : "disabled"].") + +/client/proc/addvpnbypass(ckeytobypass as text) + set category = "Special Verbs" + set name = "Add VPN Bypass" + set desc = "Allows a given ckey to connect through the VPN Blocker." + if(!CONFIG_GET(flag/kick_vpn)) + to_chat(usr, span_adminnotice("VPN Blocker is currently off!")) + + var/datum/config_entry/multi_keyed_flag/vpn_bypass/bypasses = CONFIG_GET_ENTRY(multi_keyed_flag/vpn_bypass) + bypasses.add_bypass(ckeytobypass) + log_admin("[key_name(usr)] has added [ckeytobypass] to the current round's VPN bypass list.") + message_admins("[key_name_admin(usr)] has added [ckeytobypass] to the current round's VPN bypass list.") + send2adminchat("VPN Blocker", "[key_name(usr)] has added [ckeytobypass] to the current round's VPN bypass list.") + +/client/proc/revokevpnbypass(ckeytobypass as text) + set category = "Special Verbs" + set name = "Revoke VPN Bypass" + set desc = "Removes a ckey from the VPN Blocker bypass list." + if(!CONFIG_GET(flag/kick_vpn)) + to_chat(usr, span_adminnotice("VPN Blocker is currently off!")) + + var/datum/config_entry/multi_keyed_flag/vpn_bypass/bypasses = CONFIG_GET_ENTRY(multi_keyed_flag/vpn_bypass) + bypasses.rev_bypass(ckeytobypass) + log_admin("[key_name(usr)] has removed [ckeytobypass] from the current round's VPN bypass list.") + message_admins("[key_name_admin(usr)] has removed [ckeytobypass] from the current round's VPN bypass list.") + send2adminchat("VPN Blocker", "[key_name(usr)] has removed [ckeytobypass] from the current round's VPN bypass list.") diff --git a/modular_splurt/code/modules/client/client_procs.dm b/modular_splurt/code/modules/client/client_procs.dm index 0ef3171ba5..d28091eef4 100644 --- a/modular_splurt/code/modules/client/client_procs.dm +++ b/modular_splurt/code/modules/client/client_procs.dm @@ -3,9 +3,17 @@ if(!(ip_intel != initial(ip_intel) && ip_intel >= CONFIG_GET(number/ipintel_rating_bad))) uses_vpn = FALSE return . - uses_vpn = TRUE + + uses_vpn = TRUE //Puts the vpn flag on the player playtimes + + //Kicks them automatically if 100% sure and they're not whitelisted if(!CONFIG_GET(flag/kick_vpn) || ip_intel < 1) return . + var/datum/config_entry/multi_keyed_flag/vpn_bypass/whitelist = CONFIG_GET_ENTRY(multi_keyed_flag/vpn_bypass) + if(ckey(ckey) in whitelist.config_entry_value) + log_admin("[key_name(src)] was allowed to join although they're using a vpn") + return . + to_chat(src, span_danger("You have been kicked from the server because your IP has been flagged as a VPN. \ Please turn it off in order to connect or contact staff in case this is an error.")) var/logg = "[key_name(src)] kicked for failing the vpn check." diff --git a/tgstation.dme b/tgstation.dme index ff2d2ec901..0721f1c26a 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4399,6 +4399,7 @@ #include "modular_splurt\code\modules\admin\verbs\one_click_antag.dm" #include "modular_splurt\code\modules\admin\verbs\pray.dm" #include "modular_splurt\code\modules\admin\verbs\randomverbs.dm" +#include "modular_splurt\code\modules\admin\verbs\vpnbunker.dm" #include "modular_splurt\code\modules\antagonists\_common\antag_spawner.dm" #include "modular_splurt\code\modules\antagonists\bloodsucker\levelup.dm" #include "modular_splurt\code\modules\antagonists\ert_cleanup\ert_cleanup.dm"