Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/tmp
*~
*.sw?
/docs
7 changes: 7 additions & 0 deletions classes/aziot.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ do_install:prepend() {
install -d -m 0750 -g aziotks ${D}${sysconfdir}/aziot/keyd
install -d -m 0700 -o aziotks -g aziotks ${D}${sysconfdir}/aziot/keyd/config.d
}

# a service skipped by its condition must not fail its socket through the
# trigger limit: without the limit the socket stays listening, and the first
# connect after the condition turns true activates the service
aziot_disable_socket_trigger_limit() {
sed -i 's/^\[Socket\]$/[Socket]\nTriggerLimitIntervalSec=0/' "$1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ do_install () {

install -m 0644 ${S}/edgelet/contrib/systemd/debian/aziot-edged.workload.socket ${D}${systemd_system_unitdir}/aziot-edged.workload.socket
install -m 0644 ${S}/edgelet/contrib/systemd/debian/aziot-edged.mgmt.socket ${D}${systemd_system_unitdir}/aziot-edged.mgmt.socket
aziot_disable_socket_trigger_limit ${D}${systemd_system_unitdir}/aziot-edged.workload.socket
aziot_disable_socket_trigger_limit ${D}${systemd_system_unitdir}/aziot-edged.mgmt.socket
}

USERADD_PARAM:${PN} += " \
Expand Down
6 changes: 6 additions & 0 deletions recipes-azure-iot/azure-identityd/aziot-identityd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ do_install() {
install -m 0644 ${S}/cert/aziot-certd/aziot-certd.socket.in ${D}${systemd_system_unitdir}/aziot-certd.socket
fill_placeholders ${D}${systemd_system_unitdir}/aziot-certd.service
fill_placeholders ${D}${systemd_system_unitdir}/aziot-certd.socket
aziot_disable_socket_trigger_limit ${D}${systemd_system_unitdir}/aziot-certd.socket

# enable identity service to create cert "device-id" (e.g. for x509 dps provisioning)
install -m 0600 -o aziotcs -g aziotcs ${WORKDIR}/iot-identity-service-certd.template.toml ${D}${sysconfdir}/aziot/certd/config.d/aziotid.toml
Expand All @@ -147,6 +148,7 @@ do_install() {
install -m 0644 ${S}/identity/aziot-identityd/aziot-identityd.socket.in ${D}${systemd_system_unitdir}/aziot-identityd.socket
fill_placeholders ${D}${systemd_system_unitdir}/aziot-identityd.service
fill_placeholders ${D}${systemd_system_unitdir}/aziot-identityd.socket
aziot_disable_socket_trigger_limit ${D}${systemd_system_unitdir}/aziot-identityd.socket

install -m 0644 ${S}/key/aziot-keyd/aziot-keyd.service.in ${D}${systemd_system_unitdir}/aziot-keyd.service
sed -i \
Expand All @@ -159,6 +161,7 @@ do_install() {
install -m 0644 ${S}/key/aziot-keyd/aziot-keyd.socket.in ${D}${systemd_system_unitdir}/aziot-keyd.socket
fill_placeholders ${D}${systemd_system_unitdir}/aziot-keyd.service
fill_placeholders ${D}${systemd_system_unitdir}/aziot-keyd.socket
aziot_disable_socket_trigger_limit ${D}${systemd_system_unitdir}/aziot-keyd.socket

if ${@bb.utils.contains('MACHINE_FEATURES', 'tpm2', 'true', 'false', d)}; then
install -m 0644 ${S}/tpm/aziot-tpmd/aziot-tpmd.service.in ${D}${systemd_system_unitdir}/aziot-tpmd.service
Expand All @@ -172,6 +175,7 @@ do_install() {
install -m 0644 ${S}/tpm/aziot-tpmd/aziot-tpmd.socket.in ${D}${systemd_system_unitdir}/aziot-tpmd.socket
fill_placeholders ${D}${systemd_system_unitdir}/aziot-tpmd.service
fill_placeholders ${D}${systemd_system_unitdir}/aziot-tpmd.socket
aziot_disable_socket_trigger_limit ${D}${systemd_system_unitdir}/aziot-tpmd.socket
fi

# libaziot-key-openssl-engine-shared
Expand All @@ -187,8 +191,10 @@ do_install() {
install -m 0644 ${WORKDIR}/aziot-identityd-precondition.service ${D}${systemd_system_unitdir}/aziot-identityd-precondition.service
if ${@bb.utils.contains('DISTRO_FEATURES', 'iotedge', 'true', 'false', d)}; then
sed -i "s/@@AZIOTCLI@@/iotedge/" ${D}${systemd_system_unitdir}/aziot-identityd-precondition.service
sed -i "s/@@STACK_UNITS@@/aziot-identityd.service aziot-edged.service/" ${D}${systemd_system_unitdir}/aziot-identityd-precondition.service
else
sed -i "s/@@AZIOTCLI@@/aziotctl/" ${D}${systemd_system_unitdir}/aziot-identityd-precondition.service
sed -i "s/@@STACK_UNITS@@/aziot-identityd.service/" ${D}${systemd_system_unitdir}/aziot-identityd-precondition.service
fi
install -m 0644 ${WORKDIR}/aziot-identityd-precondition.timer ${D}${systemd_system_unitdir}/aziot-identityd-precondition.timer
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ StartLimitIntervalSec=120
[Service]
Type=oneshot
ExecStart=@@AZIOTCLI@@ config apply
# a run after boot only writes the config; bring the services up like the
# boot transaction would. --no-block is required: this unit is ordered
# Before= the started units, a blocking start would deadlock. On a normal
# boot the request merges with the already queued jobs.
ExecStartPost=-/bin/systemctl start --no-block @@STACK_UNITS@@
Comment thread
HarryWaschkeit marked this conversation as resolved.
Restart=on-failure
RestartSec=5
RemainAfterExit=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ Wants=network-online.target aziot-identityd.service

ConditionPathExists=!/run/omnect-device-service/omnect_validate_update

StartLimitBurst=10
StartLimitIntervalSec=120
# never park in 'failed': each restart also pulls identity up again via
# Wants=, and a persistent loop is caught by the crash-loop check
StartLimitIntervalSec=0

[Service]
Type=notify

Restart=always
RestartSec=5
RestartSteps=5
RestartMaxDelaySec=60

User=adu
Group=adu
Expand Down
Loading