mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-15 23:20:44 +00:00
add option to disable secureboot
This commit is contained in:
9
ansible/files/paper-config/plugins/SecureBoot/config.yml
Normal file
9
ansible/files/paper-config/plugins/SecureBoot/config.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
kick_message: "<red>Server did not startup properly, please contact an @Admin!</red>"
|
||||
|
||||
# enable or disable secureboot
|
||||
enable: ${CIV_SECUREBOOT_ENABLE}
|
||||
|
||||
# Plugin names that SecureBoot will require to be enabled
|
||||
required_plugins:
|
||||
- "CivModCore"
|
||||
- "testpluginthatdoesnotexist"
|
||||
@@ -89,6 +89,8 @@ services:
|
||||
CIV_RABBITMQ_USERNAME: rabbitmq
|
||||
CIV_RABBITMQ_PASSWORD: rabbitmq
|
||||
|
||||
CIV_SECUREBOOT_ENABLE: 'false'
|
||||
|
||||
JVM_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
|
||||
CIV_WATCHDOG_TIMEOUT_TIME: 6000
|
||||
CIV_FORWARDING_SECRET: '1234'
|
||||
|
||||
@@ -28,6 +28,8 @@ enum PluginStatus {
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
public final class SecureBootPlugin extends JavaPlugin implements Listener {
|
||||
private boolean enabled = true;
|
||||
|
||||
private final Map<String, PluginStatus> pluginState = Collections.synchronizedMap(new TreeMap<>(String.CASE_INSENSITIVE_ORDER));
|
||||
private final MiniMessage mm = MiniMessage.miniMessage();
|
||||
private @NotNull Component kickMessage = Component.text("Server is in maintenance mode.");
|
||||
@@ -36,6 +38,13 @@ public final class SecureBootPlugin extends JavaPlugin implements Listener {
|
||||
@Override
|
||||
public void onLoad() {
|
||||
saveDefaultConfig();
|
||||
|
||||
enabled = getConfig().getBoolean("enable", true);
|
||||
if (!enabled) {
|
||||
getSLF4JLogger().info("SecureBoot is disabled in config, skipping checks.");
|
||||
return;
|
||||
}
|
||||
|
||||
// ensure required plugins have a status
|
||||
getConfig().getStringList("required_plugins").forEach((plugin) -> this.pluginState.put(plugin, PluginStatus.AWAITING_STATUS));
|
||||
getSLF4JLogger().debug("Awaiting status for: {}", String.join(", ", this.pluginState.keySet()));
|
||||
@@ -47,6 +56,10 @@ public final class SecureBootPlugin extends JavaPlugin implements Listener {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
|
||||
// add all plugins loaded by the server
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# kick message sent to users if secureboot finds a required plugin missing or disabled
|
||||
kick_message: "<red>Server did not startup properly, please contact an @Admin!</red>"
|
||||
|
||||
# enable or disable secureboot
|
||||
enable: true
|
||||
|
||||
# Plugin names that SecureBoot will require to be enabled
|
||||
required_plugins:
|
||||
- "CivModCore"
|
||||
|
||||
Reference in New Issue
Block a user