[Pkg-freeipa-devel] [Git][freeipa-team/pytest-multihost][master] 13 commits: Implement OpenSSH password auth with sshpass

Timo Aaltonen (@tjaalton) gitlab at salsa.debian.org
Tue Mar 29 08:59:50 BST 2022



Timo Aaltonen pushed to branch master at FreeIPA packaging / pytest-multihost


Commits:
12c8370f by Christian Heimes at 2020-03-17T12:31:56+01:00
Implement OpenSSH password auth with sshpass

Paramiko does not yet implement modern handshake variants with
rsa-sha2-256. OpenSSH 8.2 release notes say that the old ssh-rsa
algorithm (RSA with SHA-1 signature) be disabled soon. The algorithm does
not work in FIPS either.

The patch implements OpenSSH password-based logins using the sshpass
utilility. It reads the password from a secure file and feeds it to
OpenSSH command line tool.

See: https://www.openssh.com/releasenotes.html
See: https://linux.die.net/man/1/sshpass
Signed-off-by: Christian Heimes <cheimes at redhat.com>

- - - - -
95c08a60 by Scott Poore at 2020-04-02T08:36:33-05:00
Bump version to 3.1

- - - - -
23abfb86 by Scott Poore at 2020-04-03T16:11:22-05:00
Fix spec file to work with current distros

Bumping version to 3.2 also

- - - - -
cb646da0 by Scott Poore at 2020-04-06T12:04:09-05:00
README rst fix and version bump for pypi upload

- - - - -
56693d16 by Niranjan M.R at 2020-04-07T11:54:29+05:30
Set permissions in octal mode for sshpass to read the file

Signed-off-by: Niranjan M.R <mrniranjan at redhat.com>

- - - - -
9043c21a by Niranjan M.R at 2020-04-07T18:06:24+05:30
Bump version to 3.4

Signed-off-by: Niranjan M.R <mrniranjan at redhat.com>

- - - - -
d00da8ff by Timo Aaltonen at 2022-03-29T10:36:32+03:00
Merge branch 'upstream'

- - - - -
161b99ff by Timo Aaltonen at 2022-03-29T10:37:08+03:00
version bump

- - - - -
4d892b94 by Timo Aaltonen at 2022-03-29T10:38:07+03:00
source: Bump source format.

- - - - -
1e439ac4 by Timo Aaltonen at 2022-03-29T10:55:28+03:00
Migrate to debhelper-compat, bump to 13.

- - - - -
b9a2e7af by Timo Aaltonen at 2022-03-29T10:56:59+03:00
source: Add diff-ignore.

- - - - -
ceaa3bd2 by Timo Aaltonen at 2022-03-29T10:58:59+03:00
control: Bump policy to 4.6.0.

- - - - -
0ce729c9 by Timo Aaltonen at 2022-03-29T10:59:05+03:00
releasing package pytest-multihost version 3.4-1

- - - - -


9 changed files:

- README.rst
- debian/changelog
- − debian/compat
- debian/control
- debian/source/format
- + debian/source/options
- pytest_multihost/transport.py
- python-pytest-multihost.spec
- setup.py


Changes:

=====================================
README.rst
=====================================
@@ -185,7 +185,7 @@ but an encoding can be given to get a test string.
 
 For command output, separate ``stdout_bytes`` and ``stdout_text`` attributes
 are provided.
