From 01df5e3995c54cb7283e60aa6f1a724d1c8d989c Mon Sep 17 00:00:00 2001 From: Laszlo Nagy Date: Tue, 15 Feb 2022 20:34:48 +0100 Subject: [PATCH] Add new role: logon policy for ad user Lists hosts where Active Directory users have been granted log on permission. --- README.md | 2 + examples/README.md | 4 + examples/run_logon_policy_for_ad_user.yml | 21 ++ .../logon_policy_for_ad_user_filters.py | 104 ++++++++ .../modules/get_logon_policy_for_unix_host.py | 16 ++ roles/logon_policy_for_ad_user/README.md | 97 +++++++ .../defaults/main.yml | 38 +++ roles/logon_policy_for_ad_user/meta/main.yml | 66 +++++ .../tasks/gather_facts.yml | 24 ++ .../tasks/generate_reports.yml | 11 + .../tasks/get_logon_policy_for_ad_user.yml | 25 ++ roles/logon_policy_for_ad_user/tasks/main.yml | 33 +++ .../tasks/utils/set_fact_failed.yml | 14 + .../tasks/utils/set_fact_success.yml | 10 + .../tasks/utils/set_fact_unreachable.yml | 14 + ..._2020-OneIdentity_FullColor_Horizontal.png | Bin 0 -> 14172 bytes ..._2020-OneIdentity_FullColor_Horizontal.txt | 249 ++++++++++++++++++ .../logon_policy_for_ad_user_report.csv.j2 | 21 ++ .../logon_policy_for_ad_user_report.html.j2 | 45 ++++ ...n_policy_for_ad_user_report_common.html.j2 | 242 +++++++++++++++++ roles/logon_policy_for_ad_user/vars/main.yml | 1 + 21 files changed, 1037 insertions(+) create mode 100644 examples/run_logon_policy_for_ad_user.yml create mode 100644 plugins/filter/logon_policy_for_ad_user_filters.py create mode 100644 roles/logon_policy_for_ad_user/README.md create mode 100644 roles/logon_policy_for_ad_user/defaults/main.yml create mode 100644 roles/logon_policy_for_ad_user/meta/main.yml create mode 100644 roles/logon_policy_for_ad_user/tasks/gather_facts.yml create mode 100644 roles/logon_policy_for_ad_user/tasks/generate_reports.yml create mode 100644 roles/logon_policy_for_ad_user/tasks/get_logon_policy_for_ad_user.yml create mode 100644 roles/logon_policy_for_ad_user/tasks/main.yml create mode 100644 roles/logon_policy_for_ad_user/tasks/utils/set_fact_failed.yml create mode 100644 roles/logon_policy_for_ad_user/tasks/utils/set_fact_success.yml create mode 100644 roles/logon_policy_for_ad_user/tasks/utils/set_fact_unreachable.yml create mode 100644 roles/logon_policy_for_ad_user/templates/Logo_2020-OneIdentity_FullColor_Horizontal.png create mode 100644 roles/logon_policy_for_ad_user/templates/Logo_2020-OneIdentity_FullColor_Horizontal.txt create mode 100644 roles/logon_policy_for_ad_user/templates/logon_policy_for_ad_user_report.csv.j2 create mode 100644 roles/logon_policy_for_ad_user/templates/logon_policy_for_ad_user_report.html.j2 create mode 100644 roles/logon_policy_for_ad_user/templates/logon_policy_for_ad_user_report_common.html.j2 create mode 100644 roles/logon_policy_for_ad_user/vars/main.yml diff --git a/README.md b/README.md index 63c9173..19fef53 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ The One Identity Safeguard Authentication Services Ansible Collection, referred * [`logon_policy_for_unix_host role`](roles/logon_policy_for_unix_host/README.md): Identifies the Active Directory users that have been explicitly granted log on permissions for the Unix hosts. +* [`logon_policy_for_ad_user role`](roles/logon_policy_for_ad_user/README.md): Identifies the hosts where Active Directory users have been granted log on permission. + ## Installation ### Prerequisites diff --git a/examples/README.md b/examples/README.md index 77a5699..5e551e7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -70,3 +70,7 @@ The [`ad_group_conflicts`](run_ad_group_conflicts.yml) role example shows use of The [`logon_policy_for_unix_host`](run_logon_policy_for_unix_host.yml) role example shows use of the `logon_policy_for_unix_host` role in an Ansbile playbook. The variables most likely to be overriden have been included in this playbook for your convenience even though many are still set to their default values. +## `logon_policy_for_ad_user` Role Example + +The [`logon_policy_for_ad_user`](run_logon_policy_for_ad_user.yml) role example shows use of the `logon_policy_for_ad_user` role in an Ansbile playbook. The variables most likely to be overriden have been included in this playbook for your convenience even though many are still set to their default values. + diff --git a/examples/run_logon_policy_for_ad_user.yml b/examples/run_logon_policy_for_ad_user.yml new file mode 100644 index 0000000..9a9d7a1 --- /dev/null +++ b/examples/run_logon_policy_for_ad_user.yml @@ -0,0 +1,21 @@ +--- + +- hosts: all + gather_facts: false + + # The variables you would most likely want/need to override have been included + vars: + + # Report parameters + logon_policy_for_ad_user_user_name: '' + + # Facts + logon_policy_for_ad_user_facts_generate: true + + # Reports + logon_policy_for_ad_user_reports_generate: true + logon_policy_for_ad_user_reports_backup: false + + roles: + - name: oneidentity.authentication_services.logon_policy_for_ad_user + diff --git a/plugins/filter/logon_policy_for_ad_user_filters.py b/plugins/filter/logon_policy_for_ad_user_filters.py new file mode 100644 index 0000000..6612999 --- /dev/null +++ b/plugins/filter/logon_policy_for_ad_user_filters.py @@ -0,0 +1,104 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# ------------------------------------------------------------------------------ +# Copyright (c) 2022, One Identity LLC +# File: logon_policy_for_ad_user_filters.py +# Desc: Ansible filters for logon_policy_for_ad_user role +# Auth: Laszlo Nagy +# Note: +# ------------------------------------------------------------------------------ + + +# ------------------------------------------------------------------------------ +# Imports +# ------------------------------------------------------------------------------ + +# Future module imports for consistency across Python versions +from __future__ import absolute_import, division, print_function + +# Want classes to be new type for consistency across Python versions +__metaclass__ = type + +from ansible.errors import AnsibleFilterError + + +# ------------------------------------------------------------------------------ +# Helper functions +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +def get_logon_policy_for_ad_user(logon_policy_for_unix_hosts): + """ + Example of logon_policy_for_unix_hosts: + { + "192.168.56.101": [ + [ + "QASDEV\\eripley", + "VAS", + "1003", + "10001", + "Ellen Ripley", + "/home/eripley", + "/bin/bash" + ], + [ + "QASDEV\\smartbela", + "VAS", + "1371126438", + "1000", + "Bela Smart", + "/home/smartbela", + "/bin/bash" + ] + ], + "192.168.56.103": [ + [ + "QASDEV\\eripley", + "VAS", + "1003", + "10001", + "Ellen Ripley", + "/home/eripley", + "/bin/bash" + ], + [ + "QASDEV\\senior", + "VAS", + "1234567", + "1000", + "Senior", + "/home/Senior", + "/bin/bash" + ] + ] + } + """ + + users = {} + for host in logon_policy_for_unix_hosts: + users_allowed = logon_policy_for_unix_hosts[host] + for user in users_allowed: + if user[0] not in users: + users.update({user[0]: {'user': user, 'hosts': [host]} }) + else: + users[user[0]]['hosts'].append(host) + + return users + + +# ------------------------------------------------------------------------------ +# Classes +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +class FilterModule(object): + """ + logon_policy_for_ad_user role jinja2 filters + """ + + def filters(self): + filters = { + 'logonpolicyforaduser': get_logon_policy_for_ad_user + } + return filters diff --git a/plugins/modules/get_logon_policy_for_unix_host.py b/plugins/modules/get_logon_policy_for_unix_host.py index 7041524..9c1abc5 100644 --- a/plugins/modules/get_logon_policy_for_unix_host.py +++ b/plugins/modules/get_logon_policy_for_unix_host.py @@ -34,6 +34,12 @@ vastool list users-allowed command. options: + user_name: + description: + - Return only the specified user or all users? + type: str + required: false + default: '' facts: description: - Generate Ansible facts? @@ -110,6 +116,7 @@ # ------------------------------------------------------------------------------ # Arg choices and defaults +USER_NAME_DEFAULT = '' FACTS_DEFAULT = True FACTS_VERBOSE_DEFAULT = True FACTS_KEY_DEFAULT = 'get_logon_policy_for_unix_host_facts_key' @@ -127,6 +134,11 @@ def run_module(): # Module argument info module_args = { + 'user_name': { + 'type': 'str', + 'required': False, + 'default': USER_NAME_DEFAULT + }, 'facts': { 'type': 'bool', 'required': False, @@ -178,6 +190,7 @@ def run_normal(params, result): users_allowed = [] # Parameters + user_name = params['user_name'] if params['user_name'] else USER_NAME_DEFAULT facts = params['facts'] facts_key = params['facts_key'] if params['facts_key'] else FACTS_KEY_DEFAULT @@ -190,6 +203,9 @@ def run_normal(params, result): if err is None: err, users_allowed = run_vastool_list_users_allowed() + if user_name: + users_allowed = [user for user in users_allowed if user[0] == user_name] + except Exception: tb = traceback.format_exc() err = str(tb) diff --git a/roles/logon_policy_for_ad_user/README.md b/roles/logon_policy_for_ad_user/README.md new file mode 100644 index 0000000..6c2214d --- /dev/null +++ b/roles/logon_policy_for_ad_user/README.md @@ -0,0 +1,97 @@ +# `logon_policy_for_ad_user` Role + +The `logon_policy_for_ad_user` role creates CSV and HTML reports that list the hosts where Active Directory users have been granted log on permission. + +## Variables + +All of the variables shown below have a default value but can be overridden to suit your environment. Variable overriding can be done in playbooks, inventories, from the command line using the `-e` switch with the `ansible-playbook` command, or from Ansible Tower and AWX. See [Ansbile documentation](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html) for further information. + +### Report parameters + +* `logon_policy_for_ad_user_user_name`: An Active Directory user can be specified in the following format: DOMAIN\SamAccountName. For example: EXAMPLE\jason. Reports will be generated for the specified user. If no user is specified then the reports will be generated for all Active Directory users who have been granted log on permission. + + Default value is: + ```yaml + logon_policy_for_ad_user_user_name: '' + ``` + +### Facts generation + +Facts generation variable defaults for all roles are set by variables in the [`common`](../common/README.md) role and can be overriden for all roles by setting the appropriate [`common`](../common/README.md) role variable. See [common role facts generation variables](../common/README.md#facts-generation) in the [`common`](../common/README.md) role. + +* `logon_policy_for_ad_user_facts_generate` enables facts generation. Implicitely enabled if `logon_policy_for_ad_user_reports_generate` is set. + + Default value is: + ```yaml + logon_policy_for_ad_user_facts_generate: "{{ facts_generate }}" + ``` + +### Report generation + +Report generation variable defaults for all roles are set by variables in the [`common`](../common/README.md) role and can be overriden for all roles by setting the appropriate [`common`](../common/README.md) role variable. See [common role report generation variables](../common/README.md#report-generation) in the [`common`](../common/README.md) role. + +* `logon_policy_for_ad_user_reports_generate` enables report generation. Reports are generated at the end of a `logon_policy_for_ad_user` run for all hosts. + + Default value is: + ```yaml + logon_policy_for_ad_user_reports_generate: "{{ reports_generate }}" + ``` + +* `logon_policy_for_ad_user_reports_backup` enables backup of prior reports by renaming them with the date and time they were generated so that the latest reports do not override the previous reports. + + Default value is: + ```yaml + logon_policy_for_ad_user_reports_backup: "{{ reports_backup }}" + + ``` + +* `logon_policy_for_ad_user_reports_host` sets the host on which the reports should be generated. + + Default value is: + ```yaml + logon_policy_for_ad_user_reports_host: "{{ reports_host }}" + ``` + +* `logon_policy_for_ad_user_reports` is a list of dictionaries that define the reports to be generated. The default value creates a CSV and HTML report using the templates included with the `logon_policy_for_ad_user` role. + + Default value is: + ```yaml + logon_policy_for_ad_user_reports: + - src: logon_policy_for_ad_user_report.csv.j2 + dest: logon_policy_for_ad_user_report.csv + - src: logon_policy_for_ad_user_report.html.j2 + dest: logon_policy_for_ad_user_report.html + ``` + + The `src` key for each list entry is the report template file on the Ansible control node. With a relative path Ansible will look in the `logon_policy_for_ad_user` role `template` directory. Use a absolute path to speciy templates located elsewhere on the Ansible control node. + + The `dest` key for each list entry is the report file on the machine specified in `logon_policy_for_ad_user_reports_host`. If `logon_policy_for_ad_user_reports_host` is set to the Ansible control node a relative path can be used and it will be relative to the directory from which the playbook is run. For other hosts, an absolute path must be used. In either case the containing directory must exist. + +## Usage + +Below is a sample playbook using the `logon_policy_for_ad_user` role. + +```yaml +--- + +- hosts: all + gather_facts: false + + # The variables you would most likely want/need to override have been included + vars: + + # Report parameters + logon_policy_for_ad_user_user_name: '' + + # Facts + logon_policy_for_ad_user_facts_generate: true + + # Reports + logon_policy_for_ad_user_reports_generate: true + logon_policy_for_ad_user_reports_backup: false + + roles: + - name: oneidentity.authentication_services.logon_policy_for_ad_user +``` + +For a copy of this and other sample playbooks see [examples](../../examples/README.md) diff --git a/roles/logon_policy_for_ad_user/defaults/main.yml b/roles/logon_policy_for_ad_user/defaults/main.yml new file mode 100644 index 0000000..b4a3013 --- /dev/null +++ b/roles/logon_policy_for_ad_user/defaults/main.yml @@ -0,0 +1,38 @@ +--- + +# Report parameters +# ------------------------------------------------------------------------------ + +logon_policy_for_ad_user_user_name: '' + + +# Facts settings +# ------------------------------------------------------------------------------ + +logon_policy_for_ad_user_facts_generate: "{{ facts_generate }}" + + +# Reports settings +# ------------------------------------------------------------------------------ + +logon_policy_for_ad_user_reports_generate: "{{ reports_generate }}" +logon_policy_for_ad_user_reports_backup: "{{ reports_backup }}" + +# On which host should the reports be generated. +# TODO: This has only been tested on the Ansible control node (127.0.0.1) +logon_policy_for_ad_user_reports_host: "{{ reports_host }}" + +# List of reports to generate +# src: Is the report template file on the Ansible control node. +# With no or relative path Ansible will look in the logon_policy_for_ad_user role template directory. +# Full path to find the template files elsewhere on the Ansible control node. +# dest: Is the destination file on the host (logon_policy_for_ad_user_reports_host.) +# With no or relative path when the destination is the Ansible control node. +# (logon_policy_for_ad_user_reports_host = 127.0.0.1) relative to the playbook directory. +# Full path for other locations or on other hosts. +# In either case the directory must already exist. +logon_policy_for_ad_user_reports: + - src: logon_policy_for_ad_user_report.csv.j2 + dest: logon_policy_for_ad_user_report.csv + - src: logon_policy_for_ad_user_report.html.j2 + dest: logon_policy_for_ad_user_report.html diff --git a/roles/logon_policy_for_ad_user/meta/main.yml b/roles/logon_policy_for_ad_user/meta/main.yml new file mode 100644 index 0000000..cd76742 --- /dev/null +++ b/roles/logon_policy_for_ad_user/meta/main.yml @@ -0,0 +1,66 @@ +--- + +galaxy_info: + + author: Laszlo Nagy + + company: One Identity + + description: > + Identifies the hosts where Active Directory users have been granted log on permission. + + issue_tracker_url: https://github.com/OneIdentity/ansible-authentication-services/issues + + license: Apache-2.0 + + min_ansible_version: 2.9 + + # + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + platforms: + - name: Amazon + versions: + - all + - name: MacOSX + versions: + - 10.12 + - 10.13 + - 10.14 + - 10.15 + - name: EL + versions: + - all + - name: Debian + versions: + - all + - name: Fedora + versions: + - all + - name: FreeBSD + versions: + - all + - name: AIX + versions: + - 7.1 + - 7.2 + - name: opensuse + versions: + - all + - name: Solaris + versions: + - all + - name: SLES + versions: + - 11 + - 12 + - 15 + - name: Ubuntu + versions: + - all + + # galaxy_tags: [] + +dependencies: + - role: common diff --git a/roles/logon_policy_for_ad_user/tasks/gather_facts.yml b/roles/logon_policy_for_ad_user/tasks/gather_facts.yml new file mode 100644 index 0000000..70522e3 --- /dev/null +++ b/roles/logon_policy_for_ad_user/tasks/gather_facts.yml @@ -0,0 +1,24 @@ +--- + +# Gather facts +- name: gather host information + setup: + register: result + ignore_errors: true + ignore_unreachable: true + +- name: fail when unreachable + fail: + msg: "{{ result.msg }}" + when: result.unreachable is defined and result.unreachable == true + +# MODULE FAILURE\nSee stdout/stderr for the exact error +- name: fail when module failure + fail: + msg: "{{ result.module_stderr + result.module_stdout }}" + register: result + when: result.msg is defined and "'See stdout/stderr for the exact error' in result.msg" + +- fail: + msg: "{{ result.msg }}" + when: result.msg is defined diff --git a/roles/logon_policy_for_ad_user/tasks/generate_reports.yml b/roles/logon_policy_for_ad_user/tasks/generate_reports.yml new file mode 100644 index 0000000..f5af2c4 --- /dev/null +++ b/roles/logon_policy_for_ad_user/tasks/generate_reports.yml @@ -0,0 +1,11 @@ +--- + +- name: generate reports + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + backup: "{{ logon_policy_for_ad_user_reports_backup }}" + with_items: "{{ logon_policy_for_ad_user_reports }}" + delegate_to: "{{ logon_policy_for_ad_user_reports_host }}" + run_once: true + changed_when: false diff --git a/roles/logon_policy_for_ad_user/tasks/get_logon_policy_for_ad_user.yml b/roles/logon_policy_for_ad_user/tasks/get_logon_policy_for_ad_user.yml new file mode 100644 index 0000000..92abf93 --- /dev/null +++ b/roles/logon_policy_for_ad_user/tasks/get_logon_policy_for_ad_user.yml @@ -0,0 +1,25 @@ +--- + +- name: Get logon policy for ad user + get_logon_policy_for_unix_host: + user_name: "{{ logon_policy_for_ad_user_user_name }}" + facts: "{{ logon_policy_for_ad_user_facts_generate or logon_policy_for_ad_user_reports_generate }}" + facts_key: sas_logon_policy_for_ad_user_key + register: result + failed_when: false + +# Fail if there was a message returned +- fail: + msg: "{{ result.msg }}" + when: result.msg + +- set_fact: + logon_policy_for_ad_user: | + {%- set logon_policy_for_unix_hosts = {} %} + {%- for host in play_hosts %} + {%- if logon_policy_for_unix_hosts.update({host: (hostvars[host].ansible_facts.sas_logon_policy_for_ad_user_key.users_allowed | default([])) }) %} + {%- endif %} + {%- endfor %} + {{ logon_policy_for_unix_hosts | oneidentity.authentication_services.logonpolicyforaduser() }} + run_once: true + diff --git a/roles/logon_policy_for_ad_user/tasks/main.yml b/roles/logon_policy_for_ad_user/tasks/main.yml new file mode 100644 index 0000000..4c202f9 --- /dev/null +++ b/roles/logon_policy_for_ad_user/tasks/main.yml @@ -0,0 +1,33 @@ +--- + +# ------------------------------------------------------------------------------ +# Main +# ------------------------------------------------------------------------------ + +- block: + + # Gather facts + - include_tasks: gather_facts.yml + + # Gather hosts where AD users have been granted log on permission + - include_tasks: get_logon_policy_for_ad_user.yml + + # We get here on success + - include_tasks: utils/set_fact_success.yml + + ignore_unreachable: true + + rescue: + + # Set unreachable status and fail + - include_tasks: utils/set_fact_unreachable.yml + when: result.unreachable is defined and result.unreachable == true + + # Set fail status and fail + - include_tasks: utils/set_fact_failed.yml + + always: + + # Generate reports + - include_tasks: generate_reports.yml + when: logon_policy_for_ad_user_reports_generate diff --git a/roles/logon_policy_for_ad_user/tasks/utils/set_fact_failed.yml b/roles/logon_policy_for_ad_user/tasks/utils/set_fact_failed.yml new file mode 100644 index 0000000..aeb6e8d --- /dev/null +++ b/roles/logon_policy_for_ad_user/tasks/utils/set_fact_failed.yml @@ -0,0 +1,14 @@ +--- + +# Set failed +- set_fact: + cacheable: true + sas_logon_policy_for_ad_user: + unreachable: false + failed: true + changed: false + when: logon_policy_for_ad_user_reports_generate or logon_policy_for_ad_user_facts_generate + +# Propogate fail +- fail: + msg: "{{ result.msg | default('Unexpected error') }}" diff --git a/roles/logon_policy_for_ad_user/tasks/utils/set_fact_success.yml b/roles/logon_policy_for_ad_user/tasks/utils/set_fact_success.yml new file mode 100644 index 0000000..32746f3 --- /dev/null +++ b/roles/logon_policy_for_ad_user/tasks/utils/set_fact_success.yml @@ -0,0 +1,10 @@ +--- + +# Set success +- set_fact: + cacheable: true + sas_logon_policy_for_ad_user: + unreachable: false + failed: false + changed: false + when: logon_policy_for_ad_user_reports_generate or logon_policy_for_ad_user_facts_generate diff --git a/roles/logon_policy_for_ad_user/tasks/utils/set_fact_unreachable.yml b/roles/logon_policy_for_ad_user/tasks/utils/set_fact_unreachable.yml new file mode 100644 index 0000000..75ebd86 --- /dev/null +++ b/roles/logon_policy_for_ad_user/tasks/utils/set_fact_unreachable.yml @@ -0,0 +1,14 @@ +--- + +# Set unreachable +- set_fact: + cacheable: true + sas_logon_policy_for_ad_user: + unreachable: true + failed: true + changed: false + when: logon_policy_for_ad_user_reports_generate or logon_policy_for_ad_user_facts_generate + +# Propogate fail +- fail: + msg: "{{ result.msg | default('Unexpected error') }}" diff --git a/roles/logon_policy_for_ad_user/templates/Logo_2020-OneIdentity_FullColor_Horizontal.png b/roles/logon_policy_for_ad_user/templates/Logo_2020-OneIdentity_FullColor_Horizontal.png new file mode 100644 index 0000000000000000000000000000000000000000..d95f3f326a54bb582576b5a5f21fbaf3d25b4f6a GIT binary patch literal 14172 zcmeIZ^Gq;K}nSoMo2d!N4JPFX&A5( z3erxLlp3FFzJB`NZr?xQy2Os&^VOVgAAdSPtP?!ie=P`NN5!~gyMPXqrS4LEgm zN}m%$WLf=8WhSyaSXz*_#Ok>yB#Sw4gBDvB2`#MobMMR(^7;+ze{B4&5WPqUgEE&z00mOW+xuA95I&%`2T z09Ir9eTi=ycRY@+B$^&8rr{}m+0{hvx*jj>;bW$o7)$=IPQ{aTo{an_HxA&L_07nJ7k0pUX37sG zi>WHzF?2}B<=tN{p^mxolu1zDfQ5Sy+NEL^ z`eni2!1~7n@t*-&(6&%Tp*zJMBVhg3FFetGPBZ@Ur`fI#%yYAlJ;eTX_uAaFj1+{I z6OI}n|BS9q{ZwF9g^C@F=ZX*850=le1dLBJ9Wsg>#yMl0B%0#iHgt;oN8$ZO#YWtf z==LQ-qlVGRQJv8#bfk!7wnI3zo1`F^ypT-VCzwzS@{dj{-&rqarL#vxwD=%c+}+`V)c9J4wsVwpi#)zRIF}URAwP_$p-`V*uPA)S#t23b+G(kAA`UxL zI900HdBWH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jQ5>}r(k;Dcxp&95{aQ0~9?7Baeu3pQ zH$|3D>i+}5G7Us0$>ca#=|)4M5*oooW!*&e%jXbr*{5^D|AhJj2xSTMC9TW7tG1^t zHSrU*?T&{>yt52W6h41rs#663AmRID=9~d%-@#(DET=(V4_uVu>-(VUpv`xJjoDqms&c9 z;qhI^huGZ^yVKd(IPvq}HL+H}Tnc9N*>fs6{#JwuP({SdLYR|muR4HV@m$}PTtB#R zYGqIT=LA2@(nD^9Ch#WQc{zhiT^I*=*N-cn?LB@?@sWQ_w9D*x>{)JKQd+K9yH?Nl zx#c~_L3F)b9z>v?kDuZW)!a7X4M1`g(x{W$%K*TRz-?DE2if^pAenhM*2SJr*2D83 zFg8P|!rmUx5(^&e)H?TV900C6DUSER8ocZOsL8hrZ^XMK7&I`)Sx~UCp8+#9z@3s2 z(B$!BkBoSEC!Ip3?Bab(88#JB;_ug$>;Mq}Wi{ij$u+>rt@Pb*QsPlRo%CX@kDwqz zxdRBAPjvtq&<_Yy+ipyl*z|o8cd6s+bNN#%MzJP{91_ie3-j@%l61GiPEq|2BHj_% zAT4nr5f$qq*Jal4U&Dx84d#)_cu8`~iSDcY*!`kcQeL#!)Q&6tpGTYan91Hw0lymY z85`3c!mVouJRH9BUZ?QVjgJX#K4x%--Jb`9A0wAOQRD!?^7cyrq?#$l-ak?cC)qBX znvXiuNlZiYhoiw?e-#~YkN55#`{1^e=2v;V|AzqwK<2IrjEF5My+oEpvfOD^v)Cy3wQ$6-n@Si5p8Ql_rC|grX8O-9k)%N#D9*01K9~^hK6MR zA-g+)4@8Y>|>*D#`dV?*NFvN&;J``Rb)T`|hA z8Wi^pz(?x + + {# Create overall page container #} +
+ + {# Title #} + {{ report.title(report_name) }} + + {# Data table #} + {{ report.table() }} + + {# Footer #} + {{ report.footer(collection_version, now(fmt='%Y-%m-%d %H:%M:%S')) }} + + {# JS libraries #} + {{ report.libraries() }} + + {# Table data #} + {{ report.table_data() }} + + {# Table detail formatter #} + {{ report.table_detail_formatter() }} + + {# Table detail copy tooltip #} + {{ report.table_detail_tooltip() }} + + {# Table cell style #} + {{ report.table_cell_style() }} + +
+ + + +{# HTML end #} +{{ report.end() }} diff --git a/roles/logon_policy_for_ad_user/templates/logon_policy_for_ad_user_report_common.html.j2 b/roles/logon_policy_for_ad_user/templates/logon_policy_for_ad_user_report_common.html.j2 new file mode 100644 index 0000000..9ccc8ec --- /dev/null +++ b/roles/logon_policy_for_ad_user/templates/logon_policy_for_ad_user_report_common.html.j2 @@ -0,0 +1,242 @@ +{# Header #} +{% macro head(report_name) %} + + + + + {# Required meta tags for Bootstrap #} + + + + {# CSS libraries include at end of head per best practices #} + + + + + {# Ionicons preferred method of inclusion #} + + + + Safeguard Authentication Services: {{ report_name }} + +{% endmacro %} + +{# Title #} +{% macro title(report_name) %} + +The Logon Policy for AD User report is used to identify the hosts where one or more AD Users have been granted logon permission. +
+{% if logon_policy_for_ad_user_user_name %} +Selected AD User: {{logon_policy_for_ad_user_user_name}}
+{% else %} +Selected AD User: All
+{% endif %} +
+{% endmacro %} + + +{# Table #} +{% macro table() %} + + + + + + + + + + + + + +
IdNumber of HostsUsernameUser IDGroup IDCommentHome DirectoryLogin Shell
+ +{% for policy in logon_policy_for_ad_user | sort %} + + + + + + + + + + + +
HostnameGroupIP AddressOS DistroOS VersionHW Arch
+{% endfor %} +{% endmacro %} + +{# Footer #} +{% macro footer(report_version, report_time) %} + +

Generated: {{ report_time }}

+

Version: {{ report_version }}

+
+{% endmacro %} + +{# JS libraries #} +{% macro libraries() %} + + + + + +{% endmacro %} + +{# Table data #} +{% macro table_data() %} + +{% endmacro %} + +{# Table detail formatter #} +{% macro table_detail_formatter() %} + +{% endmacro %} + +{# Table detail copy tooltip #} +{% macro table_detail_tooltip() %} + +{% endmacro %} + +{# Table cell style #} +{% macro table_cell_style() %} + +{% endmacro %} + +{# HTML end #} +{% macro end() %} + +{% endmacro %} diff --git a/roles/logon_policy_for_ad_user/vars/main.yml b/roles/logon_policy_for_ad_user/vars/main.yml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/roles/logon_policy_for_ad_user/vars/main.yml @@ -0,0 +1 @@ +---