diff --git a/magnum/drivers/common/templates/kubernetes/fragments/start-container-agent.sh b/magnum/drivers/common/templates/kubernetes/fragments/start-container-agent.sh index 2c632fef79..bb37dc0442 100644 --- a/magnum/drivers/common/templates/kubernetes/fragments/start-container-agent.sh +++ b/magnum/drivers/common/templates/kubernetes/fragments/start-container-agent.sh @@ -2,7 +2,32 @@ . /etc/sysconfig/heat-params -set -ux +set -uxe + +# Create a keypair for the heat-container-agent to +# access the node over ssh. It is useful to operate +# in host mount namespace and apply configuration. +mkdir -p /srv/magnum/.ssh +chmod 700 /srv/magnum/.ssh +ssh-keygen -t rsa -N '' -f /srv/magnum/.ssh/heat_agent_rsa +chmod 400 /srv/magnum/.ssh/heat_agent_rsa +chmod 400 /srv/magnum/.ssh/heat_agent_rsa.pub +# Add the public to the host authorized_keys file. +cat /srv/magnum/.ssh/heat_agent_rsa.pub > /root/.ssh/authorized_keys +# Add localost to know_hosts +ssh-keyscan 127.0.0.1 > /srv/magnum/.ssh/known_hosts +# ssh configguration file, to be specified with ssh -F +cat > /srv/magnum/.ssh/config <