Skip to content

Commit

Permalink
blue-merle: generate a temporary IMEI before the the SIM switch
Browse files Browse the repository at this point in the history
After shutting down the modem and before replacing the SIM, we generate
a temporary random IMEI to prevent accidental disclosure of the new IMSI
under the old IMEI. It should not happen but we do not control the modem
as much as we'd like, e.g. fully power it down. So it may not be
necessary but we consider it defense in depth.
  • Loading branch information
muelli committed Oct 18, 2023
1 parent fe4021f commit 03c262a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions files/usr/bin/blue-merle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ while [[ "$answer" -eq 1 ]]; do
fi
done

## We have just disabled the modem so it should not log on to any network.
## We set a random IMEI now only to have it overwritten very soon after
## the SIM card has been replaced. We intend to prevent an accidential
## leak of the new SIM's IMSI with the old IMEI just in case the modem
## accidentally tried to log in to the network.
python3 /lib/blue-merle/imei_generate.py -r


echo -n "Please now replace the SIM card and press any key to continue. "
read answer

Expand Down
6 changes: 6 additions & 0 deletions files/usr/bin/blue-merle-switch-stage1
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ while [[ "$answer" -eq 1 ]]; do
fi
done

## We generate a random IMEI to prevent a leak of the
## new SIM's IMSI under the old IMEI in case the modem
## still talks to the network
python3 /lib/blue-merle/imei_generate.py -r


mcu_send_message "Replace the SIM card. Then pull the switch."

echo done > /tmp/blue-merle-stage1
Expand Down

0 comments on commit 03c262a

Please sign in to comment.