Authenticate your login for the Mend CLI
Overview
You must log in to the Mend CLI once for each environment where it runs, which authenticates you to work in a single organization.
Mend CLI login example
Getting it done
Prerequisites before you log into the Mend CLI
The following operating systems are supported by the Mend CLI:
Linux (Intel and ARM processors): Ubuntu, Debian, and other flavors which have glibc (GNU C library)
Windows: Windows 10/11 or Windows Server 2016 and higher
MacOS: Docker for Mac is installed.
For Docker Desktop users: Enable the default Docker socket in the Advanced settings.
Have an active Mend license.
Obtain your service user key (recommended) or your user key:
Service user key: Mend Platform Application → Administration → Users → locate service user → Copy Token
Your user key: Mend Platform Application → My Profile → User Keys.
Log in to the Mend CLI via the interactive terminal
You can log in to the Mend CLI interactively by entering mend auth login
in your terminal:
Log in to the Mend CLI via environment variables
You can log in to the Mend CLI by defining environment variables.
Tip: As a common best practice, we strongly recommend creating and using a service user when configuring the Mend CLI authentication through environment variables in your CI/CD pipelines. Read more on service users in our Manage service users in the Mend Platform documentation.
To define the variables in your environment, you can:
Set environment variables prior to the Mend CLI run to persist between sessions:
In MacOS and Linux, use a shell startup script
In Windows, use the
setx
command.setx VARIABLE "MYVALUE"
Set environment variables prior to the Mend CLI run, for the current session only:
In MacOS and Linux, use the
export
command.export VARIABLE=value
In Windows, use the
set
command.set VARIABLE=value
Note: If you receive this error: Executing <mend dependencies> and the corresponding help command requires to authenticate first, either through environment variables or by executing mend auth login
.
Remove any MEND_SAST_*
variables from your environment and rerun the SCA scan.
For more information on MEND_SAST_*
variables, refer to our CLI Parameters documentation.
Set up a proxy and automatic updates for the Mend CLI
You can set up a proxy as well as toggle automatic updates for the Mend CLI for all scan types using the mend config
command. Read through our mend config parameters section within this documentation to learn more.
Note:
When automatic updates are disabled, the Mend CLI will still check for updates and notify you that a new version is available to download.
When running a Mend CLI scan with proxy enabled, the terminal output and logs will notify you that a proxy is being used after executing a command:
Running with proxy - https:/myproxy.prx
.
Verify the connection from the Mend CLI to the Mend Server
You can verify the connection from the Mend CLI on your environment to the Mend Server using the mend connectivity
command. The command checks if all external URL resources needed during the scan are accessible with the current network/proxy settings and reports an error for each URL where the access attempt fails.
To check the connectivity, you should:
Use the
mend connectivity --mend-url="MEND_URL"
command and insert the “Mend_URL” value for the connection test.MEND_URL represents the Mend environment URL. The supported values are available in Mend CLI - mend auth login parameters.
Reference
Mend CLI - mend auth login parameters
Note: For inline help, use mend auth login -h
or mend auth login --help
.
Parameter | Description |
---|---|
Command Line: | Select the Mend environment URL of your shared instance. The supported values are:
|
Command Line: | Select the Mend product(s) that you are authenticating for. The supported value is:
|
Command Line: | Input your user email that has access to the Mend organization from the Mend Platform Application → My Profile → Identity page. |
Command Line: | Input your service user key (recommended) or your personal user key that has access to the Mend organization:
|
Command Line: | Command Line: Select the Mend organization that you want to authenticate to from the provided organization list. Environment Variable: Provide your organization UUID. This can be found within the Mend Platform Application via settings(:mp_cogicon:) → Administration → General → Organization UUID: Tip: You can also access your organization’s UUID via Mend’s API 3.0 login call ( |
Mend CLI - mend config parameters
Parameter | Description |
---|---|
Command Line: | Default Value:
|
Command Line: | Whether to start the set up process for configuring a proxy:
|
Command Line: | Enter the URL of your proxy.
|
Command Line: | Whether to start the set up process of configuration proxy credentials:
|
Command Line: | Enter the username of your proxy authentication.
|
Command Line: | Enter the password of your proxy authentication.
|