Skip to content

Commit

Permalink
Revert "Merge pull request BlueMoon-Labs#1431 from BlueMoon-Labs/tg_i…
Browse files Browse the repository at this point in the history
…pintel_port"

This reverts commit f8f6eb2, reversing
changes made to 63921cb.
  • Loading branch information
Phoenix4O4 committed Dec 11, 2024
1 parent 21ed1ce commit 3d320ad
Show file tree
Hide file tree
Showing 15 changed files with 405 additions and 602 deletions.
48 changes: 17 additions & 31 deletions SQL/bluemoon_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -81,47 +81,33 @@ DELIMITER ;
/*!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;
CREATE TABLE `ipintel` (
`ip` int(10) unsigned NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`intel` double NOT NULL DEFAULT '0',
PRIMARY KEY (`ip`),
KEY `idx_ipintel` (`ip`,`intel`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `vpn_whitelist`
-- Table structure for table `ipintel_whitelist`
--
DROP TABLE IF EXISTS `vpn_whitelist`;

DROP TABLE IF EXISTS `ipintel_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;
CREATE TABLE `ipintel_whitelist` (
`ckey` varchar(32) NOT NULL,
`admin_ckey` varchar(32) NOT NULL,
PRIMARY KEY (`ckey`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!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;
45 changes: 0 additions & 45 deletions code/_BLUEMOONCODE/_HELPERS/unsorted.dm

This file was deleted.

24 changes: 15 additions & 9 deletions code/__BLUEMOONCODE/_DEFINES/ipintel.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
// Connection types. These match enums in the SQL DB. Dont change them
/// Client was let into the server
#define CONNECTION_TYPE_ESTABLISHED "ESTABLISHED"
/// Client was disallowed due to IPIntel
#define CONNECTION_TYPE_DROPPED_IPINTEL "DROPPED - IPINTEL"
/// Client was disallowed due to being banned
#define CONNECTION_TYPE_DROPPED_BANNED "DROPPED - BANNED"
/// Client was disallowed due to invalid data
#define CONNECTION_TYPE_DROPPED_INVALID "DROPPED - INVALID"
#define IPINTEL_RATE_LIMIT_MINUTE "minute"
#define IPINTEL_RATE_LIMIT_DAY "day"

/// An internal error occurred and the query cannot be processed
#define IPINTEL_UNKNOWN_INTERNAL_ERROR "unknown_internal_error"
/// An error occurred with the query and the result is unknown
#define IPINTEL_UNKNOWN_QUERY_ERROR "unknown_query_error"
/// Cannot query as we are rate limited for the rest of the day
#define IPINTEL_RATE_LIMITED_DAY "rate_limited_day"
/// Cannot query as we are rate limited for the rest of the minute
#define IPINTEL_RATE_LIMITED_MINUTE "rate_limited_minute"
/// The IP address is a VPN or bad IP
#define IPINTEL_BAD_IP "bad_ip"
/// The IP address is not a VPN or bad IP
#define IPINTEL_GOOD_IP "good_ip"
41 changes: 0 additions & 41 deletions code/controllers/configuration/bluemoon_entries/general.dm

This file was deleted.

2 changes: 2 additions & 0 deletions code/controllers/subsystem/ipintel.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* // BLUEMOON EDIT:START IPINTEL FROM TG
SUBSYSTEM_DEF(ipintel)
name = "XKeyScore"
init_order = INIT_ORDER_XKEYSCORE
Expand All @@ -11,3 +12,4 @@ SUBSYSTEM_DEF(ipintel)
/datum/controller/subsystem/ipintel/Initialize(timeofday, zlevel)
enabled = TRUE
. = ..()
*/ // BLUEMOON EDIT:END IPINTEL FROM TG
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 3d320ad

Please sign in to comment.