Exemplo n.º 1
0
 public function actionChmodSsl()
 {
     $dir = $this->getSslDir();
     $this->passthru('chown', ['-R', 'www-data', $dir, Sudo::create()]);
     $this->passthru('chgrp', ['-R', 'www-data', $dir, Sudo::create()]);
     $this->passthru('chmod', ['-R', 'o-rwx', $dir, Sudo::create()]);
 }
Exemplo n.º 2
0
 public function actionDoLetsencrypt()
 {
     foreach ($this->getItems() as $vhost) {
         $domain = $vhost->getDomain();
         $sslDir = $vhost->getSslDir();
         $args = ['certonly', '-a', 'webroot', '--webroot-path=' . $vhost->getWebDir()];
         foreach (array_reverse($vhost->getDomains()) as $name) {
             array_push($args, '-d');
             array_push($args, $name);
         }
         if ($this->passthru('/opt/letsencrypt/letsencrypt-auto', $args)) {
             throw new Exception('failed letsencrypt');
         }
         static::mkdir($sslDir);
         $this->passthru('sh', ['-c', "cp /etc/letsencrypt/live/{$domain}/* {$sslDir}", Sudo::create()]);
         $vhost->actionChmodSsl();
     }
 }