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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
slapos
Commits
39d8d005
Commit
39d8d005
authored
Oct 25, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final improvement of stunnel recipe
parent
db1dc523
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
25 deletions
+6
-25
slapos/recipe/stunnel/__init__.py
slapos/recipe/stunnel/__init__.py
+4
-23
slapos/recipe/stunnel/template/server.conf.in
slapos/recipe/stunnel/template/server.conf.in
+2
-2
No files found.
slapos/recipe/stunnel/__init__.py
View file @
39d8d005
...
@@ -24,44 +24,25 @@
...
@@ -24,44 +24,25 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
##############################################################################
##############################################################################
import
itertools
import
zc.buildout
from
slapos.recipe.librecipe
import
GenericBaseRecipe
from
slapos.recipe.librecipe
import
GenericBaseRecipe
class
Recipe
(
GenericBaseRecipe
):
class
Recipe
(
GenericBaseRecipe
):
def
_options
(
self
,
options
):
def
_options
(
self
,
options
):
self
.
types
=
[
'local'
,
'remote'
]
self
.
datas
=
[
'address'
,
'port'
]
for
type_
in
self
.
types
:
for
data
in
self
.
datas
:
opt
=
'%s-%s'
%
(
type_
,
data
)
if
opt
not
in
options
:
raise
zc
.
buildout
.
UserError
(
"No %s for %s connections."
%
(
data
,
type_
))
self
.
isClient
=
self
.
optionIsTrue
(
'client'
,
default
=
False
)
self
.
isClient
=
self
.
optionIsTrue
(
'client'
,
default
=
False
)
if
self
.
isClient
:
if
self
.
isClient
:
self
.
logger
.
info
(
"Client mode"
)
self
.
logger
.
info
(
"Client mode"
)
else
:
else
:
self
.
logger
.
info
(
"Server mode"
)
self
.
logger
.
info
(
"Server mode"
)
if
'name'
not
in
options
:
options
[
'name'
]
=
self
.
name
def
install
(
self
):
def
install
(
self
):
path_list
=
[]
path_list
=
[]
conf
=
{}
conf
=
{}
gathered_options
=
[
'%s-%s'
%
option
for
type_
in
[
'remote'
,
'local'
]:
for
option
in
itertools
.
product
(
self
.
types
,
for
data
in
[
'host'
,
'port'
]:
self
.
datas
)]
confkey
,
opt
=
[
'%s%s%s'
%
(
type_
,
i
,
data
)
for
i
in
[
'_'
,
'-'
]]
for
option
in
gathered_options
:
conf
[
confkey
]
=
self
.
options
[
opt
]
# XXX: Because the options are using dash and the template uses
# underscore
conf
[
option
.
replace
(
'-'
,
'_'
)]
=
self
.
options
[
option
]
pid_file
=
self
.
options
[
'pid-file'
]
pid_file
=
self
.
options
[
'pid-file'
]
conf
.
update
(
pid_file
=
pid_file
)
conf
.
update
(
pid_file
=
pid_file
)
...
...
slapos/recipe/stunnel/template/server.conf.in
View file @
39d8d005
...
@@ -6,5 +6,5 @@ key = %(key)s
...
@@ -6,5 +6,5 @@ key = %(key)s
cert = %(cert)s
cert = %(cert)s
[service]
[service]
accept = %(remote_
address
)s:%(remote_port)s
accept = %(remote_
host
)s:%(remote_port)s
connect = %(local_
address
)s:%(local_port)s
connect = %(local_
host
)s:%(local_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