Project

General

Profile

OsmoNITB Crypto » History » Version 2

dexter, 02/19/2016 10:47 PM

1 1 dexter
= A5/x Crypto support ==
2
3
4
== Prepare Simcard ==
5
6
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.
7
{{{
8
dexter@da-laptop-w3:~/pysim$ ./pySim.py -d /dev/ttyUSB2 -n openBSC -c 49 -x 001 -y 01 -i 001010000000000 -s 12345678901234567890 -k DEADBEEF0C0FFEE0F00D013370D00F23
9
Generated card parameters :
10
 > Name    : openBSC
11
 > SMSP    : 00495555
12
 > ICCID   : 12345678901234567890
13
 > MCC/MNC : 1/1
14
 > IMSI    : 010010000000000
15
 > Ki      : DEADBEEF0C0FFEE0F00D013370D00F23
16
17
Autodetected card type magicsim
18
Programming ...
19
Done !
20
dexter@da-laptop-w3:~/pysim$ 
21
}}}
22
23
Pysim can be downloaded at: git clone git://git.osmocom.org/pysim.git
24
25
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.
26
27
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.
28
29
The output should contain some lines like that:
30
31 2 dexter
{{{
32 1 dexter
<0012> db.c:613 Failed to find the Subscriber. '0' '001010000000000'
33
<0012> db.c:294 New Subscriber: ID 1, IMSI 001010000000000
34
<0012> db.c:802 Allocated extension 26056 for IMSI 001010000000000.
35
<0000> abis_rsl.c:1348 (bts=0,trx=0,ts=0,ss=0) SAPI=0 DATA INDICATION
36
<0003> gsm_04_08.c:1025 CLASSMARK CHANGE CM2(len=3) CM3(len=2)
37
<0012> db.c:699 Sync Equipment IMEI=, classmark1=33, classmark2=33 59 80 , classmark3=60 14 
38
<0000> abis_rsl.c:1348 (bts=0,trx=0,ts=0,ss=0) SAPI=0 DATA INDICATION
39
<0002> gsm_04_08.c:387 IDENTITY RESPONSE: mi_type=0x02 MI(357140011801950)
40
<0012> db.c:883 New Equipment: ID 1, IMEI 357140011801950
41
<0012> db.c:921 New EquipmentWatch: ID 1, IMSI 001010000000000, IMEI 357140011801950
42
<0012> db.c:699 Sync Equipment IMEI=357140011801950, classmark1=33, classmark2=33 59 80 , classmark3=60 14 
43
<0012> db.c:766 Allocated TMSI 1473277565 for IMSI 001010000000000.
44 2 dexter
}}}
45 1 dexter
46
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.
47
48
== Configure the network ==
49
50
Now we take a closer look to the configuration:
51
52
{{{
53
!
54
network
55
 network country code 1
56
 mobile network code 1
57
 short name openBSC
58
 long name openBSC
59
 timer t3101 10
60
 timer t3113 60
61
 auth policy accept-all
62
63
! Encryption settings
64
 encryption a5 1
65
}}}
66
67
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.
68
69
So we try again to make sure that our changes are accepted:
70
71
{{{
72
<0002> gsm_04_08.c:937 LOCATION UPDATING REQUEST: mi_type=0x04 MI(1473277565) type=IMSI ATTACH 
73
<0012> db.c:641 Found Subscriber: ID 1, IMSI 1010000000000, NAME '', TMSI 1473277565, EXTEN '26056', LAC 1, AUTH 0
74
<0001> gsm_04_08.c:99 (bts 0 trx 0 ts 0 pd 05) Sending 0x18 to MS.
75
<0000> abis_rsl.c:1348 (bts=0,trx=0,ts=0,ss=0) SAPI=0 DATA INDICATION
76
<0003> gsm_04_08.c:1025 CLASSMARK CHANGE CM2(len=3) CM3(len=2)
77
<0012> db.c:699 Sync Equipment IMEI=357140011801950, classmark1=33, classmark2=33 59 80 , classmark3=60 14 
78
<0000> abis_rsl.c:1348 (bts=0,trx=0,ts=0,ss=0) SAPI=0 DATA INDICATION
79
<0002> gsm_04_08.c:387 IDENTITY RESPONSE: mi_type=0x02 MI(357140011801950)
80
<0012> db.c:934 Updated EquipmentWatch: ID 1, IMSI 1010000000000, IMEI 357140011801950
81
<0012> db.c:699 Sync Equipment IMEI=357140011801950, classmark1=33, classmark2=33 59 80 , classmark3=60 14 
82
<0002> auth.c:83 No retrievable Ki for subscriber, skipping auth<0012> db.c:766 Allocated TMSI 1347086625 for IMSI 1010000000000.
83
<0002> gsm_04_08.c:351 -> LOCATION UPDATE ACCEPT
84
}}}
85
86
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.
87
88
== Setup the keys ==
89
90
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:
91
92
subscriber imsi 001010000000000 a3a8 comp128v1 DEADBEEF0C0FFEE0F00D013370D00F23
Add picture from clipboard (Maximum size: 48.8 MB)