Skip to content

Correctly distinguish ssh banner and protocol string#597

Merged
michalvasko merged 3 commits intodevelfrom
ssh-banner-fix
Apr 21, 2026
Merged

Correctly distinguish ssh banner and protocol string#597
michalvasko merged 3 commits intodevelfrom
ssh-banner-fix

Conversation

@Roytak
Copy link
Copy Markdown
Collaborator

@Roytak Roytak commented Apr 17, 2026

Rename previous banner to protocol string and add an API setter for it.

Add actual SSH banner and send/receive it.

NBC: renamed nc_session_ssh_get_banner API to
nc_session_ssh_get_protocol_string, to better reflect what it's actually getting

Fixes #592

Comment thread src/session.c
Comment thread modules/libnetconf2-netconf-server@2025-11-11.yang Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR clarifies the distinction between the SSH protocol identification string (RFC 4253 §4.2) and the SSH pre-auth “issue banner” (RFC 4252 §5.4) in libnetconf2, adding support for configuring/sending the actual SSH banner while renaming the previously misnamed “banner” API to “protocol string”.

Changes:

  • Rename nc_session_ssh_get_banner() to nc_session_ssh_get_protocol_string() and update error messaging accordingly.
  • Add server API nc_server_ssh_set_protocol_string() and use it to set the SSH identification string via libssh.
  • Implement sending/receiving the real SSH issue banner (libssh >= 0.10) and add/adjust tests and YANG model documentation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_ssh.c Updates tests for protocol string getter/setter and adds banner test + config setup.
src/session_server_ssh.c Adds protocol string forging/setter; configures identification string; sends SSH issue banner during auth.
src/session_server.h Declares new public server API for setting the SSH protocol identification string.
src/session_server.c Frees the new server_opts.ssh_protocol_string during server teardown.
src/session_p.h Clarifies banner semantics and adds ssh_protocol_string to server options.
src/session_client_ssh.c Retrieves and logs received SSH issue banner (libssh >= 0.10).
src/session.h Renames public session getter API and updates documentation.
src/session.c Implements renamed getter and updates error text.
modules/libnetconf2-netconf-server@2025-11-11.yang Updates banner leaf semantics to real SSH issue banner and adjusts references/constraints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_ssh.c Outdated
Comment thread src/session_server_ssh.c
Comment thread src/session_server_ssh.c
Comment thread src/session_client_ssh.c Outdated
@Roytak Roytak force-pushed the ssh-banner-fix branch 2 times, most recently from ac0f6db to db40132 Compare April 21, 2026 08:34
Roytak added 3 commits April 21, 2026 10:39
Rename previous banner to protocol string and add an API setter for it.

Add actual SSH banner and send/receive it.

Deprecated nc_session_ssh_get_banner API by introducing
nc_session_ssh_get_protocol_string, to better reflect what it's actually
getting

Fixes #592
@Roytak Roytak marked this pull request as ready for review April 21, 2026 08:40
@michalvasko michalvasko merged commit 5b462c5 into devel Apr 21, 2026
11 checks passed
@michalvasko michalvasko deleted the ssh-banner-fix branch April 21, 2026 10:09
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