Project

General

Profile

OsmoNITB Crypto » History » Version 5

dexter, 02/19/2016 10:48 PM

1 1 dexter
2 5 dexter
h1. A5/x Crypto support
3 1 dexter
4
5 5 dexter
6
7
h2. Prepare Simcard
8
9
10
The first thing we do is to prepare a [[MagicSim]]-Simcard with our own provider data. We use the utitity pysim to write the provider data to the card. Enter ./pySim.py --help to get an overview about the parameters. For now it is only importand that you keep in mind that the imsi must begin with the MCC, followed by the MNC and that the pattern in the imsi must match the parameter -x (which is the MCC) and the parameter -y (which is the MNC). You also should note the KI (opetion -k) somewhere. We need it later.
11
<pre>
12 1 dexter
dexter@da-laptop-w3:~/pysim$ ./pySim.py -d /dev/ttyUSB2 -n openBSC -c 49 -x 001 -y 01 -i 001010000000000 -s 12345678901234567890 -k DEADBEEF0C0FFEE0F00D013370D00F23
13
Generated card parameters :
14
 > Name    : openBSC
15
 > SMSP    : 00495555
16
 > ICCID   : 12345678901234567890
17
 > MCC/MNC : 1/1
18
 > IMSI    : 010010000000000
19
 > Ki      : DEADBEEF0C0FFEE0F00D013370D00F23
20
21
Autodetected card type magicsim
22
Programming ...
23
Done !
24
dexter@da-laptop-w3:~/pysim$ 
25 5 dexter
</pre>
26 1 dexter
27
Pysim can be downloaded at: git clone git://git.osmocom.org/pysim.git
28
29
Now it is time to test if the card basicly work. Just grap a mobile phone, insert the card. Switch the pone on the mobile pone. Than you start your network with the option -e 1 to see whats going on. Without further intervention the moile phone should login to your network. That is a sign that the simcard works and makes the pone successfully think that your testnetwork is its home network.
30
31
Note: The network was configured to accept any pone. (accept-all) We can do this safely because we operate the natwork with a dummload under controlled conditions.
32
33
The output should contain some lines like that:
34
35 5 dexter
<pre>
36 1 dexter
<0012> db.c:613 Failed to find the Subscriber. '0' '001010000000000'
37
<0012> db.c:294 New Subscriber: ID 1, IMSI 001010000000000
38
<0012> db.c:802 Allocated extension 26056 for IMSI 001010000000000.
39
<0000> abis_rsl.c:1348 (bts=0,trx=0,ts=0,ss=0) SAPI=0 DATA INDICATION
40
<0003> gsm_04_08.c:1025 CLASSMARK CHANGE CM2(len=3) CM3(len=2)
41
<0012> db.c:699 Sync Equipment IMEI=, classmark1=33, classmark2=33 59 80 , classmark3=60 14 
42
<0000> abis_rsl.c:1348 (bts=0,trx=0,ts=0,ss=0) SAPI=0 DATA INDICATION
43
<0002> gsm_04_08.c:387 IDENTITY RESPONSE: mi_type=0x02 MI(357140011801950)
44
<0012> db.c:883 New Equipment: ID 1, IMEI 357140011801950
45 5 dexter
<0012> db.c:921 New [[EquipmentWatch]]: ID 1, IMSI 001010000000000, IMEI 357140011801950
46 1 dexter
<0012> db.c:699 Sync Equipment IMEI=357140011801950, classmark1=33, classmark2=33 59 80 , classmark3=60 14 
47
<0012> db.c:766 Allocated TMSI 1473277565 for IMSI 001010000000000.
48 5 dexter
</pre>
49 1 dexter
50 2 dexter
We see that our pone was accepted by our network. We can see our custom imsi 001010000000000. That means that the simcard parameters are correct so far.
51 1 dexter
52
53 5 dexter
h2. Configure the network
54
55
56 1 dexter
Now we take a closer look to the configuration:
57
58 5 dexter
<pre>
59 1 dexter
!
60
network
61
 network country code 1
62
 mobile network code 1
63
 short name openBSC
64
 long name openBSC
65
 timer t3101 10
66
 timer t3113 60
67
 auth policy accept-all
68
69
! Encryption settings
70
 encryption a5 1
71 5 dexter
</pre>
72 1 dexter
73 3 dexter
In the network section we activate the encryption by adding a line "encryption a5 1" at network level. Tha 'a' of a5 must be written in lowercase. Otherwise you will get an error message.
74 1 dexter
75
Note: In this example "auth policy accept-all" is enabled here for debug. You should disable this when all tests are finished. Do not forget to set the authorisation flag for the subscriber.
76
77
So we try again to make sure that our changes are accepted:
78
79 5 dexter
<pre>
80 1 dexter
<0002> gsm_04_08.c:937 LOCATION UPDATING REQUEST: mi_type=0x04 MI(1473277565) type=IMSI ATTACH 
81 5 dexter
<0012> db.c:641 Found Subscriber: ID 1, IMSI 1010000000000, NAME _, TMSI 1473277565, EXTEN '26056', LAC 1, AUTH 0
82 1 dexter
<0001> gsm_04_08.c:99 (bts 0 trx 0 ts 0 pd 05) Sending 0x18 to MS.
83
<0000> abis_rsl.c:1348 (bts=0,trx=0,ts=0,ss=0) SAPI=0 DATA INDICATION
84
<0003> gsm_04_08.c:1025 CLASSMARK CHANGE CM2(len=3) CM3(len=2)
85
<0012> db.c:699 Sync Equipment IMEI=357140011801950, classmark1=33, classmark2=33 59 80 , classmark3=60 14 
86
<0000> abis_rsl.c:1348 (bts=0,trx=0,ts=0,ss=0) SAPI=0 DATA INDICATION
87
<0002> gsm_04_08.c:387 IDENTITY RESPONSE: mi_type=0x02 MI(357140011801950)
88 5 dexter
<0012> db.c:934 Updated [[EquipmentWatch]]: ID 1, IMSI 1010000000000, IMEI 357140011801950
89 1 dexter
<0012> db.c:699 Sync Equipment IMEI=357140011801950, classmark1=33, classmark2=33 59 80 , classmark3=60 14 
90
<0002> auth.c:83 No retrievable Ki for subscriber, skipping auth<0012> db.c:766 Allocated TMSI 1347086625 for IMSI 1010000000000.
91
<0002> gsm_04_08.c:351 -> LOCATION UPDATE ACCEPT
92 5 dexter
</pre>
93 1 dexter
94
We see that authentication was activated successfully. But we gen an error: No retrievable Ki for subscriber, skipping auth. That is normal and the reason is that we did not configure the auth-keys so far. But it shows us that the encryption is ready to go. We also can see that phones for which is no key configured are accepted anyway. This means that having encryption activated does not lock yout your phones that run with old reused simcards.
95
96
97 5 dexter
h2. Setup the keys
98
99
100
The final step is to configure the keys. You have to do this for every user seperately because every user has its individual key. The keys will be stored in the table [[AuthKeys]] of the hlr databse. All you need to do is to enter the key manually through the vty:
101 1 dexter
102
subscriber imsi 001010000000000 a3a8 comp128v1 DEADBEEF0C0FFEE0F00D013370D00F23
Add picture from clipboard (Maximum size: 48.8 MB)