Rev | Date | Author | Description |
---|---|---|---|
0.1 | 01/02/2023 | Sviatoslav Boichuk | Initial version |
This document provides a high-level information for the SONiC Banner feature and Banner CLI. It describes high-level behavior, internal definition, design of the commands, syntax, and output definition.
The scope of this document is to cover definition, design and implementation of SONiC Banner feature and Banner CLI. The document covers the next CLI:
- Commands to configure banner messages
- Command to display banner settings
Term | Meaning |
---|---|
SONiC | Software for Open Networking in the Cloud |
MOTD | Message of the day |
DB | Database |
CLI | Сommand-line Interface |
YANG | Yet Another Next Generation |
- Figure 1: Banner system chart diagram
- Figure 2: Banner init flow
- Figure 3: Banner config flow
- Figure 4: Banner show configuration
The SONiC maintains several messages for communication with users. These messages are associated with login and logout processes.
There are few banners message types:
Type | Description |
---|---|
login | Display a banner to the users connected locally or remotely before login prompt |
motd | Display a banner to the users after login prompt |
logout | Display a logout banner to the users connected locally or remotely |
This feature will support the following functionality:
- Show Banner configuration
- Configure Banner
- Feature state
- Login message
- Logout message
- MOTD
Here is the representation of SONiC platform using Banner feature:
This feature require access to SONiC DB. All messages (MOTD, login and logout) saved into the SONiC config database. Hostcfgd will listen for the configuration changes in corresponding tables and restart banner-config service. Banner config service - it is simple SystemD service which runs before we get SSH connection. It reads configured messages from database and apply it to Linux.
The Linux files will be used:
- /etc/issue.net and /etc/issue - Login message
- /etc/motd - Message of the day
- /etc/logout_message - Logout message
The default Banner feature state is disabled. It means - the current (default) SONiC OS banner messages won't be changed. With disabled feature state - user can use provided CLI to configre banner messages. The changes will be applied to Config DB table. Only with enabled feature state, configured banner messages from Config DB will be applied to Linux.
User interface:
config
\-- banner
|-- state <enabled|disabled>
|-- login <message>
|-- logout <message>
|-- motd <message>
show
\-- banner
Options:
General:
<message>
- Message to be configured:string
Banner feature support multiline string message.
Example: config banner login "Hello!\nWellcome to SONiC CLI!"
Banner output: "
Hello!
Wellcome to SONiC CLI!
"
The following command set banner feature state:
config banner state <enabled|disabled>
The following command set loin banner message:
config banner login <message>
The following command set logout banner message:
config banner logout <message>
The following command set mesage of the day (MOTD):
config banner motd <message>
The following command display banner configuration:
root@sonic:/home/admin# show banner
state login motd logout
------- ------- ------------------------------------------------ --------
enabled Login You are on
Message ____ ___ _ _ _ ____
/ ___| / _ \| \ | (_)/ ___|
\___ \| | | | \| | | |
___) | |_| | |\ | | |___
|____/ \___/|_| \_|_|\____|
-- Software for Open Networking in the Cloud --
Unauthorized access and/or use are prohibited.
All access and/or use are subject to monitoring.
Help: https://sonic-net.github.io/SONiC/
New YANG model sonic-banner.yang
will be added to provide support for configuring Banner messages.
Skeleton code:
module sonic-banner {
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-banner";
prefix banner_message;
description "BANNER_MESSAGE YANG Module for SONiC-based OS";
revision 2023-05-18 {
description "First Revision";
}
container sonic-banner {
container BANNER_MESSAGE {
description "BANNER_MESSAGE part of config_db.json";
container MESSAGE {
leaf state {
type string {
pattern "enabled|disabled";
}
description "Banner feature state";
default disabled;
}
leaf login {
type string;
description "Banner message displayed to user before login prompt";
default "Debian GNU/Linux 11";
}
leaf motd {
type string;
description "Banner message displayed to user after login prompt";
default "You are on
____ ___ _ _ _ ____
/ ___| / _ \| \ | (_)/ ___|
\___ \| | | | \| | | |
___) | |_| | |\ | | |___
|____/ \___/|_| \_|_|\____|
-- Software for Open Networking in the Cloud --
Unauthorized access and/or use are prohibited.
All access and/or use are subject to monitoring.
Help: https://sonic-net.github.io/SONiC/
";
}
leaf logout {
type string;
description "Banner message dispalyed to the users on logout";
default "";
}
} /* end of container MESSAGE */
}
/* end of container BANNER_MESSAGE */
}
/* end of top level container */
}
/* end of module sonic-banner */
- Configure login banner message
- Logout form system. Login again - expected to see configured message before login prompt.
- Do not save configuration and reboot device, login to the system - expected to see default message before login prompt.
- Save configuration and reboot device - expected to see configured message before login prompt.
- Configure message of the day
- Logout form system. Login again - expected to see configured message after login prompt.
- Do not save configuration and reboot device,login to the system - expected to see default message after login prompt.
- Save configuration and reboot device - expected to see configured message after login prompt.
- Configure logout banner message
- Logout form system - expected to see configured logout message.
- Do not save configuration and reboot device. Logout from system after reboot - expected to see default message before login prompt.
- Save configuration and reboot device. Logout from system after reboot expected to see configured message before login prompt.