lxc-sshd.in revision 337e14712e2bf568db73dd57c709b3364e26d798
2ronwalf# This library is free software; you can redistribute it and/or 2ronwalf# modify it under the terms of the GNU Lesser General Public 2ronwalf# License as published by the Free Software Foundation; either 38daenzerorama# version 2.1 of the License, or (at your option) any later version. 2ronwalf# This library is distributed in the hope that it will be useful, 2ronwalf# but WITHOUT ANY WARRANTY; without even the implied warranty of 2ronwalf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 2ronwalf# Lesser General Public License for more details. 2ronwalf# You should have received a copy of the GNU Lesser General Public 2ronwalf# License along with this library; if not, write to the Free Software 2ronwalf# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11daenzeroramasshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin cat <<EOF > $rootfs/etc/group # by default setup root password with no password cat <<EOF > $rootfs/etc/ssh/sshd_config HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key UsePrivilegeSeparation yes KeyRegenerationInterval 3600 RhostsRSAAuthentication no HostbasedAuthentication no ChallengeResponseAuthentication no cat <<EOF >> $path/config # When using LXC with apparmor, uncomment the next line to run unconfined: #lxc.aa_profile = unconfined lxc.mount.entry=/dev dev none ro,bind 0 0 lxc.mount.entry=/lib lib none ro,bind 0 0 lxc.mount.entry=/bin bin none ro,bind 0 0 lxc.mount.entry=/usr usr none ro,bind 0 0 lxc.mount.entry=/sbin sbin none ro,bind 0 0 lxc.mount.entry=tmpfs var/run/sshd tmpfs mode=0644 0 0 lxc.mount.entry=@LXCTEMPLATEDIR@/lxc-sshd sbin/init none bind 0 0 lxc.mount.entry=proc $rootfs/proc proc nodev,noexec,nosuid 0 0 # if no .ipv4 section in config, then have the container run dhcp if [ "$(uname -m)" = "x86_64" ]; then cat <<EOF >> $path/config lxc.mount.entry=/lib64 lib64 none ro,bind 0 0 $1 -h|--help -p|--path=<path> if [
"$(id -u)" !=
"0" ];
then echo "This script should be run as 'root'" echo "'lxc-init is not accessible on the system" echo "'sshd' is not accessible on the system " echo "can't find dhclient" send host-name "<hostname>"; echo "'path' parameter is required" echo "failed to install sshd's rootfs" echo "failed to configure sshd template" echo "failed to write configuration file"