Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhifan huang
slapos
Commits
4d9346ce
Commit
4d9346ce
authored
Jun 06, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql : (hopefully) working set
parent
f1d9b852
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
17 deletions
+14
-17
slapos/recipe/mysql/__init__.py
slapos/recipe/mysql/__init__.py
+11
-13
slapos/recipe/mysql/template/stunnel.conf.in
slapos/recipe/mysql/template/stunnel.conf.in
+3
-4
No files found.
slapos/recipe/mysql/__init__.py
View file @
4d9346ce
...
@@ -48,18 +48,17 @@ class Recipe(BaseSlapRecipe):
...
@@ -48,18 +48,17 @@ class Recipe(BaseSlapRecipe):
mysql_conf
=
self
.
installMysqlServer
(
self
.
getLocalIPv4Address
(),
45678
)
mysql_conf
=
self
.
installMysqlServer
(
self
.
getLocalIPv4Address
(),
45678
)
ca_conf
=
self
.
installCertificateAuthority
()
ca_conf
=
self
.
installCertificateAuthority
()
key
,
certificate
=
self
.
requestCertificate
(
'
Login Based Access
'
)
key
,
certificate
=
self
.
requestCertificate
(
'
MySQL
'
)
stunnel_conf
=
self
.
installStunnel
(
self
.
getGlobalIPv6Address
(),
12345
,
stunnel_conf
=
self
.
installStunnel
(
self
.
getGlobalIPv6Address
(),
mysql_conf
[
'tcp_port'
],
self
.
getLocalIPv4Address
(),
12345
,
mysql_conf
[
'tcp_port'
],
certificate
,
key
,
ca_conf
[
'ca_crl'
],
certificate
,
key
,
ca_conf
[
'ca_crl'
],
ca_conf
[
'certificate_authority_path'
])
ca_conf
[
'certificate_authority_path'
])
self
.
linkBinary
()
self
.
linkBinary
()
self
.
setConnectionDict
(
dict
(
self
.
setConnectionDict
(
dict
(
mysql_local_ip
=
mysql_conf
[
'tcp_port'
],
stunnel_ip
=
stunnel_conf
[
'public_ip'
],
stunnel_ip
=
stunnel_conf
[
'ipv6'
],
stunnel_port
=
stunnel_conf
[
'public_port'
],
stunnel_port
=
stunnel_conf
[
'port'
],
mysql_database
=
mysql_conf
[
'mysql_database'
],
mysql_database
=
mysql_conf
[
'mysql_database'
],
mysql_user
=
mysql_conf
[
'mysql_user'
],
mysql_user
=
mysql_conf
[
'mysql_user'
],
mysql_password
=
mysql_conf
[
'mysql_password'
],
mysql_password
=
mysql_conf
[
'mysql_password'
],
...
@@ -204,23 +203,23 @@ class Recipe(BaseSlapRecipe):
...
@@ -204,23 +203,23 @@ class Recipe(BaseSlapRecipe):
parser
.
write
(
open
(
os
.
path
.
join
(
self
.
ca_request_dir
,
hash
),
'w'
))
parser
.
write
(
open
(
os
.
path
.
join
(
self
.
ca_request_dir
,
hash
),
'w'
))
return
key
,
certificate
return
key
,
certificate
def
installStunnel
(
self
,
ip
,
port
,
external
_port
,
def
installStunnel
(
self
,
public_ip
,
private_ip
,
public_port
,
private
_port
,
ca_certificate
,
key
,
ca_crl
,
ca_path
):
ca_certificate
,
key
,
ca_crl
,
ca_path
):
"""Installs stunnel"""
"""Installs stunnel"""
template_filename
=
self
.
getTemplateFilename
(
'stunnel.conf.in'
)
template_filename
=
self
.
getTemplateFilename
(
'stunnel.conf.in'
)
log
=
os
.
path
.
join
(
self
.
log_directory
,
'stunnel.log'
)
log
=
os
.
path
.
join
(
self
.
log_directory
,
'stunnel.log'
)
pid_file
=
os
.
path
.
join
(
self
.
run_directory
,
'stunnel.pid'
)
pid_file
=
os
.
path
.
join
(
self
.
run_directory
,
'stunnel.pid'
)
stunnel_conf
=
dict
(
stunnel_conf
=
dict
(
ipv6
=
ip
,
public_ip
=
public_
ip
,
ipv4
=
self
.
getLocalIPv4Address
,
private_ip
=
private_ip
,
p
ort
=
port
,
p
ublic_port
=
public_
port
,
pid_file
=
pid_file
,
pid_file
=
pid_file
,
log
=
log
,
log
=
log
,
cert
=
ca_certificate
,
cert
=
ca_certificate
,
key
=
key
,
key
=
key
,
ca_crl
=
ca_crl
,
ca_crl
=
ca_crl
,
ca_path
=
ca_path
,
ca_path
=
ca_path
,
external_port
=
external
_port
,
private_port
=
private
_port
,
)
)
stunnel_conf_path
=
self
.
createConfigurationFile
(
"stunnel.conf"
,
stunnel_conf_path
=
self
.
createConfigurationFile
(
"stunnel.conf"
,
self
.
substituteTemplate
(
template_filename
,
self
.
substituteTemplate
(
template_filename
,
...
@@ -231,7 +230,6 @@ class Recipe(BaseSlapRecipe):
...
@@ -231,7 +230,6 @@ class Recipe(BaseSlapRecipe):
self
.
options
[
'stunnel_binary'
].
strip
(),
stunnel_conf_path
]
self
.
options
[
'stunnel_binary'
].
strip
(),
stunnel_conf_path
]
)[
0
]
)[
0
]
self
.
path_list
.
append
(
wrapper
)
self
.
path_list
.
append
(
wrapper
)
return
stunnel_conf
return
stunnel_conf
...
...
slapos/recipe/mysql/template/stunnel.conf.in
View file @
4d9346ce
...
@@ -6,8 +6,7 @@ CApath = %(ca_path)s
...
@@ -6,8 +6,7 @@ CApath = %(ca_path)s
key = %(key)s
key = %(key)s
CRLpath = %(ca_crl)s
CRLpath = %(ca_crl)s
cert = %(cert)s
cert = %(cert)s
;key = /etc/ssl/certs/stunnel.pem
[
mysqls
]
[
service
]
accept = %(
ipv6)s:%(
port)s
accept = %(
public_ip)s:%(public_
port)s
connect = %(
ipv4)s:%(external
_port)s
connect = %(
private_ip)s:%(private
_port)s
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