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

TypeError: deprecated() got an unexpected keyword argument 'name' #149

Closed
Skriep opened this issue Jun 17, 2023 · 8 comments
Closed

TypeError: deprecated() got an unexpected keyword argument 'name' #149

Skriep opened this issue Jun 17, 2023 · 8 comments

Comments

@Skriep
Copy link
Contributor

Skriep commented Jun 17, 2023

When installing with pip3 install certipy-ad, the latest pyOpenSSL is installed (the only limitation is pyopenssl>=22.0.0). So, a problem arises with pyOpenSSL-23.2.0 (probably with earlier versions too - needs to be tested):
Command:

certipy auth -pfx cert.pfx -dc-ip dc.example.com -username Administrator -domain example.com

Output:

Certipy v4.4.0 - by Oliver Lyak (ly4k)

[-] Got error: deprecated() got an unexpected keyword argument 'name'
[-] Use -debug to print a stacktrace

Temporary solution: pip3 install pyOpenSSL==22.0.0

Possible long-term solutions:

  1. update requirements and limit max version of pyOpenSSL (not recommended)
  2. update the code to not use any deprecated things and use the latest version of pyOpenSSL (a better solution IMHO)
@ly4k
Copy link
Owner

ly4k commented Jun 18, 2023

Cannot reproduce. Please provide more details. Use -debug.

@Skriep
Copy link
Contributor Author

Skriep commented Jun 18, 2023

I just tried installing a newer version of PyOpenSSL and got an error: AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'. Looks like my pip is broken now: I can't even uninstall any library... Probably a compatibility issue between PyOpenSSL and cryptography, but more research is needed to say for sure.

@Skriep
Copy link
Contributor Author

Skriep commented Jun 18, 2023

Well, updating pip fixed the issue with it. So, here is the output of certipy with -debug (for some reason the error message has changed):

└─$ certipy auth -pfx admin.pfx -dc-ip dc.example.com -username Administrator -domain example.com -debug
Certipy v4.4.0 - by Oliver Lyak (ly4k)

[-] Got error: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/certipy/entry.py", line 60, in main
    actions[options.action](options)
  File "/usr/local/lib/python3.9/dist-packages/certipy/commands/parsers/auth.py", line 10, in entry
    from certipy.commands import auth
  File "/usr/local/lib/python3.9/dist-packages/certipy/commands/auth.py", line 58, in <module>
    from certipy.lib.target import Target
  File "/usr/local/lib/python3.9/dist-packages/certipy/lib/target.py", line 6, in <module>
    from dns.resolver import Resolver
  File "/usr/lib/python3/dist-packages/dns/resolver.py", line 38, in <module>
    import dns.query
  File "/usr/lib/python3/dist-packages/dns/query.py", line 40, in <module>
    import requests
  File "/home/skriep/.local/lib/python3.9/site-packages/requests/__init__.py", line 52, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/home/skriep/.local/lib/python3.9/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python3.9/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python3.9/dist-packages/OpenSSL/crypto.py", line 3268, in <module>
    _lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

@Skriep
Copy link
Contributor Author

Skriep commented Jun 18, 2023

Also, here is the output of pip freeze (filtered):

asn1crypto==1.4.0
certipy-ad==4.4.0
cryptography==41.0.1
dnspython==2.0.0
dsinternals==1.2.4
impacket==0.9.22
ldap3==2.8.1
pyasn1==0.4.8
pyasn1-modules==0.2.1
pycryptodomex==3.9.7
pyOpenSSL==22.0.0
requests==2.25.1
requests-file==1.5.1
requests-ntlm==1.1.0
requests-toolbelt==0.9.1

Python version is 3.9.2, pip version is 23.0.1.

@Skriep
Copy link
Contributor Author

Skriep commented Jun 18, 2023

Well, updating pip fixed the issue with it. So, here is the output of certipy with -debug (for some reason the error message has changed):

└─$ certipy auth -pfx admin.pfx -dc-ip dc.example.com -username Administrator -domain example.com -debug
Certipy v4.4.0 - by Oliver Lyak (ly4k)

[-] Got error: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/certipy/entry.py", line 60, in main
    actions[options.action](options)
  File "/usr/local/lib/python3.9/dist-packages/certipy/commands/parsers/auth.py", line 10, in entry
    from certipy.commands import auth
  File "/usr/local/lib/python3.9/dist-packages/certipy/commands/auth.py", line 58, in <module>
    from certipy.lib.target import Target
  File "/usr/local/lib/python3.9/dist-packages/certipy/lib/target.py", line 6, in <module>
    from dns.resolver import Resolver
  File "/usr/lib/python3/dist-packages/dns/resolver.py", line 38, in <module>
    import dns.query
  File "/usr/lib/python3/dist-packages/dns/query.py", line 40, in <module>
    import requests
  File "/home/skriep/.local/lib/python3.9/site-packages/requests/__init__.py", line 52, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/home/skriep/.local/lib/python3.9/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python3.9/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python3.9/dist-packages/OpenSSL/crypto.py", line 3268, in <module>
    _lib.OpenSSL_add_all_algorithms()
AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'

The reason the error message has changed is that pyOpenSSL is still of version 22.0.0, but some other library has been updated (can't tell which one, probably cryptography).

@Skriep
Copy link
Contributor Author

Skriep commented Jun 18, 2023

If I update pyOpenSSL to version 23.2.0, the error will be gone. So it does indeed look like a problem with pyOpenSSL and cryptography: somehow earlier pip freeze showed cryptography==3.3.2. I have no idea how it happened, since there's a requirement of cryptography>=37.0.
Anyways, with cryptography==41.0.1 everything seems to work fine.

@Skriep
Copy link
Contributor Author

Skriep commented Jun 18, 2023

While the issue seems to be resolved, I would still suggest you to change the requirements and set pyOpenSSL>=22.1.0, because of this.

@Skriep
Copy link
Contributor Author

Skriep commented Jun 18, 2023

Actually, cryptography>=39.0 and pyopenssl>=23.0.0 seems to be a more reliable solution.

@ly4k ly4k closed this as completed in 391e9d2 Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants