Commit Graph

25 Commits

Author SHA1 Message Date
Tobias Mueller
9a3f072c23 functions: provide a Lua-based IMEI generation
Soon, we can retire the relatively expensive Python script and use shell
and Lua.
2023-10-18 21:00:23 +02:00
Tobias Mueller
4b427bbcfc lua: print a random IMEI from the seed provided
I don't know how much stronger we can see the LUA RNG. It seems to
accept an "int" which I assume is 32 bit. It will complain if the seed
is too big.
2023-10-18 20:59:33 +02:00
Tobias Mueller
a3fff24042 lua: make a 15 digit IMEI 2023-10-18 20:58:05 +02:00
Tobias Mueller
1cd1125cfe lua: remove debug prints 2023-10-18 20:57:51 +02:00
Tobias Mueller
dfbcbe7506 functions: Provide a method to read the SIM ID
We can use the identifier of the SIM as a stable token to derive a
deterministic IMEI rather than the IMSI which is only available once the
SIM has been (PIN) unlocked.
2023-10-18 20:57:19 +02:00
Tobias Mueller
5c6976aa11 change MAC address in repeater mode
Now, the hosting WiFi sees random a random MAC address every time the
device is rebooted.
2023-10-18 14:58:26 +02:00
Tobias Mueller
d4886a54a9 volatile-macs: define the service self-sufficiently
This makes it hopefully a bit easier to see what we're doing because you
don't need to chase the files down. We don't re-use that functionality
anywhere. Neither would we.
A more important change is not restarting the gl-tertf service.
First of all, there seems to be no process attached to gl-tertf. It is
the "Bandwidth Monitor" and part of the kmod-gl-sdk4-tertf package, so
it's kernel module. It does not appear to be holding the clients.db.
There is, however, gl_clients which also makes sense, naming wise.
That service defines that /usr/bin/gl_clients_update ought to be run.
And stracing it shows that it does indeed touch the database:
open("/etc/oui-tertf/client.db",
O_RDWR|O_CREAT|O_LARGEFILE|O_NOFOLLOW|O_CLOEXEC, 0644) = 7

It also appears to be re-creating the file when it's missing.

Anyway, we have the service stopped during installation so that we can
safely delete the file without the process complaining. We also install
our volatile mac service s.t. it runs ahead of the gl-client service so
that the clientdb gets saved in volatile memory.
2023-10-18 14:27:55 +02:00
Tobias Mueller
f8d35b15d5 mac-wipe: Do not stop terft as it cannot be stopped
The service does not implement stop() as it throws a scary warning when
installing. So we do not even attempt to stop it.
2023-10-18 10:36:33 +02:00
Tobias Mueller
7b64f3aa9b functions: provide SET IMEI capability from shellscripts
It doesn't work for me but I also haven't tried very hard as we do not
migrate off the Python script now.
2023-10-18 10:35:39 +02:00
Tobias Mueller
c8634591b2 added Lua script to generate an IMEI
We currently use a Python script to generate IMEIs. Loading Python is
relatively expensive on our target platform so I hope we can use
something quicker.
2023-10-18 10:31:49 +02:00
Tobias Mueller
a0fad3a833 mac-wipe: fix syntax error for argument comparison 2023-10-17 22:02:04 +02:00
Tobias Mueller
8b4d371c9f functions: Do not automatically restart the wifi on RESET_BSSIDS
Instead of restarting the service we have the service started *after*
our modification to its configuration.
This makes it slightly more inconvenient to reset the WiFi BSSIDs while
the device is booted but that capability can be restored and made better
through an executable, say, /usr/bin/reset-wifi-bssids or something.

We also split the volatile client MACs into its own service to have
a bit of a clearer separation of duties. This will allow us to eventually
split the package more easily into sub-packages with finer-grained control.
2023-10-17 19:52:11 +02:00
Tobias Mueller
df8578e402 functions: CHECK_ABORT for v4 MCU 2023-10-17 09:18:00 +02:00
Tobias Mueller
11a8afd0a9 python: Added a --generate-only flag to not set the IMEI
We can probably set the IMEI through the gl_modem command.
Currently, the Web interface times out when calling random-imei. I want
to separate the steps so that each step does not take as long.
2023-10-17 09:05:02 +02:00
Tobias Mueller
53bf156fd0 python: only get the IMSI when in deterministic mode
We don't need the IMSI otherwise so let's not spend the time obtaining
it.
2023-10-17 09:01:31 +02:00
Tobias Mueller
4a16277ac2 python: debug print reading IMSI
It seems to timeout somewhere and I want to know where.
2023-10-17 09:00:56 +02:00
Tobias Mueller
4f584b4b6c mac-wipe: avoid accumulating mounts
If we mount over and over again we may consume memory unnecessarily.
2023-10-16 15:15:29 +02:00
Tobias Mueller
4beae781a2 mac-wipe: copy existing database into a volatile memory
rather than deleting everything.
It seems that the device stops working when deleting the database. That
is, the connection to the Internet stops working which is very safe as
it does not leak any data but arguably defeats the purpose of the
device.
2023-10-16 14:51:59 +02:00
Tobias Mueller
e02de82dba mac-wipe: log execution to debug where it's stuck
When installing the package, it appears to be stuck somewhere. I want to
know where and why, so I use the logging facilities.
2023-10-16 14:05:09 +02:00
Tobias Mueller
ea66e67d07 Merge remote-tracking branch 'origin/main' into luci 2023-10-16 12:39:14 +02:00
Tobias Mueller
4c29fe2732 removing v3 patches
The switch doesn't work yet but "uci  get switch-button.@main[0].func"
gets the currently active configured action for button.
I guess that /etc/rc.button/switch is called on every press of the
button.
2023-10-16 12:25:19 +02:00
Tobias Mueller
1a17e06a12 MAC address removal for v4 firmware
I have rsynced the whole device before associating with a new device and
after. The only file that got modified was /etc/oui-tertf/client.db.
We intend to have it stored in memory rather than on flash. This should
be okay since the kernel also holds the MAC addresses in memory.
2023-10-16 12:09:00 +02:00
Tobias Mueller
9c9ab738ac functions: Remove unsued restore function
This is not referenced anywhere so I guess that we don't need it.
2023-10-16 12:04:46 +02:00
nicholas
187378a1d6 Added IMEI character length validation check in
imei_generate.py which ensures IMEI has 14-char
length, including validation digit
2023-10-13 13:05:40 +02:00
kantorkel
cb4d73731f Initial commit 2022-10-21 10:14:38 +02:00