[Module development] How to correctly find SSL certs path?

Discussion in 'Plugins/Modules/Addons' started by manoaratefy, Jun 20, 2020.

  1. manoaratefy

    manoaratefy New Member

    Good morning,
    I'm developing Varnish module for ISPConfig. Currently, to detect SSL path, I do this kind of code inside function update($event_name, $data):
    if($data['new']['ssl_letsencrypt'] == 'y'){
        // It is a Let's Encrypt SSL certificate
        $key_file = $data['new']['document_root'].'/ssl/'.$data['new']['ssl_domain'].'-le.key';
        $crt_file = $data['new']['document_root'].'/ssl/'.$data['new']['ssl_domain'].'-le.crt';
    } else{
        // It is an ordinary SSL certificate
        $key_file = $data['new']['document_root'].'/ssl/'.$data['new']['ssl_domain'].'.key';
        $crt_file = $data['new']['document_root'].'/ssl/'.$data['new']['ssl_domain'].'.crt';
    This works but I'm not sure if I do it on the best way. Is this correct? Is there a better way to achieve this? Does ISPConfig has a mechanism to send SSL certificates path directly to plugins?
    Th0m and ahrasis like this.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    That should be ok like this.


Share This Page