lib/config.inc

Properties

Description

This file includes functions to manage the configuration files.

Functions

setSSLCaCert( ) : n/a

Description

Sets the environment variables for custom SSL CA certificates.

Return value

Type Description
n/a n/a

setlanguage( ) : n/a

Description

Sets language settings for automatic translation

Return value

Type Description
n/a n/a

checkChmod(   $right,   $target,   $chmod, ) : \true,

Description

Checks whether a specific flag in the rights string is set.

Arguments

Name Type Description Default
$right n/a

read,write or execute

$target n/a

owner,group or other

$chmod n/a

the chmod rights

Return value

Type Description
\true, if the chmod $right for $target were set

getConfigProfiles( ) : array

Description

Returns an array of string with all available configuration profiles (without .conf)

Return value

Type Description
array profile names

deleteConfigProfile( String   $name, ) : String

Description

Deletes the given server profile.

Arguments

Name Type Description Default
$name String

profile name

Return value

Type Description
String null if success or error message if failed

LAMVersion( ) : string

Description

Returns the version number of this LAM installation.
Format: ..
Major/minor version are always numbers, patch level may contain letters for inofficial releases only (e.g. 0.5.alpha1).

Return value

Type Description
string version number

metaRefresh( string   $page, ) : n/a

Description

Prints a meta refresh page

Arguments

Name Type Description Default
$page string

the URL of the target page

Return value

Type Description
n/a n/a

isAccountTypeHidden( String   $type, ) : boolean

Description

Checks if the given account type is hidden.

Arguments

Name Type Description Default
$type String

account type (e.g. user)

Return value

Type Description
boolean is hidden

Classes

LAMConfig

Properties

 
 
No 
No 

Description

This class manages .conf files.

Methods

__construct, check_Passwd, getAccessLevel, getHttpAuthentication, getLamProMailFrom, getLamProMailIsHTML, getLamProMailReplyTo, getLamProMailSubject, getLamProMailText, getLoginMethod, getLoginSearchDN, getLoginSearchFilter, getLoginSearchPassword, getLoginSearchSuffix, getName, getPath, getToolSettings, getUseTLS, get_AccountModules, get_ActiveTypes, get_Admins, get_Adminstring, get_ServerURL, get_Suffix, get_cacheTimeout, get_cacheTimeoutSec, get_defaultLanguage, get_listAttributes, get_moduleSettings, get_scriptPath, get_scriptRights, get_scriptServers, get_searchLimit, get_typeSettings, hashPassword, isWritable, reload, save, setAccessLevel, setHttpAuthentication, setLamProMailFrom, setLamProMailIsHTML, setLamProMailReplyTo, setLamProMailSubject, setLamProMailText, setLoginMethod, setLoginSearchDN, setLoginSearchFilter, setLoginSearchPassword, setLoginSearchSuffix, setToolSettings, setUseTLS, set_AccountModules, set_ActiveTypes, set_Adminstring, set_Passwd, set_ServerURL, set_Suffix, set_cacheTimeout, set_defaultLanguage, set_listAttributes, set_moduleSettings, set_scriptPath, set_scriptRights, set_scriptServers, set_searchLimit, set_typeSettings,

__construct( String   $file, ) : n/a

Description

Loads preferences from config file

Arguments

Name Type Description Default
$file String

file name without ".conf" (e.g. lam)

Return value

Type Description
n/a n/a

check_Passwd( String   $password, ) : boolean

Description

Checks if the given password matches.

Arguments

Name Type Description Default
$password String

Return value

Type Description
boolean true, if matches

getAccessLevel( ) : int

Description

Returns the access level for this profile.

Return value

Type Description
int level

getHttpAuthentication( ) : String

Description

Returns if HTTP authentication should be used.

Return value

Type Description
String $httpAuthentication use HTTP authentication ('true' or 'false')

getLamProMailFrom( ) : String

Description

Returns the sender address for password reset mails.

Return value

Type Description
String mail address

getLamProMailIsHTML( ) : boolean

Description

Returns if the password reset mail content should be treated as HTML.

Return value

Type Description
boolean HTML or text

getLamProMailReplyTo( ) : String

Description

Returns the reply-to address for password reset mails.

Return value

Type Description
String mail address

getLamProMailSubject( ) : String

Description

Returns the subject for password reset mails.

Return value

Type Description
String subject

getLamProMailText( ) : String

Description

Returns the mail body for password reset mails.

Return value

Type Description
String body

getLoginMethod( ) : String

Description

Returns the login method.

Return value

Type Description
String login method

Tags

Name Description
see
see

getLoginSearchDN( ) : String

Description

Returns the DN for the login search bind user.

