elements: Add new openssh-server element

Add new 'openssh-server' element to ensure that openssh server
is installed and enabled during boot. This is mostly useful for
*-minimal images which do not come with openssh installed and/or
enabled in order to keep a small dependency footprint.

Change-Id: Ide15ee04f5de123dbc8ce4bb56d638d8a167c341
This commit is contained in:
Markos Chandras 2016-10-18 23:21:07 +01:00
parent 5d2e7bade5
commit bbcc22751f
11 changed files with 63 additions and 4 deletions

View File

@ -1 +1,2 @@
debian-minimal debian-minimal
openssh-server

View File

@ -1,4 +1,3 @@
openssh-server:
file: file:
less: less:
kbd: kbd:

View File

@ -1,3 +1,3 @@
dib-init-system dib-init-system
install-static install-static
package-installs openssh-server

View File

@ -1 +1 @@
package-installs openssh-server

View File

@ -1 +0,0 @@
openssh-server:

View File

@ -0,0 +1,14 @@
==============
openssh-server
==============
This element ensures that openssh server is installed and enabled during boot.
Note
----
Most cloud images come with the openssh server service installed and enabled
during boot. However, certain cloud images, especially those created by the
\*-minimal elements may not have it installed or enabled. In these cases,
using this element may be helpful to ensure your image will accessible via SSH.
It's usually helpful to combine this element with others such as the
`runtime-ssh-host-keys`.

View File

@ -0,0 +1,3 @@
dib-init-system
package-installs
runtime-ssh-host-keys

View File

@ -0,0 +1,10 @@
{
"family": {
"suse": {
"openssh-server": "openssh"
},
"gentoo": {
"openssh-server": "openssh"
}
}
}

View File

@ -0,0 +1,29 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
case "$DIB_INIT_SYSTEM" in
upstart)
# nothing to do
exit 0
;;
systemd)
if [[ $DISTRO_NAME = "ubuntu" || $DISTRO_NAME = "debian" ]]; then
systemctl enable ssh.service
else
systemctl enable sshd.service
fi
;;
openrc)
# let dib-init-system's postinstall handle enabling init scripts
exit 0
;;
*)
echo "Unsupported init system"
exit 1
;;
esac

View File

@ -0,0 +1,4 @@
---
features:
- New openssh-server element to ensure that the openssh
server is installed and enabled during boot.