Config Shell Guide
The Config Shell feature provides an interactive and familiar environment similar to older Opengear appliances. The result is an user-experience that feels like an Interactive CLI.
Advantages of the Config Shell are:
-
Items can be created or updated without being applied immediately
-
Items that are not applied are indicated by an asterisk ( * ) beside them when viewing information.
-
Tab complete is supported for many commands.
-
Built-in help (see Global Context Commands).
-
Has a structured, tabular view when displaying lists of data.
Start and End a Config Shell Session
Start the config shell by typing config at a bash prompt. The bash prompt is presented to root and admin users when they log in via SSH or on the maintenance console.
You can exit the Config Shell by any of the following:
-
Type exit to end the session.
-
Send an EOF (Control+D).
-
Send an INT (Control+C).
Note:The session is prevented from exiting if there are un-committed changes, this condition is indicated by a message. However, you can force an exit by immediately executing an exit command again, any un-committed changes will be discarded.
Navigate in the Config Shell
The Config Shell operates in a hierarchy of entities. Due to the variety of entities, there are several ways for you to get to a place where you can make changes.
Starting at the root, enter the entity names to descend down through lower entities. Every entity name is an operation that descends into that entity. Similarly, type the names of entities higher in the hierarchy to ascend towards the root.
Identifiers:
Singleton entity |
Require only the entity name to be uniquely identified. |
List/item entity | The first level is the entity name, the second level is the item identifier (the identifier is the same identifier used by ogcli). |
Multiple identifiers | A single entity (ssh/authorized_keys) requires an extra identifier. In this case, the hierarchy is: ssh/authorized_keys > userid > [key_id]. |
Nested fields | The Config Shell treats nested fields as additional hierarchy levels. This applies both to arrays and maps. For arrays of complex values, each value shall also be a hierarchy level. |
Fields, Entities and Contexts
The config shell allows you to configure a number of fields which define settings.
The fields are grouped in entities that describe a small set of functionality. For example, there is a ‘user’ entity which is used to access user settings. Entities can contain sub-entities as well as simple fields.
Context Within Config Shell
Once in the shell, a number of commands are available depending on the current context. The context is the current entity that is the focus of the config shell. When the shell is first started, the context is a special parent context from which sub-entities can be seen.
Once a context is selected by typing the name of the entity, it is shown in the prompt between brackets. For example, in the following snippet, the ‘user’ context is accessed and then the ‘john’ sub-entity is accessed causing the context to become ‘user john’. The ‘show’ command is used to list the entities and fields that descend from the current context.
config: user
config(user): show
Item names for entity user
john matt myuser netgrp root
config(user): john
config(user john):
Entity user item john
description
enabled true
no_password false
password
ssh_password_enabled true
groups (array)
config(user john):
Global Context Commands
The following commands are available on any context:
help (or '?') |
Show help which is context sensitive. It will list some special details about the current context, the list of sub entities (or fields) and a list of available commands. |
help <entity> | Show the help for the specific entity. |
help <field> | Show the help for the specific field. |
show | List the available entities and fields. |
<entity> |
Typing the name of an entity changes the context to focus on the named entity. |
exit | Exit the command shell. |
Entity Context Commands
The following commands available on any entity context:
<field> |
Show the value of a field. |
<field> <value> | Change the field to the specific value. |
delete | Delete the current entity. This is available when the context entity is an item in a list. |
add |
Append a sub entity or field to the current entity. This is only available when the context entity is a list. |
Apply or Discard Field Changes
When fields and entities are changed, they are not yet applied to the system configuration but are kept staged. Items that are staged are indicated with an ‘*' when the show command is used. In addition, the changes command can be used to show what fields have been changed.
In the following example, the user ‘john’ has been changed to alter the description. The show command indicates the changed field with an '*'. The changes command lists the changed field.
config(user john): description "Admin"
config(user john): show
Entity user item john
description Admin *
enabled true
no_password false
password
ssh_password_enabled true
groups (array)
config(user john): changes
Entity user item john (edit)
description Admin
config(user john):
Operations
Once a change has been made, the following commands are available:
changes | show staged changes on all entities |
apply | apply changes only on the current entity |
discard | discard changes only on the current entity |
apply all | apply changes on all entities |
discard all | discard changes on all entities |
Supported Entities
The following entities are supported in phase 1 of this feature and are available in release 22.06.0:
auth | Configure remote authentication, authorization, accounting (AAA) servers. |
group | Retrieve or update user group information. |
ip_passthrough |
Passthrough entities are for retrieving / changing IP Passthrough settings. |
ip_passthrough/status | The IP Passthrough status entity provides information about what part of the IP Passthrough connection process the device is currently at and information about the connected downstream device. |
local_password_policy | Configure the password policy for local users. This includes expiry and complexity settings. |
logs/portlog_settings | Check and update port log settings. |
managementport | Used for working with local management console information. |
port | Configure and view ports information. |
ports/auto_discover/schedule | Manage Port Auto-Discovery scheduling. |
system/admin_info | Retrieve or change the Console Manager appliance system's information (hostname, contact and location). |
system/banner | Retrieve or change the Console Manager appliance system's banner text. |
system/cloud_connect |
Retrieve or change the Console Manager appliance system's cloud connect configuration. |
system/model_name | Retrieve the Console Manager appliance's Model Name. |
system/serial_number | Retrieve the Console Manager appliance's Serial Number. |
system/session_timeout | Retrieve or change the Console Manager appliance session timeouts. |
system/ssh_port | The SSH port used in Direct SSH links. |
system/time | Retrieve and update the Console Manager's time. |
system/timezone | Retrieve and update the system's timezone. |
system/version |
Retrieve the Console Manager's most recent firmware and REST API version. |
user | Retrieve and update user information. |
Example CLI Commands
Adding a User
In this example below, some commentary is added. Commentary added later is denoted with a ‘//’ prefix.
# config
Welcome to the Opengear interactive config shell. Type ? or help for help.
// Move to the user entity
config: user
config(user): help add
Add a new item for entity user.
The add command requires a unique value to identify the record.
This will be used for the username field.
Description for the item:
Retrieve and update information for a specific user.
// Create the new user
config(user): add matt
config(user matt): show
Entity user item matt
description
enabled true
no_password false
password (required)
ssh_password_enabled true
username matt
groups (array)
// Fill out some fields
config(user matt): password secretpassword
config(user matt): description Admin
config(user matt): show
Entity user item matt
description Admin *
enabled true
password secretpassword *
ssh_password_enabled true
username matt
groups (array)
// Edit the groups
config(user matt): groups
config(user matt groups): show
Entity user item matt field groups
config(user matt groups): add // Tab completion to show available values
admin myuser netgrp
config(user matt groups): add admin
config(user matt groups): up // Exit the groups list
// Show and apply
config(user matt): show
Entity user item matt
description Admin *
enabled true
password secretpassword *
ssh_password_enabled true
username matt
groups (array)
0 admin *
config(user matt): apply
Creating entity user item matt.
config(user matt):
Configuring a Port