Services

Services allow you to authenticate and login to servers using a service user. This enables you to leverage the security of ephemeral certificates when building automation that requires access to remote servers.

Services Example

Let's explore services with a basic example. Let's suppose you use your CI servers to deploy the latest build to your application servers. A typical solution for this would be to use static SSH keys without a passphrase and rely on SSH to perform whatever operations are required on the remote server. By defining a service in Advanced Server Access you'll be able to eliminate the static credential, and ensure that your CI user only has access to production when you intend it to.

Let's dive deeper into this example and explore how you could configure Jenkins to use service authentication to SSH to remote hosts.

To get started, configure these basic requirements first:

  1. Install the Advanced Server Access AgentA software agent is a lightweight program that runs as a service outside of Okta. It is typically installed behind a firewall and allows Okta to tunnel communication between an on-premises service and Okta's cloud service. Okta employs several agent types: Active Directory, LDAP, RADIUS, RSA, Active Directory Password Sync, and IWA. For example, users can install multiple Active Directory agents to ensure that the integration is robust and highly available across geographic locations. and enroll the server in Advanced Server Access
  2. Install the Advanced Server Access ClientEssentially, a client is anything that talks to the Okta service. Within the traditional client-server model, Okta is the server. The client might be an agent, an Okta mobile app, or a browser plugin. on the server
  3. Identify the UID of the jenkins user (on Linux you can use a command similar to this: id -u <user name>)
  4. Create a service user and add an API key to it
  5. Make sure the service user is provisioned on the servers you'd like to access

Now you can create a service which can securely authenticate to servers with Jenkins.

To create a service, navigate to the services tab on the server details page of the source server you identified earlier, where Jenkins is running.

Here you should see a list of existing services for this server and a button to create a new service. Click this button and it will prompt you to select the service user to authenticate as and the UID of the Jenkins user.

The final step for enabling service authentication is to configure sft. On your jenkins server, run sft config service_auth.enable true. This tells sft that it should attempt to use service authentication instead of expecting an enrolled client.

You should now be able to SSH to remote hosts managed by Advanced Server Access with a command like sft ssh <server-name>.

In order to fully leverage service authentication in Jenkins, you will want to configure an SSH proxycommand for the jenkins user so that you can transparently authenticate while using any command that relies on SSH. To do this, run sft proxycommand --config, and copy the output into the SSH configuration file for the jenkins user(e.g. /home/jenkins/.ssh/config). Read more about [proxy commands]({{%relref "ssh.md" %}}) to learn more about how they work.

Top