Skip to content

Commit

Permalink
Merge pull request BlueMoon-Labs#1459 from BlueMoon-Labs/admin_tools
Browse files Browse the repository at this point in the history
[REVERT] Возвращаем старый IPIntel.
  • Loading branch information
Phoenix4O4 authored Dec 11, 2024
2 parents 21ed1ce + d1f17d3 commit 2368e59
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 652 deletions.
45 changes: 0 additions & 45 deletions SQL/bluemoon_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -80,48 +80,3 @@ DELIMITER ;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

--
-- Table structure for table `ipintel`
--
DROP TABLE IF EXISTS `ipintel`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ipintel` (
`ip` int UNSIGNED NOT NULL,
`date` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL,
`intel` real NOT NULL DEFAULT '0',
PRIMARY KEY (`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `vpn_whitelist`
--
DROP TABLE IF EXISTS `vpn_whitelist`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vpn_whitelist` (
`ckey` varchar(32) NOT NULL,
`reason` text,
PRIMARY KEY (`ckey`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `connection_ipintel_log`
--
DROP TABLE IF EXISTS `connection_ipintel_log`;
CREATE TABLE `connection_ipintel_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL,
`ckey` varchar(32) NOT NULL,
`ip` INT UNSIGNED NOT NULL,
`computerid` varchar(32) NOT NULL,
`server_id` VARCHAR(50) NULL DEFAULT NULL,
`result` ENUM('ESTABLISHED','DROPPED - IPINTEL','DROPPED - BANNED','DROPPED - INVALID') NOT NULL DEFAULT 'ESTABLISHED' COLLATE 'utf8mb4_general_ci',
PRIMARY KEY (`id`),
KEY `ckey` (`ckey`),
KEY `ip` (`ip`),
KEY `computerid` (`computerid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
3 changes: 0 additions & 3 deletions code/_BLUEMOONCODE/_HELPERS/time.dm

This file was deleted.

45 changes: 0 additions & 45 deletions code/_BLUEMOONCODE/_HELPERS/unsorted.dm

This file was deleted.

9 changes: 0 additions & 9 deletions code/__BLUEMOONCODE/_DEFINES/ipintel.dm

This file was deleted.

41 changes: 0 additions & 41 deletions code/controllers/configuration/bluemoon_entries/general.dm

This file was deleted.

2 changes: 0 additions & 2 deletions code/controllers/configuration/entries/connections.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

/datum/config_entry/flag/check_randomizer

/* BLUEMOON EDIT:START IPINTEL FROM TG
/datum/config_entry/string/ipintel_email

/datum/config_entry/string/ipintel_email/ValidateAndSet(str_val)
Expand All @@ -59,7 +58,6 @@

/datum/config_entry/string/ipintel_domain
default = "check.getipintel.net"
*/ // BLUEMOON EDIT:END IPINTEL FROM TG

/datum/config_entry/flag/aggressive_changelog

Expand Down
1 change: 1 addition & 0 deletions code/controllers/subsystem/ipintel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ SUBSYSTEM_DEF(ipintel)
/datum/controller/subsystem/ipintel/Initialize(timeofday, zlevel)
enabled = TRUE
. = ..()

34 changes: 5 additions & 29 deletions code/modules/admin/IsBanned.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define STICKYBAN_MAX_EXISTING_USER_MATCHES 5 //ie, users who were connected before the ban triggered
#define STICKYBAN_MAX_ADMIN_MATCHES 2

/world/IsBanned(key,address,computer_id,type,real_bans_only=FALSE, check_ipintel = TRUE, log_info = TRUE) // BLUEMOON EDIT:START IPINTEL FROM TG
/world/IsBanned(key,address,computer_id,type,real_bans_only=FALSE)
var/static/key_cache = list()
if(!real_bans_only)
if(key_cache[key] >= REALTIMEOFDAY)
Expand All @@ -17,17 +17,13 @@
if(real_bans_only)
key_cache[key] = 0
return FALSE
log_access("Login (invalid data): [key] [address]-[computer_id]")
log_access("Failed Login (invalid data): [key] [address]-[computer_id]")
key_cache[key] = 0
if(log_info) // BLUEMOON EDIT:START IPINTEL FROM TG
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(log_connection), (ckey(key) || ""), (address || ""), (computer_id || ""), CONNECTION_TYPE_DROPPED_INVALID)
return list("reason"="invalid login data", "desc"="Error: Could not check ban status, Please try again. Error message: Your computer provided invalid or blank information to the server on connection (byond username, IP, and Computer ID.) Provided information for reference: Username:'[key]' IP:'[address]' Computer ID:'[computer_id]'. (If you continue to get this error, please restart byond or contact byond support.)")

if (text2num(computer_id) == 2147483647) //this cid causes stickybans to go haywire
log_access("Login (invalid cid): [key] [address]-[computer_id]")
log_access("Failed Login (invalid cid): [key] [address]-[computer_id]")
key_cache[key] = 0
if(log_info) // BLUEMOON EDIT:START IPINTEL FROM TG
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(log_connection), ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_INVALID)
return list("reason"="invalid login data", "desc"="Error: Could not check ban status, Please try again. Error message: Your computer provided an invalid Computer ID.)")

if (type == "world")
Expand All @@ -52,25 +48,19 @@
message_admins("<span class='adminnotice'>The admin [key] has been allowed to bypass the whitelist</span>")
addclientmessage(ckey,"<span class='adminnotice'>You have been allowed to bypass the whitelist</span>")
else
log_access("Login: [key] - Not on whitelist")
log_access("Failed Login: [key] - Not on whitelist")
key_cache[key] = 0
if(log_info) // BLUEMOON EDIT:START IPINTEL FROM TG
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(log_connection), ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_IPINTEL)
return list("reason"="whitelist", "desc" = "\nReason: You are not on the white list for this server")

//Guest Checking
if(!real_bans_only && IsGuestKey(key))
if (CONFIG_GET(flag/guest_ban))
log_access("Failed Login: [key] - Guests not allowed")
key_cache[key] = 0
if(log_info) // BLUEMOON EDIT:START IPINTEL FROM TG
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(log_connection), ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED)
return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.")
if (CONFIG_GET(flag/panic_bunker) && SSdbcore.Connect())
log_access("Failed Login: [key] - Guests not allowed during panic bunker")
key_cache[key] = 0
if(log_info) // BLUEMOON EDIT:START IPINTEL FROM TG
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(log_connection), ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED)
return list("reason"="guest", "desc"="\nReason: Sorry but the server is currently not accepting connections from never before seen players or guests. If you have played on this server with a byond account before, please log in to the byond account you have played from.")

//Population Cap Checking
Expand All @@ -80,16 +70,6 @@
key_cache[key] = 0
return list("reason"="popcap", "desc"= "\nReason: [CONFIG_GET(string/extreme_popcap_message)]")

// BLUEMOON EDIT:START IPINTEL FROM TG
//check if the IP address is a known proxy/vpn, and the user is not whitelisted
if(check_ipintel && CONFIG_GET(string/contact_email) && CONFIG_GET(flag/whitelist_mode) && GLOB.ipintel_manager.ipintel_is_banned(key, address))
log_admin("Failed Login: [key] [computer_id] [address] - Proxy/VPN")
var/mistakemessage = ""
if(CONFIG_GET(string/banappeals))
mistakemessage = "\nIf you have to use one, request whitelisting at: [CONFIG_GET(string/banappeals)]"
return list("reason"="using proxy or vpn", "desc"="\nReason: Proxies/VPNs are not allowed here. [mistakemessage]")
// BLUEMOON EDIT:END IPINTEL FROM TG

if(CONFIG_GET(flag/ban_legacy_system))

//Ban Checking
Expand All @@ -102,8 +82,6 @@
else
log_access("Failed Login: [key] [computer_id] [address] - Banned [.["reason"]]")
key_cache[key] = 0
if(log_info) // BLUEMOON EDIT: IPINTEL FROM TG
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(log_connection), ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED)
return .

else
Expand Down Expand Up @@ -176,8 +154,6 @@
log_access("Failed Login: [key] [computer_id] [address] - Banned (#[banid]) [.["reason"]]")
qdel(query_ban_check)
key_cache[key] = 0
if(log_info) // BLUEMOON EDIT IPINTEL FROM TG
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(log_connection), ckey(key), address, computer_id, CONNECTION_TYPE_DROPPED_BANNED)
return .
qdel(query_ban_check)

Expand Down Expand Up @@ -256,7 +232,7 @@

var/desc = "\nReason:(StickyBan) You, or another user of this computer or connection ([bannedckey]) is banned from playing here. The ban reason is:\n[ban["message"]]\nThis ban was applied by [ban["admin"]]\nThis is a BanEvasion Detection System ban, if you think this ban is a mistake, please wait EXACTLY 6 seconds, then try again before filing an appeal.\n"
. = list("reason" = "Stickyban", "desc" = desc)
log_access("Login: [key] [computer_id] [address] - StickyBanned [ban["message"]] Target Username: [bannedckey] Placed by [ban["admin"]]")
log_access("Failed Login: [key] [computer_id] [address] - StickyBanned [ban["message"]] Target Username: [bannedckey] Placed by [ban["admin"]]")

key_cache[key] = 0
return .
Expand Down
1 change: 0 additions & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ GLOBAL_PROTECT(admin_verbs_admin)
/client/proc/Getkey, /*teleports a mob with a certain ckey to our location*/
/client/proc/game_panel, /*game panel, allows to change game-mode etc*/
/client/proc/mail_panel, /*BLUEMOON ADD - панель управления почтой*/
/datum/admins/proc/vpn_whitelist, /*BLUEMOON ADD - Допуск */
/client/proc/fax_panel, /*send a paper to fax*/
// /client/proc/sendmob, /*sends a mob somewhere*/ -Removed due to it needing two sorting procs to work, which were executed every time an admin right-clicked. ~Errorage
/client/proc/jumptoarea,
Expand Down
Loading

0 comments on commit 2368e59

Please sign in to comment.