LDAP Account Manager

LAMCfgMain
in package

This class manages config.cfg.

Table of Contents

DATABASE_FILE_SYSTEM  = 'files'
store configuration on local file system
DATABASE_MYSQL  = 'mysql'
store configuration in MySQL database
ERROR_REPORTING_ALL  = 'all'
PHP error reporting setting as E_ALL | E_STRICT
ERROR_REPORTING_DEFAULT  = 'default'
PHP error reporting setting as E_ALL & ~E_NOTICE
ERROR_REPORTING_SYSTEM  = 'system'
PHP error reporting setting from php.ini
LICENSE_WARNING_ALL  = 'all'
send license warnings via email + display on screen
LICENSE_WARNING_EMAIL  = 'email'
send license warnings via email
LICENSE_WARNING_NONE  = 'none'
no license warning
LICENSE_WARNING_SCREEN  = 'screen'
display license warnings on screen
SMTP_NONE  = 'NONE'
No encryption for mail sending
SMTP_SSL  = 'SSL'
SSL encryption for mail sending
SMTP_TLS  = 'TLS'
TLS encryption for mail sending
$allowedHosts  : mixed
list of hosts which may access LAM
$allowedHostsSelfService  : mixed
list of hosts which may access LAM Pro self service
$checkedRulesCount  : mixed
number of password rules that must match (-1 = all)
$configDatabaseName  : mixed
database name
$configDatabasePassword  : mixed
database password
$configDatabasePort  : mixed
database port
$configDatabaseServer  : mixed
database server name
$configDatabaseType  : mixed
database type
$configDatabaseUser  : mixed
database user
$default  : mixed
Default profile
$errorReporting  : mixed
error reporting
$externalPwdCheckUrl  : mixed
external URL for password checking (e.g. https://domain.com/url/{SHA1})
$licenseEmailDateSent  : mixed
license warning email was last sent for this expiration date
$licenseEmailFrom  : mixed
license warning email from address
$licenseEmailTo  : mixed
license warning email TO address(es) separated by ";"
$licenseWarningType  : mixed
type of license warning (email/screen/both/none)
$logDestination  : mixed
log destination ("SYSLOG":syslog, "/...":file, "NONE":none, "REMOTE":server:port)
$logLevel  : mixed
log level
$mailEncryption  : string
$mailPassword  : mixed
mail server password
$mailServer  : mixed
mail server (server:port)
$mailUser  : mixed
mail server user
$passwordMinClasses  : mixed
minimum character classes (upper, lower, numeric, symbols)
$passwordMinLength  : mixed
minimum length for passwords
$passwordMinLower  : mixed
minimum lowercase characters
$passwordMinNumeric  : mixed
minimum numeric characters
$passwordMinSymbol  : mixed
minimum symbol characters
$passwordMinUpper  : mixed
minimum uppercase characters
$passwordMustNotContain3Chars  : mixed
password may contain more than 2 characters of user/first/last name
$passwordMustNotContainUser  : mixed
password may contain the user name
$sessionTimeout  : mixed
Time of inactivity before session times out (minutes)
$conffile  : mixed
path to config file
$delSSLCaCert  : mixed
SSL certificate should be deleted on save()
$license  : mixed
license data
$password  : mixed
Password to change config.cfg
$persistenceSettings  : mixed
persistence settings are always stored on local file system
$settings  : mixed
list of data fields to save in config file
$uploadedSSLCaCert  : mixed
uploaded SSL certificate that is stored to disk on save()
__construct()  : mixed
Loads preferences from config file
checkPassword()  : bool
Checks if the given password matches.
deleteSSLCaCert()  : mixed
Marks a single or all SSL CA certificate files for deletion.
exportCertificates()  : null|string
Returns the content of the server certificates file
exportData()  : array<string|int, mixed>
Exports the configuration data.
getLicenseLines()  : string
Returns the license key as multiple lines.
getLicenseWarningType()  : string
Returns the license warning type (screen/email/both/none).
getSSLCaCertificates()  : array<string|int, mixed>
Returns a list of all CA certificates.
getSSLCaCertPath()  : string
Returns the path to the SSL CA certificate file that overrides the system certificates.
getSSLCaCertTempFileName()  : string
Returns the name of a temporary file in tmp that contains the SSL certificate.
importCertificates()  : mixed
Imports the server certificates.
importData()  : mixed
Imports configuration data.
installSampleConfig()  : bool
Tries to copy the config file from sample config.
isConfigFileExisting()  : bool
Returns if the configuration file is existing.
isWritable()  : bool
Returns if the configuration file is writable.
save()  : mixed
Saves the configuration to the persistence layer.
saveLocal()  : void
Saves preferences to config file config.cfg
sendLicenseWarningByEmail()  : bool
Returns if the license warning should be sent via email.
setLicenseLines()  : mixed
Sets the license key as multiple lines.
setPassword()  : mixed
Sets a new config password.
showLicenseWarningOnScreen()  : bool
Returns if the license warning should be shown on screen.
uploadSSLCaCert()  : mixed
Uploads a new SSL CA cert.
wasLicenseWarningSent()  : mixed
Returns if the license warning was already sent.
getInternalSSLCaCertFileName()  : string
Returns the file name that will be used internally to store the CA file.
getSSLCaCertificateContent()  : string
Returns the content of the certificate file or uploaded data.
hashPassword()  : string
Returns the hashed password.
loadFromDb()  : bool
Loads the settings from the database.
reload()  : void
Reloads preferences from config file config.cfg
saveDb()  : void
Saves the config data to the database.
splitSSLCaCertificateContent()  : array<string|int, mixed>
Splits the certificate content into single PEM data chunks.

Constants

DATABASE_FILE_SYSTEM

store configuration on local file system

public mixed DATABASE_FILE_SYSTEM = 'files'

DATABASE_MYSQL

store configuration in MySQL database

public mixed DATABASE_MYSQL = 'mysql'

ERROR_REPORTING_ALL

PHP error reporting setting as E_ALL | E_STRICT

public mixed ERROR_REPORTING_ALL = 'all'

ERROR_REPORTING_DEFAULT

PHP error reporting setting as E_ALL & ~E_NOTICE

public mixed ERROR_REPORTING_DEFAULT = 'default'

ERROR_REPORTING_SYSTEM

PHP error reporting setting from php.ini

public mixed ERROR_REPORTING_SYSTEM = 'system'

LICENSE_WARNING_ALL

send license warnings via email + display on screen

public mixed LICENSE_WARNING_ALL = 'all'

LICENSE_WARNING_EMAIL

send license warnings via email

public mixed LICENSE_WARNING_EMAIL = 'email'

LICENSE_WARNING_NONE

no license warning

public mixed LICENSE_WARNING_NONE = 'none'

LICENSE_WARNING_SCREEN

display license warnings on screen

public mixed LICENSE_WARNING_SCREEN = 'screen'

SMTP_NONE

No encryption for mail sending

public mixed SMTP_NONE = 'NONE'

SMTP_SSL

SSL encryption for mail sending

public mixed SMTP_SSL = 'SSL'

SMTP_TLS

TLS encryption for mail sending

public mixed SMTP_TLS = 'TLS'

Properties

$allowedHosts

list of hosts which may access LAM

public mixed $allowedHosts

$allowedHostsSelfService

list of hosts which may access LAM Pro self service

public mixed $allowedHostsSelfService

$checkedRulesCount

number of password rules that must match (-1 = all)

public mixed $checkedRulesCount = -1

$configDatabaseName

database name

public mixed $configDatabaseName = ''

$configDatabasePassword

database password

public mixed $configDatabasePassword = ''

$configDatabasePort

database port

public mixed $configDatabasePort = ''

$configDatabaseServer

database server name

public mixed $configDatabaseServer = ''

$configDatabaseType

database type

public mixed $configDatabaseType = self::DATABASE_FILE_SYSTEM

$configDatabaseUser

database user

public mixed $configDatabaseUser = ''

$default

Default profile

public mixed $default

$errorReporting

error reporting

public mixed $errorReporting = self::ERROR_REPORTING_DEFAULT

$externalPwdCheckUrl

external URL for password checking (e.g. https://domain.com/url/{SHA1})

public mixed $externalPwdCheckUrl = \null

$licenseEmailDateSent

license warning email was last sent for this expiration date

public mixed $licenseEmailDateSent = ''

$licenseEmailFrom

license warning email from address

public mixed $licenseEmailFrom = ''

$licenseEmailTo

license warning email TO address(es) separated by ";"

public mixed $licenseEmailTo = ''

$licenseWarningType

type of license warning (email/screen/both/none)

public mixed $licenseWarningType = ''

$logDestination

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

public mixed $logDestination

$logLevel

log level

public mixed $logLevel

$mailEncryption

public string $mailEncryption = ''

encryption type for SMTP connection

$mailPassword

mail server password

public mixed $mailPassword = ''

$mailServer

mail server (server:port)

public mixed $mailServer = ''

$mailUser

mail server user

public mixed $mailUser = ''

$passwordMinClasses

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

public mixed $passwordMinClasses = 0

$passwordMinLength

minimum length for passwords

public mixed $passwordMinLength = 0

$passwordMinLower

minimum lowercase characters

public mixed $passwordMinLower = 0

$passwordMinNumeric

minimum numeric characters

public mixed $passwordMinNumeric = 0

$passwordMinSymbol

minimum symbol characters

public mixed $passwordMinSymbol = 0

$passwordMinUpper

minimum uppercase characters

public mixed $passwordMinUpper = 0

$passwordMustNotContain3Chars

password may contain more than 2 characters of user/first/last name

public mixed $passwordMustNotContain3Chars = 'false'

$passwordMustNotContainUser

password may contain the user name

public mixed $passwordMustNotContainUser = 'false'

$sessionTimeout

Time of inactivity before session times out (minutes)

public mixed $sessionTimeout

$conffile

path to config file

private mixed $conffile

$delSSLCaCert

SSL certificate should be deleted on save()

private mixed $delSSLCaCert = \false

$license

license data

private mixed $license = ''

$password

Password to change config.cfg

private mixed $password

$persistenceSettings

persistence settings are always stored on local file system

private mixed $persistenceSettings = array('configDatabaseType', 'configDatabaseServer', 'configDatabasePort', 'configDatabaseName', 'configDatabaseUser', 'configDatabasePassword', 'license')

$settings

list of data fields to save in config file

private mixed $settings = array("password", "default", "sessionTimeout", "logLevel", "logDestination", "allowedHosts", "passwordMinLength", "passwordMinUpper", "passwordMinLower", "passwordMinNumeric", "passwordMinClasses", "passwordMinSymbol", 'checkedRulesCount', 'passwordMustNotContainUser', 'passwordMustNotContain3Chars', 'externalPwdCheckUrl', 'errorReporting', 'allowedHostsSelfService', 'license', 'licenseEmailFrom', 'licenseEmailTo', 'licenseWarningType', 'licenseEmailDateSent', 'mailServer', 'mailUser', 'mailPassword', 'mailEncryption', 'configDatabaseType', 'configDatabaseServer', 'configDatabasePort', 'configDatabaseName', 'configDatabaseUser', 'configDatabasePassword')

$uploadedSSLCaCert

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

private mixed $uploadedSSLCaCert = \null

Methods

__construct()

Loads preferences from config file

public __construct([string $fileName = null ]) : mixed
Parameters
$fileName : string = null

file path for config file

Return values
mixed

checkPassword()

Checks if the given password matches.

public checkPassword(string $password) : bool
Parameters
$password : string

password

Return values
bool

true, if password matches

deleteSSLCaCert()

Marks a single or all SSL CA certificate files for deletion.

public deleteSSLCaCert([int $index = null ]) : mixed

The changes take effect on save().

Parameters
$index : int = null

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

Return values
mixed

exportCertificates()

Returns the content of the server certificates file

public exportCertificates() : null|string
Return values
null|string

certificates

exportData()

Exports the configuration data.

public exportData([mixed $skipPersistenceSettings = false ]) : array<string|int, mixed>
Parameters
$skipPersistenceSettings : mixed = false
Return values
array<string|int, mixed>

config data

getLicenseLines()

Returns the license key as multiple lines.

public getLicenseLines() : string
Return values
string

license

getLicenseWarningType()

Returns the license warning type (screen/email/both/none).

public getLicenseWarningType() : string
Return values
string

warning type

getSSLCaCertificates()

Returns a list of all CA certificates.

public getSSLCaCertificates() : array<string|int, mixed>
Return values
array<string|int, mixed>

list of certificates as output of openssl_x509_parse()

getSSLCaCertPath()

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

public getSSLCaCertPath() : string
Return values
string

path to certificate file or null if certificate is not overridden

getSSLCaCertTempFileName()

Returns the name of a temporary file in tmp that contains the SSL certificate.

public getSSLCaCertTempFileName() : string

The file contains either the stored data in serverCerts or the uploaded data.

Return values
string

file name or null if no certificate was set

importCertificates()

Imports the server certificates.

public importCertificates(null|string $certsContent) : mixed
Parameters
$certsContent : null|string

certificates

Tags
throws
LAMException

write to file failed

Return values
mixed

importData()

Imports configuration data.

public importData(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>

config data

Tags
throws
LAMException

import error

Return values
mixed

installSampleConfig()

Tries to copy the config file from sample config.

public installSampleConfig() : bool
Return values
bool

copied

isConfigFileExisting()

Returns if the configuration file is existing.

public isConfigFileExisting() : bool
Return values
bool

exists

isWritable()

Returns if the configuration file is writable.

public isWritable() : bool
Return values
bool

writable

save()

Saves the configuration to the persistence layer.

public save() : mixed
Return values
mixed

saveLocal()

Saves preferences to config file config.cfg

public saveLocal(bool $persistenceOnly) : void
Parameters
$persistenceOnly : bool

store only persistence related data

Return values
void

sendLicenseWarningByEmail()

Returns if the license warning should be sent via email.

public sendLicenseWarningByEmail() : bool
Return values
bool

send via email

setLicenseLines()

Sets the license key as multiple lines.

public setLicenseLines(array<string|int, string> $licenseLines) : mixed
Parameters
$licenseLines : array<string|int, string>

license lines

Return values
mixed

setPassword()

Sets a new config password.

public setPassword(string $password) : mixed
Parameters
$password : string

new password

Return values
mixed

showLicenseWarningOnScreen()

Returns if the license warning should be shown on screen.

public showLicenseWarningOnScreen() : bool
Return values
bool

show on screen

uploadSSLCaCert()

Uploads a new SSL CA cert.

public uploadSSLCaCert(string $cert) : mixed
Parameters
$cert : string

file content in DER/PEM format

Return values
mixed

TRUE if format is correct, error message if file is not accepted

wasLicenseWarningSent()

Returns if the license warning was already sent.

public wasLicenseWarningSent(int $timeStamp) : mixed
Parameters
$timeStamp : int

time stamp

Return values
mixed

getInternalSSLCaCertFileName()

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

private getInternalSSLCaCertFileName() : string
Return values
string

file name

getSSLCaCertificateContent()

Returns the content of the certificate file or uploaded data.

private getSSLCaCertificateContent() : string
Return values
string

null or certificate content

hashPassword()

Returns the hashed password.

private hashPassword(string $password, string $salt) : string
Parameters
$password : string

password

$salt : string

salt

Return values
string

hash value

loadFromDb()

Loads the settings from the database.

private loadFromDb() : bool

Persistence settings are ignored as they must be on local file system.

Tags
throws
LAMException

error reading config

Return values
bool

true when ok

reload()

Reloads preferences from config file config.cfg

private reload() : void
Tags
throws
LAMException

error reading config

Return values
void

saveDb()

Saves the config data to the database.

private saveDb() : void
Return values
void

splitSSLCaCertificateContent()

Splits the certificate content into single PEM data chunks.

private splitSSLCaCertificateContent(string $content) : array<string|int, mixed>
Parameters
$content : string

PEM file content

Return values
array<string|int, mixed>

one element for each certificate chunk

Search results