Return value

Type Description
String DN

getLoginSearchFilter( ) : String

Description

Returns the login search filter.

Return value

Type Description
String search filter

getLoginSearchPassword( ) : String

Description

Returns the password for the login search bind user.

Return value

Type Description
String password

getLoginSearchSuffix( ) : String

Description

Returns the login search suffix.

Return value

Type Description
String suffix

getName( ) : String

Description

Returns the name of the config file

Return value

Type Description
String name

getPath( ) : string

Description

Returns the path to the config file.

Return value

Type Description
string path on filesystem

getToolSettings( ) : array

Description

Returns the tool settings.

Return value

Type Description
array $toolSettings tool settings

getUseTLS( ) : String

Description

Returns if TLS is activated.

Return value

Type Description
String yes or no

get_AccountModules( string   $scope, ) : array

Description

Returns an array of all selected account modules

Arguments

Name Type Description Default
$scope string

account type

Return value

Type Description
array user modules

get_ActiveTypes( ) : array

Description

Returns a list of active account types.

Return value

Type Description
array list of types

get_Admins( ) : array

Description

Returns an array of string with all admin names

Return value

Type Description
array the admin names

get_Adminstring( ) : string

Description

Returns all admin users seperated by semicolons

Return value

Type Description
string the admin string

get_ServerURL( ) : string

Description

Returns the server address as string

Return value

Type Description
string server address

get_Suffix( string   $scope, ) : string

Description

Returns the LDAP suffix for the given account type

Arguments

Name Type Description Default
$scope string

account type

Return value

Type Description
string the LDAP suffix

get_cacheTimeout( ) : integer

Description

Returns the LDAP cache timeout in minutes

Return value

Type Description
integer cache time

get_cacheTimeoutSec( ) : integer

Description

Returns the LDAP cache timeout in seconds

Return value

Type Description
integer cache time

get_defaultLanguage( ) : string

Description

Returns the default language string

Return value

Type Description
string default language

get_listAttributes( string   $scope, ) : string

Description

Returns the list of attributes to show in user list

Arguments

Name Type Description Default
$scope string

account type

Return value

Type Description
string the attribute list

get_moduleSettings( ) : array

Description

Returns a list of saved module settings

Return value

Type Description
array list of settings: array(name => value)

get_scriptPath( ) : string

Description

Returns the path to the external script

Return value

Type Description
string script path

get_scriptRights( ) : string

Description

Returns the chmod value for new home directories.

Return value

Type Description
string rights

get_scriptServers( ) : string

Description

Returns the servers of the external script as a Array

Return value

Type Description
string script servers

get_searchLimit( ) : integer

Description

Returns the LDAP search limit.

Return value

Type Description
integer search limit

get_typeSettings( ) : array

Description

Returns a list of saved type settings

Return value

Type Description
array list of settings: array(name => value)

hashPassword( String   $password, String   $salt, ) : String

Description

Returns the hashed password.

Arguments

Name Type Description Default
$password String

password

$salt String

salt

Return value

Type Description
String hash value

isWritable( ) : boolean

Description

Returns if the file can be written on the filesystem.

Return value

Type Description
boolean true if file is writable

reload( ) : boolean

Description

Reloads preferences from config file

Return value

Type Description
boolean true if file was readable

save( ) : n/a

Description

Saves preferences to config file

Return value

Type Description
n/a n/a

setAccessLevel( int   $level, ) : n/a

Description

Sets the access level for this profile.

Arguments

Name Type Description Default
$level int

level

Return value

Type Description
n/a n/a

setHttpAuthentication( String   $httpAuthentication, ) : n/a

Description

Specifies if HTTP authentication should be used.

Arguments

Name Type Description Default
$httpAuthentication String

use HTTP authentication ('true' or 'false')

Return value

Type Description
n/a n/a

setLamProMailFrom( String   $lamProMailFrom, ) : boolean

Description

Sets the sender address for password reset mails.

Arguments

Name Type Description Default
$lamProMailFrom String

mail address

Return value

Type Description
boolean true if address is valid

setLamProMailIsHTML( boolean   $lamProMailIsHTML, ) : n/a

Description

Sets if the password reset mail content should be treated as HTML.

Arguments

Name Type Description Default
$lamProMailIsHTML boolean

Return value

Type Description
n/a n/a

setLamProMailReplyTo( String   $lamProMailReplyTo, ) : boolean

Description

Sets the reply-to address for password reset mails.

Arguments

Name Type Description Default
$lamProMailReplyTo String

mail address

Return value

Type Description
boolean true if address is valid

setLamProMailSubject( String   $lamProMailSubject, ) : n/a

