88# Maintainer: QE Security <[email protected] >99
1010package services::389ds_server ;
11- use base " opensusebasetest " ;
11+ use base ' consoletest ' ;
1212use testapi;
1313use utils;
1414use warnings;
@@ -17,6 +17,7 @@ use opensslca;
1717use network_utils ' iface' ;
1818use Utils::Architectures ' is_s390x' ;
1919use Utils::Systemd qw( disable_and_stop_service systemctl) ;
20+ use version_utils ' has_selinux' ;
2021
2122my $local_name = ' 389ds' ;
2223my $remote_name = ' sssdclient' ;
@@ -27,21 +28,28 @@ sub install_service {
2728 zypper_call(" in 389-ds openssl" );
2829}
2930
30- # The function below covers all required steps for 389ds server's configuration
31- sub config_service {
31+ # move ssh server to another port on s390x architecture
32+ sub workaround_CC_s390x {
3233 my $server_ip = get_var(' SERVER_IP' , ' 10.0.2.101' );
3334 my $client_ip = get_var(' CLIENT_IP' , ' 10.0.2.102' );
34- if (is_s390x) {
35- my $ssh_port = ' 2222' ;
36- assert_script_run(" ip addr add $server_ip /24 dev " . iface);
37- assert_script_run(" echo \" $server_ip server master\" >> /etc/hosts" );
38- assert_script_run(" echo 'ListenAddress 0.0.0.0' >> /etc/ssh/sshd_config" );
39- assert_script_run(" echo \" Port $ssh_port \" >> /etc/ssh/sshd_config" );
40- systemctl(' restart sshd' );
41- disable_and_stop_service(' firewalld' , ignore_failure => 1);
42- disable_and_stop_service(' apparmor' , ignore_failure => 1);
43- }
35+ my $ssh_port = ' 2222' ;
36+ assert_script_run " ip addr add $server_ip /24 dev " . iface;
37+ assert_script_run " echo \" $server_ip server master\" >> /etc/hosts" ;
38+ assert_script_run " echo 'ListenAddress 0.0.0.0' >> /etc/ssh/sshd_config" ;
39+ assert_script_run " echo \" Port $ssh_port \" >> /etc/ssh/sshd_config" ;
40+ assert_script_run q{ sed -i.bak 's/^[# ]*PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config} ;
41+ # on SELINUX enabled system, need to add new port type to avoid sshd start failure
42+ assert_script_run " semanage port -a -t ssh_port_t -p tcp $ssh_port " if has_selinux;
43+ systemctl(' restart sshd' );
44+ disable_and_stop_service(' firewalld' , ignore_failure => 1);
45+ disable_and_stop_service(' apparmor' , ignore_failure => 1);
46+ record_info(' sshd configuration:' , script_output(' sshd -T' ));
47+ recurd_into(' sshd tree' , script_output(' ls -lR /etc/ssh' ));
48+ }
4449
50+ # The function below covers all required steps for 389ds server's configuration
51+ sub config_service {
52+ workaround_CC_s390x if is_s390x;
4553 # Start a local instance with basic configuration file
4654 assert_script_run(" wget --quiet " . data_url(" 389ds/instance.inf" ) . " -O /tmp/instance.inf" );
4755 assert_script_run(" sed -i 's/\{\{ PASSWORD\}\} /$testapi::password /g' /tmp/instance.inf" );
0 commit comments