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

ImportError in botocore makes s3buckets module fail. #477

Closed
frost19k opened this issue Mar 8, 2022 · 1 comment
Closed

ImportError in botocore makes s3buckets module fail. #477

frost19k opened this issue Mar 8, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@frost19k
Copy link
Contributor

frost19k commented Mar 8, 2022

Describe the bug
The Docker Container is falling for a known issue in botocore - which makes the s3buckets() module in reconftw.sh fail to run.

To Reproduce

❯ docker run -it --rm --entrypoint s3scanner six2dez/reconftw:main '-h'
Traceback (most recent call last):
  File "/usr/local/bin/s3scanner", line 5, in <module>
    from S3Scanner.__main__ import main
  File "/usr/local/lib/python3.9/dist-packages/S3Scanner/__main__.py", line 15, in <module>
    from .S3Service import S3Service
  File "/usr/local/lib/python3.9/dist-packages/S3Scanner/S3Service.py", line 5, in <module>
    from boto3 import client  # TODO: Limit import to just boto3.client, probably
  File "/usr/local/lib/python3.9/dist-packages/boto3/__init__.py", line 17, in <module>
    from boto3.session import Session
  File "/usr/local/lib/python3.9/dist-packages/boto3/session.py", line 17, in <module>
    import botocore.session
  File "/usr/local/lib/python3.9/dist-packages/botocore/session.py", line 29, in <module>
    import botocore.credentials
  File "/usr/local/lib/python3.9/dist-packages/botocore/credentials.py", line 35, in <module>
    from botocore.config import Config
  File "/usr/local/lib/python3.9/dist-packages/botocore/config.py", line 16, in <module>
    from botocore.endpoint import DEFAULT_TIMEOUT, MAX_POOL_CONNECTIONS
  File "/usr/local/lib/python3.9/dist-packages/botocore/endpoint.py", line 24, in <module>
    from botocore.awsrequest import create_request_object
  File "/usr/local/lib/python3.9/dist-packages/botocore/awsrequest.py", line 23, in <module>
    import botocore.utils
  File "/usr/local/lib/python3.9/dist-packages/botocore/utils.py", line 33, in <module>
    import botocore.httpsession
  File "/usr/local/lib/python3.9/dist-packages/botocore/httpsession.py", line 10, in <module>
    from urllib3.util.ssl_ import (
ImportError: cannot import name 'PROTOCOL_TLS' from 'urllib3.util.ssl_' (/usr/local/lib/python3.9/dist-packages/urllib3/util/ssl_.py)

Expected behavior

❯ docker run -it --rm --entrypoint s3scanner six2dez/reconftw:main '-h'
usage: s3scanner [-h] [--version] [--threads n] [--endpoint-url ENDPOINT_URL]
                 [--endpoint-address-style {path,vhost}] [--insecure]
                 {scan,dump} ...

s3scanner: Audit unsecured S3 buckets
           by Dan Salmon - github.com/sa7mon, @bltjetpack

optional arguments:
  -h, --help            show this help message and exit
  --version             Display the current version of this tool
  --threads n, -t n     Number of threads to use. Default: 4
  --endpoint-url ENDPOINT_URL, -u ENDPOINT_URL
                        URL of S3-compliant API. Default: https://s3.amazonaws.com
  --endpoint-address-style {path,vhost}, -s {path,vhost}
                        Address style to use for the endpoint. Default: path
  --insecure, -i        Do not verify SSL

mode:
  {scan,dump}           (Must choose one)
    scan                Scan bucket permissions
    dump                Dump the contents of buckets

Desktop (please complete the following information):

  • Architecture: x86_64
  • OS: Manjaro
  • Version: Rolling, (21.2.4)

Additional context
As mentioned in the linked issue, the error is a consequence of the urllib3 module version being less than the minimum required, i.e. 1.25.4

❯ docker run -it --rm --entrypoint python3 six2dez/reconftw:main -c 'import urllib3; print(urllib3.__version__)'
1.24.3

This is probably a consequence of the solution (PR #436) to Issue #434

A simple fix would be to install reconftw/requirements.txt after the Python Repo Setup phase in install.sh

@frost19k frost19k added the bug Something isn't working label Mar 8, 2022
@frost19k
Copy link
Contributor Author

Closing this as it seems to be fixed in the latest release (2.2.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant