Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
provision
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
provision
Commits
fb68c5c7
Commit
fb68c5c7
authored
Jul 14, 2010
by
Adrian Rossouw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SSL WORKS NOW! ... Added a copy method to the file class, amazed we didnt have one before.
parent
b40114e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
12 deletions
+34
-12
http/http.config.inc
http/http.config.inc
+0
-2
http/http.ssl.inc
http/http.ssl.inc
+11
-10
provision.file.inc
provision.file.inc
+23
-0
No files found.
http/http.config.inc
View file @
fb68c5c7
...
...
@@ -74,8 +74,6 @@ class provisionConfig_http_server extends provisionConfig_http {
}
/**
* Base class for platform configuration files.
*/
...
...
http/http.ssl.inc
View file @
fb68c5c7
...
...
@@ -37,12 +37,12 @@ class provisionService_http_ssl extends provisionService_http_public {
function
config_data
(
$config
=
null
,
$class
=
null
)
{
$data
=
parent
::
config_data
(
$config
,
$class
);
$data
[
'http_ssl_port'
]
=
$this
->
server
->
http_ssl_port
;
if
(
$config
==
'site'
&&
$this
->
context
->
ssl_enabled
)
{
if
(
$ssl_key
=
$this
->
context
->
ssl_key
)
{
// Retrieve the paths to the cert and key files.
// they are generated if not found.
$certs
=
$this
->
get_certificates
(
$ssl_key
);
$data
=
array_merge
(
$data
,
$certs
);
...
...
@@ -50,6 +50,7 @@ class provisionService_http_ssl extends provisionService_http_public {
$data
[
'ip_address'
]
=
$this
->
server
->
ip_addresses
[
0
];
}
}
return
$data
;
}
...
...
@@ -66,7 +67,7 @@ class provisionService_http_ssl extends provisionService_http_public {
$certs
[
'ssl_cert_source'
]
=
"
{
$source_path
}
/openssl.crt"
;
foreach
(
$certs
as
$cert
)
{
$exists
=
provision_file
()
->
exists
(
$cert
)
.
status
();
$exists
=
provision_file
()
->
exists
(
$cert
)
->
status
();
if
(
!
$exists
)
{
// if any of the files don't exist, regenerate them.
$this
->
generate_certificates
(
$ssl_key
);
...
...
@@ -79,7 +80,7 @@ class provisionService_http_ssl extends provisionService_http_public {
$path
=
"
{
$this
->
server
->
http_ssld_path
}
/
{
$ssl_key
}
"
;
$certs
[
'ssl_cert_key'
]
=
"
{
$path
}
/openssl.key"
;
$certs
[
'ssl_cert'
]
=
"
{
$path
}
/openssl.crt"
;
return
$certs
;
}
...
...
@@ -93,12 +94,12 @@ class provisionService_http_ssl extends provisionService_http_public {
function
generate_certificates
(
$ssl_key
)
{
$path
=
"
{
$this
->
server
->
ssld_path
}
/
{
$ssl_key
}
"
;
$created
=
provision_file
()
->
create_dir
(
$path
,
provision_file
()
->
create_dir
(
$path
,
dt
(
"SSL certificate directory for %ssl_key"
,
array
(
'%ssl_key'
=>
$ssl_key
)),
0700
)
->
status
()
;
)),
0700
);
if
(
$created
)
{
if
(
provision_file
()
->
exists
(
$path
)
->
status
()
)
{
$pass
=
'pass'
;
// generate a key
...
...
@@ -177,7 +178,7 @@ class provisionConfig_http_ssl_site extends provisionConfig_http_site {
dt
(
"SSL Certificate directory for %key on %server"
,
array
(
'%key'
=>
$this
->
ssl_key
,
'%server'
=>
$this
->
data
[
'server'
]
->
remote_host
,
)),
700
);
)),
0
700
);
// Copy the certificates to the server's ssl.d directory.
provision_file
()
->
copy
(
...
...
@@ -200,9 +201,9 @@ class provisionConfig_http_ssl_site extends provisionConfig_http_site {
$used
=
provisionService_http_ssl
::
certificate_in_use
(
$this
->
data
[
'ssl_key'
]);
if
(
!
$used
)
{
// we can remove the certificate from the server ssl.d directory.
provision_file
()
->
rmdir
(
dirname
(
$this
->
data
[
'ssl_cert'
]));
#
provision_file()->rmdir(dirname($this->data['ssl_cert']));
// remove the file from the remote server too.
$this
->
data
[
'server'
]
->
sync
(
dirname
(
$this
->
data
[
'ssl_cert'
]));
#
$this->data['server']->sync(dirname($this->data['ssl_cert']));
}
}
...
...
@@ -215,7 +216,7 @@ class provisionConfig_http_ssl_site extends provisionConfig_http_site {
}
function
filename
()
{
$this
->
data
[
'http_vhostd_path'
]
.
'/'
.
$this
->
uri
.
'_ssl'
;
return
$this
->
data
[
'http_vhostd_path'
]
.
'/'
.
$this
->
uri
.
'_ssl'
;
}
}
provision.file.inc
View file @
fb68c5c7
...
...
@@ -20,6 +20,27 @@ function provision_file() {
}
class
provisionFileSystem
extends
provisionChainedState
{
/**
* Copy file from $source to $destination.
*
* @param $source
* The path that you want copy.
* @param $destination
* The destination path.
*/
function
copy
(
$source
,
$destination
)
{
$this
->
_clear_state
();
$this
->
tokens
=
array
(
'@source'
=>
$source
,
'@destination'
=>
$destination
);
$this
->
last_status
=
FALSE
;
$this
->
last_status
=
copy
(
$source
,
$destination
);
return
$this
;
}
/**
* Determine if $path can be written to.
*
...
...
@@ -269,6 +290,8 @@ class provisionFileSystem extends provisionChainedState {
return
$this
;
}
/**
* Extract gzip-compressed tar archive.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment