Skip to content

Commit

Permalink
Merge pull request #84 from lgranie/feature/not-load-security-context…
Browse files Browse the repository at this point in the history
…-without-sestatus

Do not need sestatus
  • Loading branch information
lexemmens committed Jul 9, 2023
2 parents 62c6da4 + cc8af84 commit 769622d
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,18 @@ private boolean isSELinuxEnabled() throws MojoExecutionException {
* Memory protection checking: actual (secure)
* Max kernel policy version: 33
*/
Optional<String> seLinuxStatus = seStatusCommand.execute()
.stream()
.filter(line -> line.contains("SELinux status"))
.map(this::extractSeLinuxStatus)
.findFirst();
try {
Optional<String> seLinuxStatus = seStatusCommand.execute()
.stream()
.filter(line -> line.contains("SELinux status"))
.map(this::extractSeLinuxStatus)
.findFirst();

return seLinuxStatus.map(seLinuxStatusString -> seLinuxStatusString.equals("enabled")).orElse(false);
return seLinuxStatus.map(seLinuxStatusString -> seLinuxStatusString.equals("enabled")).orElse(false);
} catch (MojoExecutionException mee) {
log.debug("SELinux is not installed or not available", mee);
}
return false;
}

private String extractSeLinuxStatus(String line) {
Expand Down

0 comments on commit 769622d

Please sign in to comment.