2 ## Copyright (C) 2019 Wind River Systems, Inc.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
20 STX_REPO = "config-files"
21 STX_SUBPATH = "openssh-config"
24 file://stx/sshd.init \
25 file://stx/sshd-keygen \
26 file://stx/sshd-keygen.service \
27 file://stx/sshd.sysconfig \
28 file://openssh-config-rm-hmac-ripemd160.patch \
32 bb.build.exec_func('do_copy_config_files', d)
35 do_copy_config_files () {
36 cp -f ${STX_METADATA_PATH}/files/sshd_config ${S}
37 # remove the unsupported and deprecated options
38 sed -i -e 's/^\(GSSAPIAuthentication.*\)/#\1/' \
39 -e 's/^\(GSSAPICleanupCredentials.*\)/#\1/' \
40 -e 's/^\(UsePrivilegeSeparation.*\)/#\1/' \
42 cp -f ${STX_METADATA_PATH}/files/ssh_config ${S}
45 SYSTEMD_SERVICE_${PN}-sshd = "sshd.service"
47 do_install_append () {
48 rm -f ${D}${systemd_system_unitdir}/sshd.socket
49 rm -f ${D}${systemd_system_unitdir}/sshd@service.socket
50 rm -f ${D}${systemd_system_unitdir}/sshdgenkeys.service
52 install -d ${D}/${sysconfdir}/init.d/
53 install -m 755 ${WORKDIR}/stx/sshd.init ${D}/${sysconfdir}/init.d/sshd
55 install -d ${D}/${sysconfdir}/sysconfig/
56 install -m 644 ${WORKDIR}/stx/sshd.sysconfig ${D}/${sysconfdir}/sysconfig/sshd
58 install -m 755 ${WORKDIR}/stx/sshd-keygen ${D}/${sbindir}/sshd-keygen
59 install -m644 ${STX_METADATA_PATH}/files/sshd.service ${D}/${systemd_system_unitdir}/sshd.service
60 install -m644 ${WORKDIR}/stx/sshd-keygen.service ${D}/${systemd_system_unitdir}/sshd-keygen.service
62 install -d ${D}/${sysconfdir}/tmpfiles.d
63 echo "d ${localstatedir}/run/sshd 0755 root root -" >> ${D}/${sysconfdir}/tmpfiles.d/sshd.conf
67 RDEPENDS_${PN} += "bash"
68 RDEPENDS_${PN}-sshd += "bash"
70 # allow both systemd service and sysvinit scripts are installed
71 DISTRO_FEATURES_BACKFILL_CONSIDERED_remove = "sysvinit"
73 USERADD_PARAM_${PN}-sshd = "-r -d /var/empty/sshd -s /sbin/nologin -g sshd -c 'Privilege-separated SSH' sshd"
74 GROUPADD_PARAM_${PN}-sshd = "-r ssh_keys; -r sshd"