86baa9
From fd9e724513e4c574cfa3f2498fbdae0682ccb9a9 Mon Sep 17 00:00:00 2001
86baa9
From: Alexander Bokovoy <abokovoy@redhat.com>
86baa9
Date: Tue, 19 Mar 2019 10:23:20 +0200
86baa9
Subject: [PATCH] Add design page for one-way trust to AD with shared secret
86baa9
86baa9
(cherry picked from commit b3911ade55eec139e07f8b4ea83612f1b2794857)
86baa9
86baa9
Reviewed-By: Christian Heimes <cheimes@redhat.com>
86baa9
---
86baa9
 .../oneway-trust-with-shared-secret.md        | 174 ++++++++++++++++++
86baa9
 1 file changed, 174 insertions(+)
86baa9
 create mode 100644 doc/designs/adtrust/oneway-trust-with-shared-secret.md
86baa9
86baa9
diff --git a/doc/designs/adtrust/oneway-trust-with-shared-secret.md b/doc/designs/adtrust/oneway-trust-with-shared-secret.md
86baa9
new file mode 100644
86baa9
index 0000000000000000000000000000000000000000..dc58a08941acea447f9234107ebcba775351089e
86baa9
--- /dev/null
86baa9
+++ b/doc/designs/adtrust/oneway-trust-with-shared-secret.md
86baa9
@@ -0,0 +1,174 @@
86baa9
+# One-way trust with shared secret
86baa9
+
86baa9
+## Overview
86baa9
+
86baa9
+FreeIPA does support trust to an Active Directory forest. The trust can be
86baa9
+established using administrative credentials from the forest root domain or
86baa9
+using a so-called shared secret. In the latter case no administrative access is
86baa9
+given to the remote side of the trust and each administrator performs their
86baa9
+configuration separately: FreeIPA administrator configures IPA side, Active
86baa9
+Directory administrator adds IPA forest as a trusted one on the Active
86baa9
+Directory side.
86baa9
+
86baa9
+For trust to be active, one needs to validate it. Validation process includes a
86baa9
+sequences of DCE RPC calls that force a domain controller on the trusted side
86baa9
+to establish a so-called "secure channel" to a remote domain controller in the
86baa9
+trusting domain. This is an administrative operation and requires
86baa9
+administrative privileges to activate. If trust was established using a shared
86baa9
+secret, IPA side will lack ability to initiate a validation process.
86baa9
+
86baa9
+At the same time, FreeIPA 4.6 or earlier versions do not include functionality
86baa9
+to allow a remote validation from Active Directory to happen before trust
86baa9
+objects are created and SSSD can retrieve information from the Active Directory
86baa9
+side. Unfortunately, the latter is not possible until trust is validated.
86baa9
+
86baa9
+The purpose of this design is to extend FreeIPA setup to allow trust validation
86baa9
+to be initiated from Windows UI in case a shared secret is used to create a
86baa9
+trust agreement.
86baa9
+
86baa9
+## Use Cases
86baa9
+
86baa9
+As a FreeIPA administrator, I'd like to establish a trust between an Active
86baa9
+Directory forest and a FreeIPA deployment using a shared secret. As FreeIPA
86baa9
+administrator, I have no administrative access to Active Directory and would
86baa9
+like to delegate the operation to create trust on Active Directory side to my
86baa9
+counterpart in Active Directory forest.
86baa9
+
86baa9
+
86baa9
+## How to Use
86baa9
+
86baa9
+
86baa9
+1. Establish a one-way trust with a shared secret on IPA side:
86baa9
+   `ipa trust-add <ad-domain> --shared-secret`
86baa9
+
86baa9
+2. On Windows side, open Active Directory Domain and Trusts tool
86baa9
+   * Open properties for the Windows forest
86baa9
+   * Choose 'Trusts' tab and press 'New trust' button there
86baa9
+   * Navigate through the trust wizard by entering:
86baa9
+      *  IPA forest name, then 'next'
86baa9
+      *  Choose 'Forest trust' on the Trust Type page
86baa9
+      *  Choose 'One-way: incoming' on the Direction of Trust page
86baa9
+      *  Choose 'This domain only' on the Sides of Trust page
86baa9
+      *  Enter the same shared secret one was using in step (1) with 'ipa trust-add'
86baa9
+   *  Complete trust wizard
86baa9
+
86baa9
+3. Going back to the trust properties, one can now validate the trust from Windows side.
86baa9
+
86baa9
+One limitation is that it is not possible to retrieve forest trust information
86baa9
+about IPA realm by Active Directory domain controllers due to the fact that
86baa9
+Samba configuration used by IPA does not support a remote query for this
86baa9
+information. It is only available when Samba is used in Samba AD configuration.
86baa9
+
86baa9
+TODO: check whether it is possible to force to set forest trust information
86baa9
+from IPA side after both sides of trust are were configured.
86baa9
+
86baa9
+## Design
86baa9
+
86baa9
+There are two important parts of the solution. On IPA side, there is a module
86baa9
+to allow Samba to look up trusted domains and user/group information in IPA
86baa9
+LDAP. On the other side, there is support for POSIX identities of trusted
86baa9
+domain objects in SSSD.
86baa9
+
86baa9
+### FreeIPA module for Samba passdb interface
86baa9
+
86baa9
+FreeIPA provides a special module for Samba, `ipasam`, that looks up
86baa9
+information about trusted domains and user/group in FreeIPA LDAP. The module
86baa9
+also maintains trust-related information when trust is created via  DCE RPC
86baa9
+interfaces.
86baa9
+
86baa9
+When trust is created, `ipasam` module needs to create a set of Kerberos
86baa9
+principals to allow Kerberos KDC to issue cross-realm ticket granting tickets.
86baa9
+These principals will have the same keys as trusted domain objects on Active
86baa9
+Directory level.
86baa9
+
86baa9
+When a secure channel is established between two domain controllers from
86baa9
+separate trusted domains, both DCs rely on the trusted domain object account
86baa9
+credentials to be the same on both sides. However, since Samba has to perform
86baa9
+SMB to POSIX translation when running in POSIX environment, it also needs to
86baa9
+have a POSIX identity associated with the trusted domain object account.
86baa9
+
86baa9
+As result, `ipasam` module needs to maintain POSIX attributes for the trusted
86baa9
+domain object account, along with Kerberos principals associated with the
86baa9
+trust.
86baa9
+
86baa9
+### SSSD
86baa9
+
86baa9
+When Windows successfully authenticates to Samba, Samba needs a POSIX identity
86baa9
+to run `smbd` processes as the authenticated 'user'. `smbd` and `winbindd`
86baa9
+processes use standard system calls to resolve authenticated user to a system
86baa9
+one (`getpwnam_r()`) and if the call fails, whole Windows request is rejected.
86baa9
+
86baa9
+Given that trusted domain object accounts are associated with the cross-realm
86baa9
+Kerberos principals, they are located in a special subtree in FreeIPA LDAP:
86baa9
+`cn=trusts,$SUFFIX`. However, SSSD does not look by default in this subtree for
86baa9
+users. By default, SSSD configuration for user accounts looks in
86baa9
+`cn=users,cn=accounts,$SUFFIX` for `id_provider = ipa` and will not be able to
86baa9
+see trusted domain object accounts.
86baa9
+
86baa9
+Thus, to allow Windows to successfully validate a one-way shared incoming trust
86baa9
+to FreeIPA, SSSD needs to resolve trusted domain object accounts as POSIX users
86baa9
+on IPA master side.
86baa9
+
86baa9
+
86baa9
+## Implementation
86baa9
+
86baa9
+### FreeIPA `ipasam` module
86baa9
+
86baa9
+`ipasam` module needs to create and maintain POSIX identities of the trusted
86baa9
+domain object accounts.
86baa9
+
86baa9
+Following objects and their aliases are created and maintained by `ipasam`
86baa9
+module. In the description below `REMOTE` means Kerberos realm of the Active
86baa9
+Directory forest's root domain (e.g. `AD.EXAMPLE.COM`), `REMOTE-FLAT` is
86baa9
+NetBIOS name of the Active Directory forest's root domain (e.g. `AD`).
86baa9
+Correspondingly, `LOCAL` means FreeIPA Kerberos realm (e.g. `IPA.EXAMPLE.COM`)
86baa9
+and `LOCAL-FLAT` is the NetBIOS name of the FreeIPA primary domain (e.g.
86baa9
+`IPA`).
86baa9
+
86baa9
+  Principal | Description
86baa9
+  --------- | -----------
86baa9
+  krbtgt/REMOTE@LOCAL | Cross-realm principal representing Active Directory forest root domain
86baa9
+  REMOTE-FLAT$@LOCAL | Trusted domain object account for the Active Directory forest root domain
86baa9
+  krbtgt/REMOTE-FLAT@LOCAL | Alias to REMOTE-FLAT$ TDO
86baa9
+  krbtgt/LOCAL@REMOTE | Cross-realm principal representing IPA domain in Active Directory forest to allow crross-realm TGT issuance from IPA KDC side
86baa9
+  LOCAL-FLAT$@REMOTE | Trusted domain object account for IPA domain in Active Directory forest
86baa9
+  krbtgt/LOCAL-FLAT@REMOTE | Alias to LOCAL-FLAT$
86baa9
+
86baa9
+For inbound trust `ipasam` module creates following principals:
86baa9
+  * `krbtgt/LOCAL@REMOTE`, enabled by default
86baa9
+  * `LOCAL-FLAT$@REMOTE`, used by SSSD to talk to Active Directory domain
86baa9
+    controllers, with canonical name set to `LOCAL-FLAT$` because Kerberos KDC
86baa9
+    must use this salt when issuing tickets for this principal. The use of this
86baa9
+    principal is disabled on IPA side (IPA KDC does not issue tickets in this name)
86baa9
+    --- we only retrieve a keytab for the principal in SSSD.
86baa9
+
86baa9
+For outbound trust `ipasam` module creates following principals:
86baa9
+  * `krbtgt/REMOTE@LOCAL`, enabled by default.
86baa9
+  * `REMOTE-FLAT$@LOCAL`, enabled by default. Used by a remote AD DC to
86baa9
+    authenticate against Samba on IPA master. This principal will have POSIX
86baa9
+    identity associated.
86baa9
+
86baa9
+
86baa9
+### SSSD
86baa9
+
86baa9
+In IPA master mode, SSSD needs to start look into `cn=trusts,$SUFFIX` subtree
86baa9
+in addition to `cn=users,cn=accounts,$SUFFIX` subtree to find trusted domain
86baa9
+object accounts. This can be achieved either by explicitly adding a second
86baa9
+search base to `ldap_search_user_base` option in the `[domain/...]` section or
86baa9
+by automatically expanding a list of search bases when running in the IPA
86baa9
+master mode. The latter is already implemented in SSSD 1.16.3 and 2.1.0 with
86baa9
+https://pagure.io/SSSD/sssd/c/14faec9cd9437ef116ae054412d25ec2e820e409
86baa9
+
86baa9
+
86baa9
+Feature Management
86baa9
+------------------
86baa9
+
86baa9
+We already allow to create a shared secret-based trust to Active Directory. No
86baa9
+functional change is needed in either Web UI or CLI.
86baa9
+
86baa9
+Upgrade
86baa9
+-------
86baa9
+
86baa9
+During upgrade POSIX identities need to be created for existing trust
86baa9
+agreements.
86baa9
+
86baa9
-- 
86baa9
2.20.1
86baa9