Skip to content

Commit

Permalink
New trust management module
Browse files Browse the repository at this point in the history
There is a new trust management module placed in the plugins folder:
plugins/modules/trust.py
The trust module allows to ensure presence and absence of trusts.

Here is the documentation for the module:
README-trust.md

New example playbooks have been added:
playbooks/trust/add-trust.yml
playbooks/trust/del-trust.yml
New tests added for the module:
tests/hbacrule/test_trust.yml
  • Loading branch information
Rob Verduijn committed Sep 3, 2020
1 parent 22ec1c5 commit b2fd94e
Show file tree
Hide file tree
Showing 6 changed files with 468 additions and 0 deletions.
119 changes: 119 additions & 0 deletions README-trust.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
Trust module
============

Description
-----------

The trust module allows to ensure presence and absence of a domain trust.

Features
--------

* Trust management

Supported FreeIPA Versions
--------------------------

FreeIPA versions 4.4.0 and up are supported by the ipatrust module.

Requirements
------------

**Controller**

* Ansible version: 2.8+

**Node**

* Supported FreeIPA version (see above)
* samba-4
* ipa-server-trust-ad

Usage
=====

Example inventory file

```ini
[ipaserver]
ipaserver.test.local
```

Example playbook to ensure a one-way trust is present:
Omitting the two_way option implies the default of one-way

```yaml
---
- name: Playbook to ensure a one-way trust is present
hosts: ipaserver
become: true

tasks:
- name: ensure the one-way trust present
ipatrust:
realm: ad.example.test
admin: Administrator
password: secret_password
state: present
```
Example playbook to ensure a two-way trust is present using a shared-secret:
```yaml
---
- name: Playbook to ensure a two-way trust is present
hosts: ipaserver
become: true

tasks:
- name: ensure the two-way trust is present
ipatrust:
realm: ad.example.test
trust_secret: my_share_Secret
two_way: True
state: present
```
Example playbook to ensure a trust is absent:
```yaml
---
- name: Playbook to ensure a trust is absent
hosts: ipaserver
become: true

tasks:
- name: ensure the trust is absent
ipatrust:
realm: ad.example.test
state: absent
```
This will only delete the ipa-side of the trust and it does NOT delete the id-range that matches the trust,
Variables
=========
ipatrust
-------
Variable | Description | Required
-------- | ----------- | --------
`ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
`ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
`realm` | The realm name string. | yes
`admin` | Active Directory domain administrator string. | no
`password` | Active Directory domain administrator's password string. | no
`server` | Domain controller for the Active Directory domain string. | no
`trust_secret` | Shared secret for the trust string. | no
`base_id` | First posix id for the trusted domain integer. | no
`range_size` | Size of the ID range reserved for the trusted domain integer. | no
`range_type` | Type of trusted domain ID range, It can be one of `ipa-ad-trust` or `ipa-ad-trust-posix`and defaults to `ipa-ad-trust`. | no
`two_way` | Establish bi-directional trust. By default trust is inbound one-way only. (bool) | no
`external` | Establish external trust to a domain in another forest. The trust is not transitive beyond the domain. (bool) | no
`state` | The state to ensure. It can be one of `present` or `absent`, default: `present`. | yes

Authors
=======

Rob Verduijn
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Features
* Modules for sudocmdgroup management
* Modules for sudorule management
* Modules for topology management
* Modules fot trust management
* Modules for user management
* Modules for vault management

Expand Down Expand Up @@ -427,6 +428,7 @@ Modules in plugin/modules
* [ipasudorule](README-sudorule.md)
* [ipatopologysegment](README-topology.md)
* [ipatopologysuffix](README-topology.md)
* [ipatrust](README-trust.md)
* [ipauser](README-user.md)
* [ipavault](README-vault.md)

Expand Down
12 changes: 12 additions & 0 deletions playbooks/trust/add-trust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Playbook to create a trust
hosts: ipaserver
become: true

tasks:
- name: ensure the trust is present
ipatrust:
realm: windows.local
admin: Administrator
password: secret_password
state: present
10 changes: 10 additions & 0 deletions playbooks/trust/del-trust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Playbook to delete trust
hosts: ipaserver
become: true

tasks:
- name: ensure the trust is absent
ipatrust:
realm: windows.local
state: absent
Loading

0 comments on commit b2fd94e

Please sign in to comment.