diff mbox series

[meta-networking] cloudflared: add initial recipe for 2026.3.0 version

Message ID 20260430075829.15293-1-ayoub.zaki@embetrix.com
State New
Headers show
Series [meta-networking] cloudflared: add initial recipe for 2026.3.0 version | expand

Commit Message

Ayoub Zaki April 30, 2026, 7:58 a.m. UTC
Add initial recipe for Cloudflare Tunnel client (cloudflared).
The upstream source vendors all Go dependencies so no go-mods.inc
is needed.
Includes systemd service with token-based authentication
via /etc/default/cloudflared.

Signed-off-by: Ayoub Zaki <ayoub.zaki@embetrix.com>
---
 .../cloudflared/cloudflared_2026.3.0.bb       | 36 +++++++++++++++++++
 .../cloudflared/files/cloudflared.service     | 15 ++++++++
 .../cloudflared/files/default                 |  2 ++
 3 files changed, 53 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/cloudflared/cloudflared_2026.3.0.bb
 create mode 100644 meta-networking/recipes-connectivity/cloudflared/files/cloudflared.service
 create mode 100644 meta-networking/recipes-connectivity/cloudflared/files/default
diff mbox series

Patch

diff --git a/meta-networking/recipes-connectivity/cloudflared/cloudflared_2026.3.0.bb b/meta-networking/recipes-connectivity/cloudflared/cloudflared_2026.3.0.bb
new file mode 100644
index 0000000000..f0b8530a69
--- /dev/null
+++ b/meta-networking/recipes-connectivity/cloudflared/cloudflared_2026.3.0.bb
@@ -0,0 +1,36 @@ 
+SUMMARY = "Cloudflare Tunnel client"
+DESCRIPTION = "cloudflared is the command-line client for Cloudflare Tunnel, \
+a tunneling daemon that proxies traffic from the Cloudflare network to your origins."
+HOMEPAGE = "https://github.com/cloudflare/cloudflared"
+SECTION = "networking"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=175792518e4ac015ab6696d16c4f607e"
+
+SRC_URI = "git://github.com/cloudflare/cloudflared.git;protocol=https;branch=master;destsuffix=${GO_SRCURI_DESTSUFFIX} \
+           file://cloudflared.service \
+           file://default \
+           "
+SRCREV = "d2a87e9b93456ad7f82417400f4209d513668487"
+
+GO_IMPORT = "github.com/cloudflare/cloudflared"
+GO_INSTALL = "${GO_IMPORT}/cmd/cloudflared"
+GO_LINKSHARED = ""
+SRCREV_SHORT = "${@d.getVar('SRCREV')[:8]}"
+GO_EXTRA_LDFLAGS = "-X main.Version=${PV}-${SRCREV_SHORT}"
+
+inherit go-mod systemd
+
+SYSTEMD_SERVICE:${PN} = "cloudflared.service"
+
+do_install:append() {
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${UNPACKDIR}/cloudflared.service ${D}${systemd_system_unitdir}/cloudflared.service
+    install -d ${D}${sysconfdir}/default
+    install -m 0644 ${UNPACKDIR}/default ${D}${sysconfdir}/default/cloudflared
+}
+
+FILES:${PN}-src += "${libdir}/go/src"
+
+# Fix shebang and QA Issue with scripts with /bin/bash and /usr/bin/python3
+INSANE_SKIP:${PN}-dev = "file-rdeps"
diff --git a/meta-networking/recipes-connectivity/cloudflared/files/cloudflared.service b/meta-networking/recipes-connectivity/cloudflared/files/cloudflared.service
new file mode 100644
index 0000000000..decaf0e329
--- /dev/null
+++ b/meta-networking/recipes-connectivity/cloudflared/files/cloudflared.service
@@ -0,0 +1,15 @@ 
+[Unit]
+Description=cloudflared
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=notify
+DynamicUser=yes
+EnvironmentFile=/etc/default/cloudflared
+ExecStart=/usr/bin/cloudflared --no-autoupdate tunnel run --token ${TUNNEL_TOKEN}
+Restart=on-failure
+RestartSec=5s
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-networking/recipes-connectivity/cloudflared/files/default b/meta-networking/recipes-connectivity/cloudflared/files/default
new file mode 100644
index 0000000000..1e00173af6
--- /dev/null
+++ b/meta-networking/recipes-connectivity/cloudflared/files/default
@@ -0,0 +1,2 @@ 
+# Cloudflare Tunnel token from the dashboard
+TUNNEL_TOKEN=