Custom scripts (LAM Pro)
Prev | Chapter 3. Managing entries in your LDAP directory | Next

## Custom scripts (LAM Pro)

LAM Pro allows you to execute scripts whenever an account is created, modified or deleted. This can be useful to automate processes which needed manual work afterwards (e.g. sending your user a welcome mail or register a mailbox). To activate this feature please add the "Custom scripts" module to all needed account types on the configuration pages.

You can specify multiple scripts for each action type (e.g. modify) and account type (e.g. user). The scripts need to be located on the filesystem of your webserver and will be executed in its user environment. E.g. if you webserver runs as user www-data with the group www-data then the custom scripts will be run under this user with his rights. The output of the scripts will be shown in LAM.

You can specify the scripts on the LAM configuration pages.

Syntax:

Please enter one script per line. Each line has the following format: <account type> <action> <script>

E.g.: user preModify /usr/bin/myCustomScript -u $uid$

Account types:

You can setup scripts for all available account types (e.g. user, group, host, ...). Please see the help on the configuration page about your current active account types.

Actions:

Table 3.1. Action types

Action name | Description
preCreate | executed before creating a new account (cancels operation if a script returns an exit code > 0)
postCreate | executed after creating a new account
preModify | executed before the account is modified (cancels operation if a script returns an exit code > 0)
postModify | executed after an account was modified
preDelete | executed before an account was modified (cancels operation if a script returns an exit code > 0)
postDelete | executed after an account was modified

Script:

You can execute any script which is located on the filesystem of your webserver. The path may be absolute or relative to the PATH-variable of the environment of your webserver process. It is also possible to add commandline arguments to your scripts. Additionally, LAM will resolve wildcards to LDAP attributes. If your script includes an wildcard in the format $ATTRIBUTE$ then LAM will replace it with the attribute value of the current LDAP entry. The values of multi-value attributes are separated by commas. E.g. if you create an account with the attribute "uid" and value "steve" then LAM will resolve "$uid$" to "steve".

Output may contain HTML: If your scripts generate HTML output then activate this option.

Hide command in messages: You may want to prevent that your users see the executed commands. In this case activating this option will only show the command output but not the command itself.

You can see a preview of the commands which will be executed on the "Custom scripts" tab.

Prev | Up | Next
Password policies (LAM Pro) | Home | Sudo roles (LAM Pro)