이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 3. Hammer authentication


A Satellite user must prove their identity to Red Hat Satellite when entering hammer commands. Hammer commands can be run manually or automatically. In either case, hammer requires Satellite credentials for authentication. There are three methods of hammer authentication:

  • Hammer authentication session
  • Storing credentials in the hammer configuration file
  • Providing credentials with each hammer command

The hammer configuration file method is recommended when running commands automatically. For example, running Satellite maintenance commands from a cron job. When running commands manually, Red Hat recommends using the hammer authentication session and providing credentials with each command.

3.1. Authenticating Hammer using a configuration file

If you ran the Satellite installation with --foreman-initial-admin-username and --foreman-initial-admin-password options, credentials you entered are stored in the ~/.hammer/cli.modules.d/foreman.yml configuration file, and hammer does not prompt for your credentials.

You can also add your credentials to the ~/.hammer/cli.modules.d/foreman.yml configuration file manually:

:foreman:
 :username: 'username'
 :password: 'password'

Use only spaces for indentation in hammer configuration files, do not use tabs.

Important

If you change your credentials on Satellite Server, you must update the configuration file manually. The installer does not overwrite the configuration file.

3.2. Authenticating Hammer using CLI options

If you do not have your Satellite credentials saved in the ~/.hammer/cli.modules.d/foreman.yml configuration file, hammer prompts you for them each time you enter a command. You can specify your credentials when executing a command as follows:

$ hammer -u username -p password subcommands
Note

Examples in this guide assume that you have saved credentials in the configuration file, or are using a hammer authentication session.

3.3. Authenticating Hammer using sessions

The hammer authentication session is a cache that stores your credentials, and you have to provide them only once, at the beginning of the session. This method is suited to running several hammer commands in succession, for example a script containing hammer commands. In this scenario, you enter your Satellite credentials once, and the script runs as expected. By using the hammer authentication session, you avoid storing your credentials in the script itself and in the ~/.hammer/cli.modules.d/foreman.yml hammer configuration file.

See the instructions on how to use the sessions:

  • To enable sessions, add :use_sessions: true to the ~/.hammer/cli.modules.d/foreman.yml file:

    :foreman:
     :use_sessions: true

    Note that if you enable sessions, credentials stored in the configuration file will be ignored.

  • To start a session, enter the following command:

    # hammer auth login

    You are prompted for your Satellite credentials, and logged in. You will not be prompted for the credentials again until your session expires.

  • The default length of a session is 60 minutes. You can change the time to suit your preference. For example, to change it to 30 minutes, enter the following command:

    # hammer settings set --name idle_timeout --value 30
    Setting [idle_timeout] updated to [30]
  • To see the current status of the session, enter the following command:

    # hammer auth status
  • To end the session, enter the following command:

    # hammer auth logout
Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

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

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

Red Hat 소개

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

© 2024 Red Hat, Inc.