Guide to Standardized Hooks - Universal Password Trap

Introduction

The universal password trap hook triggers each time a user's password changes. This hook triggers regardless of which method changed the password, and regardless of whether the account is a cPanel or WHM account.

Warning:

This hook method is deprecated. To convert function hooks to use the Standardized Hooks system, use the API::Module::functionCpanel event or the Passwd event in your Hook Action Code.

Basic usage

To use the universal password trap hook, perform the following steps:

  1. Write a custom module that contains a process() subroutine.
    • The system runs this subroutine as the root user.
    • Your module can access, use, and store specific universal password trap module variables.
    • To write your module in a language other than Perl, create a Perl wrapper script that calls and executes another script.
  2. Store your custom module in the /usr/local/cpanel/Cpanel/ChangePasswd/ directory.

The system attempts to run the process() subroutine for each module file in the /usr/local/cpanel/Cpanel/ChangePasswd/ directory each time that a password changes.

Note:

If your script writes to a file, you must create that file before the script runs. 

 

Module variables

Warning:

Only transmit or store these variables over an SSL/TLS-encrypted connection. Storage or transmission of password information in plain text is a huge security risk.

Your module can access the following variables:

Variable

Type

Description

Possible values

Example

user

string

The account's username.

A valid username.

username

newpass

string

The account's new password.

A secure password.

12345luggage

message

string

A status message about the password change process.

A valid string.

The password changed successfully.

rawout

string

Raw output from the password change process.

A valid string.

Changing system password for user username.

 service_ref 

string

The cPanel product that changed the password.

  • cPanel
  • WHM
cPanel

applist

array of hashes

An array of hashes of the services that cPanel & WHM checks whenever a password changes.

An array of hashes of service information.
Note:
If the user chose not to update their MySQL® password, the applist value will not list MySQL information. 
 

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....