Last active
February 15, 2018 01:38
-
-
Save shantigilbert/370cc692cd5a420ee499b621eee27ebc to your computer and use it in GitHub Desktop.
Enable SSH by default on LE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# This file is part of OpenELEC - http://www.openelec.tv | |
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) | |
# | |
# OpenELEC 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 of the License, or | |
# (at your option) any later version. | |
# | |
# OpenELEC 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. If not, see <http://www.gnu.org/licenses/>. | |
################################################################################ | |
PKG_NAME="openssh" | |
PKG_VERSION="7.3p1" | |
PKG_ARCH="any" | |
PKG_LICENSE="OSS" | |
PKG_SITE="http://www.openssh.com/" | |
PKG_URL="http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$PKG_NAME-$PKG_VERSION.tar.gz" | |
PKG_DEPENDS_TARGET="toolchain zlib openssl" | |
PKG_SECTION="network" | |
PKG_SHORTDESC="openssh: An open re-implementation of the SSH package" | |
PKG_LONGDESC="This is a Linux port of OpenBSD's excellent OpenSSH. OpenSSH is based on the last free version of Tatu Ylonen's SSH with all patent-encumbered algorithms removed, all known security bugs fixed, new features reintroduced, and many other clean-ups. SSH (Secure Shell) is a program to log into another computer over a network, to execute commands in a remote machine, and to move files from one machine to another. It provides strong authentication and secure communications over insecure channels. It is intended as a replacement for rlogin, rsh, rcp, and rdist." | |
PKG_IS_ADDON="no" | |
PKG_AUTORECONF="yes" | |
PKG_CONFIGURE_OPTS_TARGET="--sysconfdir=/etc/ssh \ | |
--libexecdir=/usr/lib/openssh \ | |
--disable-strip \ | |
--disable-lastlog \ | |
--with-sandbox=no \ | |
--disable-utmp \ | |
--disable-utmpx \ | |
--disable-wtmp \ | |
--disable-wtmpx \ | |
--without-rpath \ | |
--with-ssl-engine \ | |
--disable-pututline \ | |
--disable-pututxline \ | |
--disable-etc-default-login \ | |
--with-keydir=/storage/.cache/ssh \ | |
--without-pam" | |
pre_configure_target() { | |
export LD="$CC" | |
export LDFLAGS="$TARGET_CFLAGS $TARGET_LDFLAGS" | |
} | |
post_makeinstall_target() { | |
rm -rf $INSTALL/usr/lib/openssh/ssh-keysign | |
rm -rf $INSTALL/usr/lib/openssh/ssh-pkcs11-helper | |
if [ ! $SFTP_SERVER = "yes" ]; then | |
rm -rf $INSTALL/usr/lib/openssh/sftp-server | |
fi | |
rm -rf $INSTALL/usr/bin/ssh-add | |
rm -rf $INSTALL/usr/bin/ssh-agent | |
rm -rf $INSTALL/usr/bin/ssh-keyscan | |
sed -e "s|^#PermitRootLogin.*|PermitRootLogin yes|g" \ | |
-e "s|^#StrictModes.*|StrictModes no|g" \ | |
-e "s|^#UsePrivilegeSeparation.*|UsePrivilegeSeparation no|g" \ | |
-i $INSTALL/etc/ssh/sshd_config | |
echo "PubkeyAcceptedKeyTypes +ssh-dss" >> $INSTALL/etc/ssh/sshd_config | |
debug_strip $INSTALL/usr | |
mkdir -p $INSTALL/usr/share/services | |
cp -P $PKG_DIR/default.d/*.conf $INSTALL/usr/share/services | |
} | |
post_install() { | |
enable_service sshd-defaults.service | |
enable_service sshd.service | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=OpenSSH defaults | |
ConditionPathExists=!/storage/.cache/services/sshd.conf | |
ConditionPathExists=!/storage/.cache/services/sshd.disabled | |
[Service] | |
Type=oneshot | |
ExecStart=/bin/cp /usr/share/services/sshd.conf /storage/.cache/services/ | |
RemainAfterExit=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SSHD_DISABLE_PW_AUTH="false" | |
SSH_ARGS="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=OpenSSH server daemon | |
After=sshd-defaults.service | |
Requires=sshd-defaults.service | |
ConditionKernelCommandLine=|ssh | |
ConditionPathExists=|/storage/.cache/services/sshd.conf | |
[Service] | |
Restart=on-failure | |
EnvironmentFile=-/storage/.cache/services/sshd.conf | |
ExecStartPre=/usr/bin/ssh-keygen -A | |
ExecStart=/usr/sbin/sshd -D $SSH_ARGS | |
ExecReload=/bin/kill -HUP $MAINPID | |
TimeoutStopSec=1s | |
RestartSec=2 | |
StartLimitInterval=0 | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment