Configuring Different APIs17 minutes to read
For applications and scripts in your infrastructure that communicate with other applications using a password, you no longer have to hard-code the password in a configuration file or a script. They can securely query PAM360 to retrieve the password whenever they need, so that administrators are free to apply good practices like periodic rotation to such passwords as well, without worrying about having to update them manually in many places. Here in this document you will learn about the following topics:
1. Prerequisites to Configure the APIsThe following are the important points to be assured before configuring and using the APIs:
2. Workflow of the Steps involved in API ManagementThe following diagram illustrates the summary of steps involved in API management in PAM360: 3. Types of APIs SupportedPAM360 provides two API flavors:
The SSH CLI use PKI authentication for allowing access to the PAM360 application through the API. 4. Command Line Interface (CLI) for Scripts Over Secure Shell (SSH)Setting up CLI for Scripts over SSH involves the following steps:
4.1 Creating API User Accounts in PAM360This is the first step in the process to configure and use password management APIs for Application-to-Application Password Management. As mentioned above, user accounts have to be created in PAM360 to those who will use only the password management API. Every API user account should be attached to a single endpoint (server or desktop from where the API is used, so the user accounts are uniquely identified - for example, as user@hostname) To create an API user account:
![]() ![]() Note: The API user creation is specific to the host from where the application would contact PAM360 for passwords, That means, user and host are tied with other. If you want to make use of Password Management API from more than one host, you need to create as many API users as the number of hosts. Conversely, if you wish to have many users on a single host, then again you need to create as many API users as needed. 4.2 Configurations on the Server Side and Starting the SSH ServerPAM360 comes with an inbuilt SSH server. By default, it occupies 6622. You may configure it to run on any other desired port, if you wish to do so. You need to start the SSH server. To configure the SSH server port and to start it,
![]() 4.3 Configurations on the Client Side to Enable Applications Access to PAM360Once you have created API users and also started SSH server in PAM360, API users can access PAM360 for the passwords that are allotted to them. Note that the ownership and sharing mechanism of PAM360 applies in the case of API users too. That means, the API users will be able to access only those passwords that are allotted to them. Using Password Management APIs, users can retrieve, modify and create accounts. How does Password access workflow on the client-side work?Each user creates SSH public-private key pair for authentication purposes. The server knows the public key and the user knows the private key. The file <PAM360_HOME>/<user name>/.ssh/authorized_keys lists the public keys that are permitted for logging in. When the user logs in, the SSH program tells the server which key pair it would like to use for authentication. The server checks if this key is permitted, and if so, sends the user a challenge, a random number, encrypted by the user's public key. The challenge can only be decrypted using the proper private key. The user's client then decrypts the challenge using the private key, proving that user knows the private key but without disclosing it to the server. Once the authentication is successful, the user is permitted to do password management operations. API User Contacting PAM360 for various password operationsAs explained above, the API users will be allowed to access PAM360 for password retrieval and other operations only from the host in which they were configured to function. That is, during user creation, you would have entered the name of the host from where the API user would access PAM360 for password management operations. The API user will be allowed to access PAM360 only from the specified host. To retrieve passwords or to do any other password management operation, the applications running in the host should access the SSH server that runs with PAM360. The SSH server, in turn, connects to PAM360 for password operations. The SSH server can be accessed using any standard openSSH command. As explained below, along with the command, you need to append PAM360-specific commands to carry out the required password management operations. ssh -q [-p port] user@hostname [-i private_key] [PAM360 specific command]
For MSP Edition use the below command:ssh -q [-p port] ORGNAME/user@hostname [-i private_key] [PAM360 specific command]
4.3.1 PAM360 specific commands to be included in your application for application-to-application password management:For automatic A-to-A password management, you need to use specific commands in your application invoking the API. Use the give commands for the following operations: 1. For Password Retrievalssh -q [-p port] user@hostname [-i private_key] RETRIEVE --resource=<RESOURCE NAME As present in PAM360> --account=<ACCOUNT NAME As Present in PAM360> --reason=<REASON For Password Access> --ticketid=<TICKET ID For Password Access>
2. For Password Reset2.1 For Local Password Reset:ssh -q [-p port] user@hostname [-i private_key] RESET_LOCAL --resource=<RESOURCE NAME AS PRESENT IN PAM360> --account=<ACCOUNT_NAME As Present in PAM360> --newpassword=<NEW PASSWORD> --reason=<Reason for Password Reset> --ticketid=<TICKET ID For Password Reset>
2.2 For Remote Password Reset:ssh -q [-p port] user@hostname [-i private_key] RESET_REMOTE --resource=<RESOURCE NAME AS PRESENT IN PAM360> --account=<ACCOUNT_NAME As Present in PAM360> --newpassword=<NEW PASSWORD> --reason=<Reason for Password Reset> --ticketid=<TICKET ID For Password Reset>
3. For Creating a New Resource and a User Accountssh -q [-p port] user@hostname [-i private_key] CREATE --resource=<RESOURCE NAME To Be Created> --account=<ACCOUNT NAME to be created>--newpassword=<PASSWORD of the Account being added> --resourcetype=<Type of the Resource Being Added> --notes=<Reference Notes>
Refer this document for more details. Troubleshooting Tips1. When I executed the above command, I did not get any response from PAM360.Remove the -q option in the above commands. You will receive warning/error messages on the screen.
Contact PAM360 support with the message you see on the screen. 2. When I try to retrieve a password from PAM360 Secondary Server in High Availability mode, I do not get the required passwordEvery time after adding a new API user, the entire sshd folder available under <PAM360_Primary_Installation_Folder> has to be copied and pasted under <PAM360_Secondary_Installation_Folder>. If this is done, you will be able to access the passwords from PAM360 Secondary. 4.3.2 Accessing PAM360 Secondary for A-to-A Password Management (HA Mode - SSH CLI)If you have configured high availability setup in PAM360, when the Primary Server goes down, applications can seamlessly connect to the Secondary for A-to-A Password Management. For this to work, you need to make the following simple configuration:
As mentioned earlier, PAM360 comes with an inbuilt SSH server. It has to be started in the PAM360 secondary installation as explained below:If you have configured high availability setup in PAM360, when the Primary Server goes down, applications can seamlessly connect to the Secondary for A-to-A Password Management. For this to work, you need to make the following simple configuration:
4.3.3 Commands for accessing PAM360 Secondary ServerFor automatic A-to-A password management, you need to use the following commands in your application: 1. For Password Retrieval:ssh -q [-p port] user@PAM360_Secondary_hostname [-i private_key] RETRIEVE --resource=<RESOURCE NAME As present in PAM360> --account=<ACCOUNT NAME As Present in PAM360> --reason=<REASON For Password Access>
Once the above configuration is done, password access in high availability mode will be seamless. However, as write operations are not permitted when Primary Server is down,applications would only be able to RETRIEVE passwords. They will not be allowed to carry out password reset and resource/account creation. | |