# Windows Connector # Windows Connector ## Introduction ### Description This connector implements the LDAPS protocol and it is used to connect the Sync-Server with every server that allows this communication protocol. ### Managed System This connector has been performed to connect to the Active Directory system, it's a fork of our LDAP Connector with custom features.
For more information to check if your system may be synchronized with this connector you do not hesitate to contact us through our [Contact form](http://www.soffid.com/contactform/)
### Prerequisites To enable LDAPS in your Active Directory, please read the following guide: [SSL access to Active Directory](https://bookstack.soffid.com/books/connectors/page/howto-ssl-access-to-active-directory "HOWTO SSL access to Active Directory"). It is needed an Active Directory user with full administrator access. ## Download and Install This addon is located in the Connectors section and its name is **Windows (including Active Directory)**.For more information about the installation process you can visit the [Addons Getting started](https://bookstack.soffid.com/books/addons-getting-started/page/getting-started "Addons installation") page.
## Agent Configuration ### Basic #### Generic parameters After the installation of the addon, you may create and configure agent instances. This addon has 5 available agents: - Active Directory - Active Directory Only Passwords - Simple Windows AgentFor more information about how you may configure the generic parameters of the agent, see the following link: [Agents configuration](https://bookstack.soffid.com/books/soffid-3-reference-guide/page/agents "Agents")
#### Custom parameters Below there are the specific parameters for this agent implementation, "Active Directory" - Host name of the domain controller. - Active Directory distingished name in X500 format. e.g.: dc=soffid,dc=local - Administrator principal name in X500 format, relative to A.D name. e.g.: cn=Administrator,cn=Users - Administrator password**Parameter** | **Description** |
---|---|
Hostname | Host name of the server |
LDAP base DN | LDAP Base name |
Principal name | User name in DN format, including base name if needed |
Password | Password for the user to connect. |
Enable debug | Two options: \[ Yes / No \]. When it is enabled more log traces are printed in the Synchronization Server log |
Accepted certificates | Two options: \[ Only trusted certificates / Any (insecure) \] |
Follow referrals | Two options: \[ Don't / Yes \] If you select the Yes option, Soffid could follow the references to other systems if Soffid has the proper permissions. |
Manage child domains | Two options: \[ No / Yes \] If you select the Yes option, Soffid will manage the domain referrals. |
Create OUs when needed | Two options: \[ No / Yes \] If you select the Yes option and the OUs do not exist, these OUs will be created in the Active Directory. |
Real time load last login attribute | Two options: \[ No / Yes \] |
Real time load identity changes | Two options: \[ No / Yes \] You can check this option to synchronize the identities when Soffid is the authoritative data source. You must enable periodic synchronization. |
**Property** | **Description** |
---|---|
rename | AD agent will always map account and group names to the SAMAccount attribute. BaseDN and cn can be calculated based on user attributes. AD agent is able to move and rename AD objects. If you don't desire users or groups to be renamed or moved, an object property named "**rename**" with the value "**false**" can be added to some object mappings. |
searchBase | You can configure it if you want the reconciliation process to search accounts on a directory subtree other than AD root, put a searchBase property with the relative tree to look for. |
key | The AD attribute works as the primary key. Usually, it's the sAMAccountName and can be omitted. |
createDisabledAccounts | Set to true if you want the connector to create disabled accounts in the active directory. By default, disabled accounts are not created until enabled. |
**System attribute** | **Description** |
---|---|
objectClass | Active Directory object class. The following values mostly used "user", "group" or "organizationalUnit" |
baseDn | Active Directory container where user or group should be created. Its value should be absolute, containing Active Directory DC parts |
relativeBaseDn | Active Directory container where user or group should be created. Its value should be relative to Active Directory DC parts. |
cn | Object name |
**System attribute** | **Description** |
---|---|
sAMAccontName | Is automatically mapped. It is internally mapped to role name or account name, without further customization |
accountExpires | Sets the last date (in nanoseconds since 1600) in which the account will be valid. A common mapping expression is: ```Java if ( attributes {"expirationDate"} == null) return 9223372036854775807L; else return attributes{"expirationDate"}.getTime() * 10000L + 116445528000000000L; ``` |
samAccountType | Can be used to identify distribution lists. A value of 268435457 or 268435456 means the AD group is a distribution list group rather than a security group. |
lastLogon | The attribute can be used to get the last time an account was used. Soffid attribute is named **lastLogin** and the right mapping could be the following one. Mind when you make a reference to lastLogon attribute, every domain controller is queried about this attribute, as its value is not replicated across AD controllers: ```Java if ( lastLogon == null || lastLogon == void) return null; Long v = Long.decode(lastLogon); v = v / 10000000L; v-=11644473600L; return new Date(v*1000); => lastLogin ``` |
userCannotChangePassword | true/false This is a virtual attribute that can be used to indicate if a user can or cannot change the password. You can't assign this permission by directly modifying the UserAccountControl attribute. |
For more information about how you may configure attribute mapping, see the following link: [Soffid Attribute Mapping Reference](https://bookstack.soffid.com/link/72#bkmrk-soffid-attributes)
For instance: [](https://bookstack.soffid.com/uploads/images/gallery/2022-06/image-1654785419948.png) [](https://bookstack.soffid.com/uploads/images/gallery/2022-06/image-1654785472665.png) #### Triggers You can define BeanShell scripts that will be triggered when data is loaded into the target system (outgoing triggers). The trigger result will be a boolean value, true to continue or false to stop. Triggers can be used to validate or perform a specific action just before performing an operation or just after performing an operation on target objects.To view some examples, visit the [Outgoing triggers examples page](https://bookstack.soffid.com/books/connectors/page/outgoing-triggers-examples "Outgoing triggers examples").
## Avoid incremental load authoritative The Customizable Active Directory connector has an incremental load authoritative process. When this process is executed, it requests the changes to Active Directory after the **uSNChanged**. The value of this field is saved in Soffid in the parameter **soffid.sync.authoritative.change.NAME\_OF\_THE\_AGENT**If you want to launch a complete load authoritative process, remove this parameter first. At the end of the process, the parameter will be generated automatically.
For more information, go to the [Soffid Parameters page](https://bookstack.soffid.com/books/soffid-3-reference-guide/page/soffid-parameters "Soffid parameters"). ## Password Rotation When you are configuring password rotation using Windows Connector, it could be necessary to make some changes in the local computar policies. The Local Computer Policies on the target Windows server mentioned below: - **User Account Control: Admin Approval Mode for Built-in Administrator Account** - **User Account Control: Run All Administrator in Admin Approval Mode** Need to be disabled for PAM application to connect target server and reset password of privilege accounts. If the Policies are originally in ‘Enabled’ mode, then after disabling them a system restart may required for the Policies to get applied on target servers properly. To check the User Access Policies on servers, follow below mentioned path: Open group policy editor **Run > gpedit.msc > Local Computer Policy > Windows Settings > Security Settings > Local Policies > Security Options > select policy ‘User Account Control: Run all administrators in Admin Approval Mode’ and ‘User Account Control: Run All Administrator in Admin Approval Mode’ and select Disabled and apply > OK**. # HOWTO SSL access to Active Directory Table of Contents - [Introduction](#bkmrk-introduction). - [Installing the Certificate Services](#bkmrk-installing-the-certi). - [Configuring Automatic Certificate Request for Domain Controllers.](#bkmrk-configuring-automati) - [Check for Issued Certificate](#bkmrk-check-for-issued-cer). - [Import certificate](#bkmrk-import-certificate). ## Introduction This howto will show you how to install the Certificate Services in Windows Acive Directory Servers. Before beginning, make sure the Internet Information Server (IIS) is installed in your server. ## Installing the Certificate Services 1\. Click Start, select Control Panel and click Add or Remove Programs. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-installing-1.png) 2\. In the Add or Remove Programs window, click Add/Remove Windows Components, check the Certificate Services and click Next. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-installing-2.png) 3\. Click Next in the CA Type page. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-installing-3.png) 4\. Fill up the Common name for this CA and click Next. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-installing-4.png) 5\. Click Next in the Certificate Database Settings page. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-installing-5.png) 6\. The Certificate Services will now be installed. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-installing-6.png) 7\. Click Finish and restart your server. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-installing-7.png) ## Configuring Automatic Certificate Request for Domain Controllers 1\. Click Start, select Administrative Tools and click Domain Controller Security Policy. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-configuring-1.png) 2\. In the Default Domain Controller Security Settings window, click the Public Key Policies folder. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-configuring-2.png) 3\. Right click Automatic Certificate Request Settings, select New and click Automatic Certificate Request. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-configuring-3.png) 4\. Click Next in the Automatic Certificate Request Setup Wizard [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-configuring-4.png) 5\. Select Domain Controller in the Certificate Template page and click Next [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-configuring-5.png) 6\. Click Finish and reboot your server. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-configuring-6.png) ## Check for Issued Certificate 1\. Click Start, select Administrative Tools and click Certification Authority. This will launch the Certification Authority application. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-check-1.png) 2\. In Certification Authority, click the + sign and check the Issued Certificates folder if your server has been issued a certificate. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-check-2.png) ## Import certificate 1\. Select the certificate and open it. Select the "Certification Path" tab and select the root certificate. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-import-1.png) 2\. Click on "View Certificate" button and navigate to "Details" tab. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-import-2.png) 3\. Click on "Copy to File..." button and follow the export steps to obtain the certificate. [](https://bookstack.soffid.com/uploads/images/gallery/2021-04/win-connector-import-3.png) 4\. Open cmd and go to the soffid-iam-sync instalation directory and execute: ```shell jre\bin\keytool -import -file “file” -keystore conf\cacerts -alias AD_CERT ``` Afterwards, the console will ask you for a password. Type the default password: changeit and press enter. # Invoker interface for Active Directory Any agent, trigger or mapping can use the invoker method for the ActiveDirectory agent. The invoker method is available in the dispatcherService class. The invoker method is not specific of the Active Directory agent. Many other connectors support this method. The expected arguments are: - Action - Object name - Parameters Here you have an example of a post-update trigger to create the home server for a user: ```Java map = new HashMap(); String server = "//"+source{"homeServer"}+"/"+source{"accountName"}; // Create folder f = dispatcherService.invoke("smb:mkdir", server, map); // Add administrator ACL map.put("user", "soffid_admin"); map.put("permission", "GENERIC_ALL"); map.put("flags", "CONTAINER_INHERIT_ACE OBJECT_INHERIT_ACE"); f = dispatcherService.invoke("smb:addacl", path, map); // Add user ACL map.put("user", source{"accountName"}); f = dispatcherService.invoke("smb:addacl", path, map); // Change folder ownership using a domain admin account map.put("_auth_user", "user1"); map.put("_auth_domain", "domain1"); map.put("_auth_password", "SuperSecret"); f = dispatcherService.invoke("smb:setOwner", path, map); ``` The example above uses the smb:mkdir action to create the folder, the smb:addacl to add a new access control list entry. Other commands allow the query and modification of Active Directory objects like users and groups. The list of allowed commands are:**Command** | **Object name** | **Parameters** | **Comments** |
---|---|---|---|
insert | Object distinguished name | Object attributes | Creates a new active directory object |
update | Object distinguished name | Object attributes | Modifies an existing active directory object. Only the attributes present in the map will be updated |
delete | Object distinguished name | - | Removes an existing active directory object. |
select | Base distinguished name | Object criteria attribute | Search for any object with the values specified in the parameters map, starting in the specified base DN. The return value is a list of maps. Each element in the list is an Active Directory object |
get | Object distinguished name | - | Returns the object with the specified object DN. The return value is a list containing one or no maps. The map, if exists, contain the object attributes |
smb:mkdir | Shared file | Optionally: - \_auth\_user - \_auth\_password - \_auth\_domain | Creates the shared folder. The shared folder name should follow the syntax //server/sharedFolder/Path or \\\\server\\\\sharedFolder\\Path It is recommended to use the first syntax because the second one requires the script to escape any backslash character, leading to a harder to read script |
smb:exist | Shared file | Optionally: - \_auth\_user - \_auth\_password - \_auth\_domain | Returns a list with a single map. The map has the attribute exist with a boolean value indicating whether the file exists or not |
smb:rmdir | Shared file | Optionally: - \_auth\_user - \_auth\_password - \_auth\_domain | Removes the full directory and any file or directory within |
smb:rm | Shared file | Optionally: - \_auth\_user - \_auth\_password - \_auth\_domain | Removes the file or directory. The command will fail if the directory is not empty. |
smb:getacl | Shared file | Optionally: - \_auth\_user - \_auth\_password - \_auth\_domain | Returns a list of maps representing each access control list entry for that file or folder. Each map has three values: - user: The user or group name. When the user or group is unknown, the user or group SID is used. - permission: A text string with the permissions granted with that ACE. The string contains one or more of these values concatenated: - FILE\_READ\_DATA - FILE\_WRITE\_DATA - FILE\_APPEND\_DATA - FILE\_EXECUTE - FILE\_LIST\_DIRECTORY - FILE\_ADD\_FILE - FILE\_ADD\_SUBDIRECTORY - FILE\_TRAVERSE - FILE\_DELETE\_CHILD - FILE\_READ\_ATTRIBUTES - FILE\_WRITE\_ATTRIBUTES - FILE\_READ\_EA - FILE\_WRITE\_EA - DELETE - READ\_CONTROL - WRITE\_DAC - WRITE\_OWNER - SYNCHRONIZE - ACCESS\_SYSTEM\_SECURITY - MAXIMUM\_ALLOWED - GENERIC\_ALL - GENERIC\_EXECUTE - GENERIC\_WRITE - GENERIC\_READ - flags: A text string with the inheritance flags for that ACE. The string contains one or more of these values concatenated: - CONTAINER\_INHERIT\_ACE - FAILED\_ACCESS\_ACE\_FLAG - INHERIT\_ONLY\_ACE - INHERITED\_ACE - NO\_PROPAGATE\_INHERIT\_ACE - OBJECT\_INHERIT\_ACE - SUCCESSFUL\_ACCESS\_ACE\_FLAG |
smb:addacl | Shared file | Map with these three values: - user - permission - flags And optionally, these ones: - \_auth\_user - \_auth\_password - \_auth\_domain | Adds an access control list with the specified permission and flags |
smb:removeacl | Shared file | Map with these three values: - user - permission - flags And optionally, these ones: - \_auth\_user - \_auth\_password - \_auth\_domain | Remove the access control list entry that matches the map. If the permission or flag is missing, the connector will remove any access control list entry for the specified user |
smb:setowner | Shared file | Map with the value: - user And optionally, these ones: - \_auth\_user - \_auth\_password - \_auth\_domain | Sets the directory owner to the one specified in the map |