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
Levin Zimmermann
slapos
Commits
6159a6ab
Commit
6159a6ab
authored
Jul 06, 2021
by
Lisa Casino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/turnserver: switch-softwaretype
listening-ip parameter is now mandatory
parent
4d8940ff
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
35 deletions
+62
-35
software/turnserver/buildout.hash.cfg
software/turnserver/buildout.hash.cfg
+3
-3
software/turnserver/instance-insecure-turnserver.cfg.jinja2.in
...are/turnserver/instance-insecure-turnserver.cfg.jinja2.in
+11
-8
software/turnserver/instance-turnserver.cfg.jinja2.in
software/turnserver/instance-turnserver.cfg.jinja2.in
+19
-16
software/turnserver/instance.cfg.in
software/turnserver/instance.cfg.in
+15
-6
software/turnserver/test/test.py
software/turnserver/test/test.py
+14
-2
No files found.
software/turnserver/buildout.hash.cfg
View file @
6159a6ab
...
@@ -15,12 +15,12 @@
...
@@ -15,12 +15,12 @@
[instance-cfg]
[instance-cfg]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
776c7de2054f78ba79382c22d85018b
e
md5sum =
b43d5e8d1fc2d0eeb54f91cefe6a5ba
e
[template-turnserver]
[template-turnserver]
filename = instance-turnserver.cfg.jinja2.in
filename = instance-turnserver.cfg.jinja2.in
md5sum =
480f69e2f21a24f52bb2eb80bfb3f8ea
md5sum =
7af3318d7249e9afe22436d9fe200159
[template-insecure-turnserver]
[template-insecure-turnserver]
filename = instance-insecure-turnserver.cfg.jinja2.in
filename = instance-insecure-turnserver.cfg.jinja2.in
md5sum =
99c38cd20846eb3153d0392e6b81062c
md5sum =
3db65c3a16eb76ab438ac3817d1a5fea
software/turnserver/instance-insecure-turnserver.cfg.jinja2.in
View file @
6159a6ab
{% set part_list = [] -%}
{% set part_list = [] -%}
{% set server_name = slapparameter_dict.get('server-name', 'turn.example.com') -%}
{%- set parameter = dict(default_parameter_dict, **slapparameter_dict) %}
{%- set server_name = parameter['server-name'] %}
[directory]
[directory]
recipe = slapos.cookbook:mkdirectory
recipe = slapos.cookbook:mkdirectory
...
@@ -17,9 +18,11 @@ plugins = ${:etc}/plugin
...
@@ -17,9 +18,11 @@ plugins = ${:etc}/plugin
recipe = slapos.cookbook:generate.password
recipe = slapos.cookbook:generate.password
bytes = 8
bytes = 8
{% set turn_port = slapparameter_dict.get('port', 3478) -%}
{% set turn_port = parameter['port'] -%}
{% set turn_tls_port = slapparameter_dict.get('tls-port', 5349) -%}
{% set turn_tls_port = parameter['tls-port'] -%}
{% set listining_ip = slapparameter_dict.get('listening-ip', (ipv4 | list)[0]) -%}
# listening-ip parameter is mandatory
{% set listening_ip = slapparameter_dict['listening-ip'] -%}
[turnserver-config]
[turnserver-config]
recipe = collective.recipe.template
recipe = collective.recipe.template
user = nxdturn
user = nxdturn
...
@@ -27,11 +30,11 @@ input = inline:
...
@@ -27,11 +30,11 @@ input = inline:
listening-port={{ turn_port }}
listening-port={{ turn_port }}
lt-cred-mech
lt-cred-mech
realm={{ server_name }}
realm={{ server_name }}
{% if
slapparameter_dict.get('external-ip', '')
%}
{% if
parameter['external-ip']
%}
external-ip={{
slapparameter_dict
['external-ip'] }}
external-ip={{
parameter
['external-ip'] }}
{% endif %}
{% endif %}
fingerprint
fingerprint
listening-ip={{ list
i
ning_ip }}
listening-ip={{ list
e
ning_ip }}
server-name={{ server_name }}
server-name={{ server_name }}
no-stdout-log
no-stdout-log
simple-log
simple-log
...
@@ -56,7 +59,7 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
...
@@ -56,7 +59,7 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
<= monitor-promise-base
<= monitor-promise-base
module = check_socket_listening
module = check_socket_listening
name = turnserver-port-listening.py
name = turnserver-port-listening.py
config-host = {{ list
i
ning_ip }}
config-host = {{ list
e
ning_ip }}
config-port = {{ turn_port }}
config-port = {{ turn_port }}
[publish-connection-information]
[publish-connection-information]
...
...
software/turnserver/instance-turnserver.cfg.jinja2.in
View file @
6159a6ab
{% set part_list = [] -%}
{%- set part_list = [] -%}
{% set server_name = slapparameter_dict.get('server-name', 'turn.example.com') -%}
{%- set parameter = dict(default_parameter_dict, **slapparameter_dict) %}
{%- set server_name = parameter['server-name'] %}
[directory]
[directory]
recipe = slapos.cookbook:mkdirectory
recipe = slapos.cookbook:mkdirectory
...
@@ -31,9 +32,9 @@ mode = {{ mode }}
...
@@ -31,9 +32,9 @@ mode = {{ mode }}
{% do part_list.append(section_name) -%}
{% do part_list.append(section_name) -%}
{%- endmacro %}
{%- endmacro %}
{% if
slapparameter_dict.get('ssl-key') and slapparameter_dict.get('ssl-crt')
-%}
{% if
parameter['ssl-key'] and parameter['ssl-crt']
-%}
{{ simplefile('ssl-certificate', '${turnserver-ssl:certificate}',
slapparameter_dict.get('ssl-crt')
) }}
{{ simplefile('ssl-certificate', '${turnserver-ssl:certificate}',
parameter['ssl-crt']
) }}
{{ simplefile('ssl-key', '${turnserver-ssl:key}',
slapparameter_dict.get('ssl-key')
, 600) }}
{{ simplefile('ssl-key', '${turnserver-ssl:key}',
parameter['ssl-key']
, 600) }}
{% else -%}
{% else -%}
{% do part_list.append('gen-certificate') -%}
{% do part_list.append('gen-certificate') -%}
[gen-certificate]
[gen-certificate]
...
@@ -57,9 +58,9 @@ secret-file = ${directory:etc}/.turnsecret
...
@@ -57,9 +58,9 @@ secret-file = ${directory:etc}/.turnsecret
command =
command =
if [ ! -s "${:secret-file}" ]; then
if [ ! -s "${:secret-file}" ]; then
cat <<EOF > ${:secret-file}
cat <<EOF > ${:secret-file}
[turnserver]
[turnserver]
secret = $("{{ parameter_dict['openssl'] }}/bin/openssl" rand -hex 32)
secret = $("{{ parameter_dict['openssl'] }}/bin/openssl" rand -hex 32)
EOF
EOF
fi
fi
chmod 600 ${:secret-file}
chmod 600 ${:secret-file}
...
@@ -68,9 +69,11 @@ recipe = slapos.cookbook:zero-knowledge.read
...
@@ -68,9 +69,11 @@ recipe = slapos.cookbook:zero-knowledge.read
file-path = ${gen-secret:secret-file}
file-path = ${gen-secret:secret-file}
secret =
secret =
{% set turn_port = slapparameter_dict.get('port', 3478) -%}
{% set turn_port = parameter['port'] -%}
{% set turn_tls_port = slapparameter_dict.get('tls-port', 5349) -%}
{% set turn_tls_port = parameter['tls-port'] -%}
{% set listining_ip = slapparameter_dict.get('listening-ip', (ipv4 | list)[0]) -%}
# listening-ip parameter is mandatory
{% set listening_ip = slapparameter_dict['listening-ip'] -%}
[turnserver-config]
[turnserver-config]
recipe = collective.recipe.template
recipe = collective.recipe.template
input = inline:
input = inline:
...
@@ -80,9 +83,9 @@ input = inline:
...
@@ -80,9 +83,9 @@ input = inline:
lt-cred-mech
lt-cred-mech
use-auth-secret
use-auth-secret
static-auth-secret=${read-secret:secret}
static-auth-secret=${read-secret:secret}
listening-ip={{ list
i
ning_ip }}
listening-ip={{ list
e
ning_ip }}
{% if
slapparameter_dict.get('external-ip', '')
%}
{% if
parameter['external-ip']
%}
external-ip={{
slapparameter_dict
['external-ip'] }}
external-ip={{
parameter
['external-ip'] }}
{% endif %}
{% endif %}
server-name={{ server_name }}
server-name={{ server_name }}
realm={{ server_name }}
realm={{ server_name }}
...
@@ -122,14 +125,14 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
...
@@ -122,14 +125,14 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
<= monitor-promise-base
<= monitor-promise-base
module = check_socket_listening
module = check_socket_listening
name = turnserver-port-listening.py
name = turnserver-port-listening.py
config-host = {{ list
i
ning_ip }}
config-host = {{ list
e
ning_ip }}
config-port = {{ turn_port }}
config-port = {{ turn_port }}
[promise-check-turnserver-tls-port]
[promise-check-turnserver-tls-port]
<= monitor-promise-base
<= monitor-promise-base
module = check_socket_listening
module = check_socket_listening
name = turnserver-tls-port-listening.py
name = turnserver-tls-port-listening.py
config-host = {{ list
i
ning_ip }}
config-host = {{ list
e
ning_ip }}
config-port = {{ turn_tls_port }}
config-port = {{ turn_tls_port }}
[publish-connection-information]
[publish-connection-information]
...
...
software/turnserver/instance.cfg.in
View file @
6159a6ab
...
@@ -6,12 +6,11 @@ eggs-directory = ${buildout:eggs-directory}
...
@@ -6,12 +6,11 @@ eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
offline = true
[switch-softwaretype]
[switch-softwaretype]
recipe = slapos.cookbook:softwaretype
recipe = slapos.cookbook:switch-softwaretype
default = $${dynamic-template-turnserver:rendered}
insecure = $${dynamic-template-insecure-turnserver:rendered}
RootSoftwareInstance = $${:default}
RootSoftwareInstance = $${:default}
default = dynamic-template-turnserver:rendered
insecure = dynamic-template-insecure-turnserver:rendered
[slap-configuration]
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
recipe = slapos.cookbook:slapconfiguration.serialised
...
@@ -38,13 +37,23 @@ context =
...
@@ -38,13 +37,23 @@ context =
raw template_monitor ${monitor2-template:rendered}
raw template_monitor ${monitor2-template:rendered}
raw logrotate_cfg ${template-logrotate-base:rendered}
raw logrotate_cfg ${template-logrotate-base:rendered}
$${:extra-context}
$${:extra-context}
jsonkey default_parameter_dict :default-parameters
default-parameters =
{
"server-name" : "turn.example.com",
"ssl-key": "",
"ssl-crt": "",
"port": "3478",
"tls-port": "5349",
"external-ip": ""
# listening-ip parameter is mandatory
#"listening-ip": null,
}
[dynamic-template-turnserver-parameters]
[dynamic-template-turnserver-parameters]
openssl = ${openssl:location}
openssl = ${openssl:location}
turnserver-location = ${coturn:location}
turnserver-location = ${coturn:location}
[dynamic-template-turnserver]
[dynamic-template-turnserver]
<= jinja2-template-base
<= jinja2-template-base
template = ${template-turnserver:location}/${template-turnserver:filename}
template = ${template-turnserver:location}/${template-turnserver:filename}
...
...
software/turnserver/test/test.py
View file @
6159a6ab
...
@@ -60,6 +60,12 @@ class TurnServerTestCase(InstanceTestCase):
...
@@ -60,6 +60,12 @@ class TurnServerTestCase(InstanceTestCase):
class
TestServices
(
TurnServerTestCase
):
class
TestServices
(
TurnServerTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'listening-ip'
:
cls
.
_ipv4_address
}
def
test_process_list
(
self
):
def
test_process_list
(
self
):
hash_list
=
[
hash_list
=
[
'software_release/buildout.cfg'
,
'software_release/buildout.cfg'
,
...
@@ -138,7 +144,7 @@ class TestParameters(TurnServerTestCase):
...
@@ -138,7 +144,7 @@ class TestParameters(TurnServerTestCase):
'port'
:
3488
,
'port'
:
3488
,
'tls-port'
:
5369
,
'tls-port'
:
5369
,
'external-ip'
:
'127.0.0.1'
,
'external-ip'
:
'127.0.0.1'
,
'listening-ip'
:
'127.0.0.1'
'listening-ip'
:
cls
.
_ipv4_address
}
}
def
test_turnserver_with_parameters
(
self
):
def
test_turnserver_with_parameters
(
self
):
...
@@ -180,7 +186,7 @@ userdb=%(instance_path)s/srv/turndb
...
@@ -180,7 +186,7 @@ userdb=%(instance_path)s/srv/turndb
pidfile=%(instance_path)s/var/run/turnserver.pid
pidfile=%(instance_path)s/var/run/turnserver.pid
verbose"""
%
{
'instance_path'
:
self
.
partition_path
,
verbose"""
%
{
'instance_path'
:
self
.
partition_path
,
'secret'
:
secret
,
'secret'
:
secret
,
'ipv4'
:
'127.0.0.1'
,
'ipv4'
:
self
.
_ipv4_address
,
'name'
:
'turn.site.com'
,
'name'
:
'turn.site.com'
,
'external_ip'
:
'127.0.0.1'
,
'external_ip'
:
'127.0.0.1'
,
'port'
:
3488
,
'port'
:
3488
,
...
@@ -193,6 +199,12 @@ verbose""" % {'instance_path': self.partition_path,
...
@@ -193,6 +199,12 @@ verbose""" % {'instance_path': self.partition_path,
class
TestInsecureServices
(
TurnServerTestCase
):
class
TestInsecureServices
(
TurnServerTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'listening-ip'
:
cls
.
_ipv4_address
}
@
classmethod
@
classmethod
def
getInstanceSoftwareType
(
cls
):
def
getInstanceSoftwareType
(
cls
):
return
'insecure'
return
'insecure'
...
...
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