2.3. Authenticating by using the roxctl CLI


For authentication, you can use an API token, your administrator password, or the roxctl central login command.

Follow these guidelines for the effective use of API tokens:

  • Use an API token in a production environment with continuous integration (CI). Each token is assigned specific access permissions, providing control over the actions it can perform. In addition, API tokens do not require interactive processes, such as browser-based logins, making them ideal for automated processes. These tokens have a time-to-live (TTL) value of 1 year, providing a longer validity period for seamless integration and operational efficiency.
  • Use your administrator password only for testing purposes. Do not use it in the production environment.
  • Use the roxctl central login command only for interactive, local uses.
참고
  • To prevent privilege escalation, when you create a new token, your role’s permissions limit the permission you can assign to that token. For example, if you only have read permission for the Integration resource, you cannot create a token with write permission.
  • If you want a custom role to create tokens for other users to use, you must assign the required permissions to that custom role.
  • Use short-lived tokens for machine-to-machine communication, such as CI/CD pipelines, scripts, and other automation. Also, use the roxctl central login command for human-to-machine communication, such as roxctl CLI or API access.
  • The majority of cloud service providers support OIDC identity tokens, for example, Microsoft Entra ID, Google Cloud Identity Platform, and AWS Cognito. OIDC identity tokens issued by these services can be used for RHACS short-lived access.
  • Third-party OIDC identity tokens can also be used directly to access the API endpoint, without an exchange, if a machine-to-machine configuration exists for the token issuer.

2.3.1. Creating an API token

Procedure

  1. In the RHACS portal, go to Platform Configuration Integrations.
  2. Scroll to the Authentication Tokens category, and then click API Token.
  3. Click Generate Token.
  4. Enter a name for the token and select a role that provides the required level of access (for example, Continuous Integration or Sensor Creator).
  5. Click Generate.

    중요

    Copy the generated token and securely store it. You will not be able to view it again.

2.3.2. Exporting and saving the API token

Procedure

  1. After you have generated the authentication token, export it as the ROX_API_TOKEN variable by entering the following command:

    $ export ROX_API_TOKEN=<api_token>
  2. (Optional): You can also save the token in a file and use it with the --token-file option by entering the following command:

    $ roxctl central debug dump --token-file <token_file>

    Note the following guidelines:

    • You cannot use both the -password (-p) and the --token-file options simultaneously.
    • If you have already set the ROX_API_TOKEN variable, and specify the --token-file option, the roxctl CLI uses the specified token file for authentication.
    • If you have already set the ROX_API_TOKEN variable, and specify the --password option, the roxctl CLI uses the specified password for authentication.

2.3.3. Using an authentication provider to authenticate with roxctl

You can configure an authentication provider in Central and initiate the login process with the roxctl CLI. Set the ROX_ENDPOINT variable, initiate the login process with the roxctl central login command, select the authentication provider in a browser window, and retrieve the token information from the roxctl CLI as described in the following procedure.

Prerequisite

  • You selected an authentication provider of your choice, such as OpenID Connect (OIDC) with fragment or query mode.

Procedure

  1. Run the following command to set the ROX_ENDPOINT variable to Central hostname and port:

    export ROX_ENDPOINT=<central_hostname:port>
  2. Run the following command to initiate the login process to Central:

    $ roxctl central login
  3. Within the roxctl CLI, a URL is printed as output and you are redirected to a browser window where you can select the authentication provider you want to use.
  4. Log in with your authentication provider.

    After you have successfully logged in, the browser window indicates that authentication was successful and you can close the browser window.

  5. The roxctl CLI displays your token information including details such as the access token, the expiration time of the access token, the refresh token if one has been issued, and notification that these values are stored locally.

    Example output

    Please complete the authorization flow in the browser with an auth provider of your choice.
    If no browser window opens, please click on the following URL:
            http://127.0.0.1:xxxxx/login
    INFO:	Received the following after the authorization flow from Central:
    INFO:	Access token: <redacted>
    INFO:	Access token expiration: 2023-04-19 13:58:43 +0000 UTC
    INFO:	Refresh token: <redacted>
    INFO:	Storing these values under $HOME/.roxctl/login…

    • Access token: <redacted> is the access token.
    • Access token expiration: 2023-04-19 13:58:43 +0000 UTC is the expiration time of the access token.
    • Refresh token: <redacted> is the refresh token.
    • $HOME/.roxctl/login… is the directory where values of the access token, the access token expiration time, and the refresh token are stored locally.

      중요

      Ensure that you set the environment to determine the directory where the configuration is stored. By default, the configuration is stored in the $HOME/.roxctl/roxctl-config directory.

      • If you set the $ROX_CONFIG_DIR environment variable, the configuration is stored in the $ROX_CONFIG_DIR/roxctl-config directory. This option has the highest priority.
      • If you set the $XDG_RUNTIME_DIR environment variable and the $ROX_CONFIG_DIR variable is not set, the configuration is stored in the $XDG_RUNTIME_DIR /roxctl-config directory.
      • If you do not set the $ROX_CONFIG_DIR or $XDG_RUNTIME_DIR environment variable, the configuration is stored in the $HOME/.roxctl/roxctl-config directory.
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동