1.2. 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, the hammer authentication session and providing credentials with each command are recommended.
1.2.1. Hammer Authentication Session リンクのコピーリンクがクリップボードにコピーされました!
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
:foreman: :use_sessions: true
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
# hammer auth login
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
# hammer settings set --name idle_timeout --value 30 Setting [idle_timeout] updated to [30]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To see the current status of the session, enter the following command:
hammer auth status
# hammer auth status
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To end the session, enter the following command:
hammer auth logout
# hammer auth logout
Copy to Clipboard Copied! Toggle word wrap Toggle overflow