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

Add SSH banner config #1665

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ set(LIBYANG_DEP_SOVERSION 3.0.0)
set(LIBYANG_DEP_SOVERSION_MAJOR 3)

# libnetconf2 required version
set(LIBNETCONF2_DEP_VERSION 3.5.2)
set(LIBNETCONF2_DEP_SOVERSION 4.4.2)
set(LIBNETCONF2_DEP_VERSION 3.5.4)
set(LIBNETCONF2_DEP_SOVERSION 4.4.4)
set(LIBNETCONF2_DEP_SOVERSION_MAJOR 4)

# sysrepo required version
Expand Down Expand Up @@ -407,6 +407,7 @@ if(SYSREPO_SETUP)
message(STATUS \"Merging default server listen configuration if there is none (merge_config.sh)...\")
set(ENV{SYSREPOCTL_EXECUTABLE} \"${SYSREPOCTL_EXECUTABLE}\")
set(ENV{SYSREPOCFG_EXECUTABLE} \"${SYSREPOCFG_EXECUTABLE}\")
set(ENV{NP2_VERSION} \"${NP2SRV_VERSION}\")
execute_process(COMMAND \"\$ENV{DESTDIR}${DATA_DIR}/scripts/merge_config.sh\"
RESULT_VARIABLE CMD_RES
OUTPUT_VARIABLE CMD_OUT
Expand Down
8 changes: 8 additions & 0 deletions scripts/merge_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ if [ -n "$AUTH_CONFIG" ]; then
</users>"
fi

SSH_BANNER=""
# check if the NP2_VERSION environment variable is set
if [ -n "$NP2_VERSION" ]; then
# get the banner from the NP2_VERSION environment variable
SSH_BANNER="<banner xmlns=\"urn:cesnet:libnetconf2-netconf-server\">netopeer2-netconf-server-${NP2_VERSION}</banner>"
fi

# import default config
CONFIG="<netconf-server xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-server\">
<listen>
Expand All @@ -74,6 +81,7 @@ CONFIG="<netconf-server xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-server\
</tcp-server-parameters>
<ssh-server-parameters>
<server-identity>
${SSH_BANNER}
<host-key>
<name>default-key</name>
<public-key>
Expand Down