Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP CERTIFICATE support is available in Cacti, but there is no documentation for it #149

Open
TheWitness opened this issue Oct 27, 2021 · 3 comments
Labels

Comments

@TheWitness
Copy link
Member

Describe the bug

In the following bug report, it is reported that Cacti already supports certificates for LDAP, but that there is no documentation. Please document it.

Cacti/cacti#1573

@TheWitness TheWitness added the bug label Oct 27, 2021
@netniV
Copy link
Member

netniV commented Nov 14, 2021

@bmfmancini One for you?

@bmfmancini
Copy link
Member

Got it

@TheWitness
Copy link
Member Author

Yea, the way we support it is by placing those settings in the environment of Apache/PHP, so that those variables can be found and processed. This was added a while ago. There is a version dependency of course, but if you are using like PHP7.3++, it should not be a problem. Here is the relevant code snippet.

        if (getenv('TLS_CERT') != '' && defined('LDAP_OPT_X_TLS_CERTFILE')) {
            cacti_log('NOTE: Settings TLS_CERT to ' . getenv('TLS_CERT'), false, 'AUTH', POLLER_VERBOSITY_HIGH);
            ldap_set_option(null, LDAP_OPT_X_TLS_CERTFILE, getenv('TLS_CERT'));
        }

        if (getenv('TLS_CACERT') != '' && defined('LDAP_OPT_X_TLS_CACERTFILE')) {
            cacti_log('NOTE: Settings TLS_CACERT to ' . getenv('TLS_CACERT'), false, 'AUTH', POLLER_VERBOSITY_HIGH);
            ldap_set_option(null, LDAP_OPT_X_TLS_CACERTFILE, getenv('TLS_CACERT'));
        }

        if (getenv('TLS_KEY') != '' && defined('LDAP_OPT_X_TLS_KEYFILE')) {
            cacti_log('NOTE: Settings TLS_KEY to ' . getenv('TLS_KEY'), false, 'AUTH', POLLER_VERBOSITY_HIGH);
            ldap_set_option(null, LDAP_OPT_X_TLS_KEYFILE, getenv('TLS_KEY'));
        }

        if (getenv('TLS_CACERTDIR') != '' && defined('LDAP_OPT_X_TLS_CACERTDIR')) {
            cacti_log('NOTE: Settings TLS_CACERTDIR to ' . getenv('TLS_CACERTDIR'), false, 'AUTH', POLLER_VERBOSITY_HIGH);
            ldap_set_option(null, LDAP_OPT_X_TLS_CACERTDIR, getenv('TLS_CACERTDIR'));
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants