Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
ad07d0fa
Commit
ad07d0fa
authored
8 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Changed Nginx SSL setup (refs
#20139
).
parent
85d66cdb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
6.Nginx/0_setup.py
+16
-12
16 additions, 12 deletions
6.Nginx/0_setup.py
with
16 additions
and
12 deletions
6.Nginx/0_setup.py
+
16
−
12
View file @
ad07d0fa
...
@@ -88,17 +88,21 @@ def setup(interactive=True):
...
@@ -88,17 +88,21 @@ def setup(interactive=True):
if
not
os
.
path
.
exists
(
ssl_conf
):
if
not
os
.
path
.
exists
(
ssl_conf
):
utils
.
log
(
'
The SSL configuration file
"
%s
"
does not exist, SSL certificate not updated.
'
%
ssl_conf
)
utils
.
log
(
'
The SSL configuration file
"
%s
"
does not exist, SSL certificate not updated.
'
%
ssl_conf
)
else
:
else
:
ssl_cert
=
utils
.
get_conf
(
'
SSL_CERTIFICATE
'
)
or
'
/etc/ssl/certs/ssl-cert-snakeoil.pem
'
default_cert
=
'
/etc/ssl/certs/ssl-cert-snakeoil.pem
'
ssl_cert
=
utils
.
get_conf
(
'
SSL_CERTIFICATE
'
)
or
default_cert
ssl_key
=
utils
.
get_conf
(
'
SSL_CERTIFICATE_KEY
'
)
or
'
/etc/ssl/private/ssl-cert-snakeoil.key
'
ssl_key
=
utils
.
get_conf
(
'
SSL_CERTIFICATE_KEY
'
)
or
'
/etc/ssl/private/ssl-cert-snakeoil.key
'
with
open
(
ssl_conf
,
'
r
'
)
as
fo
:
if
ssl_cert
==
default_cert
:
content
=
fo
.
read
()
utils
.
log
(
'
The configuration uses the default certificate, no modification will be made in
"
%s
"
.
'
%
ssl_conf
)
new_content
=
content
new_content
=
re
.
sub
(
r
'
ssl_certificate\s+([\w/\-\_\.]+);
'
,
'
ssl_certificate %s;
'
%
ssl_cert
,
new_content
)
new_content
=
re
.
sub
(
r
'
ssl_certificate_key\s+([\w/\-\_\.]+);
'
,
'
ssl_certificate_key %s;
'
%
ssl_key
,
new_content
)
if
new_content
!=
content
:
with
open
(
ssl_conf
,
'
w
'
)
as
fo
:
fo
.
write
(
new_content
)
utils
.
log
(
'
SSL configuration file %s updated.
'
%
ssl_conf
)
else
:
else
:
utils
.
log
(
'
SSL configuration file %s already up to date.
'
%
ssl_conf
)
with
open
(
ssl_conf
,
'
r
'
)
as
fo
:
utils
.
run_commands
([
'
service nginx restart
'
])
content
=
fo
.
read
()
new_content
=
content
new_content
=
re
.
sub
(
r
'
ssl_certificate\s+([\w/\-\_\.]+);
'
,
'
ssl_certificate %s;
'
%
ssl_cert
,
new_content
)
new_content
=
re
.
sub
(
r
'
ssl_certificate_key\s+([\w/\-\_\.]+);
'
,
'
ssl_certificate_key %s;
'
%
ssl_key
,
new_content
)
if
new_content
!=
content
:
with
open
(
ssl_conf
,
'
w
'
)
as
fo
:
fo
.
write
(
new_content
)
utils
.
log
(
'
SSL configuration file %s updated.
'
%
ssl_conf
)
else
:
utils
.
log
(
'
SSL configuration file %s already up to date.
'
%
ssl_conf
)
utils
.
run_commands
([
'
nginx -t
'
,
'
service nginx restart
'
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment