You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by lf...@apache.org on 2022/11/08 09:11:55 UTC

[incubator-datalab] branch DATALAB-3099 updated: [DATALAB-3099]: added nmap exe removal

This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-3099
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/DATALAB-3099 by this push:
     new 5187fa780 [DATALAB-3099]: added nmap exe removal
5187fa780 is described below

commit 5187fa780131984f3e74725173ea63c3292404d5
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Tue Nov 8 11:11:43 2022 +0200

    [DATALAB-3099]: added nmap exe removal
---
 infrastructure-provisioning/src/base/scripts/create_ssh_user.py    | 1 -
 .../src/base/scripts/install_prerequisites.py                      | 2 +-
 .../src/general/lib/os/debian/common_lib.py                        | 7 ++++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/infrastructure-provisioning/src/base/scripts/create_ssh_user.py b/infrastructure-provisioning/src/base/scripts/create_ssh_user.py
index 2cb69d626..3af70e5a9 100644
--- a/infrastructure-provisioning/src/base/scripts/create_ssh_user.py
+++ b/infrastructure-provisioning/src/base/scripts/create_ssh_user.py
@@ -43,7 +43,6 @@ args = parser.parse_args()
 
 def ensure_ssh_user(initial_user, os_user, sudo_group):
     if not exists(conn, '/home/{}/.ssh_user_ensured'.format(initial_user)):
-        time.sleep(180)
         conn.sudo('useradd -m -G {1} -s /bin/bash {0}'.format(os_user, sudo_group))
         conn.sudo('bash -c "echo \'{} ALL = NOPASSWD:ALL\' >> /etc/sudoers"'.format(os_user))
         conn.sudo('mkdir /home/{}/.ssh'.format(os_user))
diff --git a/infrastructure-provisioning/src/base/scripts/install_prerequisites.py b/infrastructure-provisioning/src/base/scripts/install_prerequisites.py
index 8150affab..b88b78987 100644
--- a/infrastructure-provisioning/src/base/scripts/install_prerequisites.py
+++ b/infrastructure-provisioning/src/base/scripts/install_prerequisites.py
@@ -64,7 +64,7 @@ if __name__ == "__main__":
         sys.exit(1)
 
     logging.info("Disable scp on nodes")
-    remove_scp_binary(args.user)
+    remove_scp_nmap_binary(args.user)
 
     #logging.info("Updating openssh to version")
     #ensure_openssh_version(args.user)
diff --git a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
index 27ce44425..91d9bed9f 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
@@ -284,11 +284,12 @@ def find_java_path_local():
         sys.exit(1)
 
 
-def remove_scp_binary(os_user):
+def remove_scp_nmap_binary(os_user):
     try:
-        if not exists(datalab.fab.conn, '/home/{}/.ensure_dir/remove_scp_binary'.format(os_user)):
+        if not exists(datalab.fab.conn, '/home/{}/.ensure_dir/remove_scp_nmap_binary'.format(os_user)):
             datalab.fab.conn.sudo('rm /usr/bin/scp')
-        datalab.fab.conn.sudo('touch /home/{}/.ensure_dir/remove_scp_binary'.format(os_user))
+            datalab.fab.conn.sudo('rm /usr/share/nmap/nselib/data/psexec/nmap_service.exe > /dev/null; echo $?')
+        datalab.fab.conn.sudo('touch /home/{}/.ensure_dir/remove_scp_nmap_binary'.format(os_user))
     except Exception as err:
         logging.error('Updating openssh to version:', str(err))
         traceback.print_exc()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org