Project

General

Profile

Tvheadend oscam ziggo » History » Version 26

William Peters, 2011-02-02 11:56
Remove comments about irdeto EMMs not being supported.

1 1 William Peters
This article describes how to build and configure oscam.
2 10 William Peters
3 9 William Peters
Note that this oscam configuration is configured to work with Ziggo as provider.
4
It might work with other providers, but that needs to be confirmed.
5 1 William Peters
6
Make sure you have cmake and subversion installed, these are required for checking out and building oscam.
7
8 19 William Peters
Create a user for oscam and add it to the uucp group
9
10 23 ruud -
<pre>
11 19 William Peters
useradd oscam -s /sbin/nologin -m -d /opt/oscam/
12
gpasswd -a oscam uucp
13 23 ruud -
</pre>
14 19 William Peters
15 1 William Peters
create the required directories
16
17 23 ruud -
<pre>
18 19 William Peters
mkdir /opt/oscam/src/
19 23 ruud -
</pre>
20 1 William Peters
21
Now we need to checkout the oscam source code using SVN
22
23 23 ruud -
<pre>
24 17 William Peters
svn co http://streamboard.gmc.to/svn/oscam /opt/oscam/src/
25 23 ruud -
</pre>
26 1 William Peters
27 17 William Peters
Now we need to configure oscam
28 23 ruud -
<pre>
29 20 ruud -
cd /opt/oscam/src/trunk
30 17 William Peters
./config.sh
31 23 ruud -
</pre>
32 17 William Peters
33
This is my configuration
34 23 ruud -
<pre>
35 17 William Peters
Addons:
36
  [*] WEBIF
37
  [*] HAVE_DVBAPI
38
  [*] IRDETO_GUESSING
39
  [*] CS_ANTICASC
40
  [*] WITH_DEBUG
41
  [ ] CS_WITH_DOUBLECHECK
42
  [*] CS_LED
43
  [*] CS_LOGHISTORY
44
45
Protocols:
46
  [*] MODULE_CAMD33
47
  [*] MODULE_CAMD35
48
  [*] MODULE_CAMD35_TCP
49
  [*] MODULE_NEWCAMD
50
  [*] MODULE_CCCAM
51
  [*] MODULE_RADEGAST
52
  [*] MODULE_SERIAL
53
  [*] MODULE_MONITOR
54
  [*] MODULE_CONSTCW
55
56
Reader:
57
  [*] READER_NAGRA
58
  [*] READER_IRDETO
59
  [*] READER_CONAX
60
  [*] READER_CRYPTWORKS
61
  [*] READER_SECA
62
  [*] READER_VIACCESS
63
  [*] READER_VIDEOGARD
64
  [*] READER_DRE
65
  [*] READER_TONGFANG
