mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 16:13:19 +01:00
IPIntel Configuration
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a BYOND account.")
|
||||
|
||||
//check if the IP address is a known proxy/vpn, and the user is not whitelisted
|
||||
if(check_ipintel && config.ipintel_email && config.ipintel_whitelist && ipintel_is_banned(key, address))
|
||||
if(check_ipintel && GLOB.configuration.ipintel.contact_email && GLOB.configuration.ipintel.whitelist_mode && ipintel_is_banned(key, address))
|
||||
log_adminwarn("Failed Login: [key] [computer_id] [address] - Proxy/VPN")
|
||||
var/mistakemessage = ""
|
||||
if(GLOB?.configuration?.url.banappeals_url)
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
. = FALSE
|
||||
if(intel < 0)
|
||||
return
|
||||
if(intel <= config.ipintel_rating_bad)
|
||||
if(world.realtime < cacherealtime + (config.ipintel_save_good HOURS))
|
||||
if(intel <= GLOB.configuration.ipintel.bad_rating)
|
||||
if(world.realtime < cacherealtime + (GLOB.configuration.ipintel.hours_save_good HOURS))
|
||||
return TRUE
|
||||
else
|
||||
if(world.realtime < cacherealtime + (config.ipintel_save_bad HOURS))
|
||||
if(world.realtime < cacherealtime + (GLOB.configuration.ipintel.hours_save_bad HOURS))
|
||||
return TRUE
|
||||
|
||||
/proc/get_ip_intel(ip, bypasscache = FALSE, updatecache = TRUE)
|
||||
var/datum/ipintel/res = new()
|
||||
res.ip = ip
|
||||
. = res
|
||||
if(!ip || !config.ipintel_email || !SSipintel.enabled)
|
||||
if(!ip || !GLOB.configuration.ipintel.contact_email || !GLOB.configuration.ipintel.enabled || !SSipintel.enabled)
|
||||
return
|
||||
if(!bypasscache)
|
||||
var/datum/ipintel/cachedintel = SSipintel.cache[ip]
|
||||
@@ -50,9 +50,9 @@
|
||||
))
|
||||
"}, list(
|
||||
"ip" = ip,
|
||||
"rating_bad" = config.ipintel_rating_bad,
|
||||
"save_good" = config.ipintel_save_good,
|
||||
"save_bad" = config.ipintel_save_bad,
|
||||
"rating_bad" = GLOB.configuration.ipintel.bad_rating,
|
||||
"save_good" = GLOB.configuration.ipintel.hours_save_good,
|
||||
"save_bad" = GLOB.configuration.ipintel.hours_save_bad,
|
||||
))
|
||||
if(!query_get_ip_intel.warn_execute())
|
||||
qdel(query_get_ip_intel)
|
||||
@@ -93,7 +93,7 @@
|
||||
return
|
||||
|
||||
// Do not refactor this to use SShttp, because that requires the subsystem to be firing for requests to be made, and this will be triggered before the MC has finished loading
|
||||
var/list/http[] = world.Export("http://[config.ipintel_domain]/check.php?ip=[ip]&contact=[config.ipintel_email]&format=json&flags=b")
|
||||
var/list/http[] = world.Export("http://[GLOB.configuration.ipintel.ipintel_domain]/check.php?ip=[ip]&contact=[GLOB.configuration.ipintel.contact_email]&format=json&flags=b")
|
||||
|
||||
if(http)
|
||||
var/status = text2num(http["STATUS"])
|
||||
@@ -146,9 +146,11 @@
|
||||
|
||||
|
||||
/proc/ipintel_is_banned(t_ckey, t_ip)
|
||||
if(!config.ipintel_email)
|
||||
if(!GLOB.configuration.ipintel.contact_email)
|
||||
return FALSE
|
||||
if(!config.ipintel_whitelist)
|
||||
if(!GLOB.configuration.ipintel.enabled)
|
||||
return FALSE
|
||||
if(!GLOB.configuration.ipintel.whitelist_mode)
|
||||
return FALSE
|
||||
if(!SSdbcore.IsConnected())
|
||||
return FALSE
|
||||
@@ -159,11 +161,11 @@
|
||||
return TRUE
|
||||
|
||||
/proc/ipintel_badip_check(target_ip)
|
||||
var/rating_bad = config.ipintel_rating_bad
|
||||
var/rating_bad = GLOB.configuration.ipintel.bad_rating
|
||||
if(!rating_bad)
|
||||
log_debug("ipintel_badip_check reports misconfigured rating_bad directive")
|
||||
return FALSE
|
||||
var/valid_hours = config.ipintel_save_bad
|
||||
var/valid_hours = GLOB.configuration.ipintel.hours_save_bad
|
||||
if(!valid_hours)
|
||||
log_debug("ipintel_badip_check reports misconfigured ipintel_save_bad directive")
|
||||
return FALSE
|
||||
@@ -187,7 +189,7 @@
|
||||
return TRUE
|
||||
|
||||
/proc/vpn_whitelist_check(target_ckey)
|
||||
if(!config.ipintel_whitelist)
|
||||
if(!GLOB.configuration.ipintel.whitelist_mode)
|
||||
return FALSE
|
||||
var/datum/db_query/query_whitelist_check = SSdbcore.NewQuery("SELECT * FROM [format_table_name("vpn_whitelist")] WHERE ckey=:ckey", list(
|
||||
"ckey" = target_ckey
|
||||
|
||||
Reference in New Issue
Block a user