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

automatically remove the temporary SSH key from the authorized_keys file #428

Merged
merged 1 commit into from
Nov 17, 2023
Merged
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
10 changes: 9 additions & 1 deletion rickshaw-run
Original file line number Diff line number Diff line change
Expand Up @@ -2076,6 +2076,13 @@ sub add_ssh_keys() {
system('cat ' . $config_dir . '/rickshaw_id.rsa.pub >>/root/.ssh/authorized_keys');
}

sub remove_ssh_keys() {
my $remove_key_command = 'grep -v -x -F -f ' . $config_dir . '/rickshaw_id.rsa.pub /root/.ssh/authorized_keys > /root/.ssh/authorized_keys.new';
system($remove_key_command);
my $replace_keys_command = 'mv /root/.ssh/authorized_keys.new /root/.ssh/authorized_keys';
system($replace_keys_command);
}

sub deploy_endpoints() {
# Deploy ths endpoints so they are ready to run benchmark and tools.
# Each endpoint is responible for launching a osruntime for each client and server.
Expand Down Expand Up @@ -2434,7 +2441,8 @@ add_ssh_keys();
deploy_endpoints();
process_roadblocks();
organize_run_data();
# TODO: remove temporary ssh keys from local authorized_keys file
remove_ssh_keys();

my $run_file = $run_dir . "/rickshaw-run.json";
$run{'rickshaw-run'}{'schema'}{'version'} = "2020.03.18";
if (put_json_file($run_file, \%run, $run_schema_file) > 0) {
Expand Down
Loading