Is there a way to list the contents of a directory on the host filesystem?
I currently have a container that allows you to setup the network settings at runtime through dbus, similar to the docs, here, and a helper app, over bluetooth.
However, we now have a requirement for 802.1x cert based auth setup as well. The easiest way to get certs onto the device for setup with NetworkManager would probably be to drop them into system-connections on the SD card, so they get bind mounted to /etc/NetworkManager/system-connections.
At this point, I’ve modified my container to also allow setting the 802.1x NetworkManager fields, but would like to make the user setup a little easier.
Instead of having to type in the certificate names into the helper app, if I was able to read the directory contents of either /etc/NetworkManager/system-connections, or the system-connections folder on the SD card, I could add a drop down selection, since I would know the file names in advance.
I’m not sure if the best way to do this would be to mount the resin-state partition to a volume inside my container, or even something along the lines of ls --ignore '*.nmconnection --ignore '*.ignore' /etc/NetworkManager/system-connections >> fileInsideContainer.txt
Hi, currently there is not a way to bind mount the /etc/NetworkManager/system-connections folder in a container.
That means if you would like to use the ca-cert or a similar field in a NetworkManager profile (802-1x: NetworkManager Reference Manual), that you cannot currently use a path scheme. You may pass the certificate as a blob or pkcs#11 scheme. I personally have tried using it as a blob in the past and it was tricky but it worked.
Also for reference here is the function that is used for setting the certificates inside NetworkManager:
Please note that inside that function (and the docs above) it is asserted that wpa_supplicant only accepts certificates in a binary DER format when passed as a blob (PEM is not supported):
Here I see it verifies it uses a binary DER by checking the values of the first two bytes:
Also importantly you need to look at the NetworkManager’s logs in order to make sure it processes the certificate. I happened to not look at them when I was trying this out and it caused confusion.
It would have been easier with the file scheme, but even if the team agrees to make the system-connection folder bind-mountable, it will take time for this to be released. Also the relevant colleagues may not agree for this to be done, since there is an alternative with using the blob field. I can still raise it as an issue if needed though.
Please let me know whether using the blob schme will work for you and if you have any questions.
At this point, we have everything working on the 802.1x side. This was just a feature request to make setup slightly easier, and the user experience more ‘automatic’, if I could read file names inside of a container, either from the host OS, or the SD card where the user stores them.
Thanks for pointing it out. I’ve added the feature request to our internal tracking tool so it can be discussed. We’ll get back to you when we’ve had the chance to do so.