-
Notifications
You must be signed in to change notification settings - Fork 278
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
Prepare two synchronized machines to test PCW #17429
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PubkeyAuthentication yes | ||
PermitRootLogin yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# SUSE's openQA tests | ||
Check warning on line 1 in tests/publiccloud/ansible_client.pm GitHub Actions / CI: Running unit tests with perl v5.32Missing strict or warnings - severity 4
Check warning on line 1 in tests/publiccloud/ansible_client.pm GitHub Actions / CI: Running unit tests with perl v5.32Missing strict or warnings - severity 4
|
||
# | ||
# Copyright 2023 SUSE LLC | ||
# SPDX-License-Identifier: FSFAP | ||
|
||
# Summary: prepare the VM to sync with the ansible_target | ||
# Maintainer: [email protected] | ||
|
||
use base "consoletest"; | ||
use serial_terminal 'select_serial_terminal'; | ||
use transactional qw(trup_call process_reboot); | ||
#use strict; | ||
use warnings; | ||
use testapi; | ||
use lockapi; | ||
use mmapi; | ||
use mm_network qw(setup_static_mm_network); | ||
use utils qw(zypper_call); | ||
|
||
sub run { | ||
my ($self, $args) = @_; | ||
select_serial_terminal; | ||
|
||
record_info('system', script_output('cat /etc/os-release')); | ||
# setup_static_network(ip => '10.0.2.15/15', gw => '10.0.2.2'); | ||
# record_info('ip', script_output('ip a')); | ||
# record_info('route', script_output('ip r')); | ||
# assert_script_run('echo "10.0.2.20 microos" >> /etc/hosts'); | ||
# zypper_call('in -y iputils git'); | ||
|
||
setup_static_mm_network('10.0.2.15/15'); | ||
|
||
record_info('ip', script_output('ip a')); | ||
record_info('route', script_output('ip r')); | ||
script_run('ping -c 1 download.suse.de'); | ||
|
||
assert_script_run('curl -f -v ' . autoinst_url . '/data/slenkins/ssh/id_rsa > /root/.ssh/id_rsa'); | ||
assert_script_run('chmod 600 /root/.ssh/id_rsa'); | ||
|
||
my $children = get_children(); | ||
my $child_id = (keys %$children)[0]; | ||
mutex_wait('target_is_ready', $child_id); | ||
|
||
# Testing target is accessible | ||
assert_script_run('ping -c 1 microos'); | ||
assert_script_run('ssh -v -o StrictHostKeyChecking=accept-new root@microos cat /etc/os-release'); | ||
|
||
mutex_create 'job_completed'; | ||
|
||
wait_for_children; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# SUSE's openQA tests | ||
# | ||
# Copyright 2023 SUSE LLC | ||
# SPDX-License-Identifier: FSFAP | ||
|
||
# Summary: prepare the VM to grant access to ansible_client | ||
# Maintainer: [email protected] | ||
|
||
use base "consoletest"; | ||
use serial_terminal 'select_serial_terminal'; | ||
use transactional qw(trup_call process_reboot); | ||
use strict; | ||
use warnings; | ||
use testapi; | ||
use lockapi; | ||
use mm_network qw(setup_static_mm_network); | ||
use utils qw(zypper_call); | ||
use Utils::Systemd qw(systemctl); | ||
|
||
sub run { | ||
my ($self, $args) = @_; | ||
select_serial_terminal; | ||
record_info('system', script_output('cat /etc/os-release')); | ||
record_info('device', script_output('nmcli -t device')); | ||
|
||
setup_static_mm_network('10.0.2.20/15'); | ||
|
||
record_info('ip', script_output('ip a')); | ||
record_info('route', script_output('ip r')); | ||
script_run('ping -c 1 10.0.2.15'); | ||
script_run('ping -c 1 download.suse.de'); | ||
|
||
assert_script_run('curl -f -v ' . autoinst_url . '/data/slenkins/ssh/authorized_keys >> /root/.ssh/authorized_keys'); | ||
assert_script_run('curl -f -v ' . autoinst_url . '/data/publiccloud/pcw/sshd_config >/etc/ssh/sshd_config'); | ||
|
||
zypper_call('--gpg-auto-import-keys ref'); | ||
trup_call('pkg install python3 python3-selinux'); | ||
process_reboot(trigger => 1); | ||
|
||
systemctl('restart sshd'); | ||
systemctl('status sshd'); | ||
mutex_create 'target_is_ready'; | ||
|
||
assert_script_run('ping -c 1 10.0.2.15'); | ||
mutex_wait 'job_completed'; | ||
} | ||
|
||
1; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please either allow password login and generate the key in the test or at least generate our own key in
data/publiccloud/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's please not have pre-generated keys as they always expose a certain security risk. Unless really really really necessary, let's generate per-test key pairs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO it is too much . we can not apply common security rules into short living test VM running in internal network . Generating per-test key pairs coming with very high price -> in case debug is needed you can access VM only via VNC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we really want to care about security of test VM running on internal network let's hide ssh key in worker config so it will be protected on same level as some other info which has much much more value