t-me / DirectAdmin-Certificate-Manager

DirectAdmin Certificate Manager
MIT License
4 stars 1 forks source link

Feedback and suggestions / feature requests #6

Open stgoos opened 7 years ago

stgoos commented 7 years ago

@t-me really like how easy the script works!

Here is my feedback after test driving it during the weekend:

Prevent directory listings

Options All -Indexes

Rewrite rules start

RewriteEngine On RewriteBase /

Rewrite: always via https:// (without mod_ssl)

RewriteCond %{HTTPS} !=on [NC] RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Rewrite: remove www. (generic method)

RewriteCond %{HTTP_HOST} ^www. RewriteCond %{HTTPS}s ^on(s)|off RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www.)?(.+)$ RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L]

Rewrite: allow access only to listed countries via a 'firewall rule', with a no-access page or redirect to other website.

Include the iso3166 code of the countries you want to allow access in the list, requires mod_geoip to be installed on the server.

Please note: the no-access.php can't load anything from 'external' sources, so all css/js/images/etc should be embeded in that single file!

RewriteRule ^no-access/?$ /no-access.php [L,END] RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(US|CA|AU|UK|DE|FR|NL|BE|etcetera)$ RewriteRule ^(.)$ /no-access/ [L] # --OR-- RewriteRule ^(.)$ https://anotherdomain.tld/$1 [L]


Maybe the .htaccess is something you just have to leave to the user of Certificate Manager to setup. But in that case it could make sense to add a page with these security tips.
t-me commented 7 years ago

Hello @stgoos Thanks for the feedback.

i will look at your feedback. Is there any whay i can reach you Skype or something?

The 2nd and 3rd domain are shown BUT I can't request the Let's Encrypt certificates via the dashboard of the Certificate Manager installation on the 1st domain

That should work, i have multiple domains an can request a certificat.

cronjob triggered certificate renewal which auto-renews

is on my todo list.

t-me commented 7 years ago

@stgoos For probely fixing (Step 1 (for 2nd and 3rd domain) ) change this function : DA_GET_SUB_DOMAINS to

Public Function DA_GET_SUB_DOMAINS($domain){
            $da = $this->DA_CONNECT();
    $da->query('/CMD_API_SUBDOMAINS',
        array(
            'domain' => $domain
        ));
    $domains = $da->fetch_parsed_body();

    if (empty($domains)) {
        return array();
    }else{
        return $domains['list'];
    }

}

`

And change this Page Encrypt to this

<?php 
    $subs = $func->DA_GET_SUB_DOMAINS($domain);
    if( empty($subs)){
        $alldomains = array($domain, 'www.'.$domain);
    } else {
        foreach($subs as $sub){
            $subdomains[] = $sub . '.' . $domain;
        }
        $domainsarr = array($domain, 'www.'.$domain);
        $alldomains = array_merge($domainsarr, $subdomains);
    }

    foreach($alldomains as $certdomain){
        if($certdomain == 'www.'.$domain || $certdomain == $domain){
            echo '<option value="'.$certdomain.'" selected>'.$certdomain.'</option>';
        }else{
            echo '<option value="'.$certdomain.'">'.$certdomain.'</option>';
        }
    }
?>

Can You tell me if this fixed the problem?

stgoos commented 7 years ago

Been busy at work but will have time the coming days to check. Will let you know the outcome.