Why You Need Mavis CLI
Mavis CLI is a command-line interface that allows interaction with your computer via keyboard commands. Unlike graphical user interfaces (GUI), CLI tools do not require a mouse or graphical elements and execute operations through text commands.
For repetitive operations, manually using Mavis can be time-consuming. With Mavis CLI, you can write shell scripts to automate tasks or integrate with your system for workflow automation.
What Can Mavis CLI Do?
Create and manage projects: Create new projects, set project parameters, add or remove project members.
Create and manage secrets: Generate new secrets, configure secret permissions, revoke secrets.
Create and manage access services: Create new access services, configure service parameters, grant or revoke access permissions.
Installation
Linux / macOS: Run the following command in the terminal:
curl -sSL https://releases.pentium.network/mavis/latest/cli.sh | bash
Windows: Download from:
https://releases.pentium.network/mavis/latest/mavis_windows_amd64.zip
CLI Overview
Mavis CLI consists of main commands and subcommands. Example:
Authentication
mavis auth login
-
auth:Manage user authentication
-
login: Login to Mavis -
logout: Logout from Mavis -
token: Display current authentication token
-
-
completion Generate shell auto-completion scripts
-
bash: Generate bash shell auto-completion scripts -
fish: Generate fish shell auto-completion scripts -
powershell: Generate powershell auto-completion scripts -
zsh: Generate zsh shell auto-completion scripts
-
-
config: Configure Mavis CLI settingscurrent-project: Show current projectset: Set specific configuration optionsset-project: Set the current projectunset: Remove specific configuration optionsview: View all current settings
-
project (alias:
projects): Manage Mavis projectsadd: Create a new projectget: Retrieve project informationlist: List all available projectsremove: Delete a project
-
secret Manage keys in the Mavis project.
add: Create a new secret (requires-pflag for project)list: List all secrets in the project(requires-pflag for project)remove: Remove a secret from the project(requires-pflag for project)update: Update an existing secret(requires-pflag for project)
- access-service Manage service access. (Alias: as)
add: Add a new access servicelist: List all access servicesremove: Remove an access serviceupdate: Update an access service (requires-pflag)
Note: The
-p, --projectflag specifies the project for secret and access service commands.
Additional Information
You can append -h to any command or subcommand to display help and required parameters.
Parameter
Login:
mavis auth login [flags]
-
Authenticate the current user with Mavis.
-
Flag:
-a, --account string: Username (required)-p, --password string: Password (required)-h, --help: Display login command help
-
Logout
mavis auth logout [flags]
- Terminate the current user's Mavis session.- flag:
-
-h, --help: Display logout command help
-
Token:
mavis auth token
Displays the current authentication token
mavis config
mavis config [command] [flags]
Manage Mavis CLI configuration settings.
-
Commands:
current-project: Display the currently selected project name.set: Set a specific configuration option (replaceNAMEandVALUEwith the desired option and value).set-project --NAME: Set the current project (replaceNAMEwith the project name).unset NAME: Unset a specific configuration option (replaceNAMEwith the option to unset).view: Display all current configuration options.
-
Flags:
-
-h, --help: Show help information for theconfigcommand or a specific subcommand (usemavis config [command] --help).
-
Project Commands (mavis project)
Manage Mavis projects.
mavis project [command] [flags]
Quick reference for adding a new project named "newpj":
mavis project add -p newpj
Aliases:
listandlsfor thelistcommand,removeandrmfor theremovecommand.-
Available Commands:
add -p string: Create a new project.get -p string: Retrieve information about a specific project.list: List all available projects.remove: Delete an existing project.
-
Flags:
-h, --help: Show help information for theprojectcommand or a specific subcommand (usemavis project [command] --help).-p, --project string: Project name (required forget,remove, andupdatecommands).
Secret Commands (mavis secret)
Manage secrets within a Mavis project.
mavis secret [command] [flags]
Quick Reference: Adding a secret named "new-sef" with an account and password under the project "CLI":
mavis secret add -n new-sef -a account --password ijf38f -p CLI
-
Available Commands:
-
add: Create a new secret in the project. (Requires-aor--passwordflag)-a, --account string: Account name (optional)-n, --name string: Secret name (required)--password string: Secret value (optional, alternative to-a)
list: List all secrets in the current project.remove: Delete a secret from the current project.-
update: Update an existing secret in the current project. (Requires-aor--passwordflag)-a, --account string: Account name (optional)-n, --name string: Secret name (required)--password string: Secret value (optional, alternative to-a)
-
-
Flags:
-
-h, --help: Show help information for thesecretcommand or a specific subcommand (usemavis secret [command] --help).-p, --project string: Project name (required for all commands).
-
Access Service Commands (mavis as)
mavis secret [command] [flags]
Quick Reference: Adding an access service named "newas" under the project "CLI", with secret "secname", target device "device", using the RDP protocol:
mavis-cli as add -n newas --port 22 -s secname -t device -- protocol rdp
-
Available Commands:
-
add: Add a new access service object.-n, --name string: Access service name--port int32: Port number-p, --project string: Project name--protocol string: Protocol type (default: "ssh")-s, --secret string: Secret name-t, --targets string: Target server(s)
list: List all access services in the current project.remove: Delete an access service from the current project.-
update: Update an existing access service in the current project.-n, --name string: Access service name--port int32: Port number-p, --project string: Project name-s, --secret string: Secret name-t, --targets string: Target server(s) (multiple targets separated by commas)
-