s1: remove deprecated fields
This commit is contained in:
@@ -7,11 +7,6 @@
|
|||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.sentinelone;
|
cfg = config.services.sentinelone;
|
||||||
customerId =
|
|
||||||
cfg.customerId or (
|
|
||||||
if cfg.email != null && cfg.serialNumber != null then "${cfg.email}-${cfg.serialNumber}" else null
|
|
||||||
);
|
|
||||||
hasCustomerId = customerId != null;
|
|
||||||
initScript = pkgs.writeShellScriptBin "sentinelone-init.sh" ''
|
initScript = pkgs.writeShellScriptBin "sentinelone-init.sh" ''
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
@@ -25,7 +20,7 @@ let
|
|||||||
S1_AGENT_MANAGEMENT_TOKEN=$(cat ${cfg.sentinelOneManagementTokenPath})
|
S1_AGENT_MANAGEMENT_TOKEN=$(cat ${cfg.sentinelOneManagementTokenPath})
|
||||||
S1_AGENT_DEVICE_TYPE=desktop
|
S1_AGENT_DEVICE_TYPE=desktop
|
||||||
S1_AGENT_AUTO_START=true
|
S1_AGENT_AUTO_START=true
|
||||||
${optionalString hasCustomerId "S1_AGENT_CUSTOMER_ID=${customerId}"}
|
S1_AGENT_CUSTOMER_ID=${cfg.customerId}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat << EOF > ${cfg.dataDir}/configuration/installation_params.json
|
cat << EOF > ${cfg.dataDir}/configuration/installation_params.json
|
||||||
@@ -58,22 +53,11 @@ in
|
|||||||
|
|
||||||
customerId = mkOption {
|
customerId = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
|
||||||
description = ''
|
description = ''
|
||||||
Set a customer specific identifier for the host. It is common practice to set this as your email and serial number separated by a hyphen.
|
Set a customer specific identifier for the host.
|
||||||
'';
|
'';
|
||||||
example = "me@gmail.com-FTXYZWW";
|
example = "me@gmail.com-FTXYZWW";
|
||||||
};
|
};
|
||||||
email = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = null;
|
|
||||||
example = "me@gmail.com";
|
|
||||||
};
|
|
||||||
serialNumber = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
default = null;
|
|
||||||
example = "FTXYZWW";
|
|
||||||
};
|
|
||||||
sentinelOneManagementTokenPath = mkOption {
|
sentinelOneManagementTokenPath = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
example = "/run/secrets/s1_mgmt_token";
|
example = "/run/secrets/s1_mgmt_token";
|
||||||
@@ -87,33 +71,6 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
warnings =
|
|
||||||
optional (cfg.email != null) "services.sentinelone.email is deprecated in favour of customerId."
|
|
||||||
++ optional (
|
|
||||||
cfg.serialNumber != null
|
|
||||||
) "services.sentinelone.serialNumber is deprecated in favour of customerId.";
|
|
||||||
|
|
||||||
assertions = [
|
|
||||||
{
|
|
||||||
assertion = (cfg.customerId != null) -> (cfg.email == null && cfg.serialNumber == null);
|
|
||||||
message = ''
|
|
||||||
You cannot use services.sentinelone.customerId with the deprecated services.sentinelone.email and services.sentinelone.serialNumber options.
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = (cfg.email != null) -> (cfg.serialNumber != null);
|
|
||||||
message = ''
|
|
||||||
services.sentinelone.email requires services.sentinelone.serialNumber to also be set.
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = (cfg.serialNumber != null) -> (cfg.email != null);
|
|
||||||
message = ''
|
|
||||||
services.sentinelone.serialNumber requires services.sentinelone.email to also be set.
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
users.users.sentinelone = {
|
users.users.sentinelone = {
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
createHome = true;
|
createHome = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user