mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-25 09:31:13 +00:00
Mirrors have been updated to actually fetch the active mirror, as opposed to using an old mirror and referencing that, and then letting the banned individual through. You can also now view the mirrors for a ban. Also denies entry for people who for _some_ reason lack a computer ID or an IP address. The former can be done by using a specific wsock32.dll in your BYOND bin to bypass bans.
94 lines
3.9 KiB
Plaintext
94 lines
3.9 KiB
Plaintext
#ifndef OVERRIDE_BAN_SYSTEM
|
|
//Blocks an attempt to connect before even creating our client datum thing.
|
|
world/IsBanned(key,address,computer_id)
|
|
if(ckey(key) in admin_datums)
|
|
return ..()
|
|
|
|
//Guest Checking
|
|
if(!config.guests_allowed && IsGuestKey(key))
|
|
log_access("Failed Login: [key] - Guests not allowed")
|
|
message_admins("\blue Failed Login: [key] - Guests not allowed")
|
|
return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.")
|
|
|
|
//check if the IP address is a known TOR node
|
|
if(config && config.ToRban && ToRban_isbanned(address))
|
|
log_access("Failed Login: [src] - Banned: ToR")
|
|
message_admins("\blue Failed Login: [src] - Banned: ToR")
|
|
//ban their computer_id and ckey for posterity
|
|
AddBan(ckey(key), computer_id, "Use of ToR", "Automated Ban", 0, 0)
|
|
return list("reason"="Using ToR", "desc"="\nReason: The network you are using to connect has been banned.\nIf you believe this is a mistake, please request help at [config.banappeals]")
|
|
|
|
|
|
if(config.ban_legacy_system)
|
|
|
|
//Ban Checking
|
|
. = CheckBan( ckey(key), computer_id, address )
|
|
if(.)
|
|
log_access("Failed Login: [key] [computer_id] [address] - Banned [.["reason"]]")
|
|
message_admins("\blue Failed Login: [key] id:[computer_id] ip:[address] - Banned [.["reason"]]")
|
|
return .
|
|
|
|
return ..() //default pager ban stuff
|
|
|
|
else
|
|
|
|
if (!address)
|
|
log_access("Failed Login: [key] null-[computer_id] - Denied access: No IP address broadcast.")
|
|
message_admins("[key] tried to connect without an IP address.")
|
|
return list("reason" = "Temporary ban", "desc" = "Your connection did not broadcast an IP address to check.")
|
|
|
|
if (!computer_id)
|
|
log_access("Failed Login: [key] [address]-null - Denied access: No computer ID broadcast.")
|
|
message_admins("[key] tried to connect without a computer ID.")
|
|
return list("reason" = "Temporary ban", "desc" = "Your connection did not broadcast an computer ID to check.")
|
|
|
|
var/ckey = ckey(key)
|
|
|
|
if(!establish_db_connection(dbcon))
|
|
error("Ban database connection failure. Key [ckey] not checked")
|
|
log_misc("Ban database connection failure. Key [ckey] not checked")
|
|
return
|
|
|
|
var/pulled_ban_id = get_active_mirror(ckey, address, computer_id)
|
|
|
|
var/params[] = list()
|
|
var/query_content = ""
|
|
if (pulled_ban_id)
|
|
query_content = "SELECT id, ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM ss13_ban WHERE id = :ban_id AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)"
|
|
params[":ban_id"] = pulled_ban_id
|
|
else
|
|
query_content = "SELECT id, ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM ss13_ban WHERE (ckey = :ckey OR computerid = :computerid OR ip = :address) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)"
|
|
params[":ckey"] = ckey
|
|
params[":computerid"] = computer_id
|
|
params[":address"] = address
|
|
|
|
var/DBQuery/query = dbcon.NewQuery(query_content)
|
|
query.Execute(params)
|
|
|
|
while(query.NextRow())
|
|
var/ban_id = text2num(query.item[1])
|
|
var/pckey = query.item[2]
|
|
var/pip = query.item[3]
|
|
var/pcid = query.item[4]
|
|
var/ackey = query.item[5]
|
|
var/reason = query.item[6]
|
|
var/expiration = query.item[7]
|
|
var/duration = query.item[8]
|
|
var/bantime = query.item[9]
|
|
var/bantype = query.item[10]
|
|
|
|
if (pckey != ckey || (address && pip != address) || (computer_id && pcid != computer_id))
|
|
handle_ban_mirroring(ckey, address, computer_id, ban_id)
|
|
|
|
var/expires = ""
|
|
if(text2num(duration) > 0)
|
|
expires = " The ban is for [duration] minutes and expires on [expiration] (server time)."
|
|
|
|
var/desc = "\nReason: You, or another user of this computer or connection ([pckey]) is banned from playing here. The ban reason is:\n[reason]\nThis ban was applied by [ackey] on [bantime], [expires]"
|
|
|
|
return list("reason"="[bantype]", "desc"="[desc]")
|
|
|
|
return ..() //default pager ban stuff
|
|
#endif
|
|
#undef OVERRIDE_BAN_SYSTEM
|