diff --git a/openbas-api/src/main/java/io/openbas/migration/V3_34__Add_column_requires_elevation.java b/openbas-api/src/main/java/io/openbas/migration/V3_34__Add_column_elevation_required_payload.java similarity index 72% rename from openbas-api/src/main/java/io/openbas/migration/V3_34__Add_column_requires_elevation.java rename to openbas-api/src/main/java/io/openbas/migration/V3_34__Add_column_elevation_required_payload.java index 822e8304fa..e09b6506fa 100644 --- a/openbas-api/src/main/java/io/openbas/migration/V3_34__Add_column_requires_elevation.java +++ b/openbas-api/src/main/java/io/openbas/migration/V3_34__Add_column_elevation_required_payload.java @@ -7,12 +7,11 @@ import java.sql.Statement; @Component -public class V3_34__Add_column_requires_elevation extends BaseJavaMigration { +public class V3_34__Add_column_elevation_required_payload extends BaseJavaMigration { @Override public void migrate(final Context context) throws Exception { final Statement select = context.getConnection().createStatement(); - select.execute("ALTER TABLE asset_agent_jobs ADD asset_agent_elevation_required bool default false;"); select.execute("ALTER TABLE payloads ADD payload_elevation_required bool default false;"); } } diff --git a/openbas-api/src/main/resources/application.properties b/openbas-api/src/main/resources/application.properties index 696c122e5d..2ef09884d5 100644 --- a/openbas-api/src/main/resources/application.properties +++ b/openbas-api/src/main/resources/application.properties @@ -131,11 +131,6 @@ logging.logback.rollingpolicy.file-name-pattern=${LOG_FILE}.-%d{yyyy-MM-dd}.%i logging.logback.rollingpolicy.max-file-size=10MB logging.logback.rollingpolicy.max-history=7 - -# Non-system service account credentials for OpenBAS agent -openbas.agent.non-system-user= -openbas.agent.non-system-pwd= - ############# # EXECUTORS # ############# diff --git a/openbas-framework/src/main/java/io/openbas/asset/EndpointService.java b/openbas-framework/src/main/java/io/openbas/asset/EndpointService.java index aaa69baec2..6b111e09c6 100644 --- a/openbas-framework/src/main/java/io/openbas/asset/EndpointService.java +++ b/openbas-framework/src/main/java/io/openbas/asset/EndpointService.java @@ -1,6 +1,5 @@ package io.openbas.asset; -import io.openbas.config.OpenBASAgentConfig; import io.openbas.config.OpenBASConfig; import io.openbas.database.model.Endpoint; import io.openbas.database.repository.EndpointRepository; @@ -34,9 +33,6 @@ public class EndpointService { @Resource private OpenBASConfig openBASConfig; - @Resource - private OpenBASAgentConfig openBASAgentConfig; - @Value("${openbas.admin.token:#{null}}") private String adminToken; @@ -113,9 +109,7 @@ public String getFileOrDownloadFromJfrog(String platform, String file, String ad } return IOUtils.toString(in, StandardCharsets.UTF_8) .replace("${OPENBAS_URL}", openBASConfig.getBaseUrl()) - .replace("${OPENBAS_TOKEN}", adminToken) - .replace("${NON_SYSTEM_USER}", openBASAgentConfig.getNonSystemUser()) - .replace("${NON_SYSTEM_PWD}", openBASAgentConfig.getNonSystemPwd()); + .replace("${OPENBAS_TOKEN}", adminToken); } public String generateInstallCommand(String platform, String token) throws IOException { diff --git a/openbas-framework/src/main/java/io/openbas/config/OpenBASAgentConfig.java b/openbas-framework/src/main/java/io/openbas/config/OpenBASAgentConfig.java deleted file mode 100644 index 56085a463a..0000000000 --- a/openbas-framework/src/main/java/io/openbas/config/OpenBASAgentConfig.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.openbas.config; - -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -@Component -@ConfigurationProperties(prefix = "openbas.agent") -@Data -public class OpenBASAgentConfig { - - @JsonProperty("non-system-user") - private String nonSystemUser; - - @JsonProperty("non-system-pwd") - private String nonSystemPwd; - -} diff --git a/openbas-framework/src/main/java/io/openbas/executors/openbas/service/OpenBASExecutorContextService.java b/openbas-framework/src/main/java/io/openbas/executors/openbas/service/OpenBASExecutorContextService.java index 4afc16b72e..bbcb455f6d 100644 --- a/openbas-framework/src/main/java/io/openbas/executors/openbas/service/OpenBASExecutorContextService.java +++ b/openbas-framework/src/main/java/io/openbas/executors/openbas/service/OpenBASExecutorContextService.java @@ -53,15 +53,10 @@ public void launchExecutorSubprocess(@NotNull final Inject inject, @NotNull fina assetAgentJob.setCommand(computeCommand(inject, platform, arch)); assetAgentJob.setAsset(asset); assetAgentJob.setInject(inject); - assetAgentJob.setElevationRequired(this.isElevationRequired(inject)); assetAgentJobRepository.save(assetAgentJob); } public void launchExecutorClear(@NotNull final Injector injector, @NotNull final Asset asset) { // TODO } - - private boolean isElevationRequired(final Inject inject) { - return inject.getInjectorContract().map(injectorContract -> injectorContract.getPayload()).map(payload->payload.isElevationRequired()).orElse(false).booleanValue(); - } } diff --git a/openbas-model/src/main/java/io/openbas/database/model/AssetAgentJob.java b/openbas-model/src/main/java/io/openbas/database/model/AssetAgentJob.java index e049be8541..5cb728f4a4 100644 --- a/openbas-model/src/main/java/io/openbas/database/model/AssetAgentJob.java +++ b/openbas-model/src/main/java/io/openbas/database/model/AssetAgentJob.java @@ -46,11 +46,6 @@ public class AssetAgentJob implements Base { @NotBlank private String command; - @Getter - @Column(name = "asset_agent_elevation_required") - @JsonProperty("asset_agent_elevation_required") - private boolean elevationRequired; - @Override public String toString() { return this.id;