Boundary
Create a web TCP target
TCP targets provide a generic way to connect to any service Boundary has access to, including HTTP and HTTPS services.
The following examples use a direct target address for simplicity, but HashiCorp recommends that you configure host catalogs and host sets for scaled production deployments.
Complete the following steps to create a TCP target to connect to a web service. This example assumes an HTTPS service.
- Log in to Boundary.
- Select an org, and then select the project where you want to create a target.
- Select Targets under Project Actions.
- Click New Target.
- Complete the following fields:
- Name: (Required) A name for identification purposes. The name must be unique.
- Description: (Optional) An optional description of the target for identification purposes.
- Type: (Required) Select TCP to create a TCP target.
- Target Address (Optional) If you are not using host catalogs and host sets, you can enter a target address instead to map the target to a single address. This must be a valid IP address or DNS name.
- Default Port (Required) The default port on which to connect, such as
443. - Aliases (Optional) A globally-scoped unique identifier for the target, which makes the target easier to connect to using the CLI or transparent sessions. If you create an alias, click Add to assign it.
- Click Save.
Configure a brokered application credential
You can configure a brokered application credential for end users to connect to the target. Brokered credentials are exposed to the end user to allow them to authenticate to a target manually, or using connect helpers.
You can configure credentials for the TCP target using:
- Static credentials (
username_passwordorssh_private_key) - Vault generic credential library
Refer to the Configure targets with credential brokering page to learn how to configure a target with credential brokering.
Example
The following scenario assumes:
- A web server is deployed in your private network (Nginx, Apache, IIS, etc).
- A Boundary worker is deployed in your network and registered with the Boundary control plane.
- Your application domain has a registered DNS A-record and is resolvable by authenticated users on your network.
- SSL-signed certificates are installed on your web server, and you have distributed the root certificate to clients you want to connect to the web target. Clients should add the cert to their keychain to trust the CA that generated it.
- Your users have been onboarded to Boundary, manually or using an authentication method like OIDC or LDAP.
- You have created an org and a project where you want to set up the web target. This example calls the org
dev-projectsand the projectweb-infrastructure. The example may refer to the org by ID (such aso_c2Ah7bPMj5) or the project by ID (such asp_UXVxIgpZ8U), depending on whether you follow the UI, CLI, or Terraform workflows.
This example also assumes that you want to set up an access model with the following permissions:
- Unauthenticated users cannot access the address range
- Authenticated but unauthorized users cannot view the web target
- Authenticated and authorized users can start sessions to web target
This access model allows users connected to the web target through Boundary to access the address range, but they cannot connect to the target unless you grant a user access to it.
With these prerequisites in place, you can set up the permissions and targets to restrict access to the web target to an authenticated user. This example grants access to a single user, but using a group for authenticated users is more realistic.
Configure users and grants
To model the different access protocols, you should create an authorized and unauthorized user. These represent users that should and should not have access to the web application hosted on the target.
Create the unauthorized and authorized users:
- Log in to Boundary.
- Make sure you are in the
globalscope. The left sidebar will confirm you are at the Global Level. - Select Users under Global IAM.
- Create an unauthorized user:
- Click New User.
- Complete the following fields:
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the user
unauthorized. - Description: (Optional) An optional description of the target for identification purposes.
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the user
- Create an authorized user:
- Navigate back to the Users page and click New User.
- Complete the following fields:
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the user
authorized. - Description: (Optional) An optional description of the target for identification purposes.
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the user
- Click Save.
Assign minimal permissions to the unauthorized user in the global scope:
- Make sure you are in the
globalscope. - Click Roles in the sidebar. Click New Role.
- Complete the following fields:
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the role
unauthorized_global_role. - Description: (Optional) An optional description of the target for identification purposes. Click Save.
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the role
- Select the Principals tab for the new role. Click Add Principals.
- Select the box next to the
unauthorizeduser in theglobalscope and click Add Principals. - Select the Grants tab for the role.
- In the New Grant field, enter the grant string:
type=auth-token;ids=*;actions=read:self, then click Add. - Add another grant in the New Grant field:
type=user;actions=list-resolvable-aliases;ids=*, then click Add. - Click Save.
There are two grant strings in the example above:
"type=auth-token;ids=*;actions=read:self" This grant ensures that the user can authenticate to the Client Agent, if you are using a transparent sessions workflow.
"type=user;actions=list-resolvable-aliases;ids=*" This grant ensures that the user can read the aliases in a transparent sessions workflow.
Assign read permissions to the authorized user in the global scope:
- Make sure you are in the
globalscope. - Click Roles in the sidebar. Click New Role.
- Complete the following fields:
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the role
authorized_global_role. - Description: (Optional) An optional description of the target for identification purposes. Click Save.
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the role
- Select the Principals tab for the new role. Click Add Principals.
- Select the box next to the
authorizeduser in theglobalscope and click Add Principals. - Select the Grants tab for the role.
- In the New Grant field, enter the grant string:
ids=*;type=*;actions=read, then click Add. - Add another grant in the New Grant field:
type=auth-token;ids=*;actions=read:self, then click Add. - Add another grant in the New Grant field:
type=user;actions=list-resolvable-aliases;ids=*, then click Add. - Click Save.
The grant string "ids=*;type=*;actions=read" ensures that the user can read all resources in the global scope.
Assign full access permissions for the authorized user in the org scope:
- Click on Back to Global on the upper-right part of the page.
- On the Orgs page, select the name of your org (such as
dev-projectsor the ID likeo_c2Ah7bPMj5). - Click Roles in the sidebar. Click New Role.
- Complete the following fields:
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the role
authorized_org_role. - Description: (Optional) An optional description of the target for identification purposes. Click Save.
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the role
- Select the Principals tab for the new role. Click Add Principals.
- Select the box next to the
authorizeduser in theglobalscope and click Add Principals. - Select the Grants tab for the role.
- In the New Grant field, enter the grant string:
ids=*;type=*;actions=*, then click Add. - Click Save.
The grant string "ids=*;type=*;actions=*" ensures that the user can perform all actions in the scope.
Assign full access permissions for the authorized user in the project scope:
- Select Projects in the left-hand sidebar under Org Level.
- On the Projects page, select the name of your project (such as
web-infrastructureor the ID likep_UXVxIgpZ8U). - Click Roles in the sidebar. Click New Role.
- Complete the following fields:
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the role
authorized_project_role. - Description: (Optional) An optional description of the target for identification purposes. Click Save.
- Name: (Required) A name for identification purposes.
The name must be unique. This example calls the role
- Select the Principals tab for the new role. Click Add Principals.
- Select the box next to the
authorizeduser in theglobalscope and click Add Principals. - Select the Grants tab for the role.
- In the New Grant field, enter the grant string:
ids=*;type=*;actions=*, then click Add. - Click Save.
Configure the web target
Now that your test users exist, set up the web target. This example assumes the web target's host has a sample web application running on port 443 that the authorized user should have access to when connected through Boundary.
Create a TCP target for the web server. This example assumes port 443 for HTTPS.
- Select Targets under Project Actions.
- Click New Target.
- Complete the following fields:
- Name: (Required) A name for identification purposes. The name must be unique.
- Description: (Optional) An optional description of the target for identification purposes.
- Type: (Required) Select TCP to create a TCP target.
- Target Address (Optional) If you are not using host catalogs and host sets, you can enter a target address instead to map the target to a single address. This must be a valid IP address or DNS name.
- Default Port (Required) The default port on which to connect, such as
443. - Aliases (Optional) A globally-scoped unique identifier for the target, which makes the target easier to connect to using the CLI or transparent sessions. If you create an alias, click Add to assign it.
- Click Save.
Next steps
For an in-depth example of configuring HTTPS web targets, refer to the Secure remote access to private HTTPS targets with HashiCorp Boundary article on HashiCorp's blog.
To learn how to connect to a target, refer to Connection workflows.
To use target aliases to connect to targets:
- Create a target alias
- Connect to a target using an alias
- After you set up a target alias, you can optionally Configure transparent sessions for end users. HCP/ENT