-
Notifications
You must be signed in to change notification settings - Fork 396
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
ssh module refactoring separate auth/shell checks #331
Conversation
525fbfe
to
a0b39c9
Compare
deaabbb
to
d17522e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the PR!
Please describe briefly (in the PR description) what has been done and why, so we know what this PR aims to achieve without diving into past issues etc.
If possible please also provide example output screenshots
except AuthenticationException: | ||
self.logger.fail(f"{username}:{process_secret(password)}") | ||
except SSHException as e: | ||
if "Invalid key" in str(e): | ||
self.logger.fail(f"{username}:{process_secret(password)} Could not decrypt private key, error: {e}") | ||
if "Error reading SSH protocol banner" in str(e): | ||
self.logger.error(f"Internal Paramiko error for {username}:{process_secret(password)}, {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please preserve the current Exception handling, as with this we can catch some weird paramiko issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those exception are already handled in create_conn_obj() However, I could add the logger calls to keep the previous behavior.
Edit: actually, I didn't remembered well, there are 2 connections, a first one to check that the service is present with conn_obj() which as exception handling. A second one with plaintext_login() for which I added handle_connection_failure() to handle all kind of exception
While we are at it we should probably also catch the timeout error in #358. |
@nikaiw any update on this? |
* refactoring separate auth/shell checks * move disable log statement to logger
hello @NeffIsBack sorry this was sitting in my dev folder for a while. |
While i think the current implementation is not ideal, this PR introduces way too many problems with private key authentication, which work in the main branch. I tried fixing them in the last hour, but at this point i will need to refactor the implementation anyways. I will continue working on ssh in #531, but closing this one for now. |
This pull request aims to refactor the code to make it more readable but also to properly separate the code that can be linked to authentication from the code linked to the test concerning the shell obtained