-The latter uses a configurable encoding (``utf-8` by default).
+The latter uses a configurable encoding (``utf-8`` by default).
 
 
 Contributing


=====================================
debian/changelog
=====================================
@@ -1,3 +1,13 @@
+pytest-multihost (3.4-1) unstable; urgency=medium
+
+  * New upstream release.
+  * source: Bump source format.
+  * Migrate to debhelper-compat, bump to 13.
+  * source: Add diff-ignore.
+  * control: Bump policy to 4.6.0.
+
+ -- Timo Aaltonen <tjaalton at debian.org>  Tue, 29 Mar 2022 10:59:00 +0300
+
 pytest-multihost (3.0-2) unstable; urgency=medium
 
   * Bump debhelper to 12.


=====================================
debian/compat deleted
=====================================
@@ -1 +0,0 @@
-12


=====================================
debian/control
=====================================
@@ -4,11 +4,11 @@ Uploaders: Timo Aaltonen <tjaalton at debian.org>
 Section: python
 Priority: optional
 Build-Depends:
- debhelper (>= 12),
+ debhelper-compat (= 13),
  dh-python,
  python3-all,
  python3-setuptools,
-Standards-Version: 4.4.0
+Standards-Version: 4.6.0
 Homepage: https://pagure.io/python-pytest-multihost/
 Vcs-Git: https://salsa.debian.org/freeipa-team/pytest-multihost.git
 Vcs-Browser: https://salsa.debian.org/freeipa-team/pytest-multihost


=====================================
debian/source/format
=====================================
@@ -1 +1 @@
-1.0
+3.0 (quilt)


=====================================
debian/source/options
=====================================
@@ -0,0 +1,2 @@
+extend-diff-ignore = COPYING|Makefile|python-pytest-multihost.spec|setup.cfg|test_pytestmultihost|tox.ini
+


=====================================
pytest_multihost/transport.py
=====================================
@@ -375,9 +375,15 @@ class OpenSSHTransport(Transport):
         if self.host.ssh_key_filename:
             key_filename = os.path.expanduser(self.host.ssh_key_filename)
             argv.extend(['-i', key_filename])
+            # disable password prompt
+            argv.extend(['-o', 'BatchMode=yes'])
         elif self.host.ssh_password:
-            self.log.critical('Password authentication not supported')
-            raise RuntimeError('Password authentication not supported')
+            password_file = os.path.join(self.control_dir.path, 'password')
+            with open(password_file, 'w') as f:
+                os.fchmod(f.fileno(), 0o600)
+                f.write(self.host.ssh_password)
+                f.write('\n')
+            argv = ['sshpass', '-f', password_file] + argv
         else:
             self.log.critical('No SSH credentials configured')
             raise RuntimeError('No SSH credentials configured')


=====================================
python-pytest-multihost.spec
=====================================
@@ -1,18 +1,19 @@
-%if 0%{?rhel}
-%global with_python3 0
-%else
-%global with_python3 1
+%if 0%{?fedora} >= 30 || 0%{?rhel} >= 8
+%global default_python_ver 3
 %endif
 
-%if 0%{?rhel} && 0%{?rhel} <= 6
-%{!?__python2: %global __python2 /usr/bin/python2}
-%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
-%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+%if 0%{?default_python_ver} > 2
+%global with_python3 1
+%global __python %{__python3}
+%global with_python2 0
+%else
+%global with_python3 0
+%global with_python2 1
 %endif
 
 %global srcname pytest-multihost
 %global modulename pytest_multihost
-%global srcversion 3.0
+%global srcversion 3.4
 %global versionedname %{srcname}-%{srcversion}
 
 Name: python-%{srcname}
@@ -26,17 +27,30 @@ URL: https://github.com/encukou/%{srcname}
 Source0: https://github.com/encukou/%{srcname}/archive/v%{srcversion}.tar.gz#/%{versionedname}.tar.gz
 
 BuildArch: noarch
-BuildRequires: python-devel
-BuildRequires: python-setuptools
-BuildRequires: pytest
+
 %if 0%{?with_python3}
 BuildRequires: python3-devel
 BuildRequires: python3-setuptools
 BuildRequires: python3-pytest
+BuildRequires: openssh-clients
+BuildRequires: sshpass
+%endif
+
+%if 0%{?with_python2}
+BuildRequires: python-devel
+BuildRequires: python-setuptools
+BuildRequires: pytest
 %endif
 
 Requires: python
 Requires: pytest >= 2.4.0
+Requires: openssh-clients
+
+%if 0%{?rhel} <= 7
+Requires: sshpass
+%else
+Recommends: sshpass
+%endif
 
 # Should use python_provide macros, but those won't work in older EPEL
 Provides: python2-%{srcname}
@@ -59,6 +73,8 @@ Summary: Utility for writing multi-host tests for pytest
 
 Requires: python3
 Requires: python3-pytest
+Requires: openssh-clients
+Recommends: sshpass
 
 %description -n python3-%{srcname}
 Allows pytest tests to run commands on several machines.
@@ -77,9 +93,10 @@ rm -rf %{py3dir}
 cp -a . %{py3dir}
 %endif
 
-
 %build
+%if 0%{?with_python2}
 %{__python2} setup.py build
+%endif
 
 %if 0%{?with_python3}
 pushd %{py3dir}
@@ -89,7 +106,9 @@ popd
 
 %check
 # Do not run the test that needs passwordless SSH to localhost set up
+%if 0%{?with_python2}
 %{__python2} -m pytest -m "not needs_ssh"
+%endif
 
 %if 0%{?with_python3}
 pushd %{py3dir}
@@ -98,11 +117,8 @@ popd
 %endif
 
 %install
+%if 0%{?with_python2}
 %{__python2} setup.py install --skip-build --root %{buildroot}
-%if 0%{?with_python3}
-%py_byte_compile %{__python2} %{buildroot}%{python_sitelib}/%{srcname}
-%else
-# py_byte_compile is only defined in python3-devel
 %{__python2} -m compileall %{buildroot}%{python_sitelib}/%{srcname}
 %endif
 
@@ -113,15 +129,13 @@ pushd %{py3dir}
 popd
 %endif
 
+%if 0%{?with_python2}
 %files
-%if 0%{?rhel} && 0%{?rhel} <= 6
-%doc COPYING
-%else
 %license COPYING
-%endif
 %doc README.rst
-%{python_sitelib}/%{modulename}-%{version}-py2.?.egg-info
-%{python_sitelib}/%{modulename}/
+%{python2_sitelib}/%{modulename}-%{version}-py2.?.egg-info
+%{python2_sitelib}/%{modulename}/
+%endif
 
 %if 0%{?with_python3}
 %files -n python3-%{srcname}
@@ -133,6 +147,20 @@ popd
 
 
 %changelog
+* Tue Apr 07 2020 Niranjan MR <niranjan at ashoo.in> - 3.4-1
+- Set permissions in octal mode for sshpass to read the file
+
+* Mon Apr 06 2020 Scott Poore <spoore1 at gmail.com> - 3.3-1
+- README.rst fix for pypi upload
+- Bump version to 3.3
+
+* Fri Apr 03 2020 Scott Poore <spoore1 at gmail.com> - 3.2-1
+- Spec file updates to fix build issues on some distros
+- Bump version to 3.2 in setup.py also
+
+* Thu Apr 02 2020 Scott Poore <spoore1 at gmail.com> - 3.1-1
+- Implement OpenSSH password auth with sshpass
+
 * Fri Mar 02 2018 Petr Viktorin <encukou at gmail.com> - 3.0-1
 - Do not add extra newlines to stdin contents
 - Remove forgotten debug print


=====================================
setup.py
=====================================
@@ -11,7 +11,7 @@ with io.open('README.rst', 'rt', encoding='utf-8') as f:
 
 setup_args = dict(
     name = "pytest-multihost",
-    version = "3.0",
+    version = "3.4",
     description = "Utility for writing multi-host tests for pytest",
     long_description = readme_contents,
     url = "https://pagure.io/python-pytest-multihost",



View it on GitLab: https://salsa.debian.org/freeipa-team/pytest-multihost/-/compare/17e31beca39661d930822690122920e76620b33c...0ce729c930838c60e224b42cc76104bece5d97cb

-- 
View it on GitLab: https://salsa.debian.org/freeipa-team/pytest-multihost/-/compare/17e31beca39661d930822690122920e76620b33c...0ce729c930838c60e224b42cc76104bece5d97cb
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-freeipa-devel/attachments/20220329/198471a7/attachment-0001.htm>


More information about the Pkg-freeipa-devel mailing list