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
8725606c
Commit
8725606c
authored
7 years ago
by
Hugo Mangeart
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
219229b9
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
2.Common_services/7.letsencrypt/0_setup.sh
+63
-0
63 additions, 0 deletions
2.Common_services/7.letsencrypt/0_setup.sh
with
63 additions
and
0 deletions
2.Common_services/7.letsencrypt/0_setup.sh
0 → 100644
+
63
−
0
View file @
8725606c
# waiting for go
exit
0
trap
"cp /tmp/{mediaserver-msuser.conf,skyreach.conf,msmonitor.conf} /etc/nginx/sites-available/; exit 255"
ERR
source
/root/envsetup/global-conf.sh
LE_DIR
=
"/etc/letsencrypt/live/"
# GET LETSENCRYPT
sudo
apt-get update
sudo
apt-get
install
software-properties-common
sudo
add-apt-repository ppa:certbot/certbot
sudo
apt-get update
sudo
apt-get
install
python-certbot-nginx
cd
/etc/nginx/sites-available/
# BACKUP
cp
mediaserver-msuser.conf skyreach.conf msmonitor.conf /tmp/
# PREPARE LETSENCRYPT REQUEST STRING
# ALTER NGINX CONF TO ACCEPT CLEAR HTTP
DOMAIN_STRING
=
"
${
MS_SERVER_NAME
}
"
&&
\
sed
-i
s/rewrite/#rewrite/ mediaserver-msuser.conf
[
-n
"
${
CM_SERVER_NAME
}
"
]
&&
\
DOMAIN_STRING
=
"
${
DOMAIN_STRING
}
,
${
CM_SERVER_NAME
}
"
&&
\
sed
-i
s/rewrite/#rewrite/ skyreach.conf
[
-n
"
${
MONITOR_SERVER_NAME
}
"
]
&&
\
DOMAIN_STRING
=
"
${
DOMAIN_STRING
}
,
${
MONITOR_SERVER_NAME
}
"
&&
\
sed
-i
s/rewrite/#rewrite/ msmonitor.conf
set
-e
nginx
-t
&&
\
service nginx reload
# ASKS FOR CERTS TO LETSENCRYPT
mkdir
-p
/tmp/letsencrypt
for
domain
in
$MS_SERVER_NAME
$CM_SERVER_NAME
$MONITOR_SERVER_NAME
;
do
certbot certonly
\
--webroot
--webroot-path
/tmp/letsencrypt
\
--domains
"
${
DOMAIN_STRING
}
"
\
--email
"
${
EMAIL_ADMINS
}
"
\
--rsa-key-size
4096
done
# RE-REDIRECT HTTP to HTTPS
sed
-i
s/rewrite/#rewrite/ mediaserver-msuser.conf skyreach.conf msmonitor.conf
# CHECK CERTS PRESENCE & EDIT NGINX CONFIG
set
+e
[
-f
${
LE_DIR
}
/
${
MS_SERVER_NAME
}
/
{
fullchain.pem,privkey.pem
}
]
&&
\
sed
-i
s/#ssl_certificate/ssl_certificate/g mediaserver-msuser.conf
[
-f
${
LE_DIR
}
/
${
CM_SERVER_NAME
}
/
{
fullchain.pem,privkey.pem
}
]
&&
\
sed
-i
s/#ssl_certificate/ssl_certificate/g skyreach.conf
[
-f
${
LE_DIR
}
/
${
MONITOR_SERVER_NAME
}
/
{
fullchain.pem,privkey.pem
}
]
&&
\
sed
-i
s/#ssl_certificate/ssl_certificate/g msmonitor.conf
# RELOAD NGINX IF CONF IS CORRECT
nginx
-t
&&
\
service nginx reload
rm
/tmp/
{
mediaserver-msuser.conf,skyreach.conf,msmonitor.conf
}
cd
-
\ No newline at end of file
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