From bacc752ff261d927a2a5d4cdd668a5e984f0924c Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Thu, 11 Jun 2020 21:17:31 -0700 Subject: [PATCH] Pegs python 2 version, removes unused imports, fixes sudden ssh dir with bad perms, generates key for sudo user as well in tests --- .ci/azure-pipelines.yml | 4 ++-- .ci/localhost_ansible_tests.py | 23 +++++++++++------------ README.md | 1 - 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index a537b0f5..c23974df 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -13,10 +13,10 @@ jobs: strategy: matrix: Mito27_27: - python.version: '2.7' + python.version: '2.7.18' MODE: mitogen Ans288_27: - python.version: '2.7' + python.version: '2.7.18' MODE: localhost_ansible VER: 2.8.8 diff --git a/.ci/localhost_ansible_tests.py b/.ci/localhost_ansible_tests.py index 888d2e44..b4d6a542 100755 --- a/.ci/localhost_ansible_tests.py +++ b/.ci/localhost_ansible_tests.py @@ -1,9 +1,7 @@ #!/usr/bin/env python # Run tests/ansible/all.yml under Ansible and Ansible-Mitogen -import glob import os -import shutil import sys import ci_lib @@ -31,16 +29,17 @@ with ci_lib.Fold('job_setup'): with ci_lib.Fold('machine_prep'): - ssh_dir = os.path.expanduser('~/.ssh') - if not os.path.exists(ssh_dir): - os.makedirs(ssh_dir, int('0700', 8)) - - key_path = os.path.expanduser('~/.ssh/id_rsa') - shutil.copy(KEY_PATH, key_path) - - auth_path = os.path.expanduser('~/.ssh/authorized_keys') - os.system('ssh-keygen -y -f %s >> %s' % (key_path, auth_path)) - os.chmod(auth_path, int('0600', 8)) + # generate a new ssh key for localhost ssh + os.system("ssh-keygen -P '' -m pem -f ~/.ssh/id_rsa") + os.system("cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys") + # also generate it for the sudo user + os.system("sudo ssh-keygen -P '' -m pem -f /var/root/.ssh/id_rsa") + os.system("sudo cat /var/root/.ssh/id_rsa.pub | sudo tee -a /var/root/.ssh/authorized_keys") + os.chmod(os.path.expanduser('~/.ssh'), int('0700', 8)) + os.chmod(os.path.expanduser('~/.ssh/authorized_keys'), int('0600', 8)) + # run chmod through sudo since it's owned by root + os.system('sudo chmod 600 /var/root/.ssh') + os.system('sudo chmod 600 /var/root/.ssh/authorized_keys') if os.path.expanduser('~mitogen__user1') == '~mitogen__user1': os.chdir(IMAGE_PREP_DIR) diff --git a/README.md b/README.md index da93a80b..c7d8b03f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - # Mitogen