Skip to content
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
16 changes: 15 additions & 1 deletion src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -3055,6 +3055,15 @@ In this table, we allow configuring ssh server global settings. This will featur
- ports - Ssh port numbers - string of port numbers seperated by ','
- inactivity_timeout - Inactivity timeout for SSH session, allowed values: 0-35000 (min), default value: 15 (min)
- max_sessions - Max number of concurrent logins, allowed values: 0-100 (where 0 means no limit), default value: 0
- permit_root_login - Whether or not to allow root login. Default value: "prohibit-password"
- "yes"
- "prohibit-password"
- "forced-commands-only"
- "no"
- password_authentication - Whether or not to allow password authentication. Boolean.
- ciphers - Ciphers to allow. See `ssh -Q ciphers`
- kex_algorithms - Key Exchange algorithms to allow. See `ssh -Q kex_algorithms`
- macs - MAC algorithms to allow. See `ssh -Q macs`
```
{
"SSH_SERVER": {
Expand All @@ -3063,7 +3072,12 @@ In this table, we allow configuring ssh server global settings. This will featur
"login_timeout": "120",
"ports": "22",
"inactivity_timeout": "15",
"max_sessions": "0"
"max_sessions": "0",
"permit_root_login": "false",
"password_authentication": "true",
"ciphers": [ "[email protected]", "[email protected]" ],
"kex_algorithms": [ "sntrup761x25519-sha512", "curve25519-sha256", "ecdh-sha2-nistp521" ],
"macs": [ "[email protected]", "hmac-sha2-512" ]
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -2702,7 +2702,12 @@
"login_timeout": "120",
"ports": "22",
"inactivity_timeout": "15",
"max_sessions": "0"
"max_sessions": "0",
"permit_root_login": "no",
"password_authentication": "true",
"ciphers": [ "[email protected]", "[email protected]" ],
"kex_algorithms": [ "sntrup761x25519-sha512", "curve25519-sha256", "ecdh-sha2-nistp521" ],
"macs": [ "[email protected]", "hmac-sha2-512" ]
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
"SSH_SERVER_VALID_MODIFIED": {
"desc": "Configure modified SSH_SERVER."
},
"SSH_SERVER_PERMIT_ROOT_YES": {
"desc": "permit_root_login: yes"
},
"SSH_SERVER_PERMIT_ROOT_NO": {
"desc": "permit_root_login: no"
},
"SSH_SERVER_PERMIT_ROOT_PROHIBIT_PASSWORD": {
"desc": "permit_root_login: prohibit-password"
},
"SSH_SERVER_PERMIT_ROOT_FORCED_COMMANDS_ONLY": {
"desc": "permit_root_login: forced-commands-only"
},
"SSH_SERVER_INVALID_AUTH_RETRIES": {
"desc": "Configure invalid number of authentication retries in SSH_SERVER.",
"eStrKey" : "Range"
Expand All @@ -28,5 +40,25 @@
"SSH_SERVER_INVALID_MAX_SESSIONS": {
"desc": "Configure invalid max_sessions value in SSH_SERVER.",
"eStrKey": "Range"
},
"SSH_SERVER_INVALID_PERMIT_ROOT_LOGIN": {
"desc": "Configure invalid permit_root_login value in SSH_SERVER.",
"eStrKey": "InvalidValue"
},
"SSH_SERVER_INVALID_PASSWORD_AUTHENTICATION": {
"desc": "Configure invalid password_authentication value in SSH_SERVER.",
"eStrKey": "InvalidValue"
},
"SSH_SERVER_INVALID_CIPHERS": {
"desc": "Configure invalid ciphers value in SSH_SERVER.",
"eStrKey": "InvalidValue"
},
"SSH_SERVER_INVALID_KEX_ALGORITHMS": {
"desc": "Configure invalid kex_algorithms value in SSH_SERVER.",
"eStrKey": "InvalidValue"
},
"SSH_SERVER_INVALID_MACS": {
"desc": "Configure invalid macs value in SSH_SERVER.",
"eStrKey": "InvalidValue"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
"POLICIES":{
"authentication_retries": "6",
"login_timeout": "120",
"ports": "22"
"ports": "22",
"inactivity_timeout": "15",
"max_sessions": "0",
"permit_root_login": "no",
"password_authentication": "true",
"ciphers": [ "[email protected]", "[email protected]" ],
"kex_algorithms": [ "sntrup761x25519-sha512", "curve25519-sha256", "ecdh-sha2-nistp521" ],
"macs": [ "[email protected]", "hmac-sha2-512" ]
}
}
}
Expand All @@ -21,6 +28,42 @@
}
}
},
"SSH_SERVER_PERMIT_ROOT_YES": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"permit_root_login": "yes"
}
}
}
},
"SSH_SERVER_PERMIT_ROOT_NO": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"permit_root_login": "no"
}
}
}
},
"SSH_SERVER_PERMIT_ROOT_PROHIBIT_PASSWORD": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"permit_root_login": "prohibit-password"
}
}
}
},
"SSH_SERVER_PERMIT_ROOT_FORCED_COMMANDS_ONLY": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"permit_root_login": "forced-commands-only"
}
}
}
},
"SSH_SERVER_INVALID_AUTH_RETRIES": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
Expand Down Expand Up @@ -74,5 +117,50 @@
}
}
}
},
"SSH_SERVER_INVALID_PERMIT_ROOT_LOGIN": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"permit_root_login": "invalid"
}
}
}
},
"SSH_SERVER_INVALID_PASSWORD_AUTHENTICATION": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"password_authentication": "invalid"
}
}
}
},
"SSH_SERVER_INVALID_CIPHERS": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"ciphers": [ "[email protected]", "invalid" ]
}
}
}
},
"SSH_SERVER_INVALID_KEX_ALGORITHMS": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"kex_algorithms": [ "sntrup761x25519-sha512", "invalid" ]
}
}
}
},
"SSH_SERVER_INVALID_MACS": {
"sonic-ssh-server:sonic-ssh-server": {
"sonic-ssh-server:SSH_SERVER": {
"POLICIES":{
"macs": [ "[email protected]", "invalid" ]
}
}
}
}
}
69 changes: 69 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-ssh-server.yang
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,75 @@ module sonic-ssh-server {
range 0..100;
}
}
leaf permit_root_login {
description "Specifies whether root can log in using ssh.";
type enumeration {
enum "yes";
enum "prohibit-password";
enum "forced-commands-only";
enum "no";
}
}
leaf password_authentication {
description "Specifies whether password authentication is enabled.";
type boolean;
default true;
}
leaf-list ciphers {
description "Specifies the ciphers allowed.";
type enumeration {
enum "3des-cbc";
enum "aes128-cbc";
enum "aes192-cbc";
enum "aes256-cbc";
enum "aes128-ctr";
enum "aes192-ctr";
enum "aes256-ctr";
enum "[email protected]";
enum "[email protected]";
enum "[email protected]";
}
}
leaf-list kex_algorithms {
description "Specifies the available Key Exchange algorithms.";
type enumeration {
enum "diffie-hellman-group1-sha1";
enum "diffie-hellman-group14-sha1";
enum "diffie-hellman-group14-sha256";
enum "diffie-hellman-group16-sha512";
enum "diffie-hellman-group18-sha512";
enum "diffie-hellman-group-exchange-sha1";
enum "diffie-hellman-group-exchange-sha256";
enum "ecdh-sha2-nistp256";
enum "ecdh-sha2-nistp384";
enum "ecdh-sha2-nistp521";
enum "curve25519-sha256";
enum "[email protected]";
enum "sntrup761x25519-sha512";
enum "[email protected]";
}
}
leaf-list macs {
description "Specifies the available MAC (message authentication code) algorithms.";
type enumeration {
enum "hmac-sha1";
enum "hmac-sha1-96";
enum "hmac-sha2-256";
enum "hmac-sha2-512";
enum "hmac-md5";
enum "hmac-md5-96";
enum "[email protected]";
enum "[email protected]";
enum "[email protected]";
enum "[email protected]";
enum "[email protected]";
enum "[email protected]";
enum "[email protected]";
enum "[email protected]";
enum "[email protected]";
enum "[email protected]";
}
}
}/*container policies */
} /* container SSH_SERVER */
}/* container sonic-ssh-server */
Expand Down
Loading