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

Added ssh configurations to YANG model #13338

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
43525e5
Implemented ssh configurations
ycoheNvidia Jan 9, 2023
7b0ec56
modified sonic host services pointer
ycoheNvidia Jan 9, 2023
fdc96bd
Merge branch 'sonic-net:master' into sonic-buildimage-ycoheNvidia-ssh…
ycoheNvidia Jan 9, 2023
cb4bed9
removed debug link
ycoheNvidia Jan 12, 2023
bf95354
added ssh-server yang model tests
ycoheNvidia Feb 20, 2023
3c3738a
minor yang model fix
ycoheNvidia Feb 20, 2023
890b367
Merge branch 'master' into sonic-buildimage-ssh_config
ycoheNvidia Mar 6, 2023
8a8ce2a
Merge branch 'sonic-net:master' into sonic-buildimage-ssh_config
ycoheNvidia Mar 6, 2023
2856e65
added ssh yang to setup
ycoheNvidia Mar 6, 2023
a4422b2
Update sonic-ssh-server.yang
ycoheNvidia Mar 9, 2023
50691a3
Added ssh-server table to Configurations.md
ycoheNvidia Mar 30, 2023
03be592
Merge branch 'master' into sonic-buildimage-ssh_config
ycoheNvidia Apr 30, 2023
1741ccc
Merge branch 'master' into sonic-buildimage-ssh_config
ycoheNvidia May 17, 2023
daf7c4a
Update Configuration.md
ycoheNvidia May 21, 2023
1c0a946
Merge branch 'master' into sonic-buildimage-ssh_config
ycoheNvidia May 21, 2023
7afff88
Fixing Configuration.md line ending
ycoheNvidia May 21, 2023
9d368c9
Merge branch 'master' into sonic-buildimage-ssh_config
ycoheNvidia May 30, 2023
9318bf4
Merge branch 'sonic-net:master' into sonic-buildimage-ssh_config
ycoheNvidia Jun 26, 2023
51c1370
Fixed minor issues raised in review
ycoheNvidia Jun 26, 2023
2a0c0c4
fixed tab issues
ycoheNvidia Jul 9, 2023
fe60125
Merge branch 'sonic-net:master' into sonic-buildimage-ssh_config
ycoheNvidia Jul 10, 2023
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
7 changes: 7 additions & 0 deletions files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@
"special_class": "true"
}
},
"SSH_SERVER": {
ycoheNvidia marked this conversation as resolved.
Show resolved Hide resolved
"POLICIES":{
"authentication_retries": "6",
"login_timeout": "120",
"ports": "22"
}
},
"SYSTEM_DEFAULTS" : {
{%- if include_mux == "y" %}
"mux_tunnel_egress_acl": {
Expand Down
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def run(self):
'./yang-models/sonic-nat.yang',
'./yang-models/sonic-nvgre-tunnel.yang',
'./yang-models/sonic-passwh.yang',
'./yang-models/sonic-ssh-server.yang',
'./yang-models/sonic-pbh.yang',
'./yang-models/sonic-port.yang',
'./yang-models/sonic-policer.yang',
Expand Down
8 changes: 8 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -2131,6 +2131,14 @@
}
},

"SSH_SERVER": {
"POLICIES":{
"authentication_retries": "6",
"login_timeout": "120",
"ports": "22"
}
},

"MACSEC_PROFILE": {
"test": {
"priority": "64",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"SSH_SERVER_VALID": {
"desc": "Configure default SSH_SERVER."
},
"SSH_SERVER_VALID_MODIFIED": {
"desc": "Configure modified SSH_SERVER."
},
"SSH_SERVER_INVALID_AUTH_RETRIES": {
"desc": "Configure invalid number of authentication retries in SSH_SERVER.",
"eStrKey" : "Pattern",
"eStr": ["1..100"]
},
"SSH_SERVER_INVALID_LOGIN_TIMEOUT": {
"desc": "Configure invalid login timeout value in SSH_SERVER.",
"eStrKey" : "Pattern",
"eStr": ["1..600"]
},
"SSH_SERVER_INVALID_PORTS_1": {
"desc": "Configure invalid port value in SSH_SERVER.",
"eStr": "Invalid port numbers value"
},
"SSH_SERVER_INVALID_PORTS_2": {
"desc": "Configure invalid port value in SSH_SERVER.",
"eStr": "Invalid port numbers value"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"SSH_SERVER_VALID": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"authentication_retries": "6",
"login_timeout": "120",
"ports": "22"
}
}
}
},
"SSH_SERVER_VALID_MODIFIED": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"authentication_retries": "16",
"login_timeout": "140",
"ports": "22,222"
}
}
}
},
"SSH_SERVER_INVALID_AUTH_RETRIES": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"authentication_retries": "200"
}
}
}
},
"SSH_SERVER_INVALID_LOGIN_TIMEOUT": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"login_timeout": "606"
}
}
}
},
"SSH_SERVER_INVALID_PORTS_1": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"ports": "port22"
}
}
}
},
"SSH_SERVER_INVALID_PORTS_2": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"ports": "22.222"
}
}
}
}
}
45 changes: 45 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-ssh-server.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

//filename: sonic-ssh_server.yang
ycoheNvidia marked this conversation as resolved.
Show resolved Hide resolved
module sonic-ssh-server {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-ssh_global";
ycoheNvidia marked this conversation as resolved.
Show resolved Hide resolved
prefix sshg;

description "SSH SERVER CONFIG YANG Module for SONiC OS";

revision 2022-08-29 {
ycoheNvidia marked this conversation as resolved.
Show resolved Hide resolved
description
"First Revision";
}

container sonic-ssh-server {
container SSH_SERVER {
description "SSH SERVER CONFIG part of config_db.json";
container POLICIES {
leaf authentication_retries {
description "number of login attepmts";
default 6;
type uint8 {
range 1..100;
}
}
leaf login_timeout {
description "login timeout (secs unit)";
default 120;
type uint32 {
range 1..600;
}
}
leaf ports {
description "ssh port numbers";
ycoheNvidia marked this conversation as resolved.
Show resolved Hide resolved
type string {
ycoheNvidia marked this conversation as resolved.
Show resolved Hide resolved
pattern '[0-9]+(,[0-9]+)*' {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any limit to the number of ports that can be defined?

Copy link
Contributor Author

@ycoheNvidia ycoheNvidia Mar 8, 2023

Choose a reason for hiding this comment

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

there is no limit that I am aware of (at least not in openSSH)

error-message "Invalid port numbers value";
error-app-tag ssh-server-ports-invalid-value;
}
}
}
}/*container policies */
} /* container SSH_SERVER */
}/* container sonic-ssh-server */
}/* end of module sonic-ssh-server */