summaryrefslogtreecommitdiffstats
path: root/raddb/sites-available/example
blob: 5f204aaa6fc87e487b8542e1e4781623ff7f4a73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
######################################################################
#
#	An example virtual server configuration.
#
#	$Id$
#
######################################################################


#
#	This client will be available to any "listen" section that
#	are defined outside of a virtual server section.  However,
#	when the server receives a packet from this client, the
#	request will be processed through the "example" virtual
#	server, as the "client" section contains a configuration item
#	to that effect.
#
#	Note that this client will be able to send requests to any
#	port defined in a global "listen" section.  It will NOT,
#	however, be able to send requests to a port defined in a
#	"listen" section that is contained in a "server" section.
#
#	With careful matching of configurations, you should be able
#	to:
#
#	- Define one authentication port, but process each client
#	  through a separate virtual server.
#
#	- define multiple authentication ports, each with a private
#	  list of clients.
#
#	- define multiple authentication ports, each of which may
#	  have the same client listed, but with different shared
#	  secrets
#
#	FYI: We use an address in the 192.0.2.* space for this example,
#	as RFC 3330 says that that /24 range is used for documentation
#	and examples, and should not appear on the net.  You shouldn't
#	use it for anything, either.
#
client 192.0.2.10 {
	shortname	= example-client
	secret		= testing123
	virtual_server  = example
}

######################################################################
#
#	An example virtual server.  It starts off with "server name {"
#	The "name" is used to reference this server from a "listen"
#	or "client" section.
#
######################################################################
server example {
	#
	#	Listen on 192.0.2.1:1812 for Access-Requests
	#
	#	When the server receives a packet, it is processed
	#	through the "authorize", etc. sections listed here,
	#	NOT the global ones the "default" site.
	#
	listen {
		ipaddr = 192.0.2.1
		port = 1821
		type = auth
	}

	#
	#	This client is listed within the "server" section,
	#	and is therefore known ONLY to the socket defined
	#	in the "listen" section above.  If the client IP
	#	sends a request to a different socket, the server
	#	will treat it as an unknown client, and will not
	#	respond.
	#
	#	In contrast, the client listed at the top of this file
	#	is outside of any "server" section, and is therefore
	#	global in scope.  It can send packets to any port
	#	defined in a global "listen" section.  It CANNOT send
	#	packets to the listen section defined above, though.
	#
	#	Note that you don't have to have a "virtual_server = example"
	#	line here, as the client is encapsulated within
	#	the "server" section.
	#
	client 192.0.2.9 {
		shortname	= example-client
		secret		= testing123
	}

	authorize {
		#
		#  Some example policies.  See "man unlang" for more.
		#
		if (&User-Name == 'bob') {
			update control {
				&Cleartext-Password := 'bob'
			}
		}

		#
		#  And then reject the user.  The next line requires
		#  that the "always reject {}" section is defined in
		#  the "modules" section of radiusd.conf.
		#
		reject
	}

	authenticate {

	}

	post-auth {

		Post-Auth-Type Reject {
			update reply {
				&Reply-Message = 'This is only an example.'
			}
		}
	}

}