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

passlib (required for Ansible) is unmaintained #81949

Closed
1 task done
thbar opened this issue Oct 11, 2023 · 10 comments
Closed
1 task done

passlib (required for Ansible) is unmaintained #81949

thbar opened this issue Oct 11, 2023 · 10 comments
Assignees
Labels
affects_2.15 bug This issue/PR relates to a bug.

Comments

@thbar
Copy link

thbar commented Oct 11, 2023

Summary

Filing this as a bug report but I do not know if this is the most appropriate way to publish that concern.

passlib is used in place of crypt.crypt when using Ansible on Mac (EDIT: and soon for all users, not only Mac ones, see comment below):

https://github.com/ansible/ansible/blob/46623b0a965b2f87c426b7998e8a167f8b012668/lib/ansible/utils/encrypt.py#L94C44-L94C44

But passlib has not seen any releases nor commits in 3 years, as I've reported here:

https://foss.heptapod.net/python-libs/passlib/-/issues/187#note_331857

I am concerned that Ansible users on Mac (including me) would end up with some troubles:

  • security issues if the apparently non-maintained, widely used library gets hacked (& republished on pypi), in particular if 2FA is not enabled for its maintainers over there
  • technical debt (e.g. this library becomes incompatible with Python, or dependencies, or something similar) which could cause future Ansible releases to work slightly less well for Mac users

So I'm opening this issue to discuss that concern.

Let me know if there is a better place if needed, happy to move it where relevant.

Thanks!

Issue Type

Bug Report

Component Name

lib/ansible/utils/encrypt.py

Ansible Version

poetry run ansible --version
ansible [core 2.15.4]
  config file = $$REDACTED$$/ansible.cfg
  configured module search path = ['/Users/thbar/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/thbar/Library/Caches/pypoetry/virtualenvs/ansible-$$REDACTED$$-lWrDoP-v-py3.10/lib/python3.10/site-packages/ansible
  ansible collection location = $$REDACTED$$/collections
  executable location = /Users/thbar/Library/Caches/pypoetry/virtualenvs/ansible-$$REDACTED$$-lWrDoP-v-py3.10/bin/ansible
  python version = 3.10.3 (main, Apr 19 2022, 22:04:15) [Clang 12.0.5 (clang-1205.0.22.11)] (/Users/thbar/Library/Caches/pypoetry/virtualenvs/ansible-$$REDACTED$$-lWrDoP-v-py3.10/bin/python)
  jinja version = 3.1.2
  libyaml = True

Configuration

poetry run ansible-config dump --only-changed -t all
COLLECTIONS_PATHS(/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/ansible.cfg) = ['/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/collections']
CONFIG_FILE() = /Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/ansible.cfg
DEFAULT_HOST_LIST(/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/ansible.cfg) = ['/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/inventory']
DEFAULT_LOAD_CALLBACK_PLUGINS(/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/ansible.cfg) = True
DEFAULT_ROLES_PATH(/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/ansible.cfg) = ['/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/roles', '/Users/thbar/git/$$REDACTED$$/an>
DEFAULT_STDOUT_CALLBACK(/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/ansible.cfg) = yaml
DEFAULT_VAULT_IDENTITY_LIST(/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/ansible.cfg) = $$REDACTED

CONNECTION:
==========

ssh:
___
pipelining(/Users/thbar/git/$$REDACTED$$/ansible-$$REDACTED$$/ansible.cfg) = True

OS / Environment

Mac OS X Ventura (13).

Steps to Reproduce

  1. Install Ansible on a Mac
  2. Use encryption related operations
  3. Ansible raises an error to inform the user passlib must be installed

Expected Results

I would expect encryption in Ansible on Mac to use a well-maintained library.

(maybe a community fork is needed given the widespread use)

Actual Results

N/A

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. affects_2.15 labels Oct 11, 2023
@ansibot
Copy link
Contributor

ansibot commented Oct 11, 2023

Files identified in the description:

None

If these files are incorrect, please update the component name section of the description or use the component bot command.

@thbar
Copy link
Author

thbar commented Oct 11, 2023

@ansibot component =lib/ansible/utils/encrypt.py

@ansibot
Copy link
Contributor

ansibot commented Oct 12, 2023

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.

@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 17, 2023
@bcoca bcoca changed the title passlib (required on Mac for Ansible) is unmaintained passlib (required for Ansible) is unmaintained Oct 17, 2023
@sivel
Copy link
Member

sivel commented Oct 17, 2023

We are aware that passlib isn't exactly actively maintained. However, we are also removing support for the python crypt module as it is deprecated, which will require all uses to use passlib. The official python documentation for the crypt module indicates that passlib is the thing that should be used in it's place. In short, our options are limited, and as such, there isn't anything we plan to do here right now.

If you have further questions please stop by IRC or the mailing list:

@sivel sivel closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2023
@thbar
Copy link
Author

thbar commented Oct 17, 2023

@sivel thanks for the feedback!

However, we are also removing support for the python crypt module as it is deprecated, which will require all uses to use passlib.

I am surprised that the issue gets closed as a result - the problem I'm describing is going to affect all Ansible users, instead of just the Mac OS ones.

It makes passlib an even more interesting target for account take-over.

In short, our options are limited, and as such, there isn't anything we plan to do here right now.

I do understand your position (as an OSS maintainer myself :-)), but I believe we should collectively try to ensure the dependencies of the project are not causing harm.

A couple of possibilities are:

  • Reaching out to the maintainers of passlib and try to ensure they do have 2FA and/or minimal maintenance team
  • Creating a secured fork

I hope you will reconsider opening this issue for visibility!

I will try to help on the passlib side, but so far I haven't got reaction from the maintainers.

@thbar
Copy link
Author

thbar commented Oct 17, 2023

If you have further questions please stop by IRC or the mailing list:
IRC: #ansible on irc.libera.chat
mailing list: https://groups.google.com/forum/#!forum/ansible-project

Forgot to add: I will voice my concerns over there, thanks!

@thbar
Copy link
Author

thbar commented Oct 17, 2023

@adriantombu
Copy link

Just passing by to give my voice on this one too! I started reading "Ansible: up and running" yesterday and this excerpt made me think of this issue so much that I had to comment.

« There is no Ansible agent listening on a port. Therefore, when you use Ansible, there is no extra attack surface. (There is still an attack surface with software supply chain elements like Python libraries and other imported). »

Coming from the JavaScript ecosystem, I have seen countless times supply chain attacks leading to disasters. I hope we can avoid a future headache with Ansible by mitigating this potential attack somehow ☺️

@bcoca
Copy link
Member

bcoca commented Oct 18, 2023

@adriantombu we understand the issue and do not take it lightly, but we do not have the resources to take ownership of yet another dependency nor do we have good alternatives to use as substitutes.

As for hijacking the library, aside from pypi already have taken steps to secure this type of project, most users use distribution packages which add another layer of vetting and security, this one reason why distributions exist and most contexts that require security rely on those packages and not the 'language' package managers. Yes, this is also a reason why developers and system admins/operators have clashed since the dawn of computing ...

Another thing to consider is that this is also limited to the password lookup, password_hash filter and the encrypt option of vars_prompt, none of these are crucial to Ansible's security nor secure communications with the targets.

We closed this ticket because there is no foreseeable code solution. It does not mean we are not looking for one, it is just that none of the work towards that is something we would log here as it is going to be mostly 'we tried/looked into X, nothing happened' x100 times.

@thbar
Copy link
Author

thbar commented Oct 18, 2023

@bcoca thanks for the detailed input, appreciated!

@ansible ansible locked and limited conversation to collaborators Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.15 bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

5 participants