pi-builder icon indicating copy to clipboard operation
pi-builder copied to clipboard

Ability to insert random number or string into config files like WiFi

Open jywarren opened this issue 7 years ago • 5 comments

This could be useful in setting up a whole set of different Raspberry Pis to be used in the same place -- so the WiFi networks won't overlap.

The current default is 00-PiCamera but we could have this change to 00-PiCamera-XXX where XXX is a random string.

Maybe this could be a simple shell script to create an environment variable as $RAND_STRING or something?

jywarren avatar Sep 24 '18 19:09 jywarren

Here's a recipe for a random 6-char string in bash:

RAND_STRING=`date | md5sum | cut -c 1-6`

We would need to run sed at build time to change relevant files in builder/files/etc/.

icarito avatar Oct 13 '18 04:10 icarito

What if we just add this as default to the whole repo, i.e. merge a PR. Then any different recipe (represented in a PR) would be able to use this in their configurations. It could also be an initial step towards resolving this and we could follow up with a change to other config files.

On Sat, Oct 13, 2018, 12:53 PM Sebastian Silva [email protected] wrote:

Here's a recipe for a random 6-char string in bash:

RAND_STRING=date | md5sum | cut -c 1-6

We would need to run sed at build time to change relevant files in builder/files/etc/.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/image-builder-rpi/issues/23#issuecomment-429511195, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJwW5rxi9hp6hqRkWnoIG2uIehrROks5ukXGagaJpZM4W3U7D .

jywarren avatar Oct 17 '18 06:10 jywarren

Yeah the thing is I'm not sure what to implement because there are several levels to this. For one thing there's the hostnames which will interfere if we rely on mdns/zeroconf - so we need unique hostnames but then they'll be unpredictable - then there's the wifi hotspot.

One could think to do this at first boot, but it will be nearly impossible to get a random bit on first boot on identical hardware without networking or a RTC (unless I'm wrong on that!).

This requires some research!

icarito avatar Oct 20 '18 04:10 icarito

Hmm, interesting problem! I assume with no microphone or mouse input there's no ready source of randomness... If we do the wifi ssid could we poll some networking before we initiate the random number generation?

On Sat, Oct 20, 2018, 12:43 AM Sebastian Silva <[email protected] wrote:

Yeah the thing is I'm not sure what to implement because there are several levels to this. For one thing there's the hostnames which will interfere if we rely on mdns/zeroconf - so we need unique hostnames but then they'll be unpredictable - then there's the wifi hotspot.

One could think to do this at first boot, but it will be nearly impossible to get a random bit on first boot on identical hardware without networking or a RTC (unless I'm wrong on that!).

This requires some research!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/image-builder-rpi/issues/23#issuecomment-431548285, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJ613RqBRTWyPaGuoymJl96fGMelsks5umqnqgaJpZM4W3U7D .

jywarren avatar Oct 20 '18 18:10 jywarren

How about we decide to make a script that uses the system clock to add 2 random alphanumerics to the end of the WiFi network name. This way the URL stays the same, but we would get 00-PiCamera-XX if you press that button. This way we get good pseudorandomness (timestamp the button is pressed) and it's optional on all devices.

jywarren avatar Jun 21 '19 14:06 jywarren