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

Enable token encryption when running on Linux #23495

Open
NileshGhodekar opened this issue Aug 10, 2022 · 4 comments
Open

Enable token encryption when running on Linux #23495

NileshGhodekar opened this issue Aug 10, 2022 · 4 comments
Assignees
Labels
Account az login/account Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Feature Candidate feature-request
Milestone

Comments

@NileshGhodekar
Copy link

Related command

az login

Is your feature request related to a problem? Please describe.

Azure CLI has not yet enable token encryption when running on Linux even when MSAL now has implemented support for this.

Describe the solution you'd like

Azure CLI should store the token cache encrypted instead if plaintext on Linux

Describe alternatives you've considered

The current solution is to depend on file permissions 600 set the by CLI on the token cache file. However, encrypting it as well will improve the security posture.

Additional context

This is essentially the follow up on thread AzureAD/microsoft-authentication-extensions-for-python#106

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Account az login/account labels Aug 10, 2022
@ghost ghost assigned jiasli Aug 10, 2022
@ghost ghost added this to the Backlog milestone Aug 10, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Aug 10, 2022

@jiasli for awareness

@yonzhan yonzhan added the Azure CLI Team The command of the issue is owned by Azure CLI team label Aug 14, 2022
@jiasli
Copy link
Member

jiasli commented Aug 31, 2022

Enabling token encryption on Linux is a truly complex topic. We previously discussed with MSLA owner @rayluo heavily on this topic. The packaging on Linux is very challenging. In short:

  1. Encryption on Linux is done via PyGObject which requires GUI.
  2. As our build pipeline uses docker containers without GUI, installing PyGObject itself is complex in containers without GUI.
  3. Even if we can build the packages successfully, installing the underlying GUI binary dependencies on user’s machine can be very complex and platform dependent - Debian, Ubuntu, Fedora, CentOS Stream, RHEL, etc.
  4. Installing a whole GUI environment will significantly increase the size of Azure CLI installation, which is already pretty big (azure-cli package could lose some weight #7387).

Enabling token encryption on MacOS was attempted in #20636, but didn't finish.

@rayluo
Copy link
Member

rayluo commented Aug 31, 2022

The encryption is provided by MSAL EXtensions.

  1. Encryption on Linux is done via PyGObject which requires GUI.

I am not entirely sure about that one. As mentioned in the Q&A at the bottom of this MSAL EX wiki page, we have been able to get rid of the dependency of GTK, although we currently still install libcairo which is a graphic library. Bottom line, we were able to wrap the MSAL EX into a docker image for our unit testing. Does a docker container count as a non-GUI environment?

Perhaps we can try a proof-of-concept Azure CLI docker image built on top of MSAL EX image.

@jiasli
Copy link
Member

jiasli commented Sep 28, 2022

Linux is a little bit different from Windows.

As explained in https://github.com/AzureAD/microsoft-authentication-extensions-for-python/wiki/Encryption-on-Linux

Encryption on Linux is available by using libsecret to connect to secret service running on your Linux machine.

Secret service is only available when running in a desktop environment. It won't be available when remotely connected to a Linux machine, such as via an SSH connection.

Plain-text fall back would be the only option here. That is probably OK, because if the remote machine you are SSHing into is a backend server, it is by definition a "confidential client" in OAuth2 terminology, it is considered as a secure and safe environment that can store secrets there.

@jiasli jiasli changed the title Enable token encryption when running on Linux, Enable token encryption when running on Linux Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Feature Candidate feature-request
Projects
None yet
Development

No branches or pull requests

4 participants