Setup cellular APN remotely

Hi All,

Is there an easy way to put the cellular APN info in the device without having to give acces to the device boot partition itself?

We have a device we are going to deploy remotely and the idea is to do this with local sim card providers.
Now i don’t want to give the user acces to the boot partition and it would be nice if they can add the device to a LAN internet connection and the APN will get provisioned remotely.

I really need some help to achieve this. Hopefully you guys have a nice solution or idea’s?

Thnx!

Hi @RDB
You should be able to use the NetworkManager dbus API to configure APN settings. It should be a similar procedure to changing wifi settings remotely, which we have some documentation on here https://docs.resin.io/reference/resinOS/network/2.x/#changing-the-network-at-runtime

Yes i did have a look at it.
To test it out i would like to have the command to add a new connection.
I came up with the following but need to add the params for APN etc in the command.
Maybe you can help me out how to make the right command to add it?

DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket \
dbus-send --system --print-reply \
            --dest=org.freedesktop.NetworkManager \
            org/freedesktop/NetworkManager \
            org.freedesktop.NetworkManager.Settings.AddConnection \
            string: ...

Has anyone an idea how to get this working?
Because I havent got it working so far :frowning:

dbus-send does not support passing complex data structures. If you have Python installed in the container then you may use those examples as a reference (first is using the python-networkmanager package, the second one - the dbus package, which is lower level):

1 Like