Skip to content

Commit

Permalink
Check if firewall is currently active and enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
samcofer committed Mar 14, 2023
1 parent 6ad4ea0 commit f165d29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/os/firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

func CheckFirewallStatus(osType config.OperatingSystem) (bool, error) {
if osType == config.Redhat7 || osType == config.Redhat8 {
stdout, _, _ := system.RunCommandAndCaptureOutput("rpm -q firewalld")
rpmOutput, _, _ := system.RunCommandAndCaptureOutput("rpm -q firewalld")

if strings.Contains(stdout, "not installed") {
if strings.Contains(rpmOutput, "not installed") {
return false, nil
}
return true, nil
Expand Down
2 changes: 1 addition & 1 deletion internal/os/selinux.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func CheckSELinuxStatus(osType config.OperatingSystem) (bool, error) {
if err != nil {
return false, fmt.Errorf("issue running getenforce command: %w", err)
}
if strings.Contains(stdout, "Enforcing") || strings.Contains(stdout, "Permissive") {
if strings.Contains(stdout, "Enforcing") {
return true, nil
}
}
Expand Down

0 comments on commit f165d29

Please sign in to comment.