summaryrefslogtreecommitdiffstats
path: root/src/tests/radsec/config-home/main.conf
blob: 98966fda8d17087658eab0b862910e729bbd4cb5 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
listen {

	ipaddr = 127.0.0.1
	port = ${{port-home-auth}}
	type = auth+coa
	proto = tcp

	virtual_server = default

	clients = radsec

	tls {
		tls_max_version="1.2"
		private_key_password = whatever
		private_key_file = ${certdir}/server.pem
		certificate_file = ${certdir}/server.pem
		ca_file = ${cadir}/ca.pem
		fragment_size = 8192
		ca_path = ${cadir}
		cipher_list = "DEFAULT"
		cipher_server_preference = no

		cache {
		      enable = no
		      lifetime = 24 # hours
		}

		require_client_cert = yes
	}

	# Specify the CoA retransmit parameters for CoA single tunnel
	coa {
		irt = 1
		mrt = 16
		mrc = 0
		mrd = 5
	}
}

clients radsec {
	client localhost {
		ipaddr      = 127.0.0.1
		secret      = radsec
		proto       = tls
	
		limit {
			max_connections = 16
			lifetime = 0        # do not close connection
			idle_timeout = 0    # do not close connection even after an idle period
		}
	}
}

server default {
	authorize {
		update control {
			Originating-Realm-Key := &Called-Station-Id
			Auth-Type := Accept
		}
	}

	authenticate {
		Auth-Type PAP {
			pap
		}

		Auth-Type MS-CHAP {
			mschap
		}

		Auth-Type EAP {
			eap
		}
	}

	post-auth {
		if(User-Name && User-Name == "PostAuthCoA") {
			update coa {
				&Acct-Session-Id += "default:post-auth"
			    &Proxy-To-Originating-Realm := &Called-Station-Id
			}
		}
	}

	pre-proxy {
		update {
			&proxy-request:Acct-Session-Id += "default:pre-proxy"
		}
	}

	post-proxy {
		switch &proxy-reply:Packet-Type {
			case CoA-ACK {
				update proxy-reply {
					&Acct-Session-Id += "default:post-proxy-coa-ack"
				}
			}

			case CoA-NAK {
				update proxy-reply {
					&Acct-Session-Id += "default:post-proxy-coa-nak"
				}
			}

			case Disconnect-ACK {
				update proxy-reply {
					&Acct-Session-Id += "default:post-proxy-disconnect-ack"
				}
			}

			case Disconnect-NAK {
				update proxy-reply {
					&Acct-Session-Id += "default:post-proxy-disconnect-nak"
				}
			}

			case {
				fail
			}
		}

		# If there was no response at all
		Post-Proxy-Type Fail-CoA {
			ok
		}

		Post-Proxy-Type Fail-Disconnect {
			ok
		}

		detail_test.post-proxy
	}
}

#
# CoA Relay
#
listen {
	type = coa
	ipaddr = 127.0.0.1
	port = ${{port-home-coa}}
	virtual_server = coa
}

server coa {
	recv-coa {

		update request {
			COA-Packet-Type := "%{Packet-Type}"
		}

		if(&User-Name == "TcpSessionKey-Proxy") {
			# Proxying CoA
			update control {
				&Proxy-To-Originating-Realm := &Called-Station-Id
			}
		} else {
			# Originating CoA
			detail_coa.accounting
		}
	}
}

server coa-buffered-reader {
	listen {
		type = detail
		filename = "${radacctdir}/detail_coa"
		load_factor = 90
		track = yes
	}

	accounting {
		switch &User-Name {
			case "IpAddress" {
				update {
					coa:Packet-DST-IP-Address := &NAS-IP-Address
					coa:Packet-DST-Port:= &Called-Station-Id
				}
			}
			case "IpAddressSingleTunnel" {
				update {
					coa:Packet-DST-IP-Address := &NAS-IP-Address
				}
			}
			case "HomePoolCoA" {
				update {
					coa:Home-Server-Pool := &Called-Station-Id
				}
			}
			case "TcpSessionKey"{
				update {
					coa:Proxy-To-Originating-Realm := &Called-Station-Id
				}
			}
		}

		switch &COA-Packet-Type {
			case "Disconnect-Request" {
				update {
					#  Include given attributes
					&disconnect: += request:[*]
					&disconnect:Packet-DST-IP-Address := &COA-Packet-DST-IP-Address
					&disconnect:Packet-DST-Port := &COA-Packet-DST-Port
					&disconnect:Acct-Session-Id := &COA-Acct-Session-Id
					&disconnect:Acct-Delay-Time !* ANY
				}
			}

			case "CoA-Request" {
				update {
					&coa:Acct-Session-Id = "coa-buffered-reader:accounting:coa-request"
				}
			}
		}
		ok
	} # accounting

	pre-proxy {
		update {
			&proxy-request:Acct-Session-Id += "coa-buffered-reader:pre-proxy"
		}
	}

	post-proxy {
		update {
			&proxy-reply:Acct-Session-Id += "coa-buffered-reader:post-proxy"
		}
		detail_test.post-proxy
	}
}

server home-originate-coa-relay {

	pre-proxy {
		update {
			&proxy-request:Acct-Session-Id += "home-originate-coa-relay:pre-proxy"
		}
	}

	post-proxy {
		switch &proxy-reply:Packet-Type {
			case CoA-ACK {
				update {
					&proxy-reply:Acct-Session-Id += "home-originate-coa-relay:post-proxy-coa-ack"
				}
			}

			case CoA-NAK {
				update {
					&proxy-reply:Acct-Session-Id += "home-originate-coa-relay:post-proxy-coa-nak"
				}
			}

			case Disconnect-ACK {
				update {
					&proxy-reply:Acct-Session-Id += "home-originate-coa-relay:post-proxy-disconnect-ack"
				}
			}

			case Disconnect-NAK {
				update {
					&proxy-reply:Acct-Session-Id += "home-originate-coa-relay:post-proxy-disconnect-nak"
				}
			}

			case {
				fail
			}
		}

		# If there was no response at all
		Post-Proxy-Type Fail-CoA {
			ok
		}

		Post-Proxy-Type Fail-Disconnect {
			ok
		}

		detail_test.post-proxy
	}
}

home_server coa-nas {
	type = coa
	ipaddr = 127.0.0.1
	port = ${{port-coa}} # A placeholder to be set in test makefile
	secret =  testing123

	coa {
		irt = 2
		mrt = 16
		mrc = 5
		mrd = 30
	}
}

home_server_pool coa-nas {
	type = fail-over
	home_server = coa-nas
	virtual_server = home-originate-coa-relay
}

home_server coa-nas-tls {
	type = coa
	ipaddr = 127.0.0.1
	port = ${{port-proxy-coa}} # A placeholder to be set in test makefile
	secret =  testing123

	coa {
		irt = 2
		mrt = 16
		mrc = 5
		mrd = 30
	}
}

home_server_pool coa-nas-tls {
	type = fail-over
	home_server = coa-nas-tls
	virtual_server = home-originate-coa-relay
}