9765db344a385bc6d534895a14ca2b4c043376ba
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-connectivity / openssh / openssh_7.%.bbappend
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
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
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15
16 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
17
18 BRANCH = "r/stx.3.0"
19 SRCREV = "d778e862571957ece3c404c0c37d325769772fde"
20
21 SRC_URI += "\
22     file://stx/sshd.init \
23     file://stx/sshd-keygen \
24     file://stx/sshd-keygen.service \
25     file://stx/sshd.sysconfig \
26     git://opendev.org/starlingx/config-files.git;protocol=https;rev=${SRCREV};branch=${BRANCH};destsuffix=stx-configfiles;subpath=openssh-config \
27     file://openssh-config-rm-hmac-ripemd160.patch \
28 "
29
30 do_unpack_append() {
31     bb.build.exec_func('do_copy_config_files', d)
32 }
33
34 do_copy_config_files () {
35     cp -f ${WORKDIR}/stx-configfiles/files/sshd_config ${S}
36     # remove the unsupported and deprecated options
37     sed -i -e 's/^\(GSSAPIAuthentication.*\)/#\1/' \
38            -e 's/^\(GSSAPICleanupCredentials.*\)/#\1/' \
39            -e 's/^\(UsePrivilegeSeparation.*\)/#\1/' \
40            ${S}/sshd_config
41     cp -f ${WORKDIR}/stx-configfiles/files/ssh_config ${S}
42 }
43
44 SYSTEMD_SERVICE_${PN}-sshd = "sshd.service"
45
46 do_install_append () {
47     rm -f ${D}${systemd_system_unitdir}/sshd.socket
48     rm -f ${D}${systemd_system_unitdir}/sshd@service.socket
49     rm -f ${D}${systemd_system_unitdir}/sshdgenkeys.service
50
51     install -d ${D}/${sysconfdir}/init.d/
52     install -m 755 ${WORKDIR}/stx/sshd.init ${D}/${sysconfdir}/init.d/sshd
53
54     install -d ${D}/${sysconfdir}/sysconfig/
55     install -m 644 ${WORKDIR}/stx/sshd.sysconfig ${D}/${sysconfdir}/sysconfig/sshd
56
57     install -m 755 ${WORKDIR}/stx/sshd-keygen ${D}/${sbindir}/sshd-keygen
58     install -m644 ${WORKDIR}/stx-configfiles/files/sshd.service ${D}/${systemd_system_unitdir}/sshd.service
59     install -m644 ${WORKDIR}/stx/sshd-keygen.service ${D}/${systemd_system_unitdir}/sshd-keygen.service
60
61     install -d ${D}/${sysconfdir}/tmpfiles.d
62     echo "d ${localstatedir}/run/sshd 0755 root root -" >> ${D}/${sysconfdir}/tmpfiles.d/sshd.conf
63
64 }
65
66 RDEPENDS_${PN} += "bash"
67 RDEPENDS_${PN}-sshd += "bash"
68
69 # allow both systemd service and sysvinit scripts are installed
70 DISTRO_FEATURES_BACKFILL_CONSIDERED_remove = "sysvinit"
71
72 USERADD_PARAM_${PN}-sshd = "-r -d /var/empty/sshd -s /sbin/nologin -g sshd -c 'Privilege-separated SSH' sshd"
73 GROUPADD_PARAM_${PN}-sshd = "-r ssh_keys; -r sshd"