Skip to main content

FreeIPA password expriation and locked user notifier

Project description

FreeIPA Notification

Upload Python Package

Notify IPA Users for password expiration and locked users to admin

Required packages:

  • krb5-devel
  1. Create a new role for notifier
    ipa role-add --desc "Notification agent role" "Notification Agent"
    
  2. Add privileges to the role
    ipa role-add-privilege "Notification Agent" --privileges="User Administrators"
    ipa role-add-privilege "Notification Agent" --privileges="Group Administrators"
    ipa role-add-privilege "Notification Agent" --privileges="Password Policy Readers"
    
  3. Create a new service and assign the role to this service
    ipa service-add NOTIFY/ipa1.example.com
    ipa role-add-member  "Notification Agent" --services="NOTIFY/ipa1.example.com@EXAMPLE.COM"
    ipa service-allow-retrieve-keytab "NOTIFY/ipa1.example.com@EXAMPLE.COM" --hosts=ipa1.example.com
    
  4. Obtain a keytab with fix permissions
    ipa-getkeytab -s ipa1.example.com -p "NOTIFY/ipa1.example.com@EXAMPLE.COM" -k ~/.priv/notify.keytab
    chmod -R 600 ~/.priv
    
  5. Run the command in noop mode for a successful user listing
  6. Create a script with proper permissions under /usr/local/sbin/
  7. Add a crontab entry. For example 0 0 * * * root ipa_notify.sh > /var/log/ipa_notify.log
  8. (Optional) You can create an email template folder and overwrite the message content. You can change the content but do not change file names or variable names. Template should start with Subject: keyword and there has to be new line between the subject and body. Please test your template before using.
$ python3 -c 'import ipa_notify;print(ipa_notify.__file__)'
/usr/local/lib/python3.6/site-packages/ipa_notify/__init__.py
$ cp -r /usr/local/lib/python3.6/site-packages/ipa_notify/templates ./mytemplates
# edit the content
$ ipa-notify ... --templates ./mytemplates

Parameters:

$ ipa-notify --help
usage: ipa-notify [-h] [--server SERVER] [--verify-ssl] [--no-verify-ssl] [--principal PRINCIPAL] [--keytab KEYTAB] [--groups GROUPS [GROUPS ...]] [--limit LIMIT] [--smtp-host SMTP_HOST] [--smtp-port SMTP_PORT]
                  [--smtp-user SMTP_USER] [--smtp-pass SMTP_PASS] [--smtp-from SMTP_FROM] [--admin ADMIN] [--noop] [--check-expiration] [--check-locked] [--templates TEMPLATES]
                  [--log-level {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}]

IPA Notifier

optional arguments:
  -h, --help            show this help message and exit
  --server SERVER       ipa server fqdn (default: ipa.domain.com)
  --verify-ssl          verify ipa connection SSL cert (default) (default: True)
  --no-verify-ssl       do not verify ipa connection SSL cert (default: True)
  --principal PRINCIPAL
                        user principal for kerberos authentication (default: admin@DOMAIN.COM)
  --keytab KEYTAB       keytab path (default: /tmp/user.kt)
  --groups GROUPS [GROUPS ...]
                        list of user groups to check (default: ['users'])
  --limit LIMIT         number of days before notifying a user (default: 5)
  --smtp-host SMTP_HOST
                        smtp host for sending email (default: localhost)
  --smtp-port SMTP_PORT
                        smtp port for sending email (default: 587)
  --smtp-user SMTP_USER
                        smtp user login (default: smtp_user)
  --smtp-pass SMTP_PASS
                        smtp user password (default: smtp_pass)
  --smtp-from SMTP_FROM
                        smtp from email address (default: noreply@domain.com)
  --admin ADMIN         admin user email to notify about locked users (default: admin@domain.com)
  --noop                no operation mode. Do not send emails (default: False)
  --check-expiration    Check password expirations for users (default: False)
  --check-locked        Check locked out users (default: False)
  --templates TEMPLATES
                        Custom email template folder (default: )
  --log-level {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}
                        log level (default: INFO)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipa-notify-0.3.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

ipa_notify-0.3.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file ipa-notify-0.3.1.tar.gz.

File metadata

  • Download URL: ipa-notify-0.3.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

File hashes

Hashes for ipa-notify-0.3.1.tar.gz
Algorithm Hash digest
SHA256 03d2926b1c2222c4223b43babf78dc9d5b04115e87750672b152a1cd68e14868
MD5 9e6f75414a927e67c48629ca2622bcd7
BLAKE2b-256 b2a59f538bff6898fe21c3a07374de3b9fee150fc0da96c617e76a2ea6b3a6b9

See more details on using hashes here.

File details

Details for the file ipa_notify-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: ipa_notify-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2

File hashes

Hashes for ipa_notify-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35f8bda7b1924386be1e60964de4e80c2cde0f7131bada31af4d9344e3273938
MD5 583053f940b8f23f97aae1ad3de4d53a
BLAKE2b-256 4f1e25511acd3dde28bf378e47a2a69ebdd5fa9d14ff79a5c1c734d62e7d07cb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page