From fd566b5410660b445084a37bdfbc1e46cd7ec4c6 Mon Sep 17 00:00:00 2001 From: Alain Takoudjou <talino@tiolive.com> Date: Tue, 21 Apr 2015 11:25:58 +0200 Subject: [PATCH] allow to input all re6st-registry parameters --- .../instance-re6stnet-input-schema.json | 60 +++++++++++++++++++ software/re6stnet/instance-re6stnet.cfg.in | 15 ++++- software/re6stnet/re6st-registry.conf.in | 18 +++++- software/re6stnet/software.cfg | 4 +- 4 files changed, 91 insertions(+), 6 deletions(-) diff --git a/software/re6stnet/instance-re6stnet-input-schema.json b/software/re6stnet/instance-re6stnet-input-schema.json index dd9f6f04f..c9443a9b0 100644 --- a/software/re6stnet/instance-re6stnet-input-schema.json +++ b/software/re6stnet/instance-re6stnet-input-schema.json @@ -12,6 +12,66 @@ "type": "integer", "minimum": 1024, "default": 2048 + }, + "prefix-length": { + "title": "Default length of allocated prefixes.", + "description": "Default length of allocated prefixes.", + "type": "integer", + "default": 16 + }, + "anonymous-prefix-length": { + "title": "Length of allocated anonymous prefixes.", + "description": "Length of allocated anonymous prefixes. 0 is unset.", + "type": "integer", + "default": 0 + }, + "mailhost": { + "title": "SMTP host to send confirmation emails.", + "description": "SMTP host to send confirmation emails. Not needed if when token is requested from slave instances.", + "type": "string", + "default": "127.0.0.1" + }, + "ipv4-net": { + "title": "Enable ipv4 (ip/NET P_LENGTH).", + "description": "Enable ipv4 (ip/NET P_LENGTH). Each node is assigned a subnet of length PLEN, inside network IP/N. Ex: 10.42.0.0/16 8", + "type": "string", + "default": "" + }, + "client-count": { + "title": "Number of client tunnels to set up.", + "description": "Number of client tunnels to set up.", + "type": "integer", + "default": 10 + }, + "tunnel-refresh": { + "title": "Interval in seconds between two tunnel refresh.", + "description": "Interval in seconds between two tunnel refresh: the worst tunnel is closed if the number of client tunnels has reached its maximum number (client-count).", + "type": "integer", + "default": 300 + }, + "max-clients": { + "title": "Maximum number of accepted clients per OpenVPN server.", + "description": "Maximum number of accepted clients per OpenVPN server. (if unset or 0: client-count * 2, which actually represents the average number of tunnels to other peers)", + "type": "integer", + "default": 0 + }, + "hello": { + "title": "Hello interval in seconds, for both wired and wireless connections.", + "description": "Hello interval in seconds, for both wired and wireless connections. OpenVPN ping-exit option is set to 4 times the hello interval. It takes between 3 and 4 times the hello interval for Babel to re-establish connection with a node for which the direct connection has been cut.", + "type": "integer", + "default": 15 + }, + "min-protocol": { + "title": "Reject nodes that are too old.", + "description": "Reject nodes that are too old. Default is unset.", + "type": "integer", + "default": -1 + }, + "encrypt": { + "title": "Specify that tunnels should be encrypted.", + "description": "Specify that tunnels should be encrypted.", + "type": "boolean", + "default": false } } } \ No newline at end of file diff --git a/software/re6stnet/instance-re6stnet.cfg.in b/software/re6stnet/instance-re6stnet.cfg.in index a6a7ebb21..8ab293f29 100644 --- a/software/re6stnet/instance-re6stnet.cfg.in +++ b/software/re6stnet/instance-re6stnet.cfg.in @@ -35,6 +35,7 @@ log = ${directory:log}/re6stnet conf = ${directory:etc}/re6stnet ssl = ${:conf}/ssl token = ${:conf}/token +run = ${directory:run}/re6stnet [certificate-authority] recipe = slapos.cookbook:certificate_authority @@ -116,11 +117,19 @@ db = ${re6stnet-dirs:registry}/registry.db ca = ${re6stnet-dirs:ssl}/re6stnet.crt key = ${re6stnet-dirs:ssl}/re6stnet.key dh = ${re6stnet-dirs:ssl}/dh.pem -mailhost = 127.0.0.1 +verbose = 2 +mailhost = {{ slapparameter_dict.get('mailhost', '127.0.0.1') }} prefix-length = {{ slapparameter_dict.get('prefix-length', 16) }} -anonymous-prefix-length = 32 +anonymous-prefix-length = {{ slapparameter_dict.get('anonymous-prefix-length', 0) }} logfile = ${re6stnet-dirs:log}/registry.log -verbose = 2 +run-dir = ${re6stnet-dirs:run} +ipv4-net = {{ slapparameter_dict.get('ipv4-net', '') }} +client-count = {{ slapparameter_dict.get('client-count', 10) }} +tunnel-refresh = {{ slapparameter_dict.get('tunnel-refresh', 300) }} +max-clients = {{ slapparameter_dict.get('max-clients', 0) }} +hello = {{ slapparameter_dict.get('hello', 15) }} +min-protocol = {{ slapparameter_dict.get('min-protocol', -1) }} +encrypt = {{ slapparameter_dict.get('encrypt', 'False') }} [re6st-registry-conf] recipe = slapos.recipe.template:jinja2 diff --git a/software/re6stnet/re6st-registry.conf.in b/software/re6stnet/re6st-registry.conf.in index b95a29944..34603c646 100644 --- a/software/re6stnet/re6st-registry.conf.in +++ b/software/re6stnet/re6st-registry.conf.in @@ -5,8 +5,24 @@ db {{ parameter_dict['db'] }} ca {{ parameter_dict['ca'] }} key {{ parameter_dict['key'] }} dh {{ parameter_dict['dh'] }} +{% if parameter_dict.get('ipv4-net', '') -%} +ipv4 {{ parameter_dict['ipv4-net'] }} +{% endif -%} +client-count {{ parameter_dict['client-count'] }} +tunnel-refresh {{ parameter_dict['tunnel-refresh'] }} +hello {{ parameter_dict['hello'] }} mailhost {{ parameter_dict['mailhost'] }} prefix-length {{ parameter_dict['prefix-length'] }} anonymous-prefix-length {{ parameter_dict['anonymous-prefix-length'] }} logfile {{ parameter_dict['logfile'] }} -verbose {{ parameter_dict['verbose'] }} \ No newline at end of file +verbose {{ parameter_dict['verbose'] }} +run {{ parameter_dict['run-dir'] }} +{% if parameter_dict.get('min-protocol', '-1') != '-1' -%} +min-protocol {{ parameter_dict['min-protocol'] }} +{% endif -%} +{% if parameter_dict.get('encrypt', 'False') in ('true', 'True', '1') -%} +encrypt +{% endif -%} +{% if parameter_dict.get('max-clients') != '0' -%} +max-clients {{ parameter_dict['max-clients'] }} +{% endif -%} \ No newline at end of file diff --git a/software/re6stnet/software.cfg b/software/re6stnet/software.cfg index 62b3fcff7..984cddc4a 100644 --- a/software/re6stnet/software.cfg +++ b/software/re6stnet/software.cfg @@ -95,7 +95,7 @@ extra-context = [template-re6stnet] < = download-base filename = instance-re6stnet.cfg.in -md5sum = 3f72b0d5ef63b037e26e742e8eecaa1d +md5sum = a5000a513877bdab10f160ac0aaac95f [template-logrotate-base] < = template-jinja2-base @@ -114,7 +114,7 @@ md5sum = 6fcf417f6b9651b1ed442f00c094f50c [template-re6st-registry-conf] < = download-base filename = re6st-registry.conf.in -md5sum = 7760a213896755e707993d67d8d980bb +md5sum = 5dc218f887faeffc466e41c7d6191e49 [template-wrapper] < = download-base -- 2.30.9