Added warnings for ultrasafe and safe security modes (#30515)

This commit is contained in:
Jordan Brown
2017-09-09 20:39:49 -04:00
committed by CitadelStationBot
parent 1769b0272a
commit eaeaae7bef
2 changed files with 24 additions and 0 deletions
+5
View File
@@ -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
+19
View File
@@ -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)