• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / mender-mcu / 1752165357

04 Apr 2025 08:58AM UTC coverage: 57.795%. First build
1752165357

push

gitlab-ci

danielskinstad
feat: added dormant certificate

Add a dormant certificate that can be opted out by disabling `MENDER_SERVER_DORMANT_CERTIFICATE`.
It will install Let's Encrypts X1 certificate that can be used as a
backup for disaster recovery.

Ticket: MEN-8142
Changelog: Title

Signed-off-by: Daniel Skinstad Drabitzius <daniel.drabitzius@northern.tech>

6 of 7 new or added lines in 2 files covered. (85.71%)

2291 of 3964 relevant lines covered (57.8%)

70.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/src/platform/certs/zephyr/certs.c
1
/**
2
 * @file      certs.c
3
 * @brief     Mender MCU Certificate for zephyr
4
 *
5
 * Copyright Northern.tech AS
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with the License.
9
 * You may obtain a copy of the License at
10
 *
11
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
18
 */
19

20
#include "certs.h"
21
#include "log.h"
22
#include <errno.h>
23
#include <zephyr/net/tls_credentials.h>
24

25
static const unsigned char dormant_certificate[] = {
26
#include "dormant.cer.inc"
27
};
28

29
/* @note See https://docs.zephyrproject.org/4.0.0/doxygen/html/group__tls__credentials.html#ga640ff6dd3eb4d5017feaab6fab2bb2f7 */
30
int
31
mender_add_dormant_cert(void) {
29✔
32
    int ret;
33
    if (0
29✔
34
        != (ret = tls_credential_add(
29✔
35
                CONFIG_MENDER_NET_CA_CERTIFICATE_TAG_DORMANT, TLS_CREDENTIAL_CA_CERTIFICATE, dormant_certificate, sizeof(dormant_certificate)))) {
NEW
36
        mender_log_error("Failed to add dormant certificate. (result = %d, error: %s)", ret, strerror(errno));
×
37
    }
38
    return ret;
29✔
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc