PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/beacons/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/beacons/aix_account.py

"""
Beacon to fire event when we notice a AIX user is locked due to many failed login attempts.

.. versionadded:: 2018.3.0

:depends: none
"""

import logging

log = logging.getLogger(__name__)

__virtualname__ = "aix_account"


def __virtual__():
    """
    Only load if kernel is AIX
    """
    if __grains__["kernel"] == "AIX":
        return __virtualname__

    err_msg = "Only available on AIX systems."
    log.error("Unable to load %s beacon: %s", __virtualname__, err_msg)
    return False, err_msg


def validate(config):
    """
    Validate the beacon configuration
    """
    # Configuration for aix_account beacon should be a dictionary
    if not isinstance(config, dict):
        return False, "Configuration for aix_account beacon must be a dict."
    if "user" not in config:
        return (
            False,
            "Configuration for aix_account beacon must include a user or ALL for all users.",
        )
    return True, "Valid beacon configuration"


def beacon(config):
    """
    Checks for locked accounts due to too many invalid login attempts, 3 or higher.

    .. code-block:: yaml

        beacons:
          aix_account:
            user: ALL
            interval: 120

    """

    ret = []

    user = config["user"]

    locked_accounts = __salt__["shadow.login_failures"](user)
    ret.append({"accounts": locked_accounts})

    return ret