Alternc  latest
Alternc logiel libre pour l'hébergement
hosting_vhost-ssl.sh
Go to the documentation of this file.
1 #!/usr/bin/php
2 <?php
3 /*
4  function called as a hook during alternc update_domains.sh as follow:
5  (launched by functions_hosting.sh in launch_hook() shell function)
6  create a host: launch_hooks "create" "$1" "$2" "$3" "$4" (type domain mail value)
7  at the end of host creation: launch_hooks "postinst" "$1" "$2" "$3" "$4"
8  enable or disable a host: launch_hooks "enable|disable" "$1" "$2" "$3" (type domain value)
9  at host deletion: launch_hooks "delete" "$1" "$2" "$3" "$4" (type fqdn)
10 
11  also, after reloading apache :
12  run-parts --arg=web_reload /usr/lib/alternc/reload.d
13 
14  also, dns functions are:
15  after reconfiguring bind (rndc reconfig) : run-parts --arg=dns_reconfig /usr/lib/alternc/reload.d
16  (may need to *redo* rndc reconfig... a "before_dns_reconfig" would be better !)
17  before reloading a zone : run-parts --arg=dns_reload_zone --arg="$domain" /usr/lib/alternc/reload.d
18 */
19 
20 // Bootstrap
21 require_once("/usr/share/alternc/panel/class/config_nochk.php");
22 
23 if (!isset($ssl)) {
24  echo "OUPS: hosting_vhost-ssl.sh launched, but ssl module not installed, exiting\n";
25  exit();
26 }
27 
28 if (!isset($argv[1])) {
29  echo "FATAL: must be launched from functions_hosting.sh !\n";
30  exit();
31 }
32 if ( ($argv[1]=="create" || $argv[1]=="postinst" || $argv[1]=="delete") ) {
33  if (count($argv)<5) {
34  echo "FATAL: create/postinst/delete need 4 parameters: type domain mail value\n";
35  print_r($argv);
36  exit();
37  }
38  $ssl->updateDomain($argv[1], $argv[2], $argv[3], $argv[4]);
39  exit();
40 }
41 if ( ($argv[1]=="enable" || $argv[1]=="disable") ) {
42  if (count($argv)<4) {
43  echo "FATAL: enable/disable need 3 parameters: type domain value\n";
44  print_r($argv);
45  exit();
46  }
47  $ssl->updateDomain($argv[1], $argv[2], $argv[3] );
48  exit();
49 }
50 
51 echo "FATAL: action unknown, must be launched from functions_hosting.sh !\n";
52 print_r($argv);
53 exit();
54