kuksa-val: add regenerated server certificate
[AGL/meta-agl-demo.git] / recipes-connectivity / kuksa-val / kuksa-val_git.bb
1 SUMMARY = "KUKSA.val, the KUKSA Vehicle Abstraction Layer"
2 DESCRIPTION = "KUKSA.val provides a COVESA VSS data model describing data in a vehicle."
3 HOMEPAGE = "https://github.com/eclipse/kuksa.val"
4 BUGTRACKER = "https://github.com/eclipse/kuksa.val/issues"
5
6 LICENSE = "EPL-2.0 & BSL-1.0 & MIT"
7 LIC_FILES_CHKSUM = "file://LICENSE;md5=d9fc0efef5228704e7f5b37f27192723 \
8                     file://3rd-party-libs/jsoncons/LICENSE;md5=6ee7f7ed2001e4cde4679fdb8926f820 \
9                     file://3rd-party-libs/turtle/LICENSE_1_0.txt;md5=e4224ccaecb14d942c71d31bef20d78c \
10                     file://3rd-party-libs/jwt-cpp/LICENSE;md5=8325a5ce4414c65ffdda392e0d96a9ff"
11
12 DEPENDS = "boost openssl mosquitto protobuf-native grpc-native grpc"
13
14 require kuksa-val.inc
15
16 SRC_URI += "file://kuksa-val.service \
17             file://0001-Make-Boost-requirements-more-liberal.patch \
18             file://0002-Fix-gRPC-configuration-for-OE-cross-compiling.patch \
19             file://0003-Make-install-locations-configurable.patch \
20             file://0004-Disable-default-fetch-and-build-of-googletest.patch \
21             file://0001-genCerts.sh-add-Subject-Alt-Name-extension-to-server.patch \
22             file://Server.key \
23             file://Server.pem \
24 "
25
26 inherit cmake pkgconfig systemd useradd
27
28 SYSTEMD_SERVICE:${PN} = "kuksa-val.service"
29
30 USERADD_PACKAGES = "${PN}"
31 USERADDEXTENSION = "useradd-staticids"
32 GROUPADD_PARAM:${PN} = "-g 900 kuksa ;"
33 USERADD_PARAM:${PN} = "--system -g 900 -u 900 -o -d / --shell /bin/nologin kuksa ;"
34
35 # Configure file locations more along the lines of FHS instead of kuksa.val's
36 # default locations.
37 EXTRA_OECMAKE = " \
38     -DKUKSA_INSTALL_BINDIR=${bindir} \
39     -DKUKSA_INSTALL_CERTDIR=${sysconfdir}/kuksa-val \
40     -DKUKSA_INSTALL_DATADIR=${datadir}/kuksa-val \
41     -DKUKSA_INSTALL_CONFIGDIR=${sysconfdir}/kuksa-val \
42 "
43
44 do_install:append() {
45     # Lower the logging level used in the installed config.ini from the upstream
46     # default of "ALL", which spams the logs.
47     sed -i 's/^log-level = .*/log-level = WARNING/' ${D}/${sysconfdir}/kuksa-val/config.ini
48
49     if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
50         install -d ${D}${systemd_system_unitdir}
51         install -m 0644 ${WORKDIR}/kuksa-val.service ${D}${systemd_system_unitdir}
52     fi
53
54     # Install replacement server key + certificate
55     # These are AGL specific versions generated using a tweaked
56     # genCerts.sh script from the source tree that adds the now
57     # required subjectAltName extension field to make python3-ssl
58     # happy.  This will be addressed with upstream and can hopefully
59     # be dropped in the future.
60     rm -f ${D}${sysconfdir}/kuksa-val/Server.key
61     install ${WORKDIR}/Server.key ${D}${sysconfdir}/kuksa-val/
62     rm -f ${D}${sysconfdir}/kuksa-val/Server.pem
63     install ${WORKDIR}/Server.pem ${D}${sysconfdir}/kuksa-val/
64
65     # Restrict server certificate access
66     # NOTE: The client certificates are left alone here for client
67     #       development convenience for now, but this will need to
68     #       be revisited.
69     chmod 640 ${D}${sysconfdir}/kuksa-val/Server.key
70     chgrp 900 ${D}${sysconfdir}/kuksa-val/Server.key
71     chmod 640 ${D}${sysconfdir}/kuksa-val/Server.pem
72     chgrp 900 ${D}${sysconfdir}/kuksa-val/Server.pem
73 }
74
75 # Put client certificates into their own package so we can avoid
76 # duplicates of them for e.g. cluster clients.  Longer term this
77 # will need to be revisited.
78 PACKAGE_BEFORE_PN += "${PN}-client-certificates"
79
80 FILES:${PN}-client-certificates = " \
81     ${sysconfdir}/kuksa-val/Client.key \
82     ${sysconfdir}/kuksa-val/Client.pem \
83     ${sysconfdir}/kuksa-val/CA.pem \
84 "
85
86 FILES:${PN} += "${systemd_system_unitdir} ${datadir}"
87
88 RDEPENDS:${PN} += "${PN}-client-certificates"