Skip to content

Conversation

@arrownj
Copy link
Contributor

@arrownj arrownj commented Apr 14, 2020

Description
This PR is try to provide an workaround solution for vmssh on adal.

As vmssh feature can only be implemented based on a msal access token. After investigation, we find it's possible to get msal access token with adal refresh token. Thus we can unblock vmssh before we adapt to msal completely.

These codes may be deprecated after the msal adoption finished.

Testing Guide
It should be tested through ssh extension which is in developing.

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems account not used, how about remove this wrapper?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a method which defined in the parent class. We'd better not to change the method signature in subclasses.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this be different under different cloud env?

Copy link
Contributor Author

@arrownj arrownj Apr 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there is only one link. This was described in this document. The document says it may change to sshservice.azure.net in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature currently seems only supported in public cloud https://docs.microsoft.com/en-us/azure/active-directory/devices/howto-vm-sign-in-azure-ad-windows#supported-azure-regions-and-windows-distributions, but we should add this endpoint in the cloud.py and throw error for non-public cloud


In reply to: 412720221 [](ancestors = 412720221)

Copy link
Member

@qianwens qianwens Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should let the client pass scopes and data to get token to make this method more generic, this method contain too much implementation detail for SSHcert


In reply to: 413537394 [](ancestors = 413537394,412720221)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should let the client pass scopes and data to get token to make this method more generic, this method contain too much implementation detail for SSHcert

In reply to: 413537394 [](ancestors = 413537394,412720221)

Agreed. I will change it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be using the built-in hash because the value changes between runs. Here's the code that I've modified it to locally to make it generate the same hash each run to use the same SSH cert out of the token cache.

        key_hash = hashlib.sha256()
        key_hash.update(modulus.encode('utf-8'))
        key_hash.update(exponent.encode('utf-8'))
        key_id = key_hash.hexdigest()

        jwk = {
            "kty": "RSA",
            "n": modulus,
            "e": exponent,
            "kid": key_id
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rlrossiter . Updated.

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 15, 2020

vm ssh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add test for this api

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 23, 2020

vm ssh

@Azure Azure deleted a comment from yungezz Apr 23, 2020
@Azure Azure deleted a comment from arrownj Apr 23, 2020
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ssh_certificate [](start = 13, length = 15)

please just implement a method like get_msal_for_resource and put the SSH related logic in vm module

Copy link
Member

@qianwens qianwens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

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

Successfully merging this pull request may close these issues.

5 participants