adding templates + template generator from others (main, squirrelmail, roundcube) addins domaines_types in ssl.sql, adding warning in view when admin not owner of current cert

This commit is contained in:
Benjamin Sonntag 2015-02-11 16:29:54 +01:00
parent c0ced4b900
commit f7d8c4fe72
5 changed files with 56 additions and 15 deletions

20
ssl/gen-ssl-templates.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# this script regenerate the SSL-* templates from the ORIGINAL non-ssl in parent folder
# launch it if you know that some templates has been changed in parent folder.
function convert {
src=$1
dst=$2
cat $src |
sed -e 's#:80#:443#' \
-e "s#</VirtualHost># SSLEngine On\n SSLCertificateFile %%CRT%%\n SSLCertificateKeyFile %%KEY%%\n %%CHAINLINE%%\n\n</VirtualHost>#i" \
>$dst
}
for template in panel url vhost
do
convert "../etc/alternc/templates/apache2/${template}.conf" "templates/${template}-ssl.conf"
done
convert "../roundcube/templates/apache2/roundcube.conf" "templates/roundcube-ssl.conf"
convert "../squirrelmail/templates/apache2/squirrelmail.conf" "templates/squirrelmail-ssl.conf"

View File

@ -1,17 +1,23 @@
#!/bin/bash
#!/usr/bin/php
<?php
/*
function called as a hook during alternc update_domains.sh as follow:
create a host: launch_hooks "create" "$1" "$2" "$3" "$4" (type domain mail value)
at the end of host creation: launch_hooks "postinst" "$1" "$2" "$3" "$4"
enable or disable a sot: launch_hooks "enable|disable" "$1" "$2" "$3" (type domain value)
at host deletion: launch_hooks "delete" "$1" "$2" "$3" "$4" (type fqdn)
# function called as a hook during alternc update_domains.sh as follow:
# create a host: launch_hooks "create" "$1" "$2" "$3" "$4" (type domain mail value)
# at the end of host creation: launch_hooks "postinst" "$1" "$2" "$3" "$4"
# enable or disable a sot: launch_hooks "enable|disable" "$1" "$2" "$3" (type domain value)
# at host deletion: launch_hooks "delete" "$1" "$2" "$3" "$4" (type fqdn)
also, after reloading apache :
run-parts --arg=web_reload /usr/lib/alternc/reload.d
also, dns functions are:
after reconfiguring bind (rndc reconfig) : run-parts --arg=dns_reconfig /usr/lib/alternc/reload.d
(may need to *redo* rndc reconfig... a "before_dns_reconfig" would be better !)
before reloading a zone : run-parts --arg=dns_reload_zone --arg="$domain" /usr/lib/alternc/reload.d
*/
// Bootstraps
require_once("/usr/share/alternc/panel/class/config_nochk.php");
#
# also, after reloading apache :
# run-parts --arg=web_reload /usr/lib/alternc/reload.d
#
# also, dns functions are:
# after reconfiguring bind (rndc reconfig) : run-parts --arg=dns_reconfig /usr/lib/alternc/reload.d
# (may need to *redo* rndc reconfig... a "before_dns_reconfig" would be better !)
# before reloading a zone : run-parts --arg=dns_reload_zone --arg="$domain" /usr/lib/alternc/reload.d

View File

@ -178,6 +178,10 @@ if ($cert["status"] == $ssl::STATUS_PENDING) {
<input class="inb cancel" type="submit" name="unshare" value="<?php __("Click here to stop sharing this certificate"); ?>" />
</form>
<?php
} else {
?>
<p><?php __("You are not the owner of this certificate, only its owner can share/unshare this certificate."); ?></p>
<?php
}
} else {
echo _("This certificate is currently <b>NOT shared</b>");
@ -190,6 +194,10 @@ if ($cert["status"] == $ssl::STATUS_PENDING) {
<input class="inb ok" type="submit" name="unshare" value="<?php __("Click here to share this certificate"); ?>" />
</form>
<?php
} else {
?>
<p><?php __("You are not the owner of this certificate, only its owner can share/unshare this certificate."); ?></p>
<?php
}
}
}

View File

@ -28,3 +28,10 @@ CREATE TABLE IF NOT EXISTS `certif_alias` (
PRIMARY KEY (`name`),
KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Global aliases defined for SSL certificates FILE validation processes';
INSERT IGNORE INTO `domaines_type` (name ,description ,target ,entry ,compatibility ,enable ,only_dns ,need_dns ,advanced ) VALUES ('vhost-ssl','Locally hosted WITH SSL','DIRECTORY','%SUB% IN A @@PUBLIC_IP@@','vhost,url,txt,defmx,defmx2,mx,mx2','ALL',0,0,0,1,1);
INSERT IGNORE INTO `domaines_type` (name ,description ,target ,entry ,compatibility ,enable ,only_dns ,need_dns ,advanced ) VALUES ('url-ssl','URL redirection WITH SSL','URL','%SUB% IN A @@PUBLIC_IP@@','vhost,url,txt,defmx,defmx2','ALL',0,0,0,0,0);
INSERT IGNORE INTO `domaines_type` (name ,description ,target ,entry ,compatibility ,enable ,only_dns ,need_dns ,advanced ) VALUES ('panel-ssl','AlternC panel access WITH SSL','NONE','%SUB% IN A @@PUBLIC_IP@@','panel,ip,ipv6,cname,txt,mx,mx2,defmx,defmx2','ALL',0,0,1,0,0);
INSERT IGNORE INTO `domaines_type` (name ,description ,target ,entry ,compatibility ,enable ,only_dns ,need_dns ,advanced ) VALUES ('roundcube-ssl','Roundcube Webmail access WITH SSL', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'mx,mx2,defmx,defmx2,roundcube,txt', 'ALL', '0', '0', '0');
INSERT IGNORE INTO `domaines_type` (name ,description ,target ,entry ,compatibility ,enable ,only_dns ,need_dns ,advanced ) VALUES ('squirrelmail-ssl','Squirrelmail Webmail access WITH SSL', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'mx,mx2,defmx,defmx2,squirrelmail,txt', 'ALL', '0', '0', '0');

View File

@ -14,4 +14,4 @@
SSLCertificateKeyFile %%KEY%%
%%CHAINLINE%%
</Virtualhost>
</VirtualHost>