summaryrefslogtreecommitdiff
path: root/usr.sbin/hostapd/hostapd.conf.5
blob: 8d032008baca4b7d094e497af8d14324f3463935 (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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
.\" $OpenBSD: hostapd.conf.5,v 1.12 2005/09/30 16:50:03 reyk Exp $
.\"
.\" Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd April 13, 2004
.Dt HOSTAPD.CONF 5
.Os
.Sh NAME
.Nm hostapd.conf
.Nd configuration file for the Host Access Point daemon
.Sh DESCRIPTION
.Nm
is the configuration file for the
.Xr hostapd 8
daemon.
.Sh SECTIONS
The
.Nm
file is divided into four main sections.
.Bl -tag -width xxxx
.It Sy Macros
User-defined variables may be defined and used later, simplifying the
configuration file.
.It Sy Tables
Tables provide a mechanism to handle a large number of link layer
addresses easily, with increased performance and flexibility.
.It Sy Global Configuration
Global runtime settings for
.Xr hostapd 8 .
.It Sy Event rules
Event rules provide a powerful mechanism to trigger certain actions
when receiving specified IEEE 802.11 frames.
.El
.Pp
Comments can be put anywhere in the file using a hash mark
.Pq Sq # ,
and extend to the end of the current line.
.Sh MACROS
Much like
.Xr cpp 1
or
.Xr m4 1 ,
macros can be defined that will later be expanded in context.
Macro names must start with a letter, and may contain letters, digits
and underscores.
Macro names may not be reserved words (for example,
.Ic set ,
.Ic interface ,
or
.Ic hostap ) .
Macros are not expanded inside quotes.
.Pp
For example:
.Bd -literal -offset indent
wlan="ath0"
set iapp interface $wlan
.Ed
.Sh TABLES
Tables are named structures which can hold a collection of link layer
addresses, masked address ranges, and link layer to IP address
assignments.
Lookups against tables in
.Xr hostapd 8
are relatively fast, making a single rule with tables much more
efficient, in terms of processor usage and memory consumption, than a
large number of rules which differ only in link layer addresses.
.Pp
Tables are used for
.Xr hostapd 8
.Em event rules
to match specified IEEE 802.11 link layer addresses and address ranges,
and the capability to assign link layer to IP addresses is a
requirement for advanced IAPP functionality.
.Pp
Table options may be presented after the table name declaration.
The following options are supported:
.Bl -tag -width const
.It Ic const
The table is constant and cannot be later changed from its original
definition.
.El
.Pp
For example:
.Bd -literal -offset indent
cisco="00:40:06:ff:ff:ff / ff:ff:ff:00:00:00"

table <black> { $cisco, 00:0d:60:ff:f1:2a }
table <myess> const {
	00:00:24:c3:40:18 -> 10.195.64.24,
	00:00:24:c3:40:19 -> 10.195.64.25,
	00:00:24:c3:40:1a -> 10.195.64.26
}
.Ed
.Sh GLOBAL CONFIGURATION
The following configuration settings are understood:
.Bl -tag -width Ds
.It Ic set hostap interface Ar interface
Specify the wireless interface running in Host AP mode.
This option could be omitted to use
.Xr hostapd 8
to log received IAPP messages.
.It Ic set hostap mode Ar mode
Specify the Host AP capture mode.
The supported modes are:
.Pp
.Bl -tag -width radiotap -offset indent -compact
.It Ic radiotap
Capture IEEE 802.11 frames with additional radiotap headers.
They will provide optional but useful information like received frame
signal levels.
.It Ic pcap
Capture plain IEEE 802.11 frames.
.El
.It Ic set iapp interface Ar interface
Specify the mandatory Inter-Access-Point (IAPP) interface.
It is important that the IAPP interface is on a trusted
network because there is no authentication and an attacker could force
disassociation of selected stations on all listening access points.
.It Ic set iapp mode Ar mode
Specify the IAPP mode.
The supported modes are:
.Pp
.Bl -tag -width broadcast -offset indent -compact
.It Ic multicast
Use multicast frames.
.It Ic broadcast
Use broadcast frames.
.El
.Pp
The default is multicast.
The multicast group used is 224.0.1.178.
.El
.Sh EVENT RULES
Event rules provide a powerful way to trigger a certain action when
receiving specified IEEE 802.11 frames on the
.Em hostap interface .
The rules are handled in sequential order, from first to last.
.Pp
In difference to packet filter rules like in
.Xr pf.conf 5 ,
the
.Xr hostapd 8
event rules are handled without a state;
each rule is processed indepedently from the others and from
any previous actions.
.Pp
All
.Xr hostapd 8
event rules are single line statements beginning with
the mandatory
.Ic hostap handle
keywords and optional rule options, frame matching,
a specified action, a limit, and a minimal rate:
.Bd -filled -offset indent
.Ic hostap handle
.Op Ar option
.Op Ar frame
.Op Ar action
.Op Ar limit
.Op Ar rate
.Ed
.Pp
The optional parts are defined below.
.Ss Rule Option
The rule
.Ar option
will modify the behaviour of handling the statement.
There are two possible options,
.Ic quick
and
.Ic skip .
If either the keyword
.Ic quick
or the keyword
.Ic skip
is specified, no further event rules will be handled for this frame
after processing this rule successfully.
The keyword
.Ic skip
additionally skips any further IAPP processing of the frame,
which is normally done after handling the event rules.
.Ss Rule Frame
The
.Ar frame
description specifies a mechanism to match IEEE 802.11 frames.
.Bl -tag -width Ds
.It Ic any
Match all frames.
.It Xo
.Ic frame
.Op Ar type
.Op Ar dir
.Op Ar from
.Op Ar to
.Op Ar bssid
.Xc
Apply rules to frames matching the given parameters.
The parameters are explained below.
.Pp
The
.Ar type
parameter specifies the frame type to match on.
The frame type may be specified in the following ways:
.Bl -tag -width Ds
.It Ic type any
Match all frame types.
.It Xo
.Ic type
.Op Ic not
.Ic data
.Xc
Match data frames.
Presence of the
.Ic not
keyword negates the match and will match all non-data frames.
.It Xo
.Ic type
.Op Ic not
.Ic management
.Oo Op Ic not
.Ar subtype Oc
.Xc
Match management frames.
The
.Ar subtype
argument may be specified to optionally match management frames of the
given subtype.
The subtype match may be negated by specifying the
.Ic not
keyword.
See the
.Sx Management Frame Subtypes
section below for available subtypes specifications.
.El
.Pp
The
.Ar dir
parameter specifies the direction the frame is being sent.
The direction may be specified in the following ways:
.Bl -tag -width Ds
.It Ic dir any
Match all directions.
.It Ic dir Ar framedir
Match frames with the given direction
.Ar framedir.
See the
.Sx Frame Directions
section below for available direction specifications.
.El
.Pp
The
.Ar from , to ,
and
.Ar bssid
parameters specify the IEEE 802.11 address fields to match on.
They can be specified in the following ways:
.Bl -tag -width Ds
.It Xo
.Ic ( from \*(Ba to \*(Ba bssid ) Ic any
.Xc
Allow all addresses for the specified address field.
.It Xo
.Ic ( from \*(Ba to \*(Ba bssid )
.Op Ic not
.Aq Ar table
.Xc
Allow allow addresses from the given
.Aq Ar table
(see
.Sx Tables
above)
for the specified address field.
.It Xo
.Ic ( from \*(Ba to \*(Ba bssid )
.Op Ic not
.Ar lladdr
.Xc
Allow the given address
.Ar lladdr
for the specified address field.
.El
.El
.Ss Rule Action
An optional
.Ar action
is triggered if a received IEEE 802.11 frame matches the frame
description.
The following actions are supported:
.Bl -tag -width Ds
.It Xo
.Ic with frame Ar type
.Op Ar dir
.Ar from to bssid
.Xc
Send an arbitrary constructed frame to the wireless network.
The arguments are as follows.
.Pp
The
.Ar type
describes the IEEE 802.11 frame type to send, specified in the
frame control header.
The following frames types are supported at present:
.Bl -tag -width Ds
.It Ic type data
Send a data frame.
This is normally used to encapsulate ordinary IEEE 802.3
frames into IEEE 802.11 wireless frames.
.It Ic type Ic management Ar subtype
Send a management frame with the specified subtype.
Management frames are used to control states and to find access points
and IBSS nodes in IEEE 802.11 networks.
See the
.Sx Management Frame Subtypes
section below for available subtypes specifications.
.El
.Pp
The
.Ar dir
describes the direction the IEEE 802.11 frame will be sent.
It has the following syntax:
.Bd -filled -offset indent
.Ic dir Ar framedir
.Ed
.Pp
See the
.Sx Frame Directions
section below for available direction specifications.
.Pp
The
.Ar from , to ,
and
.Ar bssid
arguments specify the link layer address fields used in IEEE 802.11
frames.
All address fields are mandatory in the frame action.
The optional fourth address field used by wireless distribution
systems (WDS) is currently not supported.
Each argument is specified by a keyword of the same name
.Po
.Ic from , to ,
or
.Ic bssid
.Pc
followed by one of the following address specifications:
.Bl -tag -width "&refaddr"
.It Ar lladdr
Specify the link layer addresses used in the IEEE 802.11 frame address
field.
The link layer address
.Ql ff:ff:ff:ff:ff:ff
is the IEEE 802.11 broadcast address.
.It Li & Ns Ar refaddr
Fill in a link layer address from the previously matched IEEE 802.11
frame.
.Ic &from
will use the source link layer address;
.Ic &to
the destination link layer address; and
.Ic &bssid
the BSSID link layer address of the previously matched frame.
.It Ic random
Use a random link layer address in the specified IEEE 802.11 frame
address field.
Multicast and broadcast link layer addresses will be skipped.
.El
.It Ic with iapp type Ar iapp-type
Send a
.Xr hostapd 8
specific IAPP frame with a raw IEEE 802.11 packet dump of the received
frame to the wired network.
The only supported
.Ar iapp-type
is
.Ic radiotap .
.It Ic with log Op Ic verbose
Write informational messages to the local system log (see
.Xr syslogd 8 )
or standard error.
If the
.Sx Rule Rate
has been specified,
log will print the actual rate.
.It Ic node add | delete Ar lladdr
Add or remove the specified node from the internal kernel
node table.
.It Ic resend
Resend the received IEEE 802.11 frame.
.El
.Ss Rule Limit
It is possible to limit handling of specific rules with the
.Ic limit
keyword:
.Bd -filled -offset indent
.Ic limit
.Ar number
.Ic sec \*(Ba usec
.Ed
.Pp
In some cases it is absolutely necessary to use limited matching
to protect
.Xr hostapd 8
against excessive flooding with IEEE 802.11 frames.
For example, beacon frames will be normally received every 100 ms.
.Ss Rule Rate
It is possible to tell
.Xr hostapd 8
to trigger the action only after a specific
.Ic rate
of matched frames.
.Bd -filled -offset indent
.Ic rate
.Ar number
.Ar /
.Ar number
.Ic sec
.Ed
.Pp
This will help to detect excessive flooding of IEEE 802.11 frames.
For example, de-auth flooding is a DoS (Denial of Service) attack
against IEEE 802.11 wireless networks.
.Ss Management Frame Subtypes
The
.Ar subtype
describes the IEEE 802.11 frame subtype, specified in
the frame control header.
The choice of subtypes depends on the used frame type.
.Xr hostapd 8
currently only supports management frame subtypes.
Most frame subtypes require an additional subtype-specific header
in the frame body, but currently only the
.Ic deauth
and
.Ic disassoc
reason codes are supported:
.Pp
.Bl -tag -width Ds -compact
.It Ic subtype beacon
A beacon frame.
Wireless access points and devices running in
.Em ibss
master or
.Em hostap
mode continuously send beacon frames to indicate their presence,
traffic load, and capabilities.
.It Ic subtype deauth Op Ar reason
A deauthentication frame with an optional reason code.
Deauthenticated stations will lose any IEEE 802.11 operational state.
.It Ic subtype disassoc Op Ar reason
A disassociation frame with an optional reason code.
.It Ic subtype assoc request
An association request frame.
.It Ic subtype assoc response
An association response frame.
.It Ic subtype atim
An announcement traffic indication message (ATIM frame).
.It Xo
.Ic subtype auth Op Ic open request \*(Ba response
.Xc
An authentication frame.
.It Ic subtype probe request
A probe request frame.
Probe requests are used to probe for access points and IBSS nodes.
.It Ic subtype probe response
A probe response frame.
.It Ic subtype reassoc request
A re-association request frame.
.It Ic subtype reassoc response
A re-association response frame.
.El
.Pp
The
.Ar reason
defines a descriptive reason for the actual
.Em deauthentication
or
.Em disassociation
of a station:
.Pp
.Bl -tag -width Ds -compact
.It Ic reason assoc expire
Disassociated due to inactivity.
.It Ic reason assoc leave
Disassociated because the sending station is leaving or has left the
wireless network.
.It Ic reason assoc toomany
Disassociated because the access point has reached its limit of
associated stations.
.It Ic reason auth expire
Previous authentication no longer valid.
.It Ic reason auth leave
Deauthenticated because the sending station is leaving or has left the
wireless network.
.It Ic reason ie invalid
IEEE 802.11i extension.
.It Ic reason mic failure
IEEE 802.11i extension.
.It Ic reason not authed
Frame received from unauthenticated station.
.It Ic reason assoc not authed
Frame received from an associated but unauthenticated station.
.It Ic reason not assoced
Frame received from unassociated station.
.It Ic reason rsn required
IEEE 802.11i extension.
.It Ic reason rsn inconsistent
IEEE 802.11i extension.
.It Ic reason unspecified
Unspecified reason.
.El
.Ss Frame Directions
The direction a frame is being transmitted
.Pq Ar framedir
can be specified in the following ways:
.Pp
.Bl -tag -width Ds -compact
.It Ic dir no ds
No distribution system direction is used for management frames.
.It Ic dir to ds
A frame sent from a station to the distribution system, the access point.
.It Ic dir from ds
A frame from the distribution system, the access point, to a station.
.It Ic dir ds to ds
A frame direction used by wireless distribution systems (WDS) for
wireless access point to access point communication.
.El
.Sh EVENT RULE EXAMPLES
.Bd -literal
# Log probe requests locally
hostap handle type management subtype probe request \\
    with log

# Detect flooding of management frames except beacons.
# This will detect some possible Denial of Service attacks
# against the IEEE 802.11 protocol.
hostap handle skip type management subtype ! beacon \\
    with log \\
    rate 100 / 10 sec

# Log rogue accesspoints via IAPP, limited to every second,
# and skip further IAPP processing.
hostap handle skip type management subtype beacon bssid !<myess> \\
    with iapp type radiotap limit 1 sec

# Send deauthentication frames to stations accociated to rogue APs
hostap handle type data bssid !<myess> with frame type management \\
    subtype deauth reason auth expire \\
    from &bssid to &from bssid &bssid

# Send authentication requests from random station addresses to
# rogue accesspoints. This is common way to test the quality of
# various hostap implementations.
hostap handle skip type management subtype beacon bssid <pentest> \\
    with frame type management subtype auth \\
    from random to &bssid bssid &bssid

# Re-inject a received IEEE 802.11 frame
hostap handle type management subtype auth with resend

# Remove a blacklisted node from the kernel node tree
hostap handle type management subtype auth from <blacklist> \\
    with node delete &from
.Ed
.Sh GRAMMAR
Syntax for
.Nm
in BNF:
.Bd -literal
grammar		= [ varset ] | [ tabledef ] | option | [ event ]

varset		= varname "=" varvalue

tabledef	= "table" table tableopts

table		= "<" tablename ">"

tableopts	= "const" | "{" [ "\en" ] "}" |
		  "{" [ "\en" ] tableaddrlist [ "\en" ] "}"

tableaddrlist	= lladdr [ "->" ipv4-dotted-quad | "&" lladdr-mask |
		  "/" number ] [ "," ] [ tableaddrlist ]

option		= "set" ( "hostap" "interface" name |
		  "iapp" "interface" name [ "passive" ] |
		  [ "iapp" "mode" ( "multicast" | "broadcast" ] )

event		= "hostap" "handle" [ eventopt ] [ frmmatch ] [ action ]
		  [ limit ]

eventopt	= "skip" | "quick"

action		= "with" ( "log" [ "verbose" ] | "frame" frmaction |
		  "iapp" "type" "radiotap" |
		  "node" ( "add" | "delete" ) frmactionaddr )

frmmatch	= [ frmmatchtype ] [ "dir" ( "any" | [ "!" ] frmdir ) ]
		  [ ( "from" | "to" | "bssid" ) frmmatchaddr ]

frmmatchtype	= "type" ( "any" | [ "!" ] ( "data" | "management"
		  [ frmmatchmgmt ] ) )

frmmatchmgmt	= "subtype" ( "any" | [ "!" ] frmsubtype )

frmmatchaddr	= "any" | [ "!" ] table | [ "!" ] lladdr

frmaction	= frmactiontype [ "dir" frmdir ]
		  ( "from" , "to" , "bssid" ) frmactionaddr

frmactiontype	= "type" ( "data" | "management" "subtype" frmsubtype )

frmactionaddr	= lladdr | refaddr | "random"

limit		= "limit" number ( "sec" | "usec" )

frmsubtype	= ( "probe-request" | "probe-resp" |
		  "beacon" ) [ frmelems ] | "atim" | "auth" | "deauth" |
		  "assoc-request" | "assoc-resp" | "reassoc-request" |
		  "reassoc-response"

frmelems	= "nwid" [ "!" ] name [ frmelems ]

frmdir		= ( "no" | "to" | "from" | "ds" "to" ) "ds"

refaddr		= "&" ( "from" | "to" | "bssid" )
.Ed
.Sh FILES
.Bl -tag -width "/etc/hostapd.conf" -compact
.It Pa /etc/hostapd.conf
Default location of the configuration file.
.El
.Sh SEE ALSO
.Xr hostapd 8
.Sh AUTHORS
The
.Xr hostapd 8
program was written by
.An Reyk Floeter Aq reyk@openbsd.org .