|
| 1 | +# kdump_Remote_SSH |
| 2 | + |
| 3 | +## High Level Design Document |
| 4 | +**Rev 0.1** |
| 5 | + |
| 6 | +## Table of Contents |
| 7 | + |
| 8 | +<!-- TOC depthFrom:2 depthTo:4 withLinks:1 updateOnSave:1 orderedList:0 --> |
| 9 | + |
| 10 | +- [High Level Design Document](#high-level-design-document) |
| 11 | +- [Table of Contents](#table-of-contents) |
| 12 | +- [List of Tables](#list-of-tables) |
| 13 | +- [Revision](#revision) |
| 14 | +- [Overview](#about-this-manual) |
| 15 | +- [Scope](#scope) |
| 16 | +- [Definitions/Abbreviations](#definitionsabbreviations) |
| 17 | + - [Table 1: Abbreviations](#table-1-abbreviations) |
| 18 | +- [Introduction](#introduction) |
| 19 | +- [Requirements Overview <a name="requirements-overview"></a>](#requirements-overview-a-namerequirements-overviewa) |
| 20 | + - [Functional Requirements <a name="functional-requirements"></a>](#functional-requirements-a-namefunctional-requirementsa) |
| 21 | + - [Configuration and Management Requirements](#configuration-and-management-requirements) |
| 22 | + - [SSH Key Generation Requirements](#ssh-key-generation-requirement) |
| 23 | +- [kdump Remote Architechture](#kdump-remote-architechture) |
| 24 | +- [Functional Description](#functional-description) |
| 25 | + - [Design Changes](#design-changes) |
| 26 | +- [Configurations and Management](#configuration-and-management) |
| 27 | + - [CONFIG_DB Enhancements](#config_db-enhancements) |
| 28 | + - [SAI API](#sai-api) |
| 29 | + - [CLI/Yang MOdel Enhancements](#cliyang-model-enhancements) |
| 30 | +- [CLI Enhancements](#cli-enhancements) |
| 31 | + - [CLI Configuration Commands](#cli-configuration-commands) |
| 32 | + - [CLI Show Commands](#cli-show-commands) |
| 33 | +- [YANG Enhancement](#yang-enhancements) |
| 34 | +- [Warmboot Requirements](#warmboot-requirements) |
| 35 | +- [Test](#test) |
| 36 | + - [Unit Test cases](#unit-test-cases) |
| 37 | +- [Links](#links) |
| 38 | + |
| 39 | +<!-- /TOC --> |
| 40 | + |
| 41 | +## List of Tables |
| 42 | + |
| 43 | +[Table 1: Abbreviations](#table-1-abbreviations) |
| 44 | + |
| 45 | +## Revision |
| 46 | + |
| 47 | +Rev | Date | Author | Change Description |
| 48 | +:---: | :-----: | :------: | :--------- |
| 49 | +0.1 | 06/05/2024 | Ghulam Bahoo, Muhammad Ali Hussnain | Initial version |
| 50 | +## Overview |
| 51 | +This document outlines the configuration and usage of the kdump remote feature with ssh for the SONiC. |
| 52 | + |
| 53 | +## Scope |
| 54 | + |
| 55 | +This document describes how to configure remote kdump feature in SONiC infrastructure. |
| 56 | + |
| 57 | +## Definitions/Abbreviations |
| 58 | + |
| 59 | +### Table 1: Abbreviations |
| 60 | + |
| 61 | +| **Term** | **Meaning** | |
| 62 | +| ----------- | ---------------------- | |
| 63 | +| SSH | Secure Shell | |
| 64 | +| kdump | Kernel Dump | |
| 65 | +| NFS | Network File System | |
| 66 | + |
| 67 | +## Introduction |
| 68 | +Kdump, a built-in Linux kernel feature, generates and stores a crash dump file in the event of a kernel panic. Currently SONiC lacks the functionality of storing dump files on a remote server. It offloads the storage from switch by saving the crash reports to a separate designated server for offline analysis. This feature extends existing kdump feature by enabling remote dumps via ssh protocol, allowing you to transfer kernel crash data to a designated remote server. |
| 69 | + |
| 70 | +## Requirements Overview <a name="requirements-overview"></a> |
| 71 | + |
| 72 | +### Functional Requirements <a name="functional-requirements"></a> |
| 73 | +This section describes the SONiC requirements for kdump remote feature. |
| 74 | + |
| 75 | +At a high level the following should be supported: |
| 76 | +1. The kernel core dump files must be stored on the a remote ssh server. |
| 77 | +### Configuration and Management Requirements |
| 78 | + |
| 79 | +- CLI support for configuring remote kdump feature enable/disable via ssh. |
| 80 | +- CLI support for configuring username and hostname of ssh server (username@server_address). |
| 81 | +- CLI support for configuring SSH private key path for ssh server (SSH_private_Key_Path). |
| 82 | +- CLI support for displaying credentials of ssh server. |
| 83 | +- CLI support for displaying state of kdump remote feature (enable/disable). |
| 84 | +### SSH Key Generation Requirement |
| 85 | +The system should authenticate with the remote server using SSH keys for secure access. |
| 86 | + |
| 87 | +``` |
| 88 | +admin@sonic: ssh-keygen |
| 89 | +``` |
| 90 | + |
| 91 | +User be prompted to choose a location to save the key pair. By default, it saves the private key to ~/.ssh/id_rsa and the public key to ~/.ssh/id_rsa.pub. |
| 92 | + |
| 93 | +``` |
| 94 | +admin@sonic: ssh-copy-id username@server_address |
| 95 | +``` |
| 96 | + |
| 97 | + This helps automate passwordless SSH logins by copying public key to authorized servers. |
| 98 | + |
| 99 | +## kdump Remote Architechture |
| 100 | + |
| 101 | + |
| 102 | +## Functional Description |
| 103 | + |
| 104 | +### Design Changes |
| 105 | + |
| 106 | +The SONiC kernel core dump remote functionality can be divided into two categories: |
| 107 | + |
| 108 | +1. Kernel core-dump generation service |
| 109 | +2. Storing Kernel core-dump files remotely |
| 110 | + |
| 111 | +Current SONiC lacks remote kernel dump functionality. To add this feature, consider enabling kdump for remote storage. |
| 112 | + |
| 113 | +We are suggesting modifying the exisitng SONiC configuration as following sonic-buildimage files. |
| 114 | + |
| 115 | +1. build_debian.sh (Addition) |
| 116 | + |
| 117 | + - Required for kdump_remote_ssh_dump: InItialize network interfaces and enable DHCP upon kernel crash. |
| 118 | + |
| 119 | +2. files/scripts/network_setup.sh (New Addition) |
| 120 | + - A script to initialize the network interfaces and enable DHCP on them. |
| 121 | +3. files/script/network_setup.hook (New Addition) |
| 122 | +4. Updated exisitng hostcfg daemon file script/hostcfgd (Updation). |
| 123 | + |
| 124 | +## Configuration and Management |
| 125 | +This section describes all types of configuration and management related design. Example sub-sections for "CLI" and "Config DB" are given below. |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | +### CONFIG_DB Enhancements |
| 130 | + New attributes will be introduced to "KDUMP" table in ConfigDB for maintaining remote kdump configurations. Below is the schema for this table. |
| 131 | + |
| 132 | +``` |
| 133 | + KDUMP_TABLE:{{config}} |
| 134 | + "enabled" :{{"false"|"true"}} |
| 135 | + "memory" :{{string}} |
| 136 | + "num_dumps" :{{number}} |
| 137 | + "remote" :{{"false"|"true"}} |
| 138 | + "ssh_string" :{{string}} |
| 139 | + "ssh_path" :{{string}} |
| 140 | +``` |
| 141 | + |
| 142 | +### SAI API |
| 143 | + |
| 144 | +No SAI API change or addition is needed for this HLD. |
| 145 | + |
| 146 | + |
| 147 | +### CLI/YANG model Enhancements |
| 148 | +### CLI Enhancements |
| 149 | + |
| 150 | +#### CLI Configuration Commands |
| 151 | +New SONiC CLI commands are introduced to configure remote kdump feature. |
| 152 | + |
| 153 | +``` |
| 154 | +admin@sonic: sudo config kdump remote enable |
| 155 | +``` |
| 156 | +This commans will configure remote kdump feature in SONiC. |
| 157 | + |
| 158 | +``` |
| 159 | +admin@sonic: sudo config kdump remote add ssh_string username@serverip |
| 160 | +``` |
| 161 | + |
| 162 | +``` |
| 163 | +admin@sonic: sudo config kdump remote add ssh_path /path to ssh private key/ |
| 164 | +``` |
| 165 | + |
| 166 | +``` |
| 167 | +admin@sonic: sudo config kdump remove ssh_sting |
| 168 | +``` |
| 169 | + |
| 170 | +``` |
| 171 | +admin@sonic: sudo config kdump remove ssh_path |
| 172 | +``` |
| 173 | + |
| 174 | +``` |
| 175 | +admin@sonic: sudo config kdump remote disable |
| 176 | +``` |
| 177 | +This command disables the remote kdump feature. |
| 178 | +#### CLI Show Commands |
| 179 | +An existing SONiC CLI command is used to display the current remote kdump feature configuraitons. |
| 180 | + |
| 181 | +``` |
| 182 | +admin@sonic: show kdump config |
| 183 | +``` |
| 184 | + |
| 185 | +Example output from the above command: |
| 186 | +``` |
| 187 | +admin@sonic:~$ show kdump config |
| 188 | +Kdump administrative mode: Enabled |
| 189 | +Kdump operational mode: Ready |
| 190 | +Kdump memory reservation: 512 |
| 191 | +Maximum number of Kdump files: 3 |
| 192 | +remote: true |
| 193 | +ssh_string: username@serverip |
| 194 | +ssh_path: /path to ssh_private key/ |
| 195 | +``` |
| 196 | + |
| 197 | +### YANG Enhancements |
| 198 | + |
| 199 | +``` |
| 200 | +leaf remote { |
| 201 | + type boolean; |
| 202 | + description |
| 203 | + "Enable or Disable the Kdump remote ssh mechanism"; |
| 204 | +} |
| 205 | +
|
| 206 | +leaf ssh_string { |
| 207 | + type string; |
| 208 | + description |
| 209 | + "Remote ssh connection string"; |
| 210 | +} |
| 211 | +
|
| 212 | +leaf ssh_path { |
| 213 | + type string; |
| 214 | + description |
| 215 | + "Remote ssh private key path"; |
| 216 | +
|
| 217 | +} |
| 218 | +
|
| 219 | +``` |
| 220 | + |
| 221 | +### Warmboot Requirements |
| 222 | + |
| 223 | +Configuring kdump feature always requires a cold reboot of the switch. Warmboot is not supported while generating a core file in the event of a kernel crash. |
| 224 | + |
| 225 | +## Test |
| 226 | + |
| 227 | +### Unit Test Cases |
| 228 | +- Enable/Disable remote kdump feature. |
| 229 | +- Add/Remove ssh_string i.e. username@hostname. |
| 230 | +- Add/Remove ssh_path. |
| 231 | + |
| 232 | +## Links |
| 233 | + - [White Paper: Red Hat Crash Utility](https://people.redhat.com/anderson/crash_whitepaper/) |
| 234 | + - [crash utility help pages](https://people.redhat.com/anderson/help.html) |
0 commit comments