Skip to content

Commit 2c4c01d

Browse files
authored
HLD for cli sessions feature (#1)
Prepare HLD documents for CLI sessions feature Update ssh_config.md with auto-logout and max-syslogins parameters. Create serial-console-HLD.md
1 parent 40a3a13 commit 2c4c01d

File tree

4 files changed

+246
-0
lines changed

4 files changed

+246
-0
lines changed

doc/console/serial-console-HLD.md

+214
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
# Serial-console global config HLD
2+
## <a name='TableofContent'></a>Table of Content
3+
- [Serial-console config HLD](#serial-console-global-config-hld)
4+
- [Table of Content](#table-of-content)
5+
- [Revision](#revision)
6+
- [1. Introduction](#11-introduction)
7+
- [1.1. Scope](#11-scope)
8+
- [1.2. Definitions/Abbreviations](#12-definitionsabbreviations)
9+
- [1.3. Overview](#13-overview)
10+
- [1.4. Requirements](#14-requirements)
11+
- [2. Architecture Design](#2-architecture-design)
12+
- [2.1. Configuration modules](#21-configuration-modules)
13+
- [3. High-Level Design](#3-high-level-design)
14+
- [Flow diagram](#flow-diagram)
15+
- [3.1 Flow description](#31-flow-description)
16+
- [3.2 serial-console configurations](#32-serial-console-configurations)
17+
- [4. Init flow](#4-init-flow)
18+
- [4.1. Feature Default](#41-feature-default)
19+
- [5. SAI api](#19-sai-api)
20+
- [6. Configuration and management](#6-configuration-and-management)
21+
- [6.1. SERIAL_CONNECTION configDB table](#61-serial-connection-configdb-table)
22+
- [6.2. ConfigDB schemas](#62-configdb-schemas)
23+
- [6.3. CLI/YANG model Enhancements](#63-cliyang-model-enhancements)
24+
- [6.4. Config DB Enhancements](#64-config-db-enhancements)
25+
- [6.5. Manifest (if the feature is an Application Extension)](#65-manifest-if-the-feature-is-an-application-extension)
26+
- [7. Warmboot and Fastboot Design Impact](#7-warmboot-and-fastboot-design-impact)
27+
- [8. Restrictions/Limitations](#8-restrictionslimitations)
28+
- [9. Testing Requirements/Design](#9-testing-requirementsdesign)
29+
- [9.1. Unit Test cases](#91-unit-test-cases)
30+
- [9.2. System Test cases](#92-system-test-cases)
31+
- [10. Open/Action items - if any](#10-openaction-items---if-any)
32+
### <a name='Revision'></a>Revision
33+
34+
| Rev | Date | Author | Change Description |
35+
| :---: | :------: | :--------: | ------------------ |
36+
| 0.1 | 16/06/23 | Ivan Davydenko | Initial version |
37+
38+
## 1 <a name='Introduction'></a>Introduction
39+
40+
### 1.1. <a name='Scope'></a>Scope
41+
42+
This hld doc for serial cli global configurations describes the requirements, architecture and general flow details of serial connection config in SONIC OS based switches.
43+
44+
### 1.2. <a name='DefinitionsAbbreviations'></a>Definitions/Abbreviations
45+
46+
serial - secure shell
47+
TCP - Transmission Control protocol
48+
49+
### 1.3. <a name='Overview'></a>Overview
50+
51+
We want to allow configuring serial console global settings. This will feature will include two configurations on first phase.
52+
53+
### 1.4. <a name='Requirements'></a>Requirements
54+
55+
This feature requires a dedicated table in the configuration DB, enhancements of hostcfg demon and separate service that updates configutaion files. In order to update the serial-console configurations, we need to have write access in /etc/profile.d/, /proc/sys/kernel/sysrq and /etc/sysctl.d/95-sysrq-sysctl.conf.
56+
57+
## 2. <a name='ArchitectureDesign'></a>Architecture Design
58+
### 2.1. <a name='ConfigModules'></a>Configuration modules
59+
![serial_console_config](serial_console_config.png)
60+
61+
We want to enhance configDB to include table for serial-console global configurations. In addition, serial_console.service will be added to modify configuration files.
62+
63+
## 3. <a name='High-LevelDesign'></a>High-Level Design
64+
65+
We want to enable serial-console configuration in SONIC. In order to do so will touch few areas in the system:
66+
1. configDB - to include a dedicated table for configurations
67+
2. hostcfg demon - to trigger dedicated service on config apply.
68+
3. OS config files - specific for this stage we are only /etc/profile.d/serial_tmout.sh and /etc/sysctl.d/95-sysctl.d/95-sysrq-sysctl.conf and /proc/sys/kernel/sysrq are going to be modifed by the service-script.
69+
70+
##### Flow diagram
71+
![serial_console_flow](serial_console_flow.png)
72+
### 3.1 <a name='Flow description'></a>Flow description
73+
When the feature is enabled, by modifying the DB manually, user will set serial-console configurations by modifing CONFIG_DB in SERIAL_CONSOLE table.
74+
75+
The hostcfgd daemon will be extended to listen to confogurations from SERIAL_CONSOLE table and restarts the serial_console.service. Serial console script will read SERIAL_CONSOLE table and update config files accordingly.
76+
77+
78+
### 3.2 <a name='serial-console configurations'></a>serial-console configurations
79+
80+
We want to enable configuring the following attributes:
81+
| Policy | Action | Param values | Default |
82+
|--------------------|-----------------------------------------------------------------------|---------------------|--------------|
83+
| auto logout | Inactivity timeout for serial-console session | 0-35000 (min) | 15 |
84+
| sysrq capabilities | Enabling or disabling SysRq functionality for serial-consoles | enabled/disabled | disabled |
85+
86+
87+
## 4. <a name='Init flow'></a>Init flow
88+
89+
During init flow we will set default configurations as mentioned in the table abowe. Default values will be added to init_cfg.json.j2 .
90+
### 4.1. <a name='FeatureDefault'></a>Feature Default
91+
92+
Description of default values in init_cfg.json regarding serial-console config:
93+
```
94+
auto logout: 15 //minutes
95+
sysrq capabilities: disabled
96+
```
97+
## 5. <a name='SAI api'></a>SAI api
98+
NA
99+
## 6. <a name='Configurationandmanagement'></a>Configuration and management
100+
101+
### 6.1. <a name='SERIAL_CONSOLEconfigDBtable'></a>SERIAL_CONSOLE configDB table
102+
103+
```
104+
SERIAL_CONSOLE:{
105+
"auto_logout": {{min}}
106+
"sysrq-capabilities": {{enabled|disabled}}
107+
}
108+
```
109+
### 6.2. ConfigDB schemas
110+
```
111+
; Defines schema for SERIAL_CONSOLE configuration attributes in SERIAL_CONSOLE table:
112+
auto_logout = 5*DIGIT ; autologout timer - max is 35000 minutes
113+
max_syslogins = "enabled/disabled" ; enabling or disabling sysrq capabilities in linux, default is disabled.
114+
```
115+
116+
### 6.3. <a name='CLIYANGmodelEnhancements'></a>CLI/YANG model Enhancements
117+
```yang
118+
//filename: sonic-serial-console.yang
119+
module sonic-serial-console {
120+
121+
yang-version 1.1;
122+
123+
namespace "http://github.com/Azure/sonic-serial-console";
124+
prefix cli-sessions;
125+
126+
description "SERIAL_CONSOLE YANG Module for SONiC-based OS";
127+
128+
revision 2023-06-07 {
129+
description "First Revision";
130+
}
131+
132+
container sonic-serial-console {
133+
134+
container SERIAL_CONSOLE {
135+
136+
description "SERIAL_CONSOLE part of config_db.json";
137+
138+
key "name";
139+
140+
leaf auto_logout {
141+
description "serial-console auto-logout timer value in minutes";
142+
type int32 {
143+
range "0..15000";
144+
}
145+
default 15;
146+
}
147+
148+
leaf sysrq_capabilities {
149+
description "managing SysRq capabilities";
150+
type enumeration {
151+
enum disabled;
152+
enum enabled;
153+
}
154+
default disabled;
155+
}
156+
}
157+
/* end of container SERIAL_CONSOLE */
158+
}
159+
/* end of top level container */
160+
}
161+
/* end of module sonic-serial-console */
162+
163+
```
164+
### 6.4. <a name='ConfigDBEnhancements'></a>Config DB Enhancements
165+
166+
The ConfigDB will be extended with next objects:
167+
168+
```json
169+
{
170+
"SERIAL_CONSOLE": {
171+
"auto_logout": "15",
172+
"sysrq_capabilities": "disabled",
173+
}
174+
}
175+
```
176+
177+
### 6.5. <a name='ManifestifthefeatureisanApplicationExtension'></a>Manifest (if the feature is an Application Extension)
178+
179+
180+
NA
181+
182+
183+
## 7. <a name='WarmbootandFastbootDesignImpact'></a>Warmboot and Fastboot Design Impact
184+
NA
185+
186+
## 8. <a name='RestrictionsLimitations'></a>Restrictions/Limitations
187+
188+
## 9. <a name='TestingRequirementsDesign'></a>Testing Requirements/Design
189+
Explain what kind of unit testing, system testing, regression testing, warmboot/fastboot testing, etc.,
190+
Ensure that the existing warmboot/fastboot requirements are met. For example, if the current warmboot feature expects maximum of 1 second or zero second data disruption, the same should be met even after the new feature/enhancement is implemented. Explain the same here.
191+
Example sub-sections for unit test cases and system test cases are given below.
192+
193+
### 9.1. <a name='UnitTestcases'></a>Unit Test cases
194+
Configuration
195+
1. Configure auto-logout for serial-console.
196+
1.1. Configure and apply non-default auto-logout value (1-2 min.)
197+
1.2. Connect and login via serial-console. Validate auto-logout happend in configured time (1-2 min.)
198+
2. Init flow for auto-logout.
199+
2.1. Don`t save previous auto-logout configuration and reboot the switch.
200+
2.2. After boot connect and login via serial-console. Validate that auto-logout didn`t happend in previously configured time (1-2 min.)
201+
3. Configure sysrq parameter.
202+
3.1. Configure and apply non-default sysrq-capabilities parameter (enabled)
203+
3.2. Check sysrq parameter value in linux proc filesystem being changed to new applied value of "1:
204+
4. Init flow for sysrq parameter.
205+
4.1. Don`t save previous sysrq configuration and reboot the switch.
206+
4.2. Check sysrq parameter value in linux proc filesystem being equal to default value of "0".
207+
208+
209+
### 9.2. <a name='SystemTestcases'></a>System Test cases
210+
211+
## 10. <a name='OpenActionitems-ifany'></a>Open/Action items - if any
212+
213+
214+
NOTE: All the sections and sub-sections given above are mandatory in the design document. Users can add additional sections/sub-sections if required.

doc/console/serial_console_config.png

240 KB
Loading

doc/console/serial_console_flow.png

185 KB
Loading

doc/ssh_config/ssh_config.md

+32
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
- [1.14. Open/Action items - if any](#114-openaction-items---if-any)
3131
### 1.1. <a name='Revision'></a>Revision
3232

33+
| Rev | Date | Author | Change Description |
34+
| :---: | :------: | :--------: | ------------------ |
35+
| 0.1 | 17/05/23 | Yona Coen | Initial version |
36+
| 0.2 | 16/06/23 | Ivan Davydenko | Add descriptions for auto-logout and max-sessions parameters |
37+
38+
3339
### 1.2. <a name='Scope'></a>Scope
3440

3541
This hld doc for ssh server global configurations describes the requirements, architecture and general flow details of ssh server config in SONIC OS based switches.
@@ -80,6 +86,8 @@ We want to enable configuring the following policies, with default values are ta
8086
| authentication retries | Number of attempts to try to log in before rejecting the session | 3-100 | 6 |
8187
| login timeout | SSH session timeout | 1-600 (secs) | 120 |
8288
| ports | Port numbers for SSH | 1-65535 | 22 |
89+
| auto logout | Inactivity timeout for SSH session | 0-35000 (min) | 15 |
90+
| max sessions | Max number of concurrent logins | 3-100 | 100 |
8391

8492

8593
### 1.8. <a name='Init flow'></a>Init flow
@@ -92,6 +100,8 @@ Description of default values in init_cfg.json regarding ssh server config:
92100
authentication retries: 6
93101
login timeout: 120 //seconds
94102
ports: 22
103+
auto logout: 15 //minutes
104+
max sessions: 100
95105
```
96106
### 1.9. <a name='SAI api'></a>SAI api
97107
NA
@@ -105,6 +115,8 @@ SSH_SERVER:{
105115
"authentication_retries": {{num}}
106116
"login_timeout": {{secs}}
107117
"ports": {{num}}
118+
"auto_logout": {{min}}
119+
"max_syslogins": {{num}}
108120
}
109121
}
110122
```
@@ -116,6 +128,8 @@ key = "POLICIES" ;ssh server confi
116128
authentication_retries = 3*DIGIT ; number of login attepmts, should be 100 max
117129
LOGIN_TIMEOUT = 3*DIGIT ; login timeout in secs unit, max is 600 secs
118130
PORTS = 5*DIGIT ; ssh port number - max is 65535
131+
auto_logout = 5*DIGIT ; autologout timer - max is 35000 minutes
132+
max_syslogins = 3*DIGIT ; maximum number of concurrent sessions - max is 100
119133
```
120134

121135
#### 1.10.3. <a name='CLIYANGmodelEnhancements'></a>CLI/YANG model Enhancements
@@ -161,6 +175,20 @@ module sonic-ssh-server {
161175
}
162176
}
163177
}
178+
leaf auto_logout {
179+
description "inactivity timeoout (min unit)";
180+
default 15;
181+
type uint32 {
182+
range 0..35000;
183+
}
184+
}
185+
leaf max_syslogins {
186+
description "limit of concurrent system logins";
187+
default 100;
188+
type uint32 {
189+
range 3..100;
190+
}
191+
}
164192
}/*container POLICIES */
165193
} /* container SSH_SERVER */
166194
}/* container sonic-ssh-server */
@@ -177,6 +205,8 @@ The ConfigDB will be extended with next objects:
177205
"authentication_retries": "6",
178206
"login_timeout": "120",
179207
"ports": "22",
208+
"auto_logout": "15",
209+
"max_syslogins": "100",
180210
}
181211
}
182212
}
@@ -205,6 +235,8 @@ Example sub-sections for unit test cases and system test cases are given below.
205235
- Configure authentication_retries to X and try to connect with wrong password X+1 times
206236
- Configure login_timeout to X, try to connect and wait for X+5 seconds (need to disconnect)
207237
- Configure ports to 222 and see if unable to connect to 22
238+
- Configure auto_logout to X, login and wait for X+5 seconds (need to disconnect)
239+
- Configure max_syslogins to X and see if unable to login to X+1 concurrent sessions
208240

209241
#### 1.13.2. <a name='SystemTestcases'></a>System Test cases
210242

0 commit comments

Comments
 (0)