Browse code

Adding RADIUS

Veselin Kolev authored on 16/12/2019 07:33:16
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,663 @@
1
+######################################################################
2
+#
3
+#	As of 2.0.0, FreeRADIUS supports virtual hosts using the
4
+#	"server" section, and configuration directives.
5
+#
6
+#	Virtual hosts should be put into the "sites-available"
7
+#	directory.  Soft links should be created in the "sites-enabled"
8
+#	directory to these files.  This is done in a normal installation.
9
+#
10
+#	If you are using 802.1X (EAP) authentication, please see also
11
+#	the "inner-tunnel" virtual server.  You wll likely have to edit
12
+#	that, too, for authentication to work.
13
+#
14
+#	$Id: 520ccbc90f3a09cd6a80e1e3b16000b7ba94d884 $
15
+#
16
+######################################################################
17
+#
18
+#	Read "man radiusd" before editing this file.  See the section
19
+#	titled DEBUGGING.  It outlines a method where you can quickly
20
+#	obtain the configuration you want, without running into
21
+#	trouble.  See also "man unlang", which documents the format
22
+#	of this file.
23
+#
24
+#	This configuration is designed to work in the widest possible
25
+#	set of circumstances, with the widest possible number of
26
+#	authentication methods.  This means that in general, you should
27
+#	need to make very few changes to this file.
28
+#
29
+#	The best way to configure the server for your local system
30
+#	is to CAREFULLY edit this file.  Most attempts to make large
31
+#	edits to this file will BREAK THE SERVER.  Any edits should
32
+#	be small, and tested by running the server with "radiusd -X".
33
+#	Once the edits have been verified to work, save a copy of these
34
+#	configuration files somewhere.  (e.g. as a "tar" file).  Then,
35
+#	make more edits, and test, as above.
36
+#
37
+#	There are many "commented out" references to modules such
38
+#	as ldap, sql, etc.  These references serve as place-holders.
39
+#	If you need the functionality of that module, then configure
40
+#	it in radiusd.conf, and un-comment the references to it in
41
+#	this file.  In most cases, those small changes will result
42
+#	in the server being able to connect to the DB, and to
43
+#	authenticate users.
44
+#
45
+######################################################################
46
+
47
+#
48
+#	In 1.x, the "authorize", etc. sections were global in
49
+#	radiusd.conf.  As of 2.0, they SHOULD be in a server section.
50
+#
51
+#	The server section with no virtual server name is the "default"
52
+#	section.  It is used when no server name is specified.
53
+#
54
+#	We don't indent the rest of this file, because doing so
55
+#	would make it harder to read.
56
+#
57
+
58
+#  Authorization. First preprocess (hints and huntgroups files),
59
+#  then realms, and finally look in the "users" file.
60
+#
61
+#  Any changes made here should also be made to the "inner-tunnel"
62
+#  virtual server.
63
+#
64
+#  The order of the realm modules will determine the order that
65
+#  we try to find a matching realm.
66
+#
67
+#  Make *sure* that 'preprocess' comes before any realm if you 
68
+#  need to setup hints for the remote radius server
69
+authorize {
70
+	#
71
+	#  Security settings.  Take a User-Name, and do some simple
72
+	#  checks on it, for spaces and other invalid characters.  If
73
+	#  it looks like the user is trying to play games, reject it.
74
+	#
75
+	#  This should probably be enabled by default.
76
+	#
77
+	#  See policy.conf for the definition of the filter_username policy.
78
+	#
79
+#	filter_username
80
+
81
+	#
82
+	#  The preprocess module takes care of sanitizing some bizarre
83
+	#  attributes in the request, and turning them into attributes
84
+	#  which are more standard.
85
+	#
86
+	#  It takes care of processing the 'raddb/hints' and the
87
+	#  'raddb/huntgroups' files.
88
+	preprocess
89
+
90
+	#
91
+	#  If you want to have a log of authentication requests,
92
+	#  un-comment the following line, and the 'detail auth_log'
93
+	#  section, above.
94
+#	auth_log
95
+
96
+	#
97
+	#  The chap module will set 'Auth-Type := CHAP' if we are
98
+	#  handling a CHAP request and Auth-Type has not already been set
99
+	chap
100
+
101
+	#
102
+	#  If the users are logging in with an MS-CHAP-Challenge
103
+	#  attribute for authentication, the mschap module will find
104
+	#  the MS-CHAP-Challenge attribute, and add 'Auth-Type := MS-CHAP'
105
+	#  to the request, which will cause the server to then use
106
+	#  the mschap module for authentication.
107
+	mschap
108
+
109
+	#
110
+	#  If you have a Cisco SIP server authenticating against
111
+	#  FreeRADIUS, uncomment the following line, and the 'digest'
112
+	#  line in the 'authenticate' section.
113
+	digest
114
+
115
+	#
116
+	#  The WiMAX specification says that the Calling-Station-Id
117
+	#  is 6 octets of the MAC.  This definition conflicts with
118
+	#  RFC 3580, and all common RADIUS practices.  Un-commenting
119
+	#  the "wimax" module here means that it will fix the
120
+	#  Calling-Station-Id attribute to the normal format as
121
+	#  specified in RFC 3580 Section 3.21
122
+#	wimax
123
+
124
+	#
125
+	#  Look for IPASS style 'realm/', and if not found, look for
126
+	#  '@realm', and decide whether or not to proxy, based on
127
+	#  that.
128
+#	IPASS
129
+
130
+	#
131
+	#  If you are using multiple kinds of realms, you probably
132
+	#  want to set "ignore_null = yes" for all of them.
133
+	#  Otherwise, when the first style of realm doesn't match,
134
+	#  the other styles won't be checked.
135
+	#
136
+	suffix
137
+#	ntdomain
138
+
139
+	#
140
+	#  This module takes care of EAP-MD5, EAP-TLS, and EAP-LEAP
141
+	#  authentication.
142
+	#
143
+	#  It also sets the EAP-Type attribute in the request
144
+	#  attribute list to the EAP type from the packet.
145
+	#
146
+	#  As of 2.0, the EAP module returns "ok" in the authorize stage
147
+	#  for TTLS and PEAP.  In 1.x, it never returned "ok" here, so
148
+	#  this change is compatible with older configurations.
149
+	#
150
+	#  The example below uses module failover to avoid querying all
151
+	#  of the following modules if the EAP module returns "ok".
152
+	#  Therefore, your LDAP and/or SQL servers will not be queried
153
+	#  for the many packets that go back and forth to set up TTLS
154
+	#  or PEAP.  The load on those servers will therefore be reduced.
155
+	#
156
+	eap {
157
+		ok = return
158
+	}
159
+
160
+	#
161
+	#  Pull crypt'd passwords from /etc/passwd or /etc/shadow,
162
+	#  using the system API's to get the password.  If you want
163
+	#  to read /etc/passwd or /etc/shadow directly, see the
164
+	#  passwd module in radiusd.conf.
165
+	#
166
+#	unix
167
+
168
+	#
169
+	#  Read the 'users' file
170
+	files
171
+
172
+	#
173
+	#  Look in an SQL database.  The schema of the database
174
+	#  is meant to mirror the "users" file.
175
+	#
176
+	#  See "Authorization Queries" in sql.conf
177
+#	sql
178
+
179
+	#
180
+	#  If you are using /etc/smbpasswd, and are also doing
181
+	#  mschap authentication, the un-comment this line, and
182
+	#  configure the 'smbpasswd' module.
183
+#	smbpasswd
184
+
185
+	#
186
+	#  The ldap module will set Auth-Type to LDAP if it has not
187
+	#  already been set
188
+	ldap
189
+
190
+	#
191
+	#  Enforce daily limits on time spent logged in.
192
+#	daily
193
+
194
+	#
195
+	# Use the checkval module
196
+#	checkval
197
+
198
+	expiration
199
+	logintime
200
+
201
+	#
202
+	#  If no other module has claimed responsibility for
203
+	#  authentication, then try to use PAP.  This allows the
204
+	#  other modules listed above to add a "known good" password
205
+	#  to the request, and to do nothing else.  The PAP module
206
+	#  will then see that password, and use it to do PAP
207
+	#  authentication.
208
+	#
209
+	#  This module should be listed last, so that the other modules
210
+	#  get a chance to set Auth-Type for themselves.
211
+	#
212
+	pap
213
+
214
+	#
215
+	#  If "status_server = yes", then Status-Server messages are passed
216
+	#  through the following section, and ONLY the following section.
217
+	#  This permits you to do DB queries, for example.  If the modules
218
+	#  listed here return "fail", then NO response is sent.
219
+	#
220
+        update control {
221
+                Tmp-String-0 = "%{debug:3}"
222
+        }
223
+#	Autz-Type Status-Server {
224
+#
225
+#	}
226
+}
227
+
228
+
229
+#  Authentication.
230
+#
231
+#
232
+#  This section lists which modules are available for authentication.
233
+#  Note that it does NOT mean 'try each module in order'.  It means
234
+#  that a module from the 'authorize' section adds a configuration
235
+#  attribute 'Auth-Type := FOO'.  That authentication type is then
236
+#  used to pick the apropriate module from the list below.
237
+#
238
+
239
+#  In general, you SHOULD NOT set the Auth-Type attribute.  The server
240
+#  will figure it out on its own, and will do the right thing.  The
241
+#  most common side effect of erroneously setting the Auth-Type
242
+#  attribute is that one authentication method will work, but the
243
+#  others will not.
244
+#
245
+#  The common reasons to set the Auth-Type attribute by hand
246
+#  is to either forcibly reject the user (Auth-Type := Reject),
247
+#  or to or forcibly accept the user (Auth-Type := Accept).
248
+#
249
+#  Note that Auth-Type := Accept will NOT work with EAP.
250
+#
251
+#  Please do not put "unlang" configurations into the "authenticate"
252
+#  section.  Put them in the "post-auth" section instead.  That's what
253
+#  the post-auth section is for.
254
+#
255
+authenticate {
256
+	#
257
+	#  PAP authentication, when a back-end database listed
258
+	#  in the 'authorize' section supplies a password.  The
259
+	#  password can be clear-text, or encrypted.
260
+	Auth-Type PAP {
261
+		pap
262
+	}
263
+
264
+	#
265
+	#  Most people want CHAP authentication
266
+	#  A back-end database listed in the 'authorize' section
267
+	#  MUST supply a CLEAR TEXT password.  Encrypted passwords
268
+	#  won't work.
269
+	#Auth-Type CHAP {
270
+	#	chap
271
+	#}
272
+
273
+	#
274
+	#  MSCHAP authentication.
275
+	#Auth-Type MS-CHAP {
276
+	#	mschap
277
+	#}
278
+
279
+	#
280
+	#  If you have a Cisco SIP server authenticating against
281
+	#  FreeRADIUS, uncomment the following line, and the 'digest'
282
+	#  line in the 'authorize' section.
283
+	#digest
284
+
285
+	#
286
+	#  Pluggable Authentication Modules.
287
+	pam
288
+
289
+	#
290
+	#  See 'man getpwent' for information on how the 'unix'
291
+	#  module checks the users password.  Note that packets
292
+	#  containing CHAP-Password attributes CANNOT be authenticated
293
+	#  against /etc/passwd!  See the FAQ for details.
294
+	#
295
+	#  For normal "crypt" authentication, the "pap" module should
296
+	#  be used instead of the "unix" module.  The "unix" module should
297
+	#  be used for authentication ONLY for compatibility with legacy
298
+	#  FreeRADIUS configurations.
299
+	#
300
+	#unix
301
+
302
+	# Uncomment it if you want to use ldap for authentication
303
+	#
304
+	# Note that this means "check plain-text password against
305
+	# the ldap database", which means that EAP won't work,
306
+	# as it does not supply a plain-text password.
307
+	Auth-Type LDAP {
308
+		ldap
309
+	}
310
+
311
+	#
312
+	#  Allow EAP authentication.
313
+	eap
314
+
315
+	#
316
+	#  The older configurations sent a number of attributes in
317
+	#  Access-Challenge packets, which wasn't strictly correct.
318
+	#  If you want to filter out these attributes, uncomment
319
+	#  the following lines.
320
+	#
321
+#	Auth-Type eap {
322
+#		eap {
323
+#			handled = 1  
324
+#		}
325
+#		if (handled && (Response-Packet-Type == Access-Challenge)) {
326
+#			attr_filter.access_challenge.post-auth
327
+#			handled  # override the "updated" code from attr_filter
328
+#		}
329
+#	}
330
+}
331
+
332
+
333
+#
334
+#  Pre-accounting.  Decide which accounting type to use.
335
+#
336
+preacct {
337
+	preprocess
338
+
339
+	#
340
+	#  Session start times are *implied* in RADIUS.
341
+	#  The NAS never sends a "start time".  Instead, it sends
342
+	#  a start packet, *possibly* with an Acct-Delay-Time.
343
+	#  The server is supposed to conclude that the start time
344
+	#  was "Acct-Delay-Time" seconds in the past.
345
+	#
346
+	#  The code below creates an explicit start time, which can
347
+	#  then be used in other modules.
348
+	#
349
+	#  The start time is: NOW - delay - session_length
350
+	#
351
+
352
+#	  update request {
353
+#	  	FreeRADIUS-Acct-Session-Start-Time = "%{expr: %l - %{%{Acct-Session-Time}:-0} - %{%{Acct-Delay-Time}:-0}}"
354
+#	}
355
+
356
+
357
+	#
358
+	#  Ensure that we have a semi-unique identifier for every
359
+	#  request, and many NAS boxes are broken.
360
+	acct_unique
361
+
362
+	#
363
+	#  Look for IPASS-style 'realm/', and if not found, look for
364
+	#  '@realm', and decide whether or not to proxy, based on
365
+	#  that.
366
+	#
367
+	#  Accounting requests are generally proxied to the same
368
+	#  home server as authentication requests.
369
+#	IPASS
370
+	suffix
371
+#	ntdomain
372
+
373
+	#
374
+	#  Read the 'acct_users' file
375
+	files
376
+}
377
+
378
+#
379
+#  Accounting.  Log the accounting data.
380
+#
381
+accounting {
382
+	#
383
+	#  Create a 'detail'ed log of the packets.
384
+	#  Note that accounting requests which are proxied
385
+	#  are also logged in the detail file.
386
+	detail
387
+#	daily
388
+
389
+	#  Update the wtmp file
390
+	#
391
+	#  If you don't use "radlast", you can delete this line.
392
+#	unix
393
+
394
+	#
395
+	#  For Simultaneous-Use tracking.
396
+	#
397
+	#  Due to packet losses in the network, the data here
398
+	#  may be incorrect.  There is little we can do about it.
399
+#	radutmp
400
+#	sradutmp
401
+
402
+	#  Return an address to the IP Pool when we see a stop record.
403
+#	main_pool
404
+
405
+	#
406
+	#  Log traffic to an SQL database.
407
+	#
408
+	#  See "Accounting queries" in sql.conf
409
+#	sql
410
+
411
+	#
412
+	#  If you receive stop packets with zero session length,
413
+	#  they will NOT be logged in the database.  The SQL module
414
+	#  will print a message (only in debugging mode), and will
415
+	#  return "noop".
416
+	#
417
+	#  You can ignore these packets by uncommenting the following
418
+	#  three lines.  Otherwise, the server will not respond to the
419
+	#  accounting request, and the NAS will retransmit.
420
+	#
421
+#	if (noop) {
422
+#		ok
423
+#	}
424
+
425
+	#
426
+	#  Instead of sending the query to the SQL server,
427
+	#  write it into a log file.
428
+	#
429
+#	sql_log
430
+
431
+	#  Cisco VoIP specific bulk accounting
432
+#	pgsql-voip
433
+
434
+	# For Exec-Program and Exec-Program-Wait
435
+	exec
436
+
437
+	#  Filter attributes from the accounting response.
438
+	attr_filter.accounting_response
439
+
440
+	#
441
+	#  See "Autz-Type Status-Server" for how this works.
442
+	#
443
+#	Acct-Type Status-Server {
444
+#
445
+#	}
446
+}
447
+
448
+
449
+#  Session database, used for checking Simultaneous-Use. Either the radutmp 
450
+#  or rlm_sql module can handle this.
451
+#  The rlm_sql module is *much* faster
452
+session {
453
+	radutmp
454
+
455
+	#
456
+	#  See "Simultaneous Use Checking Queries" in sql.conf
457
+#	sql
458
+}
459
+
460
+
461
+#  Post-Authentication
462
+#  Once we KNOW that the user has been authenticated, there are
463
+#  additional steps we can take.
464
+post-auth {
465
+	#  Get an address from the IP Pool.
466
+#	main_pool
467
+
468
+	#
469
+	#  If you want to have a log of authentication replies,
470
+	#  un-comment the following line, and the 'detail reply_log'
471
+	#  section, above.
472
+#	reply_log
473
+
474
+	#
475
+	#  After authenticating the user, do another SQL query.
476
+	#
477
+	#  See "Authentication Logging Queries" in sql.conf
478
+#	sql
479
+
480
+	#
481
+	#  Instead of sending the query to the SQL server,
482
+	#  write it into a log file.
483
+	#
484
+#	sql_log
485
+
486
+	#
487
+	#  Un-comment the following if you have set
488
+	#  'edir_account_policy_check = yes' in the ldap module sub-section of
489
+	#  the 'modules' section.
490
+	#
491
+#	ldap
492
+
493
+	# For Exec-Program and Exec-Program-Wait
494
+	exec
495
+
496
+	#
497
+	#  Calculate the various WiMAX keys.  In order for this to work,
498
+	#  you will need to define the WiMAX NAI, usually via
499
+	#
500
+	#	update request {
501
+	#	       WiMAX-MN-NAI = "%{User-Name}"
502
+	#	}
503
+	#
504
+	#  If you want various keys to be calculated, you will need to
505
+	#  update the reply with "template" values.  The module will see
506
+	#  this, and replace the template values with the correct ones
507
+	#  taken from the cryptographic calculations.  e.g.
508
+	#
509
+	# 	update reply {
510
+	#		WiMAX-FA-RK-Key = 0x00
511
+	#		WiMAX-MSK = "%{EAP-MSK}"
512
+	#	}
513
+	#
514
+	#  You may want to delete the MS-MPPE-*-Keys from the reply,
515
+	#  as some WiMAX clients behave badly when those attributes
516
+	#  are included.  See "raddb/modules/wimax", configuration
517
+	#  entry "delete_mppe_keys" for more information.
518
+	#
519
+#	wimax
520
+
521
+	#  If there is a client certificate (EAP-TLS, sometimes PEAP
522
+	#  and TTLS), then some attributes are filled out after the
523
+	#  certificate verification has been performed.  These fields
524
+	#  MAY be available during the authentication, or they may be
525
+	#  available only in the "post-auth" section.
526
+	#
527
+	#  The first set of attributes contains information about the
528
+	#  issuing certificate which is being used.  The second
529
+	#  contains information about the client certificate (if
530
+	#  available).
531
+#
532
+#	update reply {
533
+#	       Reply-Message += "%{TLS-Cert-Serial}"
534
+#	       Reply-Message += "%{TLS-Cert-Expiration}"
535
+#	       Reply-Message += "%{TLS-Cert-Subject}"
536
+#	       Reply-Message += "%{TLS-Cert-Issuer}"
537
+#	       Reply-Message += "%{TLS-Cert-Common-Name}"
538
+#	       Reply-Message += "%{TLS-Cert-Subject-Alt-Name-Email}"
539
+#
540
+#	       Reply-Message += "%{TLS-Client-Cert-Serial}"
541
+#	       Reply-Message += "%{TLS-Client-Cert-Expiration}"
542
+#	       Reply-Message += "%{TLS-Client-Cert-Subject}"
543
+#	       Reply-Message += "%{TLS-Client-Cert-Issuer}"
544
+#	       Reply-Message += "%{TLS-Client-Cert-Common-Name}"
545
+#	       Reply-Message += "%{TLS-Client-Cert-Subject-Alt-Name-Email}"
546
+#	}
547
+
548
+	#  MacSEC requires the use of EAP-Key-Name.  However, we don't
549
+	#  want to send it for all EAP sessions.  Therefore, the EAP
550
+	#  modules put required data into the EAP-Session-Id attribute.
551
+	#  This attribute is never put into a request or reply packet.
552
+	#
553
+	#  Uncomment the next few lines to copy the required data into
554
+	#  the EAP-Key-Name attribute
555
+#	if (reply:EAP-Session-Id) {
556
+#		update reply {
557
+#			EAP-Key-Name := "%{reply:EAP-Session-Id}"
558
+#		}
559
+#	}
560
+
561
+	#  If the WiMAX module did it's work, you may want to do more
562
+	#  things here, like delete the MS-MPPE-*-Key attributes.
563
+	#
564
+	#	if (updated) {
565
+	#		update reply {
566
+	#			MS-MPPE-Recv-Key !* 0x00
567
+	#			MS-MPPE-Send-Key !* 0x00
568
+	#		}
569
+	#	}
570
+
571
+	#
572
+	#  Access-Reject packets are sent through the REJECT sub-section of the
573
+	#  post-auth section.
574
+	#
575
+	#  Add the ldap module name (or instance) if you have set 
576
+	#  'edir_account_policy_check = yes' in the ldap module configuration
577
+	#
578
+	Post-Auth-Type REJECT {
579
+		# log failed authentications in SQL, too.
580
+#		sql
581
+		attr_filter.access_reject
582
+	}
583
+}
584
+
585
+#
586
+#  When the server decides to proxy a request to a home server,
587
+#  the proxied request is first passed through the pre-proxy
588
+#  stage.  This stage can re-write the request, or decide to
589
+#  cancel the proxy.
590
+#
591
+#  Only a few modules currently have this method.
592
+#
593
+pre-proxy {
594
+#	attr_rewrite
595
+
596
+	#  Uncomment the following line if you want to change attributes
597
+	#  as defined in the preproxy_users file.
598
+#	files
599
+
600
+	#  Uncomment the following line if you want to filter requests
601
+	#  sent to remote servers based on the rules defined in the
602
+	#  'attrs.pre-proxy' file.
603
+#	attr_filter.pre-proxy
604
+
605
+	#  If you want to have a log of packets proxied to a home
606
+	#  server, un-comment the following line, and the
607
+	#  'detail pre_proxy_log' section, above.
608
+#	pre_proxy_log
609
+}
610
+
611
+#
612
+#  When the server receives a reply to a request it proxied
613
+#  to a home server, the request may be massaged here, in the
614
+#  post-proxy stage.
615
+#
616
+post-proxy {
617
+
618
+	#  If you want to have a log of replies from a home server,
619
+	#  un-comment the following line, and the 'detail post_proxy_log'
620
+	#  section, above.
621
+#	post_proxy_log
622
+
623
+#	attr_rewrite
624
+
625
+	#  Uncomment the following line if you want to filter replies from
626
+	#  remote proxies based on the rules defined in the 'attrs' file.
627
+#	attr_filter.post-proxy
628
+
629
+	#
630
+	#  If you are proxying LEAP, you MUST configure the EAP
631
+	#  module, and you MUST list it here, in the post-proxy
632
+	#  stage.
633
+	#
634
+	#  You MUST also use the 'nostrip' option in the 'realm'
635
+	#  configuration.  Otherwise, the User-Name attribute
636
+	#  in the proxied request will not match the user name
637
+	#  hidden inside of the EAP packet, and the end server will
638
+	#  reject the EAP request.
639
+	#
640
+	eap
641
+
642
+	#
643
+	#  If the server tries to proxy a request and fails, then the
644
+	#  request is processed through the modules in this section.
645
+	#
646
+	#  The main use of this section is to permit robust proxying
647
+	#  of accounting packets.  The server can be configured to
648
+	#  proxy accounting packets as part of normal processing.
649
+	#  Then, if the home server goes down, accounting packets can
650
+	#  be logged to a local "detail" file, for processing with
651
+	#  radrelay.  When the home server comes back up, radrelay
652
+	#  will read the detail file, and send the packets to the
653
+	#  home server.
654
+	#
655
+	#  With this configuration, the server always responds to
656
+	#  Accounting-Requests from the NAS, but only writes
657
+	#  accounting packets to disk if the home server is down.
658
+	#
659
+#	Post-Proxy-Type Fail {
660
+#			detail
661
+#	}
662
+}
663
+