Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETFILTER_PKT test fix in ip_eb_tables #13203

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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