mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-30 22:26:42 +00:00
openssh: dont run ssh per default, there is a security related discussion in http://openelec.tv/forum/20-development-discussion/20259-security-the-dilema-of-the-out-of-the-box-experience . Add 'ssh' to the appendline in our bootloader, or put a file called 'ssh_enable' in /storage/.config or the 'Configfile' Samba share. Both will enable SSH on boot. Add 'progress' to the appendline in bootloader to show the bootprogress without enabled debugging.
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
1ca0f8f8fe
commit
93f3737a94
@ -52,6 +52,12 @@ NFS_OVERLAY="192.168.1.1:/var/lib/overlay"
|
|||||||
bootchart)
|
bootchart)
|
||||||
BOOTCHART=yes
|
BOOTCHART=yes
|
||||||
;;
|
;;
|
||||||
|
ssh)
|
||||||
|
SSH=yes
|
||||||
|
;;
|
||||||
|
progress)
|
||||||
|
PROGRESS=yes
|
||||||
|
;;
|
||||||
fastboot)
|
fastboot)
|
||||||
FASTBOOT=yes
|
FASTBOOT=yes
|
||||||
;;
|
;;
|
||||||
@ -80,7 +86,7 @@ NFS_OVERLAY="192.168.1.1:/var/lib/overlay"
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
progress() {
|
progress() {
|
||||||
if test "$DEBUG" = "yes"; then
|
if test "$PROGRESS" = "yes"; then
|
||||||
echo "### $1 ###"
|
echo "### $1 ###"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#
|
#
|
||||||
# runlevels: openelec, textmode
|
# runlevels: openelec, textmode
|
||||||
|
|
||||||
(
|
|
||||||
RSA1_KEY="/storage/.cache/ssh/ssh_host_key"
|
RSA1_KEY="/storage/.cache/ssh/ssh_host_key"
|
||||||
RSA2_KEY="/storage/.cache/ssh/ssh_host_rsa_key"
|
RSA2_KEY="/storage/.cache/ssh/ssh_host_rsa_key"
|
||||||
DSA2_KEY="/storage/.cache/ssh/ssh_host_dsa_key"
|
DSA2_KEY="/storage/.cache/ssh/ssh_host_dsa_key"
|
||||||
@ -30,45 +29,48 @@
|
|||||||
KEYGEN="/usr/bin/ssh-keygen"
|
KEYGEN="/usr/bin/ssh-keygen"
|
||||||
SSHD="/usr/sbin/sshd"
|
SSHD="/usr/sbin/sshd"
|
||||||
|
|
||||||
# Check for the SSH1 RSA key
|
(
|
||||||
if [ ! -s $RSA1_KEY ] ; then
|
if [ "$SSH" = yes -o -f /storage/.config/ssh_enable ]; then
|
||||||
progress "SSH: generating SSH1 RSA key"
|
|
||||||
|
|
||||||
mkdir -p /storage/.cache/ssh
|
# Check for the SSH1 RSA key
|
||||||
$KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null
|
if [ ! -s $RSA1_KEY ] ; then
|
||||||
chmod 600 $RSA1_KEY
|
progress "SSH: generating SSH1 RSA key"
|
||||||
|
|
||||||
|
mkdir -p /storage/.cache/ssh
|
||||||
|
$KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null
|
||||||
|
chmod 600 $RSA1_KEY
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for the SSH2 RSA key
|
||||||
|
if [ ! -s $RSA2_KEY ] ; then
|
||||||
|
progress "SSH: generating SSH2 RSA key"
|
||||||
|
|
||||||
|
mkdir -p /storage/.cache/ssh
|
||||||
|
$KEYGEN -q -t rsa -f $RSA2_KEY -C '' -N '' >&/dev/null
|
||||||
|
chmod 600 $RSA2_KEY
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for the SSH2 DSA key
|
||||||
|
if [ ! -s $DSA2_KEY ] ; then
|
||||||
|
progress "SSH: generating SSH2 DSA key"
|
||||||
|
|
||||||
|
mkdir -p /storage/.cache/ssh
|
||||||
|
$KEYGEN -q -t dsa -f $DSA2_KEY -C '' -N '' >&/dev/null
|
||||||
|
chmod 600 $DSA2_KEY
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for predifined known hosts file
|
||||||
|
if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then
|
||||||
|
progress "SSH: setup predifined known hosts"
|
||||||
|
|
||||||
|
mkdir -p /$HOME/.ssh
|
||||||
|
cp /etc/ssh/known_hosts $HOME/.ssh
|
||||||
|
fi
|
||||||
|
|
||||||
|
progress "Starting SSH Server"
|
||||||
|
|
||||||
|
mkdir -p /var/empty
|
||||||
|
chmod -R 600 /var/empty
|
||||||
|
$SSHD
|
||||||
fi
|
fi
|
||||||
|
)&
|
||||||
# Check for the SSH2 RSA key
|
|
||||||
if [ ! -s $RSA2_KEY ] ; then
|
|
||||||
progress "SSH: generating SSH2 RSA key"
|
|
||||||
|
|
||||||
mkdir -p /storage/.cache/ssh
|
|
||||||
$KEYGEN -q -t rsa -f $RSA2_KEY -C '' -N '' >&/dev/null
|
|
||||||
chmod 600 $RSA2_KEY
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for the SSH2 DSA key
|
|
||||||
if [ ! -s $DSA2_KEY ] ; then
|
|
||||||
progress "SSH: generating SSH2 DSA key"
|
|
||||||
|
|
||||||
mkdir -p /storage/.cache/ssh
|
|
||||||
$KEYGEN -q -t dsa -f $DSA2_KEY -C '' -N '' >&/dev/null
|
|
||||||
chmod 600 $DSA2_KEY
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for predifined known hosts file
|
|
||||||
if [ -f /etc/ssh/known_hosts -a ! -f $HOME/.ssh/known_hosts ] ; then
|
|
||||||
progress "SSH: setup predifined known hosts"
|
|
||||||
|
|
||||||
mkdir -p /$HOME/.ssh
|
|
||||||
cp /etc/ssh/known_hosts $HOME/.ssh
|
|
||||||
fi
|
|
||||||
|
|
||||||
progress "Starting SSH Server"
|
|
||||||
|
|
||||||
mkdir -p /var/empty
|
|
||||||
chmod -R 600 /var/empty
|
|
||||||
$SSHD
|
|
||||||
|
|
||||||
)&
|
|
||||||
|
@ -30,6 +30,12 @@
|
|||||||
debugging)
|
debugging)
|
||||||
DEBUG=yes
|
DEBUG=yes
|
||||||
;;
|
;;
|
||||||
|
ssh)
|
||||||
|
SSH=yes
|
||||||
|
;;
|
||||||
|
progress)
|
||||||
|
PROGRESS=yes
|
||||||
|
;;
|
||||||
fastboot)
|
fastboot)
|
||||||
FASTBOOT=yes
|
FASTBOOT=yes
|
||||||
;;
|
;;
|
||||||
@ -43,7 +49,7 @@
|
|||||||
|
|
||||||
# functions
|
# functions
|
||||||
progress() {
|
progress() {
|
||||||
if test "$DEBUG" = yes; then
|
if test "$PROGRESS" = yes; then
|
||||||
logger -s -t Boot "### $1 ###"
|
logger -s -t Boot "### $1 ###"
|
||||||
else
|
else
|
||||||
logger -t Boot "### $1 ###"
|
logger -t Boot "### $1 ###"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user