Resiliency: add promises about presence of public-key parameter value.

parent d10e469b
...@@ -21,6 +21,7 @@ parts = ...@@ -21,6 +21,7 @@ parts =
# XXX: we have to manually add this for resilience # XXX: we have to manually add this for resilience
rdiff-backup rdiff-backup
collective.recipe.template-egg
#XXX-Cedric : Currently, one can only access to KVM using noVNC. #XXX-Cedric : Currently, one can only access to KVM using noVNC.
# Ideally one should be able to access KVM by using either NoVNC or VNC. # Ideally one should be able to access KVM by using either NoVNC or VNC.
......
...@@ -15,7 +15,6 @@ extends = ...@@ -15,7 +15,6 @@ extends =
../../stack/slapos.cfg ../../stack/slapos.cfg
parts = parts =
rdiff-backup
template template
eggs eggs
nginx nginx
...@@ -27,6 +26,10 @@ parts = ...@@ -27,6 +26,10 @@ parts =
instance-runner-export instance-runner-export
slapos-cookbook slapos-cookbook
# XXX: we have to manually add this for resilience
rdiff-backup
collective.recipe.template-egg
#################### ####################
## Node JS proxy ## Node JS proxy
#################### ####################
......
[buildout] [buildout]
extends = extends =
../../component/dash/buildout.cfg
../../component/dropbear/buildout.cfg ../../component/dropbear/buildout.cfg
../../component/gzip/buildout.cfg ../../component/gzip/buildout.cfg
../../component/rdiff-backup/buildout.cfg ../../component/rdiff-backup/buildout.cfg
../../component/rsync/buildout.cfg ../../component/rsync/buildout.cfg
parts = parts =
rdiff-backup collective.recipe.template-egg
pbsready pbsready
pbsready-import pbsready-import
pbsready-export pbsready-export
...@@ -16,7 +17,12 @@ parts = ...@@ -16,7 +17,12 @@ parts =
# needed tools for resiliency # needed tools for resiliency
gzip gzip
rdiff-backup
dash
[collective.recipe.template-egg]
recipe = zc.recipe.egg
eggs = collective.recipe.template
#---------------- #----------------
#-- #--
...@@ -30,7 +36,7 @@ parts = ...@@ -30,7 +36,7 @@ parts =
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready.cfg.in url = ${:_profile_base_location_}/pbsready.cfg.in
output = ${buildout:directory}/pbsready.cfg output = ${buildout:directory}/pbsready.cfg
md5sum = 570e0b54c97d510befa2ea981c1e90e0 #md5sum = 46f9d33e642467a72c599c8dc767e6c3
mode = 0644 mode = 0644
[pbsready-import] [pbsready-import]
...@@ -39,7 +45,7 @@ mode = 0644 ...@@ -39,7 +45,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready-import.cfg.in url = ${:_profile_base_location_}/pbsready-import.cfg.in
output = ${buildout:directory}/pbsready-import.cfg output = ${buildout:directory}/pbsready-import.cfg
md5sum = cc9c776500ccd07cb51969beb68ffcda md5sum = cb562bd954b9e809c8748d0f96de4116
mode = 0644 mode = 0644
[pbsready-export] [pbsready-export]
...@@ -48,7 +54,7 @@ mode = 0644 ...@@ -48,7 +54,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready-export.cfg.in url = ${:_profile_base_location_}/pbsready-export.cfg.in
output = ${buildout:directory}/pbsready-export.cfg output = ${buildout:directory}/pbsready-export.cfg
md5sum = 25d05b3929fb4c6cf275866bad678d6a md5sum = 8fb619622a08aff2321497895e04df16
mode = 0644 mode = 0644
[template-pull-backup] [template-pull-backup]
...@@ -61,14 +67,14 @@ mode = 0644 ...@@ -61,14 +67,14 @@ mode = 0644
[template-replicated] [template-replicated]
recipe = slapos.recipe.download recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template-replicated.cfg.in url = ${:_profile_base_location_}/template-replicated.cfg.in
md5sum = c762a625f65193bc8a570b4d56a0d08c md5sum = e8cf325c87c9b4416a47c14bc68e1bdf
mode = 0644 mode = 0644
destination = ${buildout:directory}/template-replicated.cfg.in destination = ${buildout:directory}/template-replicated.cfg.in
[template-parts] [template-parts]
recipe = slapos.recipe.download recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template-parts.cfg.in url = ${:_profile_base_location_}/template-parts.cfg.in
md5sum = c942f82552fcb42fc74a5f896e0cd5f3 md5sum = dcce0e74292eddffde7f9e366d356080
mode = 0644 mode = 0644
destination = ${buildout:directory}/template-parts.cfg.in destination = ${buildout:directory}/template-parts.cfg.in
......
...@@ -14,6 +14,7 @@ parts = ...@@ -14,6 +14,7 @@ parts =
sshkeys-authority sshkeys-authority
dropbear-server dropbear-server
sshkeys-dropbear sshkeys-dropbear
resilient-sshkeys-dropbear-promise
dropbear-server-pbs-authorized-key dropbear-server-pbs-authorized-key
notifier notifier
......
...@@ -14,6 +14,7 @@ parts = ...@@ -14,6 +14,7 @@ parts =
sshkeys-authority sshkeys-authority
dropbear-server dropbear-server
sshkeys-dropbear sshkeys-dropbear
resilient-sshkeys-dropbear-promise
dropbear-server-pbs-authorized-key dropbear-server-pbs-authorized-key
notifier notifier
......
...@@ -10,6 +10,7 @@ parts = ...@@ -10,6 +10,7 @@ parts =
sshkeys-authority sshkeys-authority
dropbear-server dropbear-server
sshkeys-dropbear sshkeys-dropbear
resilient-sshkeys-dropbear-promise
dropbear-server-pbs-authorized-key dropbear-server-pbs-authorized-key
notifier notifier
...@@ -179,6 +180,27 @@ server-binary = ${buildout:bin-directory}/pubsubserver ...@@ -179,6 +180,27 @@ server-binary = ${buildout:bin-directory}/pubsubserver
notifier-binary = ${buildout:bin-directory}/pubsubnotifier notifier-binary = ${buildout:bin-directory}/pubsubnotifier
#----------------
#--
#-- Dropbear.
[dropbear-server]
recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6}
# Explicitely excludes to define "port" argument. It will be defined in
# pbs-ready-import.cfg.in and pbs-ready-export.cfg.in
home = $${directory:ssh}
wrapper = $${rootdirectory:bin}/raw_sshd
shell = $${rdiff-backup-server:wrapper}
rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear
[dropbear-server-pbs-authorized-key]
<= dropbear-server
recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key}
#---------------- #----------------
#-- #--
#-- sshkeys #-- sshkeys
...@@ -205,31 +227,21 @@ public-key = $${dropbear-server:rsa-keyfile}.pub ...@@ -205,31 +227,21 @@ public-key = $${dropbear-server:rsa-keyfile}.pub
private-key = $${dropbear-server:rsa-keyfile} private-key = $${dropbear-server:rsa-keyfile}
wrapper = $${basedirectory:services}/sshd wrapper = $${basedirectory:services}/sshd
[resilient-sshkeys-dropbear-promise]
#---------------- # Check that public key file exists and is not empty
#-- recipe = collective.recipe.template
#-- Dropbear. input = inline:#!${dash:location}/bin/dash
PUBLIC_KEY_CONTENT="$${sshkeys-dropbear:public-key-value}"
[dropbear-server] if [ ! -n "$PUBLIC_KEY_CONTENT" ]; then
recipe = slapos.cookbook:dropbear exit 1
host = $${slap-network-information:global-ipv6} fi
# Explicitely excludes to define "port" argument. It will be defined in output = $${basedirectory:promises}/public-key-existence
# pbs-ready-import.cfg.in and pbs-ready-export.cfg.in mode = 700
home = $${directory:ssh}
wrapper = $${rootdirectory:bin}/raw_sshd
shell = $${rdiff-backup-server:wrapper}
rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear
[dropbear-server-pbs-authorized-key]
<= dropbear-server
recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key}
#---------------- #----------------
#-- #--
#-- Conncetion informations to re-use. #-- Connection informations to re-use.
# XXX-Cedric: when "aggregation" system is done in libslap, directly publish. # XXX-Cedric: when "aggregation" system is done in libslap, directly publish.
[resilient-publish-connection-parameter] [resilient-publish-connection-parameter]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
......
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
request-{{namebase}} request-{{namebase}}
request-{{namebase}}-2 request-{{namebase}}-2
resilient-request-{{namebase}}-public-key-promise
{% for i in range(1,nbbackup|int) %} {% for i in range(1,nbbackup|int) %}
request-{{namebase}}-pseudo-replicating-{{i}} request-{{namebase}}-pseudo-replicating-{{i}}
request-{{namebase}}-pseudo-replicating-{{i}}-2 request-{{namebase}}-pseudo-replicating-{{i}}-2
resilient-request-{{namebase}}-pseudo-replicating-{{i}}-public-key-promise
{% endfor %} {% endfor %}
{% for i in range(1,nbbackup|int) %} {% for i in range(1,nbbackup|int) %}
......
...@@ -11,6 +11,13 @@ ...@@ -11,6 +11,13 @@
{% endif -%} {% endif -%}
[resilient-directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
promise = ${:etc}/promise
## Tells the Backupable recipe that we want a backup ## Tells the Backupable recipe that we want a backup
[resilient] [resilient]
recipe = slapos.cookbook:request recipe = slapos.cookbook:request
...@@ -28,7 +35,6 @@ software-url = ${slap-connection:software-release-url} ...@@ -28,7 +35,6 @@ software-url = ${slap-connection:software-release-url}
software-type = {{typeexport}} software-type = {{typeexport}}
name = {{namebase}}0 name = {{namebase}}0
return = ssh-public-key ssh-url notification-id ip return = ssh-public-key ssh-url notification-id ip
config = config =
# Resilient related parameters # Resilient related parameters
number authorized-key notify ip-list namebase number authorized-key notify ip-list namebase
...@@ -66,6 +72,7 @@ sla-{{ key }} = {{ value }} ...@@ -66,6 +72,7 @@ sla-{{ key }} = {{ value }}
{% endif -%} {% endif -%}
{% endif -%} {% endif -%}
{% for id in range(1,nbbackup|int) %} {% for id in range(1,nbbackup|int) %}
[request-{{namebase}}-pseudo-replicating-{{id}}] [request-{{namebase}}-pseudo-replicating-{{id}}]
...@@ -107,9 +114,9 @@ sla-{{ key }} = {{ value }} ...@@ -107,9 +114,9 @@ sla-{{ key }} = {{ value }}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor -%} {% endfor -%}
[iplist] [iplist]
config-ip-list = ${request-{{namebase}}:connection-ip}{% for j in range(1,nbbackup|int) %} ${request-{{namebase}}-pseudo-replicating-{{j}}:connection-ip}{% endfor %} config-ip-list = ${request-{{namebase}}:connection-ip}{% for j in range(1,nbbackup|int) %} ${request-{{namebase}}-pseudo-replicating-{{j}}:connection-ip}{% endfor %}
...@@ -117,11 +124,37 @@ config-ip-list = ${request-{{namebase}}:connection-ip}{% for j in range(1,nbback ...@@ -117,11 +124,37 @@ config-ip-list = ${request-{{namebase}}:connection-ip}{% for j in range(1,nbback
<= request-{{namebase}} <= request-{{namebase}}
iplist iplist
[resilient-request-{{namebase}}-public-key-promise]
# Check that public-key-value parameter exists and is not empty
# XXX: maybe we should consider empty values to be non-nexistent.
recipe = collective.recipe.template
# XXX: don't use system executable
input = inline:#!/bin/sh
PUBLIC_KEY_CONTENT="${request-{{namebase}}-2:connection-ssh-public-key})"
if [ ! -n "$PUBLIC_KEY_CONTENT" ]; then
exit 1
fi
output = ${resilient-directory:promise}/resilient-request-{{namebase}}-public-key
mode = 700
{% for id in range(1,nbbackup|int) %} {% for id in range(1,nbbackup|int) %}
[request-{{namebase}}-pseudo-replicating-{{id}}-2] [request-{{namebase}}-pseudo-replicating-{{id}}-2]
<= request-{{namebase}}-pseudo-replicating-{{id}} <= request-{{namebase}}-pseudo-replicating-{{id}}
iplist iplist
[resilient-request-{{namebase}}-pseudo-replicating-{{id}}-public-key-promise]
# Check that public-key-value parameter exists and is not empty
# XXX: maybe we should consider empty values to be non-nexistent.
recipe = collective.recipe.template
# XXX: don't use system executable
input = inline:#!/bin/sh
PUBLIC_KEY_CONTENT="${request-{{namebase}}-pseudo-replicating-{{id}}-2:connection-ssh-public-key})"
if [ ! -n "$PUBLIC_KEY_CONTENT" ]; then
exit 1
fi
output = ${resilient-directory:promise}/resilient-request-{{namebase}}-pseudo-replicating-{{id}}-public-key
mode = 700
{% endfor %} {% endfor %}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment