Skip to content

Commit 44f4dfd

Browse files
committed
chore(pairing): FDO feature now enabled by default
Removed env variable PAIRING_ENABLE_FDO used to enable the feature Removed openbao-init container since no longer needed Signed-off-by: frossq <francesco.asquini@secomind.com>
1 parent c89cda8 commit 44f4dfd

File tree

11 files changed

+19
-176
lines changed

11 files changed

+19
-176
lines changed

.github/workflows/astarte-end-to-end-test-workflow.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ jobs:
144144
- name: Initialize keys
145145
working-directory: .tmp/repos/astarte
146146
run: astartectl utils gen-keypair test
147-
- name: Enable FDO
148-
run: echo "PAIRING_ENABLE_FDO=true" >> .tmp/repos/astarte/.env
149147
- name: Start all Astarte services
150148
working-directory: .tmp/repos/astarte
151149
run: docker compose up --no-build --pull missing -d

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8-
## Unreleased
8+
## [1.4.0] - Unreleased
9+
10+
### Changed
11+
12+
- [astarte_pairing] FDO feature is enabled for all installations, removed environment variable `PAIRING_ENABLE_FDO`.
913

1014
## [1.4.0-rc.0] - 2026-04-08
1115

apps/astarte_pairing/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ CASSANDRA_NODES=localhost CFSSL_API_URL=http://localhost:8080 mix test
5252

5353
# Test FDO
5454

55-
> The feature is experimental and PAIRING_ENABLE_FDO must be set to true
56-
5755
To test FDO, the manufacturer and Device CA keys are required and
5856
can be generated from the following tools:
5957

apps/astarte_pairing/lib/astarte_pairing/config.ex

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ defmodule Astarte.Pairing.Config do
2323

2424
use Skogsra
2525

26+
alias Astarte.FDO.Config, as: FDOConfig
2627
alias Astarte.Pairing.CFSSLCredentials
27-
alias Astarte.Pairing.Config.BaseURLProtocol
2828
alias Astarte.Pairing.Config.CQExNodes
2929
alias Astarte.Secrets.Config, as: SecretsConfig
3030

@@ -34,30 +34,6 @@ defmodule Astarte.Pairing.Config do
3434
type: :binary,
3535
required: true
3636

37-
@envdoc """
38-
Set this variable to 'true' to enable FDO feature as device authentication mechanism.
39-
WARNING: this feature is experimental and is not enabled by default
40-
"""
41-
app_env :enable_fdo, :astarte_pairing, :enable_fdo,
42-
os_env: "PAIRING_ENABLE_FDO",
43-
type: :boolean,
44-
default: false
45-
46-
@envdoc "The port the ingress is listening on, used for FDO authentication mechanism"
47-
app_env :base_url_port, :astarte_pairing, :base_url_port,
48-
os_env: "ASTARTE_BASE_URL_PORT",
49-
type: :integer
50-
51-
@envdoc "The protocol the ingress is listening on, used for FDO authentication mechanism"
52-
app_env :base_url_protocol, :astarte_pairing, :base_url_protocol,
53-
os_env: "ASTARTE_BASE_URL_PROTOCOL",
54-
type: BaseURLProtocol
55-
56-
@envdoc "The astarte base domain, used for FDO authentication mechanism"
57-
app_env :base_url_domain, :astarte_pairing, :base_url_domain,
58-
os_env: "ASTARTE_BASE_URL_DOMAIN",
59-
type: :binary
60-
6137
@envdoc "URL to the running CFSSL instance for device certificate generation."
6238
app_env :cfssl_url, :astarte_pairing, :cfssl_url,
6339
os_env: "PAIRING_CFSSL_URL",
@@ -157,16 +133,8 @@ defmodule Astarte.Pairing.Config do
157133
end
158134
end
159135

160-
if enable_fdo!() do
161-
# check that all mandatory FDO variables are configured before starting
162-
variables_to_check = [:base_url_port, :base_url_protocol, :base_url_domain]
163-
164-
if !Enum.all?(variables_to_check, &variable_set?(&1)) do
165-
raise "FDO feature is enabled but not all its parameters are configured"
166-
end
167-
168-
SecretsConfig.init()
169-
end
136+
FDOConfig.init!()
137+
SecretsConfig.init()
170138
end
171139

