Skip to content

Fixed ssh_password_login_disallowed test for Juniper#5253

Merged
ram-mac merged 2 commits intoopenconfig:mainfrom
ram-mac:ssh_pwd_disallow_jun
Mar 24, 2026
Merged

Fixed ssh_password_login_disallowed test for Juniper#5253
ram-mac merged 2 commits intoopenconfig:mainfrom
ram-mac:ssh_pwd_disallow_jun

Conversation

@ram-mac
Copy link
Copy Markdown
Contributor

@ram-mac ram-mac commented Mar 24, 2026

Juniper device's SSH daemon was probably not responding when the test applies the CA configurations hence failing the test. Following fixes were made to the test to pass this test.

-In RotateTrustedUserCA and RotateAuthorizedKey, the test extracts the public key from the generated .pub files and sends only the Base64 section (AAAA...), stripping the prefix (ssh-ed25519 or ssh-rsa). So with this change we now pass the Full OpenSSH public key string (e.g., ssh-rsa AAAA...) to the device instead of just the Base64 portion.

-Increased maxSSHRetryTime to 120 seconds, and updated the context timeouts in ssh_password_login_disallowed_test.go from 60 to 120 seconds. This is just to make sure that there is enough time given to Juniper in case there was some issue with the SSH daemon.

@ram-mac ram-mac requested review from a team as code owners March 24, 2026 02:26
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a test failure observed on Juniper devices related to SSH credential handling. The changes involve adjusting the format of public keys sent to Juniper devices to include the full OpenSSH key string, as well as increasing SSH connection timeouts to accommodate potential delays in the device's SSH daemon responsiveness. These modifications aim to stabilize the ssh_password_login_disallowed test for Juniper.

Highlights

  • SSH Key Format for Juniper: Modified the test to send the full OpenSSH public key string (e.g., ssh-rsa AAAA...) instead of just the Base64 portion for Juniper devices, addressing an issue where the device might not respond correctly.
  • Increased SSH Timeouts: Extended maxSSHRetryTime and context timeouts in the ssh_password_login_disallowed_test.go from 30 to 120 seconds to provide more time for Juniper's SSH daemon to respond.
  • Algorithm-Specific Key Generation: Introduced a new function CreateSSHKeyPairAlgo to allow specifying the SSH key algorithm (e.g., rsa for Juniper, ed25519 by default), improving compatibility.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@OpenConfigBot
Copy link
Copy Markdown

OpenConfigBot commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a failing test on Juniper devices by switching to RSA keys, providing the full OpenSSH public key string, and increasing timeouts. The changes are logical and directly address the issue described. My review includes a few critical suggestions to prevent potential panics from malformed key files and to handle unknown key types more robustly, justifying the use of t.Fatalf for these critical test failures. I've also pointed out some code duplication that could be refactored for better maintainability and a minor issue with an oversimplified key type mapping, aligning with the rule for keeping constants general for future reusability.

Copy link
Copy Markdown
Member

@mihirpitale-googler mihirpitale-googler left a comment

Choose a reason for hiding this comment

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

lgtm

@ram-mac ram-mac merged commit b85bc30 into openconfig:main Mar 24, 2026
15 of 16 checks passed
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.

3 participants