Description

Sets the subject for password reset mails.

Arguments

Name Type Description Default
$lamProMailSubject String

subject

Return value

Type Description
n/a n/a

setLamProMailText( String   $lamProMailText, ) : n/a

Description

Sets the mail body for password reset mails.

Arguments

Name Type Description Default
$lamProMailText String

body

Return value

Type Description
n/a n/a

setLoginMethod( String   $loginMethod, ) : n/a

Description

Sets the login method.

Arguments

Name Type Description Default
$loginMethod String

Return value

Type Description
n/a n/a

setLoginSearchDN( String   $loginSearchDN, ) : boolean

Description

Sets the DN for the login search bind user.

Arguments

Name Type Description Default
$loginSearchDN String

DN

Return value

Type Description
boolean true if DN is valid

setLoginSearchFilter( String   $loginSearchFilter, ) : n/a

Description

Sets the login search filter.

Arguments

Name Type Description Default
$loginSearchFilter String

search filter

Return value

Type Description
n/a n/a

setLoginSearchPassword( String   $loginSearchPassword, ) : n/a

Description

Sets the password for the login search bind user.

Arguments

Name Type Description Default
$loginSearchPassword String

password

Return value

Type Description
n/a n/a

setLoginSearchSuffix( String   $loginSearchSuffix, ) : n/a

Description

Sets the login search suffix.

Arguments

Name Type Description Default
$loginSearchSuffix String

suffix

Return value

Type Description
n/a n/a

setToolSettings( array   $toolSettings, ) : boolean

Description

Sets the tool settings.

Arguments

Name Type Description Default
$toolSettings array

tool settings

Return value

Type Description
boolean true if ok

setUseTLS(   $useTLS, ) : boolean

Description

Sets if TLS is activated.

Arguments

Name Type Description Default
$useTLS n/a

Return value

Type Description
boolean true if $useTLS has correct format

set_AccountModules( array   $modules, string   $scope, ) : boolean

Description

Sets the selected account modules

Arguments

Name Type Description Default
$modules array

array with module names (not aliases!)

$scope string

account type

Return value

Type Description
boolean true if $modules has correct format

set_ActiveTypes(   $types, ) : n/a

Description

Sets the list of active types.

Arguments

Name Type Description Default
$types n/a

Return value

Type Description
n/a n/a

set_Adminstring( string   $value, ) : boolean

Description

Sets the admin string

Arguments

Name Type Description Default
$value string

new admin string that contains all admin users seperated by semicolons

Return value

Type Description
boolean true if $value has correct format

set_Passwd( string   $value, ) : boolean

Description

Sets the preferences wizard password

Arguments

Name Type Description Default
$value string

new password

Return value

Type Description
boolean true if $value has correct format

set_ServerURL( string   $value, ) : boolean

Description

Sets the server address

Arguments

Name Type Description Default
$value string

new server address

Return value

Type Description
boolean true if $value has correct format

set_Suffix( string   $scope, string   $value, ) : boolean

Description

Sets the LDAP suffix where accounts are saved

Arguments

Name Type Description Default
$scope string

account type

$value string

new LDAP suffix

Return value

Type Description
boolean true if $value has correct format

set_cacheTimeout( integer   $value, ) : boolean

Description

Sets the LDAP cache timeout in minutes (0,1,2,5,10,15)

Arguments

Name Type Description Default
$value integer

new cache timeout

Return value

Type Description
boolean true if $value has correct format

set_defaultLanguage( string   $value, ) : boolean

Description

Sets the default language string

Arguments

Name Type Description Default
$value string

new default language

Return value

Type Description
boolean true if $value has correct format

set_listAttributes( string   $value, string   $scope, ) : boolean

Description

Sets the list of attributes to show in user list

Arguments

Name Type Description Default
$value string

new attribute string

$scope string

account type

Return value

Type Description
boolean true if $value has correct format

set_moduleSettings( array   $settings, ) : boolean

Description

Sets the settings for the account modules.

Arguments

Name Type Description Default
$settings array

list of module setting array(name => value)

Return value

Type Description
boolean true if $settings has correct format

set_scriptPath( string   $value, ) : boolean

Description

Sets the path to the external script

Arguments

Name Type Description Default
$value string

new script path

Return value

Type Description
boolean true if $value has correct format

set_scriptRights( string   $chmod, ) : boolean

Description

Sets the rights for the home directory.

Arguments

Name Type Description Default
$chmod string

the rights

Return value

Type Description
boolean true if values has correct format

set_scriptServers( string   $value, ) : boolean

Description

Sets the servers of the external script

Arguments

Name Type Description Default
$value string

new script servers

