Using redsocks.conf for initial provisioning in a golden image (offline / no Supervisor API access)

Hello community,

We are preparing a golden balenaOS image that will be handed off to a hardware supplier for mass provisioning of devices.

In our setup, devices use a cellular modem and do not have direct connectivity to balenaCloud on first boot. The only way for the device to reach balenaCloud is through a proxy, so we need redsocks to be configured before the device is able to register or before the Supervisor API is reachable.

According to the documentation, there are two ways to enable the system proxy / redsocks:

  1. Via the Supervisor GET/PATCH /v1/device/host-config API

  2. By placing a redsocks.conf file under /mnt/boot/system-proxy/

Since option (1) is not possible for initial provisioning in our case, we are planning to use option (2). However, the documentation does not clearly describe the expected workflow for this approach.

Since we need to configure this offline (modifying the .img or the SD card before the first boot), we would like to confirm the exact procedure to ensure the device comes online immediately.

Thanks in advance!

Hi @lbarragan,

Thanks for reaching out, this seems like an interesting use of our platform!

Details on how to setup redsocks on your device can be found here: Network Setup on balenaOS | balena

You can modify the boot partition by mounting the img file by mounting the file, editing and unmount as follows:

mount -o loop file.img /mnt/img

then edit and unmount normally

umount /mnt/img/

Hope this helps?