Skip to content

Repository files navigation

Remote Console

Remote Console is an OpenCHAMI service for remote console access.

The service is a wrapper around conman which manages console access. The service generates the appropriate configuation to drive conman. The service layer keeps conman behind a narrower interface so clients do not need to invoke conman directly and the implementation will likely evolve over time.

History

This codebase is a combination of ideas and code from the earlier Cray-HPE/console-node and Cray-HPE/console-data services. These projects split console connection handling, console logging, and console state tracking across multiple services.

Notable changes since the original import include:

  • OpenCHAMI module naming and GitHub/GHCR build automation.
  • Splitting functionality into well defined packages each with their own configuration. Providing better separation of concerns and testability.
  • Vendor-agnostic console discovery using Redfish data provided by SMD instead of HPE-specific node type checks.
  • WebSocket console access for interactive sessions and log tail sessions.
  • Unit tests for the new internal packages.
  • Integration tests using testcontainers, an IPMI simulator, Redfish mocks, and SSH containers that act as mock consoles.

Runtime Behavior

On startup the service:

  1. Loads configuration from flags and RCS_ environment variables.
  2. Fetches console-capable nodes from SMD.
  3. Retrieves console credentials from secure storage.
  4. Writes a generated conman configuration using scripts/conman.conf.tmpl template.
  5. Runs conmand.
  6. Serves HTTP health, console inventory, and WebSocket console endpoints.
  7. Watches SMD and credential state for changes and restarts or signals conman when needed.
  8. Manages conman log rotation and aggregate console logs.

API

All routes are under /remote-console.

RouteDescription
GET /livenessKubernetes-style liveness check. Returns 204 when alive.
GET /readinessKubernetes-style readiness check. Returns 204 when ready.
GET /healthReturns console count and last hardware update time.
GET /consolesReturns the current console inventory.
GET /consoles/{nodeID}WebSocket interactive console session.
GET /consoles/{nodeID}?mode=tailWebSocket console log tail session.

The console endpoints are protected by JWT middleware when --jwks-url is set. If no JWKS URL is configured, console endpoints are left unprotected and the service logs a warning.

Tail mode supports:

Query parameterDescription
mode=tailSelects console log tail mode instead of interactive mode.
follow=trueContinues streaming new log lines after existing content.
lines=NSends the last N lines before optionally following.

Build and Test

Build the container image:

make image

Override the image tag:

make image DOCKER_VERSION=dev

Run lint:

make lint

Run tests:

make test

Configuration

Configuration is exposed as command-line flags and matching environment variables. Environment variables use the RCS_ prefix. Command-line flags take precedence over environment variables.

FlagEnvironment variableDefaultDescription
--conman-base-conf-file-pathRCS_CONMAN_BASE_CONF_FILE_PATH/app/conman.conf.tmplPath to the base conman configuration template file.
--conman-conf-file-pathRCS_CONMAN_CONF_FILE_PATH/app/conman.confPath to the generated conman configuration file.
--conman-logs-pathRCS_CONMAN_LOGS_PATH/var/log/conmanPath to conman log files.
--conman-pid-file-pathRCS_CONMAN_PID_FILE_PATH/var/run/conman.pidPath to the conman PID file.
--conman-console-scripts-pathRCS_CONMAN_CONSOLE_SCRIPTS_PATH/usr/binPath to console helper scripts.
--creds-ssh-console-key-pathRCS_CREDS_SSH_CONSOLE_KEY_PATH/app/conman.keyPath where the SSH private key file for console access is written.
--creds-vault-base-pathRCS_CREDS_VAULT_BASE_PATHemptyBase path in Vault where credentials are stored.
--creds-vault-roleRCS_CREDS_VAULT_ROLEemptyVault role to use when authenticating to Vault.
--creds-local-store-file-pathRCS_CREDS_LOCAL_STORE_FILE_PATHemptyPath to local secure storage file.
--creds-local-store-keyRCS_CREDS_LOCAL_STORE_KEYemptyKey to use for local secure storage decryption.
--creds-secure-storage-ssh-keys-pathRCS_CREDS_SECURE_STORAGE_SSH_KEYS_PATHemptyPath where SSH keys can be found in secure storage. Leave empty to skip SSH key management.
--creds-secure-storage-passwords-pathRCS_CREDS_SECURE_STORAGE_PASSWORDS_PATHhms-credsPath where console access credentials can be found in secure storage.
--http-listenRCS_HTTP_LISTEN0.0.0.0:26776HTTP listen address.
--new-node-lookupRCS_NEW_NODE_LOOKUP120Interval in seconds to look for new nodes.
--creds-monitor-intervalRCS_CREDS_MONITOR_INTERVAL30Interval in seconds to monitor credential updates.
--smd-urlRCS_SMD_URLhttp://cray-smd/URL for the SMD service. A trailing slash is added automatically.
--jwks-urlRCS_JWKS_URLemptyJWKS URL for fetching public keys for JWT validation.
--jwks-fetch-intervalRCS_JWKS_FETCH_INTERVAL5Interval in seconds to retry fetching JWKS on failure.
--oauth2-client-idRCS_OAUTH2_CLIENT_IDemptyOAuth2 client ID for SMD authentication.
--oauth2-client-secretRCS_OAUTH2_CLIENT_SECRETemptyOAuth2 client secret for SMD authentication.
--oauth2-token-urlRCS_OAUTH2_TOKEN_URLemptyOAuth2 token endpoint URL for SMD authentication.
--oauth2-scopesRCS_OAUTH2_SCOPES[]OAuth2 scopes for SMD authentication.
--console-logs-file-sizeRCS_CONSOLE_LOGS_FILE_SIZE5MMaximum size of console log files before rotation.
--console-logs-num-rotateRCS_CONSOLE_LOGS_NUM_ROTATE2Number of rotated console log files to keep.
--console-logs-backup-pathRCS_CONSOLE_LOGS_BACKUP_PATH/var/log/conman.oldPath to rotated console log files.
--agg-logs-file-sizeRCS_AGG_LOGS_FILE_SIZE20MMaximum size of aggregation log file before rotation.
--agg-logs-num-rotateRCS_AGG_LOGS_NUM_ROTATE1Number of rotated aggregation log files to keep.
--agg-logs-pathRCS_AGG_LOGS_PATH/tmp/consoleAggPath to aggregation log files.
--log-rotate-enabledRCS_LOG_ROTATE_ENABLEDtrueEnable log rotation.
--log-rotate-check-frequencyRCS_LOG_ROTATE_CHECK_FREQUENCY600Frequency in seconds to check for log rotation.
--log-rotate-file-pathRCS_LOG_ROTATE_FILE_PATH/tmp/logrotate.conmanPath to generated logrotate configuration file.
--log-rotate-state-file-pathRCS_LOG_ROTATE_STATE_FILE_PATH/tmp/rot_conman.statePath to logrotate state file.

OAuth2 settings are all-or-nothing. If any OAuth2 field is set, all of --oauth2-client-id, --oauth2-client-secret, --oauth2-token-url, and --oauth2-scopes must be provided.

Logging is configured separately with these process environment variables:

Environment variableDefaultDescription
LOG_LEVELINFOAny level accepted by Go slog, such as DEBUG, INFO, WARN, or ERROR.
LOG_FORMATtextSet to json for structured JSON logs. Any other value uses text logs.

License

This project is licensed under the MIT license. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages