@hardenize/cli

0.53.0 • Public • Published

Hardenize CLI Tool

This tool provides easy access to the Hardenize API.

Install

$ sudo npm i -g @hardenize/cli

Or:

$ git clone https://github.com/hardenize/hardenize-cli
$ cd hardenize-cli
$ sudo npm i -g

Updating

To see if there is a newer version (no output means you are):

$ sudo npm outdated -g @hardenize/cli

To upgrade to the latest version if you're not:

$ sudo npm i -g @hardenize/cli

Usage

Run without arguments or with help/--help/-h to see the list of options:

$ hardenize help
hardenize <command>

Commands:
  hardenize bash                      Show bash auto-completion script
  hardenize certs <command>           Manage certificates
  hardenize config <command>          Manage configuration at Hardenize
  hardenize dns-zones <command>       Manage dns zones
  hardenize events <command>          Manage events
  hardenize groups <command>          Manage groups
  hardenize hdb <command>             Search HDB
  hardenize hosts <command>           Manage hosts
  hardenize local_config <command>    Manage local configuration
  hardenize network-ranges <command>  Manage network ranges
  hardenize reports0 <command>        Manage reports (unstable)
  hardenize suborgs <command>         Manage organizations
  hardenize users <command>           Manage users

Options:
  --version     Show version number                                    [boolean]
  --config, -c  Path to configuration file
                                   [string] [default: "/home/picard/.hardenize"]
  --org         Organization (falls back to config default_org)         [string]
  --format      Output format (falls back to config "default_format", otherwise
                "table")
                      [choices: "table", "table-per-row", "yaml", "json", "csv"]
  --debug, -d   Displays debug information about API requests and responses
                                                                       [boolean]
  --help        Show help                                              [boolean]

Find our API documentation at https://www.hardenize.com/docs/api/v1/

You can also get additional help on a per-command basis. E.g:

hardenize certs <command>

Manage certificates

Commands:
  hardenize certs create        Create a certificate. (Reads PEM from stdin)
  hardenize certs get <sha256>  Get a certificate
  hardenize certs ls [host]     List certificates

Options:
  --version     Show version number                                     [boolean]
  --config, -c  Path to configuration file
                                    [string] [default: "/home/picard/.hardenize"]
  --org         Organization (falls back to config default_org)          [string]
  --format      Output format (falls back to config "default_format", otherwise
                "table")                [choices: "table", "yaml", "json", "csv"]
  --debug, -d   Displays debug information about API requests and responses
                                                                        [boolean]
  --help        Show help                                               [boolean]
$ hardenize certs create help
hardenize certs create

Create a certificate. (Reads PEM from stdin)

Options:
  --version     Show version number                                     [boolean]
  --config, -c  Path to configuration file
                                    [string] [default: "/home/picard/.hardenize"]
  --org         Organization (falls back to config default_org)          [string]
  --format      Output format (falls back to config "default_format", otherwise
                "table")                [choices: "table", "yaml", "json", "csv"]
  --debug, -d   Displays debug information about API requests and responses
                                                                        [boolean]
  --help        Show help                                               [boolean]
  --file, -f    Read cert from disk instead of stdin                     [string]

Configuration

Before you can run most commands, you will need to configure your credentials and a few other things by running hardenize local_config init

$ hardenize local_config init
* API Username: your api username
* API Password: your api password
  Default organization: your default org
  Default output format [table]: json
Configuration saved

Details will be saved to ~/.hardenize by default. Unless you specify the --config command line option to indicate a different path.

Many commands take an optional "--org" option. If you do not supply that arg, it will use the configured default org instead, or fail if there is none.

You can override configuration values using environment variables prefixed with HZ_. For example, to override a configuration item named "username", you would set the environment variable HZ_USERNAME

Most command simply display the results as returned from the API. By specifying --format on the command line, you can choose for them to be displayed in either table, table-per-row, yaml, json or csv format. The output defaults to your configs default_format option, or table if that does not exist.

Development

If you are a core developer of this library (you almost certainly aren't, unless you work for Hardenize Limited), you should check out DEVELOPMENT.md

Readme

Keywords

none

Package Sidebar

Install

npm i @hardenize/cli

Weekly Downloads

1

Version

0.53.0

License

Apache-2.0

Unpacked Size

83.8 kB

Total Files

93

Last publish

Collaborators

  • mikehardenize