From c1a761805ab15862dc10c5a3254dcc92ff93a0d9 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 7 May 2019 00:27:46 -0400 Subject: [PATCH] import awscli-1.14.50-5.el8 --- .awscli.metadata | 2 + .gitignore | 2 + SOURCES/python-rsa-to-cryptography.patch | 115 ++++++++ SPECS/awscli.spec | 322 +++++++++++++++++++++++ 4 files changed, 441 insertions(+) create mode 100644 .awscli.metadata create mode 100644 .gitignore create mode 100644 SOURCES/python-rsa-to-cryptography.patch create mode 100644 SPECS/awscli.spec diff --git a/.awscli.metadata b/.awscli.metadata new file mode 100644 index 0000000..e6aafab --- /dev/null +++ b/.awscli.metadata @@ -0,0 +1,2 @@ +8d6dde3c848339b438e71be80b4f0d6e583a3624 SOURCES/awscli-1.14.50.tar.gz +7310d6ddf680c524ad6b16f673a77a9defb5766e SOURCES/colorama-0.3.7.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b487538 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/awscli-1.14.50.tar.gz +SOURCES/colorama-0.3.7.tar.gz diff --git a/SOURCES/python-rsa-to-cryptography.patch b/SOURCES/python-rsa-to-cryptography.patch new file mode 100644 index 0000000..6c3c8f5 --- /dev/null +++ b/SOURCES/python-rsa-to-cryptography.patch @@ -0,0 +1,115 @@ +diff -uNr a/awscli/customizations/cloudfront.py b/awscli/customizations/cloudfront.py +--- a/awscli/customizations/cloudfront.py 2018-03-01 21:17:11.000000000 +0100 ++++ b/awscli/customizations/cloudfront.py 2018-06-28 09:11:54.560750789 +0200 +@@ -14,7 +14,9 @@ + import time + import random + +-import rsa ++from cryptography.hazmat.primitives import serialization, hashes ++from cryptography.hazmat.primitives.asymmetric import padding ++from cryptography.hazmat.backends import default_backend + from botocore.utils import parse_to_aware_datetime + from botocore.signers import CloudFrontSigner + +@@ -254,7 +256,16 @@ + + class RSASigner(object): + def __init__(self, private_key): +- self.priv_key = rsa.PrivateKey.load_pkcs1(private_key.encode('utf8')) ++ try: ++ self.priv_key = serialization.load_pem_private_key( ++ private_key.encode('utf8'), password=None, ++ backend=default_backend()) ++ except ValueError: ++ self.priv_key = '' + + def sign(self, message): +- return rsa.sign(message, self.priv_key, 'SHA-1') ++ try: ++ return self.priv_key.sign( ++ message, padding.PKCS1v15(), hashes.SHA1()) ++ except AttributeError: ++ return b'' +diff -uNr a/awscli/customizations/cloudtrail/validation.py b/awscli/customizations/cloudtrail/validation.py +--- a/awscli/customizations/cloudtrail/validation.py 2018-03-01 21:17:11.000000000 +0100 ++++ b/awscli/customizations/cloudtrail/validation.py 2018-06-28 09:11:54.559750804 +0200 +@@ -22,8 +22,10 @@ + from datetime import datetime, timedelta + from dateutil import tz, parser + +-from pyasn1.error import PyAsn1Error +-import rsa ++from cryptography.hazmat.primitives import serialization, hashes ++from cryptography.hazmat.backends import default_backend ++from cryptography.hazmat.primitives.asymmetric import padding ++from cryptography.exceptions import InvalidSignature + + from awscli.customizations.cloudtrail.utils import get_trail_by_arn, \ + get_account_id_from_arn +@@ -530,20 +532,18 @@ + """ + try: + decoded_key = base64.b64decode(public_key) +- public_key = rsa.PublicKey.load_pkcs1(decoded_key, format='DER') ++ public_key = serialization.load_der_public_key(decoded_key, ++ backend=default_backend()) + to_sign = self._create_string_to_sign(digest_data, inflated_digest) + signature_bytes = binascii.unhexlify(digest_data['_signature']) +- rsa.verify(to_sign, signature_bytes, public_key) +- except PyAsn1Error: ++ public_key.verify(signature_bytes, to_sign, padding.PKCS1v15(), ++ hashes.SHA256()) ++ except (ValueError, TypeError): + raise DigestError( + ('Digest file\ts3://%s/%s\tINVALID: Unable to load PKCS #1 key' + ' with fingerprint %s') + % (bucket, key, digest_data['digestPublicKeyFingerprint'])) +- except rsa.pkcs1.VerificationError: +- # Note from the Python-RSA docs: Never display the stack trace of +- # a rsa.pkcs1.VerificationError exception. It shows where in the +- # code the exception occurred, and thus leaks information about +- # the key. ++ except InvalidSignature: + raise DigestSignatureError(bucket, key) + + def _create_string_to_sign(self, digest_data, inflated_digest): +diff -uNr a/awscli/customizations/ec2/decryptpassword.py b/awscli/customizations/ec2/decryptpassword.py +--- a/awscli/customizations/ec2/decryptpassword.py 2018-03-01 21:17:11.000000000 +0100 ++++ b/awscli/customizations/ec2/decryptpassword.py 2018-06-28 09:11:54.559750804 +0200 +@@ -13,7 +13,9 @@ + import logging + import os + import base64 +-import rsa ++from cryptography.hazmat.primitives import serialization ++from cryptography.hazmat.backends import default_backend ++from cryptography.hazmat.primitives.asymmetric import padding + from awscli.compat import six + + from botocore import model +@@ -109,9 +111,11 @@ + try: + with open(self._key_path) as pk_file: + pk_contents = pk_file.read() +- private_key = rsa.PrivateKey.load_pkcs1(six.b(pk_contents)) ++ private_key = serialization.load_pem_private_key( ++ six.b(pk_contents), password=None, ++ backend=default_backend()) + value = base64.b64decode(value) +- value = rsa.decrypt(value, private_key) ++ value = private_key.decrypt(value, padding.PKCS1v15()) + logger.debug(parsed) + parsed['PasswordData'] = value.decode('utf-8') + logger.debug(parsed) +diff -uNr a/requirements.txt b/requirements.txt +--- a/requirements.txt 2018-03-01 21:17:11.000000000 +0100 ++++ b/requirements.txt 2018-06-28 09:11:54.560750789 +0200 +@@ -9,6 +9,6 @@ + nose==1.3.0 + colorama>=0.2.5,<=0.3.7 + mock==1.3.0 +-rsa>=3.1.2,<=3.5.0 ++cryptography==2.0.3 + wheel==0.24.0 + PyYAML>=3.10,<=3.12 diff --git a/SPECS/awscli.spec b/SPECS/awscli.spec new file mode 100644 index 0000000..4b248d6 --- /dev/null +++ b/SPECS/awscli.spec @@ -0,0 +1,322 @@ +%if 0%{?rhel} <= 7 +%bcond_with python3 +%else +%bcond_without python3 +%endif + +%global botocore_version 1.9.1 + +# python-colorama +%global colorama_version 0.3.7 +%global bundled_lib_dir bundled +%global colorama_dir %{bundled_lib_dir}/colorama + +Name: awscli +Version: 1.14.50 +Release: 5%{?dist} +Summary: Universal Command Line Environment for AWS + +License: ASL 2.0 and MIT +URL: http://aws.amazon.com/cli +Source0: https://pypi.io/packages/source/a/%{name}/%{name}-%{version}.tar.gz +Source1: colorama-%{colorama_version}.tar.gz +Patch0: python-rsa-to-cryptography.patch +BuildArch: noarch +%if %{with python3} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +Requires: python3-botocore = %{botocore_version} +# python-colorama bundle +#Requires: python3-colorama >= 0.2.5 +Provides: bundled(python3-colorama) = %{colorama_version} +Requires: python3-docutils >= 0.10 +Requires: python3-cryptography >= 2.0.3 +Requires: python3-s3transfer >= 0.1.9 +Requires: python3-PyYAML >= 3.10 +%else +BuildRequires: python2-devel +BuildRequires: python-setuptools +Requires: python2-botocore = %{botocore_version} +# python-colorama bundle +#Requires: python-colorama >= 0.2.5 +Requires: python-docutils >= 0.10 +Requires: python2-rsa >= 3.1.2 +Requires: python2-s3transfer >= 0.1.9 +Requires: PyYAML >= 3.10 +%endif # with python3 +%if 0%{?fedora} +Recommends: bash-completion +Recommends: zsh +%endif # Fedora + +%if %{with python3} +%{?python_provide:%python_provide python3-%{name}} +%else +%{?python_provide:%python_provide python2-%{name}} +%endif # with python3 + +%description +This package provides a unified +command line interface to Amazon Web Services. + +%prep +%setup -q -n %{name}-%{version} +%patch0 -p1 + +rm -rf %{name}.egg-info + +# python-colorama bundle +mkdir -p %{bundled_lib_dir} +tar -xzf %SOURCE1 -C %{bundled_lib_dir} +mv %{bundled_lib_dir}/colorama-%{colorama_version} %{colorama_dir} +cp %{colorama_dir}/LICENSE.txt colorama_LICENSE.txt +cp %{colorama_dir}/README.rst colorama_README.rst + +pushd %{colorama_dir} +# remove bundled egg-info +rm -rf *.egg-info +popd +# python-colorama: append bundled-directory to search path +sed -i "/^import colorama/isys.path.insert(0, '/usr/lib/%{name}/bundled')" awscli/customizations/history/show.py awscli/table.py +# python-jmespath: append bundled-directory to search path +sed -i "/^import jmespath/iimport sys\nsys.path.insert(0, '/usr/lib/%{name}/bundled')" awscli/customizations/arguments.py + +%build +%if %{with python3} +%py3_build +%else +%py2_build +%endif # with python3 + +# python-colorama bundle +pushd %{colorama_dir} +%{__python3} setup.py build +popd + +%install +%if %{with python3} +%py3_install +%else +%py2_install +%endif # with python3 +# Fix path and permissions for bash completition +%global bash_completion_dir /etc/bash_completion.d +mkdir -p %{buildroot}%{bash_completion_dir} +mv %{buildroot}%{_bindir}/aws_bash_completer %{buildroot}%{bash_completion_dir} +chmod 644 %{buildroot}%{bash_completion_dir}/aws_bash_completer +# Fix path and permissions for zsh completition +%global zsh_completion_dir /usr/share/zsh/site-functions +mkdir -p %{buildroot}%{zsh_completion_dir} +mv %{buildroot}%{_bindir}/aws_zsh_completer.sh %{buildroot}%{zsh_completion_dir} +chmod 644 %{buildroot}%{zsh_completion_dir}/aws_zsh_completer.sh +ls -alh %{buildroot}%{zsh_completion_dir}/aws_zsh_completer.sh +# We don't need the Windows CMD script +rm %{buildroot}%{_bindir}/aws.cmd +# python-botocore bundle +pushd %{colorama_dir} +%{__python3} setup.py install -O1 --skip-build --root %{buildroot} --install-lib /usr/lib/%{name}/bundled +popd + +%files +%{!?_licensedir:%global license %doc} +%doc README.rst colorama_README.rst +%license LICENSE.txt colorama_LICENSE.txt +%{_bindir}/aws +%{_bindir}/aws_completer +%dir %{bash_completion_dir} +%{bash_completion_dir}/aws_bash_completer +%dir %{zsh_completion_dir} +%{zsh_completion_dir}/aws_zsh_completer.sh +%if %{with python3} +%{python3_sitelib}/awscli +%{python3_sitelib}/%{name}-%{version}-py?.?.egg-info +%else +%{python2_sitelib}/awscli +%{python2_sitelib}/%{name}-%{version}-py?.?.egg-info +%endif # with python3 +# python-colorama bundle +%dir /usr/lib/%{name} +/usr/lib/%{name}/bundled + +%changelog +* Tue Nov 20 2018 Oyvind Albrigtsen - 1.14.50-5 +- bundled python-colorama + + Resolves: rhbz#1633654 + +* Sun Jul 08 2018 Charalampos Stratakis - 1.14.50-3 +- Change to Python 3 + +* Sat Mar 03 2018 Kevin Fenzi - 1.14.50-2 +- Update for new python-botocore. + +* Sat Mar 03 2018 Kevin Fenzi - 1.14.50-1 +- Update to 1.14.50. Fixes bug #1550746 + +* Thu Mar 01 2018 Kevin Fenzi - 1.14.49-1 +- Update to 1.14.49. Fixes bug #1549549 + +* Sat Feb 24 2018 Kevin Fenzi - 1.14.46-1 +- Update to 1.14.46. Fixes bug #1546901 + +* Sat Feb 17 2018 Kevin Fenzi - 1.14.41-1 +- Update to 1.14.41. Fixes bug #1546437 + +* Fri Feb 16 2018 Kevin Fenzi - 1.14.40-1 +- Update to 1.14.40. Fixes bug #1544045 + +* Thu Feb 08 2018 Kevin Fenzi - 1.14.34-1 +- Update to 1.14.34. Fixes bug #1543659 + +* Wed Feb 07 2018 Kevin Fenzi - 1.14.33-1 +- Update to 1.14.33. Fixes bug #1542468 + +* Wed Feb 07 2018 Fedora Release Engineering - 1.14.32-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jan 31 2018 Kevin Fenzi - 1.14.32-2 +- Fix python-botocore version requirement. + +* Wed Jan 31 2018 Kevin Fenzi - 1.14.32-1 +- Update to 1.14.32. Fixes bug #1481464 + +* Sun Aug 13 2017 Fabio Alessandro Locati - 1.11.133-1 +- Update to 1.11.133 + +* Wed Jul 26 2017 Fedora Release Engineering - 1.11.109-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed Jun 21 2017 Fabio Alessandro Locati - 1.11.109-2 +- Forgot to update + +* Wed Jun 21 2017 Fabio Alessandro Locati - 1.11.109-1 +- Update to 1.11.109 + +* Tue May 23 2017 Fabio Alessandro Locati - 1.11.90-1 +- Update to 1.11.90 + +* Wed Mar 15 2017 Fabio Alessandro Locati - 1.11.63-1 +- Update to 1.11.63 + +* Sat Feb 25 2017 Fabio Alessandro Locati - 1.11.55-1 +- Update to 1.11.55 + +* Fri Feb 10 2017 Fedora Release Engineering - 1.11.40-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Jan 20 2017 Fabio Alessandro Locati - 1.11.40-1 +- Update to 1.11.40 + +* Wed Dec 28 2016 Fabio Alessandro Locati - 1.11.34-2 +- Update to 1.11.34 + +* Mon Dec 19 2016 Miro HronĨok - 1.11.28-3 +- Rebuild for Python 3.6 + +* Tue Dec 13 2016 Fabio Alessandro Locati - 1.11.28-2 +- Add PyYAML dependency + +* Sun Dec 11 2016 Fabio Alessandro Locati - 1.11.28-1 +- Update to 1.11.28 + +* Sat Dec 03 2016 Fabio Alessandro Locati - 1.11.24-1 +- Update to 1.11.24 + +* Thu Nov 24 2016 Fabio Alessandro Locati - 1.11.21-1 +- Update to 1.11.21 + +* Mon Oct 10 2016 Fabio Alessandro Locati - 1.11.12-1 +- Update to 1.11.12 + +* Sun Oct 02 2016 Fabio Alessandro Locati - 1.11.0-1 +- Update to 1.11.0 + +* Wed Sep 28 2016 Fabio Alessandro Locati - 1.10.67-1 +- Update to 1.10.67 + +* Wed Sep 07 2016 Fabio Alessandro Locati - 1.10.62-1 +- Update to 1.10.62 + +* Wed Aug 24 2016 Fabio Alessandro Locati - 1.10.59-1 +- Update to current upstream version + +* Fri Aug 05 2016 Fabio Alessandro Locati - 1.10.53-1 +- Update to current upstream version + +* Tue Jul 19 2016 Fedora Release Engineering - 1.10.45-2 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Wed Jul 06 2016 Fabio Alessandro Locati - 1.10.45-1 +- Update to current upstream version + +* Wed Jun 08 2016 Fabio Alessandro Locati - 1.10.36-1 +- Update to current upstream version + +* Sat May 28 2016 Fabio Alessandro Locati - 1.10.34-1 +- Update to current upstream version + +* Wed Feb 24 2016 Fabio Alessandro Locati - 1.10.7-1 +- Update to current upstream version + +* Tue Feb 23 2016 Fabio Alessandro Locati - 1.10.6-2 +- Fix broken dependency + +* Fri Feb 19 2016 Fabio Alessandro Locati - 1.10.6-1 +- Update to current upstream version + +* Wed Feb 17 2016 Fabio Alessandro Locati - 1.10.5-1 +- Update to current upstream version + +* Fri Feb 12 2016 Fabio Alessandro Locati - 1.10.4-1 +- Update to current upstream version + +* Wed Feb 10 2016 Fabio Alessandro Locati - 1.10.3-1 +- Update to current upstream version + +* Tue Feb 09 2016 Fabio Alessandro Locati - 1.10.2-1 +- Update to current upstream version + +* Tue Feb 02 2016 Fabio Alessandro Locati - 1.10.1-1 +- Update to current upstream version + +* Fri Jan 22 2016 Fabio Alessandro Locati - 1.10.0-1 +- Update to current upstream version + +* Wed Jan 20 2016 Fabio Alessandro Locati - 1.9.21-1 +- Update to current upstream version +- Don't fix documentation permissions any more (pull request merged) + +* Fri Jan 15 2016 Fabio Alessandro Locati - 1.920-1 +- Update to current upstream version + +* Fri Jan 15 2016 Fabio Alessandro Locati - 1.9.19-1 +- Update to current upstream version +- Don't substitue the text of bin/aws_bash_completer anymore (pull request merged) +- Don't remove the shabang from awscli/paramfile.py anymore (pull request merged) + +* Wed Jan 13 2016 Fabio Alessandro Locati - 1.9.18-1 +- Update to current upstream version +- Fix completion for bash +- Remove bcdoc dependency that is not used anymore + +* Sun Jan 10 2016 Fabio Alessandro Locati - 1.9.17-1 +- Update to current upstream version +- Lock the botocore dependency version + +* Sat Jan 09 2016 Fabio Alessandro Locati - 1.9.16-1 +- Update to current upstream version +- Add dir /usr/share/zsh +- Add dir /usr/share/zsh/site-functions +- Add MIT license (topictags.py is MIT licensed) +- Move dependency from python-devel to python2-devel +- Add Recommends lines for zsh and bsah-completion for Fedora +- Remove BuildReuires: bash-completion +- Remove the macros py2_build and py2_install to prefer the extended form +- Force non-executable bit for documentation +- Remove shabang from awscli/paramfile.py +- Fix bash completion +- Fix zsh completion +- Remove aws.cmd + +* Tue Dec 29 2015 Fabio Alessandro Locati - 1.9.15-1 +- Initial package.