Return value

Type Description
boolean true if $value has correct format

set_searchLimit( integer   $value, ) : boolean

Description

Sets the LDAP search limit.

Arguments

Name Type Description Default
$value integer

new search limit

Return value

Type Description
boolean true if $value has correct format

set_typeSettings( array   $settings, ) : boolean

Description

Sets the settings for the account types.

Arguments

Name Type Description Default
$settings array

list of type setting array(name => value)

Return value

Type Description
boolean true if $settings has correct format

Properties

$Admins, $Passwd, $ServerURL, $accessLevel, $activeTypes, $cachetimeout, $defaultLanguage, $file, $httpAuthentication, $lamProMailFrom, $lamProMailIsHTML, $lamProMailReplyTo, $lamProMailSubject, $lamProMailText, $loginMethod, $loginSearchDN, $loginSearchFilter, $loginSearchPassword, $loginSearchSuffix, $moduleSettings, $scriptPath, $scriptRights, $scriptServer, $searchLimit, $settings, $toolSettings, $treesuffix, $typeSettings, $useTLS,

  private  $Admins =

Array of string: users with admin rights


  private  $Passwd =

Password to edit preferences


  private  $ServerURL =

Server address (e.g. ldap://127.0.0.1:389)


  private  $accessLevel = \LAMconfig::ACCESS_ALL

access level


  private  $activeTypes = "user,group,host,smbDomain"

Active account types


  private  $cachetimeout =

LDAP cache timeout


  private  $defaultLanguage =

Default language


  private  $file =

Name of configuration file


  private  $httpAuthentication = 'false'

specifies if HTTP authentication should be used


  private  $lamProMailFrom = ''

email address for sender of password reset mails


  private  $lamProMailIsHTML = 'false'

treat password reset mail body as HTML


  private  $lamProMailReplyTo = ''

reply-to email address for password reset mails


  private  $lamProMailSubject = ''

subject for password reset mails


  private  $lamProMailText = ''

mail body for password reset mails


  private  $loginMethod = \LAMconfig::LOGIN_LIST

login method


  private  $loginSearchDN = ''

bind user for login search


  private  $loginSearchFilter = 'uid=%USER%'

search filter for login


  private  $loginSearchPassword = ''

bind password for login search


  private  $loginSearchSuffix = 'dc=yourdomain,dc=org'

search suffix for login


  private  $moduleSettings = array()

module settings


  private  $scriptPath =

Path to external lamdaemon script on server where it is executed
This is used for managing quota and home directories. optional setting, may not be defined

  private  $scriptRights = '750'

The rights for the home directory


  private  $scriptServer =

Servers where lamdaemon script is executed
This is used for managing quota and home directories. optional setting, may not be defined

  private  $searchLimit = 0

LDAP search limit


  private  $settings = array("ServerURL", "useTLS", "Passwd", "Admins", "treesuffix", "defaultLanguage", "scriptPath", "scriptServer", "scriptRights", "cachetimeout", "modules", "activeTypes", "types", "tools", "accessLevel", 'loginMethod', 'loginSearchSuffix', 'loginSearchFilter', 'searchLimit', 'lamProMailFrom', 'lamProMailReplyTo', 'lamProMailSubject', 'lamProMailText', 'lamProMailIsHTML', 'httpAuthentication', 'loginSearchDN', 'loginSearchPassword')

List of all settings in config file


  private  $toolSettings = array()

tool settings


  private  $treesuffix =

LDAP suffix for tree view


  private  $typeSettings = array()

type settings


  private  $useTLS =

enables/disables TLS encryption


Constants

  ACCESS_ALL = 100




  ACCESS_PASSWORD_CHANGE = 20




  ACCESS_READ_ONLY = 0




  LINE_SEPARATOR = '+::+'

line separator


  LOGIN_LIST = 'list'




  LOGIN_SEARCH = 'search'




  SAVE_FAIL = 1




  SAVE_OK = 0




LAMCfgMain

Properties

 
 
No 
No 

Description

This class manages config.cfg.

Methods

__construct, checkPassword, deleteSSLCaCert, getInternalSSLCaCertFileName, getSSLCaCertPath, getSSLCaCertTempFileName, getSSLCaCertificateContent, getSSLCaCertificates, hashPassword, isConfigFileExisting, isWritable, reload, save, setPassword, splitSSLCaCertificateContent, uploadSSLCaCert,

__construct( ) : n/a

Description

Loads preferences from config file

Return value

Type Description
n/a n/a

checkPassword( String   $password, ) : boolean

Description

Checks if the given password matches.

Arguments

Name Type Description Default
$password String

password

Return value

Type Description
boolean true, if password matches

deleteSSLCaCert( int   $index = null, ) : n/a

Description

Marks a single or all SSL CA certificate files for deletion.
The changes take effect on save().

Arguments

Name Type Description Default
$index int

certificate index, null deletes all certificates (default: null)

null

Return value

Type Description
n/a n/a

getInternalSSLCaCertFileName( ) : String

Description

Returns the file name that will be used internally to store the CA file.

Return value

Type Description
String file name

getSSLCaCertPath( ) : String

Description

Returns the path to the SSL CA certificate file that overrides the system certificates.

Return value

Type Description
String path to certificate file or null if certificate is not overridden

getSSLCaCertTempFileName( ) : String

Description

Returns the name of a temporary file in tmp that contains the SSL certificate.
The file contains either the stored data in serverCerts or the uploaded data.

Return value

Type Description
String file name or null if no certificate was set

getSSLCaCertificateContent( ) : String

Description

Returns the content of the certificate file or uploaded data.

Return value

Type Description
String null or certificate content

getSSLCaCertificates( ) : array

Description

Returns a list of all CA certificates.

Return value

Type Description
array list of certificates as output of openssl_x509_parse()

hashPassword( String   $password, String   $salt, ) : String

Description

Returns the hashed password.

Arguments

Name Type Description Default
$password String

password

$salt String

salt

Return value

Type Description
String hash value

isConfigFileExisting( ) : boolean

Description

Returns if the configuration file is existing.

Return value

Type Description
boolean exists

isWritable( ) : boolean

Description

Returns if the configuration file is writable.

Return value

Type Description
boolean writable

reload( ) : boolean

Description

Reloads preferences from config file config.cfg

Return value

Type Description
boolean true if file was readable

save( ) : n/a

Description

Saves preferences to config file config.cfg

Return value

Type Description
n/a n/a

setPassword( String   $password, ) : n/a

Description

Sets a new config password.

Arguments

Name Type Description Default
$password String

new password

Return value

Type Description
n/a n/a

splitSSLCaCertificateContent( String   $content, ) : array

Description

Splits the certificate content into single PEM data chunks.

Arguments

Name Type Description Default
$content String

PEM file content

Return value

Type Description
array one element for each certificate chunk

uploadSSLCaCert( String   $cert, ) : mixed

Description

Uploads a new SSL CA cert.

Arguments

Name Type Description Default
$cert String

file content in DER/PEM format

Return value

Type Description
mixed TRUE if format is correct, error message if file is not accepted

Properties

$allowedHosts, $conffile, $default, $delSSLCaCert, $errorReporting, $logDestination, $logLevel, $mailEOL, $password, $passwordMinClasses, $passwordMinLength, $passwordMinLower, $passwordMinNumeric, $passwordMinSymbol, $passwordMinUpper, $sessionTimeout, $settings, $uploadedSSLCaCert,

  public  $allowedHosts =

list of hosts which may access LAM


  private  $conffile =

path to config file


  public  $default =

Default profile


  private  $delSSLCaCert = false

SSL certificate should be deleted on save()


  public  $errorReporting = self::ERROR_REPORTING_DEFAULT

error reporting


  public  $logDestination =

log destination ("SYSLOG":syslog, "/.
..":file, "NONE":none)

  public  $logLevel =

log level


  public  $mailEOL = 'default'

EOL for emails (default/unix)


  private  $password =

Password to change config.cfg


  public  $passwordMinClasses = 0

minimum character classes (upper, lower, numeric, symbols)


  public  $passwordMinLength = 0

minimum length for passwords


  public  $passwordMinLower = 0

minimum lowercase characters


  public  $passwordMinNumeric = 0

minimum numeric characters


  public  $passwordMinSymbol = 0

minimum symbol characters


  public  $passwordMinUpper = 0

minimum uppercase characters


  public  $sessionTimeout =

Time of inactivity before session times out (minutes)


  private  $settings = array("password", "default", "sessionTimeout", "logLevel", "logDestination", "allowedHosts", "passwordMinLength", "passwordMinUpper", "passwordMinLower", "passwordMinNumeric", "passwordMinClasses", "passwordMinSymbol", "mailEOL", 'errorReporting')

list of data fields to save in config file


  private  $uploadedSSLCaCert = null

uploaded SSL certificate that is stored to disk on save()


Constants

  ERROR_REPORTING_DEFAULT = 'default'

PHP error reporting setting as E_ALL & ~E_NOTICE


  ERROR_REPORTING_SYSTEM = 'system'

PHP error reporting setting from php.ini


Documentation was generated by phpDocumentor 2.1.0 .

Namespaces

  • global

    Packages