Configure Active Directory
Active Directory can be configured using the VM Squared wizard or by directly editing the configuration file.
Assumptions
- Have followed the steps in Installation and have a working VM Squared cluster.
- Have added SSH key to the Cluster SSH Authorized Keys outlined in Dashboard Console
- Knowledge of the AD configuration and credentials
Gather pre-requisite information
You will need several pieces of information from your Active Directory domain before proceeding with the configuration:
- The IP of a domain controller that is accessible by the dashboard
- The credentials of a user account with permissions to read AD objects (typically a dedicated “bind” user is recommended)
- The distinguished name of the base location within your AD domain from which you wish to search for users and groups
- The distinguished name of the security group which contains the users to whom you wish to grant access
Distinguished Names
The distinguished names be easily obtained through the use of a simple PowerShell script run on a domain controller or a domain-joined machine:
Warning
SoftIron provides these scripts as reference examples, to be modified by local experts to match the needs of your organization. Despite our best efforts, errors can occur during script execution. We do not recommend running these scripts without a clear understanding of their possible impact to your environment. SoftIron is not liable for any errors in these scripts or for any damage that may result from their use.
PowerShell script to collect AD information
If desired, the distinguished names can also be obtained directly from the Active Directory Users and Computers MMC
Ensure that the Advanced Features view is enabled
Navigate to the desired location to grab the base DN, (typically this is just your root domain), right-click, and under Properties, select “Distinguished Name” under Attribute Editor
Navigate to the desired group that contains the users you wish to grant access to, and under Properties, select “Distinguished Name” under Attribute Editor
AD Configuration
Active Directory is configured on VM Squared through the dashboard console.
AD Configuration Wizard
This guide illustrates the use of the AD configuration wizard to create and test the configuration file prior to it being applied to the VM Squared cluster.
- SSH onto the VM Squared dashboard console and run the manage-ldap command
- Select option 1 to create a new AD configuration with the wizard, and hit enter.
- Enter the hostname or IP address of a domain controller accessible by the dashboard.
- Enter the username of the bind account that has permissions to read AD objects in the format of “username@domain”, followed by its password.
- Enter the base distinguished name to search for target users and groups, for the example above:
- Enter the distinguished name of the security group you wish to use, for the example above: CN=normal-users,OU=Groups,OU=TEST-LABS,DC=TEST-LABS,DC=sa,DC=test,DC=com
- Select the group in the dashboard (or create a new one) to which you wish to map the AD group
- You may add additional mappings at this time if desired, but if you are only adding one group, select
n
and hit enter
- At this time, you can choose to test the configuration by selecting the
Test
option and entering the credentials of a user that exists in the security group selected previously.
- Once the test is successful, commit the changes to save the configuration.
- Once changes have been committed, select
Quit
.
At this point Active Directory has been enabled on the VM Squared cluster.
Manually Editing the AD Configuration
In some cases it may be preferable to manually define the Active Directory configuration file. The steps below will guide you through the manual configuration process.
- Connect to the dashboard via SSH and run the manage-ldap command.
- Select the “Create new AD configuration” option
- A sample file will be opened in a text editor. First, you’ll want to change the values for :user: and :password: to reflect that of the bind user that has permissions to read your AD domain.
- Next, change the value of :host: to reflect either the IP or FQDN of the desired domain controller. In most cases, the value of :port: should stay the same, but can be changed if applicable.
- If needed, you can change the value of :timeout:, but in most cases the default should suffice. If a change is needed, uncomment the line and change the value.
- Define the base DN in which users and groups are located. Typically this is the root of the domain
- In most cases, the :user_field: value should be set to ‘sAMAccountName’. This allows users to log in as simply “username” instead of “username@domain.com”
- The value of :mapping_timeout: should remain set to the default value
- Set a value for the name of the mapping file. This is typically recommended to be left as mapping.yaml, but if the name is changed you must remember to specify that in a later step in which group mapping is defined.
- The :order: value should be left at its default unless you’ve added an additional authentication server. You can add an additional server if needed, just ensure that the next one is defined as server2, then server3, etc.
Below is an example of a complete configuration file based on the information provided in the steps of using the Configuration Wizard.
Now that the configuration file has been edited, save your changes with CTRL + S, and then hit CTRL + Q to exit the editor.
At the configuration management menu, select the option for Group Mappings
- If you left the value of :mapping_filename: the default value in step 9 above, select option 2. Otherwise, select option 1 to create a new mapping file
- Replace “cn=example_group,ou=Groups,dc=my_company,dc=com” with the distinguished name of the AD group you wish to map, and replace “1” with the ID of a group within the dashboard that you wish to map to the AD group. In some cases, the value 1 may be accurate and can be left in place.
Add lines as-needed to map additional groups. When finished save your changes with CTRL + S, and then hit CTRL + Q to exit the editor.
At the Group Mappings menu, select the option to go Back, and then commit your changes at the Configuration Management Menu
Prior to testing the connection, follow the steps in the “Adding Users” section to ensure all of the requisite users have been created in the dashboard.
At the Configuration Management menu, select the
Test
option, and follow the prompts to confirm the connection is valid.
- Select the
Quit
option to exit themanage-ldap
menu
At this point Active Directory has been enabled on the VM Squared cluster.
Adding AD Users to VM Squared
Please note that you must create placeholder users in the UI and associate them with the proper group before they will be able to log in. You can create users via the Glasshouse GUI, Manifold API calls, or the VM Squared Dashboard. This guide will focus on the first two options.
Creating Users With the Glasshouse GUI
After logging in, navigate to System > Users. Click the Create button to create a user.
Ensure that the username entered matches the username of a user that belongs to an AD group mapped during the configuration.
- Change the “Authentication Type” to LDAP.
- Enter a random character string in the “Password” and “Confirm Password” fields (it simply needs to match), this is required for user creation but does not need to be remembered and will not be used again.
Click next, and ensure that the user’s primary group matches the mapping defined during the AD configuration wizard.
Click Finish. The user is now able to log in.
Creating Users Systematically With the Manifold API
To simplify this process, a PowerShell script (provided below) can be used to create the requisite users based on the desired Active Directory group’s current members. The requirements to run this are as follows:
- This script must be run on a domain-joined machine with proper permissions to read AD objects.
- The machine on which it is run must have the ActiveDirectory PowerShell module installed and loaded.
- It requires credentials of a user account with permissions to create and manage users & groups within VM Squared.
Warning
SoftIron provides these scripts as reference examples, to be modified by local experts to match the needs of your organization. Despite our best efforts, errors can occur during script execution. We do not recommend running these scripts without a clear understanding of their possible impact to your environment. SoftIron is not liable for any errors in these scripts or for any damage that may result from their use.
Running the script
Save the code block at the end of this article as a ‘.ps1’ file (for illustration purposes, the file is named ‘Manage-Dashboard-Users.ps1’.
Open PowerShell and call the script.
Enter the name of the AD group you wish to use to create the VM Squared users (in the form of samAccountName). For the example domain illustrated here, that value is “normal-users”.
Enter the IP or FQDN of the dashboard.
In the credential window that appears, enter the username and password of a VM Squared user with administrative permissions.
Select the number of the VM Squared group to which you wish to map the AD users.
This script will now determine if the users in the AD group already exist, and if not, automatically create them. This can be run ad-hoc and it will not overwrite existing users.