diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 209a33e0c5..1c79dde65f 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -458,3 +458,8 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE #define SHELLEO_ERRORLEVEL 1 #define SHELLEO_STDOUT 2 #define SHELLEO_STDERR 3 + +//server security mode +#define SECURITY_SAFE 1 +#define SECURITY_ULTRASAFE 2 +#define SECURITY_TRUSTED 3 diff --git a/code/game/world.dm b/code/game/world.dm index a1fcc364cd..991e6230e6 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -1,3 +1,6 @@ +GLOBAL_VAR(security_mode) +GLOBAL_PROTECT(security_mode) + /world/New() log_world("World loaded at [time_stamp()]") @@ -5,6 +8,8 @@ GLOB.config_error_log = GLOB.sql_error_log = GLOB.world_href_log = GLOB.world_runtime_log = GLOB.world_attack_log = GLOB.world_game_log = file("data/logs/config_error.log") //temporary file used to record errors with loading config, moved to log directory once logging is set bl + CheckSecurityMode() + make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once) config = new @@ -94,6 +99,20 @@ if(GLOB.round_id) log_game("Round ID: [GLOB.round_id]") +/world/proc/CheckSecurityMode() + //try to write to data + if(!text2file("The world is running at least safe mode", "data/server_security_check.lock")) + GLOB.security_mode = SECURITY_ULTRASAFE + warning("/tg/station 13 is not supported in ultrasafe security mode. Everything will break!") + return + + //try to shell + if(shell("echo \"The world is running in trusted mode\"") != null) + GLOB.security_mode = SECURITY_TRUSTED + else + GLOB.security_mode = SECURITY_SAFE + warning("/tg/station 13 uses many file operations, a few shell()s, and some external call()s. Trusted mode is recommended. You can download our source code for your own browsing and compilation at https://github.com/tgstation/tgstation") + /world/Topic(T, addr, master, key) var/list/input = params2list(T)