lxc-sshd.in revision b78b2e23a17cdf59d057201508c1f0a90afb7e9e
4459N/A# lxc: linux Container library 2582N/A# Daniel Lezcano <daniel.lezcano@free.fr> 7161N/A# This library is free software; you can redistribute it and/or 2582N/A# modify it under the terms of the GNU Lesser General Public 2582N/A# License as published by the Free Software Foundation; either 2582N/A# version 2.1 of the License, or (at your option) any later version. 2582N/A# This library is distributed in the hope that it will be useful, 2582N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of 2582N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 4006N/A# Lesser General Public License for more details. 4006N/A# You should have received a copy of the GNU Lesser General Public 4006N/A# License along with this library; if not, write to the Free Software 2582N/A# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 4006N/A# Detect use under userns (unsupported) 4459N/A echo "This template can't be used for unprivileged containers." 1>&
2 4459N/A echo "You may want to try the \"download\" template instead." 1>&
2 4459N/A# Make sure the usual locations are in PATH 4459N/Aroot:x:0:0:root:/root:/bin/bash 7161N/Asshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin 4459N/A # by default setup root password with no password 4459N/AHostKey /etc/ssh/ssh_host_rsa_key 4459N/AHostKey /etc/ssh/ssh_host_dsa_key 4459N/AKeyRegenerationInterval 3600 4459N/AChallengeResponseAuthentication no 7161N/Alxc.cap.drop = sys_module mac_admin mac_override sys_time 7161N/A# When using LXC with apparmor, uncomment the next line to run unconfined: 4459N/A#lxc.aa_profile = unconfined 7161N/Alxc.mount.entry = /dev dev none ro,bind 0 0 7161N/Alxc.mount.entry = /lib lib none ro,bind 0 0 7161N/Alxc.mount.entry = /bin bin none ro,bind 0 0 7161N/Alxc.mount.entry = /usr usr none ro,bind 0 0 7161N/Alxc.mount.entry = /sbin sbin none ro,bind 0 0 7161N/Alxc.mount.entry = tmpfs var/run/sshd tmpfs mode=0644 0 0 7161N/Alxc.mount.entry = @LXCTEMPLATEDIR@/lxc-sshd sbin/init none ro,bind 0 0 7161N/Alxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0 7161N/Alxc.mount.entry = sysfs sys sysfs ro 0 0 4459N/Alxc.mount.entry = /etc/init.d etc/init.d none ro,bind 0 0 7161N/A # Oracle Linux and Fedora need the following two bind mounted 7161N/Alxc.mount.entry = /etc/sysconfig/network-scripts etc/sysconfig/network-scripts none ro,bind 0 0 4459N/Alxc.mount.entry = /etc/rc.d etc/rc.d none ro,bind 0 0 4459N/A # if no .ipv4 section in config, then have the container run dhcp 7161N/Alxc.mount.entry = /lib64 lib64 none ro,bind 0 0 4459N/A$1 -h|--help -p|--path=<path> [--rootfs=<path>] 4006N/A # we use cut instead of awk because awk is alternatives symlink on ubuntu 4459N/A echo "This script should be run as 'root'" 2582N/Asend host-name = gethostname(); 2582N/A echo "Container IP address:" 2582N/A echo "'path' parameter is required" 2582N/A echo "failed to install sshd's rootfs" 2582N/A echo "failed to configure sshd template" 7161N/A echo "failed to write configuration file"