66 23 ruud -
</pre>
67 17 William Peters
68
Now compile oscam
69 23 ruud -
<pre>
70 1 William Peters
make
71 23 ruud -
</pre>
72 2 William Peters
73 18 William Peters
After oscam is built you should have a file like 'oscam-1.00-unstable_svnxxxx-i686-pc-linux' in /opt/oscam/src/Distribution/.
74 2 William Peters
We need to copy this file to an alternate location
75
76 23 ruud -
<pre>
77 2 William Peters
cd /opt/oscam/src/Distribution/
78 21 ruud -
cp ./oscam-* /opt/oscam/oscam.bin
79 23 ruud -
</pre>
80 2 William Peters
81
Ok, the binaries are installed :)
82
Now we need to configure oscam first create the configuration directories
83
84 23 ruud -
<pre>
85 2 William Peters
mkdir -p /opt/oscam/etc/
86
mkdir -p /opt/oscam/etc/cw/
87 23 ruud -
</pre>
88 2 William Peters
89
Note: /opt/oscam/etc/cw/ is used for caching keys. 
90
91 1 William Peters
Now, create oscam.conf in /opt/oscam/etc/oscam.conf
92 22 ruud -
93 21 ruud -
Note: replace example CAID with your own CAID (e.g. 0602)
94 2 William Peters
95 23 ruud -
<pre>
96 1 William Peters
[global]
97 14 William Peters
usrfile                       = /opt/oscam/oscamuser.log
98
logfile                       = /opt/oscam/oscam.log
99
cwlogdir                      = /opt/oscam/etc/cw
100
disablelog                    = 0
101
disableuserfile               = 0
102
usrfileflag                   = 0
103
clienttimeout                 = 2000
104
fallbacktimeout               = 1500
105
clientmaxidle                 = 120
106
failbantime                   = 0
107
bindwait                      = 120
108
netprio                       = 0
109
clientdyndns                  = 0
110
resolvedelay                  = 2
111
unlockparental                = 0
112
nice                          = -1
113
serialreadertimeout           = 1000
114
maxlogsize                    = 10
115
waitforcards                  = 1
116
preferlocalcards              = 1
117
saveinithistory               = 0
118
readerrestartseconds          = 5
119
lb_mode                       = 0
120 1 William Peters
lb_save                       = 0
121 14 William Peters
lb_nbest_readers              = 1
122
lb_nfb_readers                = 1
123
lb_min_ecmcount               = 5
124
lb_max_ecmcount               = 500
125
lb_reopen_seconds             = 900
126
resolvegethostbyname          = 0
127 1 William Peters
128
[newcamd]
129 14 William Peters
port                          = 15050@0604:000000
130
key                           = 0102030405060708091011121314
131
allowed                       =
132
keepalive                     = 1
133
mgclient                      = 0
134
135
[webif]
136
httpport                      = 15080
137
httpuser                      = username
138
httppwd                       = password
139
httprefresh                   = 0
140
httpallowed                   = 127.0.0.1,YourIpRange
141
httphideidleclients           = 0
142
httpreadonly                  = 0
143 23 ruud -
</pre>
144 1 William Peters
145
Now create oscam.server in /opt/oscam/etc/oscam.server
146
147 23 ruud -
<pre>
148 1 William Peters
[reader]
149
Label = Ziggo
150
Device = /dev/ttyUSB0
151
mhz = 600
152
cardmhz = 600
153
Protocol = mouse
154
EMMCache = 1,3,2
155
Group = 1
156
caid = 0604:0000
157
rsakey = 3C8633AAC0D367533DEC7BB2EEEDEB8CA3ADA52E58B99BB34672783277A1DAAC3B6106AD0909774E031B2A6E30195B437683AD0FC599B87D08CEA47BE1B6C76A
158
boxkey = 1122334455667788
159
fallback = 0
160 23 ruud -
</pre>
161 1 William Peters
162
Now create oscam.user in /opt/oscam/etc/oscam.user
163
164 23 ruud -
<pre>
165 1 William Peters
[account]
166
user = tvheadend
167
pwd = tvheadend
168
uniq = 0
169
group = 1
170
ident = 0604:000000
171
caid = 0604
172
au = Ziggo
173 23 ruud -
</pre>
174 1 William Peters
175
Ok, if everything is configured correctly we can test the oscam installation
176
177 23 ruud -
<pre>
178 1 William Peters
/opt/oscam/oscam.bin -c /opt/oscam/etc/& touch /opt/oscam/oscam.log ; tail -f /opt/oscam/oscam.log ; killall oscam.bin
179 23 ruud -
</pre>
180 2 William Peters
181
this should create some output like this
182
183 23 ruud -
<pre>
184 2 William Peters
-------------------------------------------------------------------------------
185 14 William Peters
>> OSCam <<  cardserver started at Thu Oct 28 11:06:01 2010
186 2 William Peters
-------------------------------------------------------------------------------
187 14 William Peters
2010/10/28 11:06:01 B73DF6C0 s version=1.00-unstable_svn, build #, system=i686-pc-linux, nice=-1
188
2010/10/28 11:06:01 B73DF6C0 s client max. idle=120 sec, debug level=0
189
2010/10/28 11:06:01 B73DF6C0 s max. logsize=10 Kb
190
2010/10/28 11:06:01 B73DF6C0 s client timeout=2000 ms, fallback timeout=1500 ms, cache delay=0 ms
191
2010/10/28 11:06:01 B73DF6C0 s auth size=4788
192
2010/10/28 11:06:01 B73DF6C0 s Cannot open file "/opt/oscam/etc//oscam.services" (errno=2)
193
2010/10/28 11:06:01 B73DF6C0 s userdb reloaded: 0 accounts freed, 2 accounts loaded, 0 expired, 0 disabled
194
2010/10/28 11:06:01 B73DF6C0 s signal handling initialized (type=sysv)
195
2010/10/28 11:06:01 B73DF6C0 s can't open file "/opt/oscam/etc//oscam.srvid" (err=2), no service-id's loaded
196
2010/10/28 11:06:01 B73DF6C0 s can't open file "/opt/oscam/etc//oscam.tiers" (err=2), no tier-id's loaded
197
2010/10/28 11:06:01 B73DF6C0 s can't open file "/opt/oscam/etc//oscam.provid" (err=2), no provids's loaded
198
2010/10/28 11:06:01 B73DF6C0 s can't open file "/opt/oscam/etc//oscam.ird" (errno=2) irdeto guessing not loaded
199
2010/10/28 11:06:01 B73DF6C0 s monitor: initialized (fd=7, port=988)
200
2010/10/28 11:06:01 B73DF6C0 s camd33: disabled
201
2010/10/28 11:06:01 B73DF6C0 s camd35: disabled
202
2010/10/28 11:06:01 B73DF6C0 s cs378x: disabled
203
2010/10/28 11:06:01 B73DF6C0 s newcamd: initialized (fd=8, port=15050, crypted)
204
2010/10/28 11:06:01 B73DF6C0 s CAID: 0604
205
2010/10/28 11:06:01 B73DF6C0 s provid #0: 000000
206
2010/10/28 11:06:01 B73DF6C0 s cccam: disabled
207
2010/10/28 11:06:01 B73DF6C0 s radegast: disabled
208
2010/10/28 11:06:01 B73DF6C0 s http thread started
209
2010/10/28 11:06:01 B73DF6C0 s creating thread for device /dev/ttyUSB0 slot 0
210
2010/10/28 11:06:01 B73DF6C0 s waiting for local card init
211
2010/10/28 11:06:01 B7375280 r reader thread started (thread=B7375280, device=/dev/ttyUSB0, detect=cd, mhz=600, cardmhz=600)
212
2010/10/28 11:06:01 B76EA280 h HTTP Server listening on port 15080
213
2010/10/28 11:06:04 B7375280 r card detected
214
2010/10/28 11:06:08 B7375280 r ATR: 3B 9F 21 0E 49 52 44 45 54 4F 20 41 43 53 20 56 35 2E 37 9A
215
2010/10/28 11:06:09 B7375280 r Maximum frequency for this card is formally 6 Mhz, clocking it to 6.00 Mhz
216
2010/10/28 11:06:10 B7375280 r detect irdeto card
217
2010/10/28 11:06:10 B7375280 r caid: 0604, acs: 6.08, country code: NLD
218
2010/10/28 11:06:10 B7375280 r providers: 4, ascii serial: xxxxxxxxxxx, hex serial: XXXXXX, hex base: XX
219
2010/10/28 11:06:13 B7375280 r active providers: 4 (xxxxxx,xxxxxx,xxxxxx,xxxxxx)
220
2010/10/28 11:06:13 B7375280 r found cardsystem
221
2010/10/28 11:06:14 B7375280 r entitlements for provider: 1, id: XXXXXX
222
2010/10/28 11:06:14 B7375280 r chid: 0001, date: 2004/08/16 - 2004/09/15
223
2010/10/28 11:06:14 B7375280 r chid: 000B, date: 2004/08/16 - 2004/09/15
224
2010/10/28 11:06:14 B7375280 r chid: FFE0, date: 2004/08/16 - 2004/08/20
225
2010/10/28 11:06:14 B7375280 r chid: 0384, date: 2004/08/16 - 2004/09/15
226
2010/10/28 11:06:14 B7375280 r chid: 000D, date: 2004/08/16 - 2004/09/15
227
2010/10/28 11:06:19 B7375280 r [irdeto-reader] ready for requests
228
2010/10/28 11:06:19 B73DF6C0 s init for all local cards done
229
2010/10/28 11:06:19 B73DF6C0 s anti cascading disabled
230
2010/10/28 11:06:19 B736E280 c client connected to 15050 port
231
2010/10/28 11:06:19 B7367280 c client connected to 15050 port
232
2010/10/28 11:06:19 B7367280 c Connection closed to client
233
2010/10/28 11:06:19 B736E280 c Connection closed to client
234
2010/10/28 11:06:19 B7367280 c thread B7367280 ended!
235
2010/10/28 11:06:19 B736E280 c thread B736E280 ended!
236 23 ruud -
</pre>
237 2 William Peters
238 1 William Peters
Oscam is now running on serverip:15050.
239
Open your tvheadend web interface.
240 24 William Peters
Go to Configuration and click Code Word Client
241 1 William Peters
Click Add Entry
242
Doubleclick 'hostname' type your server ip or hostname that is runnin oscam. 
243
Doubleclick 'port' type the port number (if you made no changes to config files it should be 15050).
244
Doubleclick 'username' type the username as configured in oscam.user.
245 2 William Peters
Doubleclick 'password' type the password as configured in oscam.user.
246 11 William Peters
Doubleclick 'DES key' here you can insert your DES key. If you haven't changed it in oscam.conf (you should!) then this should be: 01:02:03:04:05:06:07:08:09:10:11:12:13:14
247 26 William Peters
Check 'Update Card'
248 2 William Peters
Now check Enabled and click 'Save Changes'
249 16 William Peters
250 5 William Peters
When you click Save Changes you will see something like this in the system logs
251
252 23 ruud -
<pre>
253 5 William Peters
Mar 24 20:55:38 cwc: 10.2.0.2: Connected as user 0x0x to a Irdeto-card [0x0604 : xx.xx.xx.xx.xx.xx.xx.xx] with 5 providers
254
Mar 24 20:55:38 cwc: 10.2.0.2: irdeto card
255
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #1: 0x000000 xx.xx.xx.xx.xx.xx.xx.xx
256
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #2: 0x000001 xx.xx.xx.xx.xx.xx.xx.xx
257 2 William Peters
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #3: 0x000002 xx.xx.xx.xx.xx.xx.xx.xx
258
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #4: 0x000003 xx.xx.xx.xx.xx.xx.xx.xx
259
Mar 24 20:55:38 cwc: 10.2.0.2: Provider ID #5: 0x000004 xx.xx.xx.xx.xx.xx.xx.xx
260
Mar 24 20:55:38 cwc: 10.2.0.2: Will forward EMMs
261 23 ruud -
</pre>
262 7 Lars Op den Kamp -
263 1 William Peters
Ok tvheadend is now connected to oscam and is able to descramble channels that your card gives you access to.
264 26 William Peters
Now to kill oscam press ctrl+c in the console.
265 1 William Peters
266 25 William Peters
Now you need to change the owner and group of /opt/oscam to oscam (because you should run oscam as a unprivileged user)
267 1 William Peters
268 25 William Peters
<pre>
269
chown -R oscam:oscam /opt/oscam
270
</pre>
271 2 William Peters
272 23 ruud -
h2. For Gentoo users i have an init script
273
274
275 2 William Peters
nano -w /etc/init.d/oscam
276 23 ruud -
<pre>
277 15 William Peters
#!/sbin/runscript
278 2 William Peters
# Copyright 1999-2010 Gentoo Foundation
279
# Distributed under the terms of the GNU General Public License v2
280
# $Header:
281
282 14 William Peters
depend() {
283 2 William Peters
        use net
284
}
285
286
start() {
287 14 William Peters
        ebegin "Starting oscam"
288
        start-stop-daemon \
289
                --start \
290
                --user $OSCAMUSER \
291
                --name $OSCAMNAME \
292 2 William Peters
                --exec $OSCAMBIN -- $OSCAMOPTS
293
        eend $?
294
}
295
296
stop() {
297 1 William Peters
        ebegin "Stopping oscam"
298 2 William Peters
        start-stop-daemon --stop --signal 2 --name $OSCAMNAME
299
        eend $?
300
}
301 23 ruud -
</pre>
302 2 William Peters
303
nano -w /etc/conf.d/oscam
304 23 ruud -
<pre>
305 1 William Peters
# /etc/conf.d/oscam: config file for /etc/init.d/oscam
306 14 William Peters
307
OSCAMOPTS="-b -c /opt/oscam/etc/"
308 19 William Peters
OSCAMUSER="oscam"
309 14 William Peters
OSCAMNAME="oscam.bin"
310
OSCAMBIN="/opt/oscam/${OSCAMNAME}"
311 23 ruud -
</pre>