Commit 6f2b8551 authored by Ben Howard's avatar Ben Howard

Ubuntu Snappy: conditionally enable SSH on Snappy

  When a user provides authentication tokens, enable SSH unless SSH has
  been explicitly disabled (LP: #1494816).
parent ba3e59cb
......@@ -274,7 +274,20 @@ def handle(name, cfg, cloud, log, args):
LOG.warn("'%s' failed for '%s': %s",
pkg_op['op'], pkg_op['name'], e)
disable_enable_ssh(mycfg.get('ssh_enabled', False))
# Default to disabling SSH
ssh_enabled = mycfg.get('ssh_enabled', False)
# If the user has not explicitly enabled or disabled SSH, then enable it
# when password SSH authentication is requested or there are SSH keys
if mycfg.get('ssh_enabled', None) is not False:
if len(mycfg.get('public-keys', [])) > 0:
LOG.debug("Enabling SSH, user SSH keys provided")
ssh_enabled = True
elif mycfg.get('ssh_pwauth', False):
LOG.debug("Enabling SSH, password authentication requested")
ssh_enabled = True
if fails:
raise Exception("failed to install/configure snaps")
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