Part 1
요약·해설
Provisioner·Provisionee role, 5단계 process, URI encoding과 secure OOB 선택을 설명합니다.
Provisioner · Provisionee
5
Advertising · GATT
Static OOB · OOB key
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
637BF33A8F4EF7438846AB4EFD065E90E3DD97859979577E4E4D4D3811D662CE
.. _bluetooth_mesh_provisioning:
Provisioning
############
Provisioning is the process of adding devices to a mesh network. It requires
two devices operating in the following roles:
* The *provisioner* represents the network owner, and is responsible for
adding new nodes to the mesh network.
* The *provisionee* is the device that gets added to the network through the
Provisioning process. Before the provisioning process starts, the
provisionee is an *unprovisioned device*.
The Provisioning module in the Zephyr Bluetooth Mesh stack supports both the
Advertising and GATT Provisioning bearers for the provisionee role, as well as
the Advertising Provisioning bearer for the provisioner role.
The Provisioning process
************************
All Bluetooth Mesh nodes must be provisioned before they can participate in a
Bluetooth Mesh network. The Provisioning API provides all the functionality
necessary for a device to become a provisioned mesh node.
Provisioning is a five-step process, involving the following steps:
* Beaconing
* Invitation
* Public key exchange
* Authentication
* Provisioning data transfer
Beaconing
=========
To start the provisioning process, the unprovisioned device must first start
broadcasting the Unprovisioned Beacon. This makes it visible to nearby
provisioners, which can initiate the provisioning. To indicate that the device
needs to be provisioned, call :c:func:`bt_mesh_prov_enable`. The device
starts broadcasting the Unprovisioned Beacon with the device UUID and the
``OOB information`` field, as specified in the ``prov`` parameter passed to
:c:func:`bt_mesh_init`. Additionally, a Uniform Resource Identifier (URI)
may be specified, which can point the provisioner to the location of some Out
Of Band information, such as the device's public key or an authentication
value database. The URI is advertised in a separate beacon, with a URI hash
included in the unprovisioned beacon, to tie the two together.
Uniform Resource Identifier
---------------------------
The Uniform Resource Identifier shall follow the format specified in the
Bluetooth Core Specification Supplement. The URI must start with a URI scheme,
encoded as a single utf-8 data point, or the special ``none`` scheme, encoded
as ``0x01``. The available schemes are listed on the `Bluetooth website
<https://www.bluetooth.com/specifications/assigned-numbers/>`_.
Examples of encoded URIs:
.. list-table:: URI encoding examples
* - URI
- Encoded
* - ``http://example.com``
- ``\x16//example.com``
* - ``https://www.zephyrproject.org/``
- ``\x17//www.zephyrproject.org/``
* - ``just a string``
- ``\x01just a string``
Provisioning invitation
=======================
The provisioner initiates the Provisioning process by sending a Provisioning
invitation. The invitations prompts the provisionee to call attention to
itself using the Health Server
:ref:`bluetooth_mesh_models_health_srv_attention`, if available.
The Unprovisioned device automatically responds to the invite by presenting a
list of its capabilities, including the supported Out of Band Authentication
methods and algorithms.
Public key exchange
===================
Before the provisioning process can begin, the provisioner and the unprovisioned
device exchange public keys, either in-band or Out of Band (OOB).
In-band public key exchange is a part of the provisioning process and always
supported by the unprovisioned device and provisioner.
If the application wants to support public key exchange via OOB, it needs to
provide public and private keys to the mesh stack. The unprovisioned device
will reflect this in its capabilities. The provisioner obtains the public key
via any available OOB mechanism (e.g. the device may advertise a packet
containing the public key or it can be encoded in a QR code printed on the
device packaging). Note that even if the unprovisioned device has specified
the public key for the Out of Band exchange, the provisioner may choose to
exchange the public key in-band if it can't retrieve the public key via OOB
mechanism. In this case, a new key pair will be generated by the mesh stack
for each Provisioning process.
To enable support of OOB public key on the unprovisioned device side,
:kconfig:option:`CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY` needs to be enabled. The
application must provide public and private keys before the Provisioning
process is started by initializing pointers to
:c:member:`bt_mesh_prov.public_key_be`
and :c:member:`bt_mesh_prov.private_key_be`. The keys needs to be
provided in big-endian bytes order.
To provide the device's public key obtained via OOB,
call :c:func:`bt_mesh_prov_remote_pub_key_set` on the provisioner side.
Authentication
==============
After the initial exchange, the provisioner selects an Out of Band (OOB)
Authentication method. This allows the user to confirm that the device the
provisioner connected to is actually the device they intended, and not a
malicious third party.
The Provisioning API supports the following authentication methods for the
provisionee:
* **Static OOB:** An authentication value is assigned to the device in
production, which the provisioner can query in some application specific
way.
* **Input OOB:** The user inputs the authentication value. The available input
actions are listed in :c:enum:`bt_mesh_input_action_t`.
* **Output OOB:** Show the user the authentication value. The available output
actions are listed in :c:enum:`bt_mesh_output_action_t`.
The application must provide callbacks for the supported authentication
methods in :c:struct:`bt_mesh_prov`, as well as enabling the supported actions
in :c:member:`bt_mesh_prov.output_actions` and
:c:member:`bt_mesh_prov.input_actions`.
When an Output OOB action is selected, the authentication value should be
presented to the user when the output callback is called, and remain until the
:c:member:`bt_mesh_prov.input_complete` or :c:member:`bt_mesh_prov.complete`
callback is called. If the action is ``blink``, ``beep`` or ``vibrate``, the
sequence should be repeated after a delay of three seconds or more.
When an Input OOB action is selected, the user should be prompted when the
application receives the :c:member:`bt_mesh_prov.input` callback. The user
response should be fed back to the Provisioning API through
:c:func:`bt_mesh_input_string` or :c:func:`bt_mesh_input_number`. If
no user response is recorded within 60 seconds, the Provisioning process is
aborted.
If Provisionee wants to mandate OOB authentication, it is mandatory to use
the BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM algorithm.
Data transfer
=============
After the device has been successfully authenticated, the provisioner
transfers the Provisioning data:
* Unicast address
* A network key
* IV index
* Network flags
* Key refresh
* IV update
Additionally, a device key is generated for the node. All this data is stored
by the mesh stack, and the provisioning :c:member:`bt_mesh_prov.complete`
callback gets called.
Provisioning security
*********************
Depending on the choice of public key exchange mechanism and authentication method,
the provisioning process can be secure or insecure.
On May 24th 2021, ANSSI `disclosed <https://kb.cert.org/vuls/id/799380>`_
a set of vulnerabilities in the Bluetooth Mesh provisioning protocol that showcased
how the low entropy provided by the Blink, Vibrate, Push, Twist and
Input/Output numeric OOB methods could be exploited in impersonation and MITM
attacks. In response, the Bluetooth SIG has reclassified these OOB methods as
insecure in the Bluetooth Mesh Profile Specification v1.0.1 `erratum 16350 <https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=516072>`_,
as AuthValue may be brute forced in real time. To ensure secure provisioning, applications
should use a static OOB value and OOB public key transfer.
API reference
*************
.. doxygengroup:: bt_mesh_prov
Part 3
한국어 전문 번역
Provisioning
Provisioning은 device를 mesh network에 추가하는 process이며 두 role이 필요합니다.
- Provisioner: Network owner를 나타내며 새 node를 mesh network에 추가합니다.
- Provisionee: Provisioning을 통해 network에 추가되는 device입니다. Process 시작 전에는 unprovisioned device입니다.
Zephyr Bluetooth Mesh Provisioning module은 provisionee role에서 Advertising·GATT Provisioning bearer를 모두 지원하고 provisioner role에서는 Advertising Provisioning bearer를 지원합니다.
Provisioning process
모든 Bluetooth Mesh node는 network에 참여하기 전에 provision되어야 합니다. Provisioning API는 device가 provisioned mesh node가 되는 데 필요한 기능을 제공합니다.
- Beaconing
- Invitation
- Public key exchange
- Authentication
- Provisioning data transfer
Beaconing
Unprovisioned device가 먼저 Unprovisioned Beacon broadcast를 시작하면 근처 provisioner가 device를 발견하고 provisioning을 시작할 수 있습니다. bt_mesh_prov_enable을 호출해 provisioning 필요 상태를 표시합니다.
Device는 bt_mesh_init의 prov parameter에 지정한 device UUID와 OOB information field를 담아 beacon을 보냅니다.
Device public key 또는 authentication value database 같은 OOB 정보 위치를 가리키는 URI도 지정할 수 있습니다. URI는 별도 beacon으로 advertise하고 unprovisioned beacon에는 URI hash를 넣어 두 beacon을 연결합니다.
Uniform Resource Identifier
URI는 Bluetooth Core Specification Supplement format을 따라야 합니다. Single UTF-8 data point로 encoding된 URI scheme 또는 0x01로 encoding한 특별한 none scheme으로 시작해야 합니다. 사용 가능한 scheme은 Bluetooth Assigned Numbers에 나열됩니다.
| URI | Encoded |
|---|---|
http://example.com | \x16//example.com |
https://www.zephyrproject.org/ | \x17//www.zephyrproject.org/ |
just a string | \x01just a string |
Provisioning invitation
Provisioner가 invitation을 보내 process를 시작합니다. Health Server가 있다면 invitation은 provisionee가 attention state로 자신을 표시하도록 요청합니다.
Unprovisioned device는 지원하는 OOB authentication method와 algorithm을 포함한 capability list로 자동 응답합니다.
Public key exchange
Process 시작 전 provisioner와 unprovisioned device가 in-band 또는 OOB로 public key를 교환합니다. In-band exchange는 provisioning process의 일부이며 양쪽에서 항상 지원합니다.
OOB public key exchange를 지원하려면 application이 mesh stack에 public·private key를 제공하고 device capability에 이를 표시해야 합니다. Provisioner는 advertise packet이나 package QR code 같은 OOB mechanism으로 public key를 얻습니다.
Unprovisioned device가 OOB public key를 제공해도 provisioner가 key를 가져오지 못하면 in-band exchange를 선택할 수 있습니다. 이 경우 mesh stack이 provisioning process마다 새 key pair를 생성합니다.
Provisionee에서 OOB public key를 사용하려면 CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY를 활성화하고 process 시작 전에 bt_mesh_prov.public_key_be와 bt_mesh_prov.private_key_be pointer를 초기화해야 합니다. Key byte order는 big-endian입니다.
Provisioner는 OOB로 얻은 device public key를 bt_mesh_prov_remote_pub_key_set으로 제공합니다.
Authentication
초기 exchange 뒤 provisioner가 OOB authentication method를 선택합니다. 사용자가 연결된 device가 의도한 device이며 악의적인 제3자가 아님을 확인하는 단계입니다.
- Static OOB: Production 때 device에 authentication value를 할당하고 provisioner가 application-specific 방법으로 조회합니다.
- Input OOB: 사용자가 authentication value를 입력합니다. Action은
bt_mesh_input_action_t에 정의됩니다. - Output OOB: Device가 authentication value를 사용자에게 보여 줍니다. Action은
bt_mesh_output_action_t에 정의됩니다.
Application은 bt_mesh_prov에 지원 method callback을 제공하고 bt_mesh_prov.output_actions와 bt_mesh_prov.input_actions에 action을 활성화해야 합니다.
Output OOB가 선택되면 output callback에서 value를 사용자에게 제시하고 bt_mesh_prov.input_complete 또는 bt_mesh_prov.complete callback까지 유지합니다. Action이 blink, beep 또는 vibrate라면 3초 이상 간격으로 sequence를 반복해야 합니다.
Input OOB가 선택되면 bt_mesh_prov.input callback에서 사용자 입력을 요청합니다. 응답을 bt_mesh_input_string 또는 bt_mesh_input_number로 Provisioning API에 전달합니다. 60초 안에 응답이 없으면 process를 중단합니다.
Provisionee가 OOB authentication을 mandatory로 요구하려면 BT_MESH_ECDH_P256_HMAC_SHA256_AES_CCM algorithm을 사용해야 합니다.
Data transfer
Authentication 성공 뒤 provisioner가 다음 Provisioning data를 전달합니다.
- Unicast address
- Network key
- IV index
- Network flag: Key Refresh
- Network flag: IV Update
Node device key도 생성합니다. Mesh stack이 모든 data를 저장하고 bt_mesh_prov.complete callback을 호출합니다.
Provisioning security
Public key exchange mechanism과 authentication method 선택에 따라 process가 secure하거나 insecure할 수 있습니다.
2021년 5월 24일 ANSSI는 Bluetooth Mesh provisioning protocol의 취약점 집합을 공개했습니다. Blink, Vibrate, Push, Twist와 Input/Output numeric OOB가 제공하는 entropy가 낮아 impersonation과 MITM attack에 악용될 수 있음을 보였습니다.
Bluetooth SIG는 Mesh Profile Specification 1.0.1 erratum 16350에서 AuthValue를 실시간 brute force할 수 있다는 이유로 이 OOB method들을 insecure로 재분류했습니다. Secure provisioning에는 static OOB value와 OOB public key transfer를 사용해야 합니다.
API Reference
공식 bt_mesh_prov Doxygen group이 Provisioner·Provisionee callback과 provisioning API를 생성합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.