Skip to content

Commit

Permalink
ipsecbase.pm: check firewall status before stop firewall
Browse files Browse the repository at this point in the history
  • Loading branch information
coolgw committed Dec 17, 2024
1 parent 930b099 commit 43ecb70
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/ipsecbase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ sub pre_run_hook {

# disable packagekitd
quit_packagekit();
ensure_apparmor_disabled();
ensure_service_disabled('apparmor');

# Stop firewall
systemctl 'stop ' . $self->firewall;
ensure_service_disabled($self->firewall);

set_hostname(get_var('HOSTNAME', 'susetest'));

Expand All @@ -112,10 +112,11 @@ sub pre_run_hook {
$self->SUPER::pre_run_hook;
}

sub ensure_apparmor_disabled () {
unless (systemctl "is-active apparmor", ignore_failure => 1) { # 0 if active, unless to revert
systemctl "disable --now apparmor";
record_info "apparmor", "disabled";
sub ensure_service_disabled {
my ($service) = @_;
unless (systemctl "is-active " . $service, ignore_failure => 1) { # 0 if active, unless to revert
systemctl "disable --now " . $service;
record_info $service, "disabled";
}
}

Expand Down

0 comments on commit 43ecb70

Please sign in to comment.