172140
@envdoc """
@@ -200,27 +168,9 @@ defmodule Astarte.Pairing.Config do
200168
@spec cassandra_node!() :: {String.t(), integer()}
201169
def cassandra_node!, do: Enum.random(cqex_nodes!())
202170

203-
def base_url! do
204-
protocol = base_url_protocol!()
205-
domain = base_url_domain!()
206-
port = base_url_port!()
207-
208-
"#{protocol}://#{domain}:#{port}"
209-
end
210-
211171
@doc """
212172
Returns true if the authentication for the agent is disabled.
213173
Credential requests made by devices are always authenticated, even it this is true.
214174
"""
215175
def authentication_disabled?, do: disable_authentication!()
216-
217-
defp variable_set?(var_name) do
218-
case apply(__MODULE__, var_name, []) do
219-
{:ok, val} when not is_nil(val) ->
220-
true
221-
222-
_ ->
223-
false
224-
end
225-
end
226176
end

apps/astarte_pairing/lib/astarte_pairing_web/plug/fdo_gate.ex

Lines changed: 0 additions & 46 deletions
This file was deleted.

apps/astarte_pairing/lib/astarte_pairing_web/router.ex

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ defmodule Astarte.PairingWeb.Router do
3333
plug Astarte.PairingWeb.Plug.LogHwId
3434
end
3535

36-
pipeline :fdo_feature_gate do
37-
plug Astarte.PairingWeb.Plug.FDOGate
38-
end
39-
4036
pipeline :fdo do
4137
plug :accepts, ["cbor"]
4238
plug :put_view, Astarte.PairingWeb.FDOView
@@ -54,8 +50,6 @@ defmodule Astarte.PairingWeb.Router do
5450
end
5551

5652
scope "/v1/:realm_name/fdo/101", Astarte.PairingWeb do
57-
pipe_through :fdo_feature_gate
58-
5953
pipe_through :fdo
6054

6155
post "/msg/60", FDOOnboardingController, :hello_device
@@ -98,8 +92,6 @@ defmodule Astarte.PairingWeb.Router do
9892
end
9993

10094
scope "/fdo" do
101-
pipe_through :fdo_feature_gate
102-
10395
pipe_through :agent_api
10496

10597
post "/owner_keys", OwnerKeyController, :create_or_upload_key
@@ -112,7 +104,6 @@ defmodule Astarte.PairingWeb.Router do
112104
end
113105

114106
scope "/ownership" do
115-
pipe_through :fdo_feature_gate
116107
pipe_through :agent_api
117108

118109
post "/", OwnershipVoucherController, :create

apps/astarte_pairing/test/astarte_pairing_web/controllers/fdo_onboarding_controller_test.exs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -279,21 +279,4 @@ defmodule Astarte.PairingWeb.FDOOnboardingControllerTest do
279279
assert {100, id} == assert_cbor_error(conn)
280280
end
281281
end
282-
283-
describe "FDO feature disabled" do
284-
setup context do
285-
setup_authenticated(context, :hello_device, 60)
286-
end
287-
288-
test "makes the /v1/:realm_name/fdo/101 endpoints return a 404 error", %{
289-
conn: conn,
290-
create_path: path
291-
} do
292-
stub(Config, :enable_fdo!, fn -> false end)
293-
294-
conn
295-
|> post(path, CBOR.encode(%{hello: "device"}))
296-
|> response(404)
297-
end
298-
end
299282
end

apps/astarte_pairing/test/astarte_pairing_web/controllers/owner_key_controller_test.exs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,6 @@ defmodule Astarte.PairingWeb.Controllers.OwnerKeyControllerTest do
175175

176176
assert resp_message =~ "has already been imported"
177177
end
178-
179-
test "returns a 404 error if FDO feature is disabled", context do
180-
%{auth_conn: conn, owner_key_path: path, create_key_payload: payload} = context
181-
182-
stub(Config, :enable_fdo!, fn -> false end)
183-
184-
conn
185-
|> post(path, payload)
186-
|> response(404)
187-
end
188178
end
189179

190180
describe "/fdo/owner_keys listing" do

apps/astarte_pairing/test/astarte_pairing_web/controllers/ownership_voucher_controller_test.exs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,6 @@ defmodule Astarte.PairingWeb.Controllers.OwnershipVoucherControllerTest do
156156
|> post(path, @sample_load_params)
157157
|> response(422)
158158
end
159-
160-
test "returns a 404 error if FDO feature is disabled", context do
161-
%{auth_conn: conn, register_path: path} = context
162-
163-
stub(Config, :enable_fdo!, fn -> false end)
164-
165-
conn
166-
|> post(path, @sample_load_params)
167-
|> response(404)
168-
end
169159
end
170160

171161
defp register_setup(context) do
@@ -220,16 +210,6 @@ defmodule Astarte.PairingWeb.Controllers.OwnershipVoucherControllerTest do
220210
|> post(path, %{data: %{}})
221211
|> response(422)
222212
end
223-
224-
test "returns 404 when the FDO feature is disabled", context do
225-
%{auth_conn: conn, path: path} = context
226-
227-
stub(Config, :enable_fdo!, fn -> false end)
228-
229-
conn
230-
|> post(path, %{data: %{"ownership_voucher" => sample_voucher()}})
231-
|> response(404)
232-
end
233213
end
234214

235215
describe "list_ownership_vouchers/2" do

docker-compose.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ services:
8080
condition: service_started
8181
openbao:
8282
condition: service_healthy
83-
openbao-init:
84-
condition: service_completed_successfully
8583
labels:
8684
- "traefik.enable=true"
8785
- "traefik.http.routers.astarte-pairing.rule=Host(`api.${DOCKER_COMPOSE_ASTARTE_BASE_DOMAIN}`) && PathPrefix(`/pairing`)"
@@ -239,17 +237,6 @@ services:
239237
retries: 5
240238
start_period: 1s
241239

242-
# additional Bao server to inject runtime configurations in main Bao server
243-
openbao-init:
244-
image: openbao/openbao:2
245-
depends_on:
246-
openbao:
247-
condition: service_healthy
248-
environment:
249-
- BAO_ADDR=http://openbao:8200
250-
- BAO_TOKEN=${ASTARTE_VAULT_TOKEN}
251-
command: bao secrets enable transit
252-
253240
rendezvous:
254241
image: astarte/go-fdo-server:ade68cda47-20251128
255242
restart: on-failure

0 commit comments

Comments
 (0)