1
|
|
|
<?php |
2
|
|
|
namespace Kunstmaan\Skylab\Skeleton; |
3
|
|
|
|
4
|
|
|
class SslSkeleton extends AbstractSkeleton |
5
|
|
|
{ |
6
|
|
|
|
7
|
|
|
const NAME = "ssl"; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @return string |
11
|
|
|
*/ |
12
|
|
|
public function getName() |
13
|
|
|
{ |
14
|
|
|
return self::NAME; |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @param \ArrayObject $project |
19
|
|
|
* |
20
|
|
|
* @return mixed |
21
|
|
|
*/ |
22
|
|
|
public function create(\ArrayObject $project) |
23
|
|
|
{ |
24
|
|
|
$this->fileSystemProvider->createDirectory($project, 'conf/ssl/selfsigned'); |
25
|
|
|
$this->processProvider->executeSudoCommand('openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout '.$this->fileSystemProvider->getProjectConfigDirectory($project["name"]).'/ssl/selfsigned/selfsigned.key -out '.$this->fileSystemProvider->getProjectConfigDirectory($project["name"]).'/ssl/selfsigned/selfsigned.crt -subj "/C=BE/ST=Vlaams-Brabant/L=Leuven/O=Kunstmaan/OU=Smarties/CN='.$project["url"].'"'); |
26
|
|
|
|
27
|
|
|
$this->fileSystemProvider->renderDistConfig( |
28
|
|
|
$this->fileSystemProvider->getConfigTemplateDir("ssl"), |
29
|
|
|
$this->fileSystemProvider->getConfigTemplateDir("ssl",true), |
30
|
|
|
$this->fileSystemProvider->getProjectConfigDirectory($project["name"]) . "/apache.d/" |
31
|
|
|
); |
32
|
|
|
$this->fileSystemProvider->renderConfig( |
33
|
|
|
$this->fileSystemProvider->getCustomConfigTemplateDir("ssl"), |
34
|
|
|
$this->fileSystemProvider->getCustomConfigTemplateDir("ssl",true), |
35
|
|
|
$this->fileSystemProvider->getProjectConfigDirectory($project["name"]) . "/apache.d/" |
36
|
|
|
); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return mixed |
41
|
|
|
*/ |
42
|
|
|
public function preMaintenance() |
43
|
|
|
{ |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return mixed |
48
|
|
|
*/ |
49
|
|
|
public function postMaintenance() |
50
|
|
|
{ |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param \ArrayObject $project |
55
|
|
|
* |
56
|
|
|
* @return mixed |
57
|
|
|
*/ |
58
|
|
|
public function maintenance(\ArrayObject $project) |
59
|
|
|
{ |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param \ArrayObject $project |
64
|
|
|
* |
65
|
|
|
* @return mixed |
66
|
|
|
*/ |
67
|
|
|
public function preBackup(\ArrayObject $project) |
68
|
|
|
{ |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param \ArrayObject $project |
73
|
|
|
* |
74
|
|
|
* @return mixed |
75
|
|
|
*/ |
76
|
|
|
public function postBackup(\ArrayObject $project) |
77
|
|
|
{ |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param \ArrayObject $project |
82
|
|
|
* |
83
|
|
|
* @return mixed |
84
|
|
|
*/ |
85
|
|
|
public function preRemove(\ArrayObject $project) |
86
|
|
|
{ |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @param \ArrayObject $project |
91
|
|
|
* |
92
|
|
|
* @return mixed |
93
|
|
|
*/ |
94
|
|
|
public function postRemove(\ArrayObject $project) |
95
|
|
|
{ |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return string[] |
100
|
|
|
*/ |
101
|
|
|
public function dependsOn() |
102
|
|
|
{ |
103
|
|
|
return array("base", "apache"); |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
|
107
|
|
|
} |