Skip to content

Commit

Permalink
Fix NETFILTER_PKT test in ip_eb_tables
Browse files Browse the repository at this point in the history
  • Loading branch information
vtrubovics committed Sep 9, 2021
1 parent 7bc5215 commit 99bd49c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/audit_test.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ our @EXPORT = qw(
upload_audit_test_logs
);

our $testdir = '/tmp/';
our $code_repo = get_var('CODE_BASE', 'https://gitlab.suse.de/security/audit-test-sle15/-/archive/master/audit-test-sle15-master.tar');
our $testfile_tar = 'audit-test-sle15-master';
our $testdir = '/tmp/';
our $code_repo = get_var('CODE_BASE', 'https://gitlab.suse.de/security/audit-test-sle15/-/archive/master/audit-test-sle15-master.tar');
my @lines = split(/[\/\.]+/, $code_repo);
our $testfile_tar = $lines[-2];
our $mode = get_var('MODE', 64);

# $current_file: current output file name; $baseline_file: baseline file name
Expand Down
25 changes: 24 additions & 1 deletion tests/security/cc/ip_eb_tables.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,36 @@ use utils;
use audit_test qw(run_testcase compare_run_log);

sub run {
my ($self) = shift;
my ($self) = shift;
my $f_ifcfg_br0 = '/etc/sysconfig/network/ifcfg-br0';
my $f_ifcfg_eth0 = '/etc/sysconfig/network/ifcfg-eth0';
my $bakf_ifcfg_eth0 = '/etc/sysconfig/network/ifcfg-eth0.bak';
my $br0_config = "BOOTPROTO='dhcp'\nSTARTMODE='auto'\nBRIDGE='yes'\nBRIDGE_PORTS='eth0'\nBRIDGE_STP='off'\nBRIDGE_FORWARDDELAY='15'\n";
my $eth0_config = "IPADDR='0.0.0.0'\nBOOTPROTO='none'\nSTARTMODE='auto'\n";

select_console 'root-console';

# Configure bridge for ip_eb_tables workaround
assert_script_run("cat > $f_ifcfg_br0 <<'END'\n$br0_config\nEND\n( exit \$?)");

# Creating backup for eth0 configuration
assert_script_run("cp $f_ifcfg_eth0 $bakf_ifcfg_eth0");

# Configure eth0 for ip_eb_tables workaround
assert_script_run("cat > $f_ifcfg_eth0 <<'END'\n$eth0_config\nEND\n( exit \$?)");

assert_script_run("service network restart");
assert_script_run("bridge link show");

# Run test case
run_testcase('ip+eb-tables', timeout => 300);

# Clean-up and restore configuration
assert_script_run("rm $f_ifcfg_br0");
assert_script_run("rm $f_ifcfg_eth0");
assert_script_run("cp $bakf_ifcfg_eth0 $f_ifcfg_eth0");
assert_script_run("service network restart");

# Compare current test results with baseline
my $result = compare_run_log('ip_eb_tables');
$self->result($result);
Expand Down

0 comments on commit 99bd49c

Please sign in to comment.