mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 05:36:47 +00:00
openssh: add tmpfiles.d support
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
30a2f06aec
commit
55ceb8caa3
@ -42,16 +42,12 @@
|
|||||||
KEYGEN="/usr/bin/ssh-keygen"
|
KEYGEN="/usr/bin/ssh-keygen"
|
||||||
SSHD="/usr/sbin/sshd"
|
SSHD="/usr/sbin/sshd"
|
||||||
|
|
||||||
HOME="/storage"
|
|
||||||
|
|
||||||
(
|
(
|
||||||
if [ "$SSH" = "yes" -o "$SSHD_START" = "true" ]; then
|
if [ "$SSH" = "yes" -o "$SSHD_START" = "true" ]; then
|
||||||
|
|
||||||
# Check for the SSH1 RSA key
|
# Check for the SSH1 RSA key
|
||||||
if [ ! -s $RSA1_KEY ] ; then
|
if [ ! -s $RSA1_KEY ] ; then
|
||||||
progress "SSH: generating SSH1 RSA key"
|
progress "SSH: generating SSH1 RSA key"
|
||||||
|
|
||||||
mkdir -p $CONFIG_CACHE/ssh
|
|
||||||
$KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null
|
$KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null
|
||||||
chmod 600 $RSA1_KEY
|
chmod 600 $RSA1_KEY
|
||||||
fi
|
fi
|
||||||
@ -59,8 +55,6 @@
|
|||||||
# Check for the SSH2 RSA key
|
# Check for the SSH2 RSA key
|
||||||
if [ ! -s $RSA2_KEY ] ; then
|
if [ ! -s $RSA2_KEY ] ; then
|
||||||
progress "SSH: generating SSH2 RSA key"
|
progress "SSH: generating SSH2 RSA key"
|
||||||
|
|
||||||
mkdir -p $CONFIG_CACHE/ssh
|
|
||||||
$KEYGEN -q -t rsa -f $RSA2_KEY -C '' -N '' >&/dev/null
|
$KEYGEN -q -t rsa -f $RSA2_KEY -C '' -N '' >&/dev/null
|
||||||
chmod 600 $RSA2_KEY
|
chmod 600 $RSA2_KEY
|
||||||
fi
|
fi
|
||||||
@ -68,28 +62,17 @@
|
|||||||
# Check for the SSH2 DSA key
|
# Check for the SSH2 DSA key
|
||||||
if [ ! -s $DSA2_KEY ] ; then
|
if [ ! -s $DSA2_KEY ] ; then
|
||||||
progress "SSH: generating SSH2 DSA key"
|
progress "SSH: generating SSH2 DSA key"
|
||||||
|
|
||||||
mkdir -p $CONFIG_CACHE/ssh
|
|
||||||
$KEYGEN -q -t dsa -f $DSA2_KEY -C '' -N '' >&/dev/null
|
$KEYGEN -q -t dsa -f $DSA2_KEY -C '' -N '' >&/dev/null
|
||||||
chmod 600 $DSA2_KEY
|
chmod 600 $DSA2_KEY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ensure that $HOME/.ssh exists, is root-owned and not world-readable
|
|
||||||
mkdir -p $HOME/.ssh
|
|
||||||
chown root:root $HOME/.ssh
|
|
||||||
chmod 0700 $HOME/.ssh
|
|
||||||
|
|
||||||
# Check for predefined known hosts file
|
# Check for predefined known hosts file
|
||||||
if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then
|
if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then
|
||||||
progress "SSH: setup predefined known hosts"
|
progress "SSH: setup predefined known hosts"
|
||||||
|
cp /etc/ssh/known_hosts $HOME/.ssh
|
||||||
cp /etc/ssh/known_hosts $HOME/.ssh
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
progress "Starting SSH Server"
|
progress "Starting SSH Server"
|
||||||
|
eval $SSHD $OPTIONS
|
||||||
mkdir -p /var/empty
|
|
||||||
chmod -R 600 /var/empty
|
|
||||||
eval $SSHD $OPTIONS
|
|
||||||
fi
|
fi
|
||||||
)&
|
)&
|
||||||
|
22
packages/network/openssh/tmpfiles.d/51_sshd.conf
Normal file
22
packages/network/openssh/tmpfiles.d/51_sshd.conf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
################################################################################
|
||||||
|
# This file is part of OpenELEC - http://www.openelec.tv
|
||||||
|
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
|
||||||
|
#
|
||||||
|
# This Program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This Program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
d /storage/.cache/ssh 0755 root root - -
|
||||||
|
d /storage/.ssh 0700 root root - -
|
Loading…
x
Reference in New Issue
Block a user