x-pfs-01.mkiv /size: 11 Kb    last modification: 2020-07-01 14:35
1% pfsense status info, work in progress
2%
3% usage:
4%
5% context --environment=x-pfs-01 filename.xml
6%
7% or
8%
9%  <?context-directive job ctxfile x-pfsense.ctx ?>
10
11\setupbodyfont
12  [dejavu,10pt]
13
14\setuplayout
15  [topspace=1cm,
16   backspace=1cm,
17   footer=0pt,
18   header=1cm,
19   width=middle,
20   height=middle]
21
22\setupheader
23  [style=bold]
24
25\setuphead
26   [section]
27   [style=\bfb]
28
29\setuphead
30   [subsection]
31   [style=\bfa]
32
33\setuppagenumbering
34  [location=]
35
36\dontcomplain
37
38% todo: show all values and map keys onto longer names via labels
39
40\startxmlsetups xml:system
41
42    \startsection[title={System}]
43
44        \startsubsection[title={Properties}]
45
46            \starttabulate[|B|T|]
47                \NC hostname    \NC \xmlfirst{#1}{hostname}    \NC \NR
48                \NC domain      \NC \xmlfirst{#1}{domain}      \NC \NR
49                \NC timezone    \NC \xmlfirst{#1}{timezone}    \NC \NR
50                \NC timeservers \NC \xmlfirst{#1}{timeservers} \NC \NR
51                \NC dnsserver   \NC \xmlfirst{#1}{dnsserver}   \NC \NR
52            \stoptabulate
53
54        \stopsubsection
55
56        \startsubsection[title={Groups}]
57            \xmlfilter{#1}{group/command(xml:system:group)}
58        \stopsubsection
59
60        \startsubsection[title={Users}]
61            \xmlfilter{#1}{user/command(xml:system:user)}
62        \stopsubsection
63
64    \stopsection
65
66\stopxmlsetups
67
68\startxmlsetups xml:system:group
69
70       \starttabulate[|B|T|]
71            \NC name        \NC \xmlfirst{#1}{/name}                        \NC \NR
72            \NC description \NC \xmlfirst{#1}{/descr}                       \NC \NR
73            \NC scope       \NC \xmlfirst{#1}{/scope}                       \NC \NR
74            \NC gid         \NC \xmlfirst{#1}{/gid}                         \NC \NR
75            \NC privilege   \NC \xmlfirst{#1}{/priv}                        \NC \NR
76            \NC members     \NC \xmlconcat{#1}{/member}{ }                  \NC \NR
77        \stoptabulate
78
79\stopxmlsetups
80
81\startxmlsetups xml:system:user
82
83       \starttabulate[|B|T|]
84            \NC name        \NC \xmlfirst{#1}{/name}                        \NC \NR
85            \NC description \NC \xmlfirst{#1}{/descr}                       \NC \NR
86            \NC scope       \NC \xmlfirst{#1}{/scope}                       \NC \NR
87            \NC uid         \NC \xmlfirst{#1}{/uid}                         \NC \NR
88            \NC group       \NC \xmlfirst{#1}{/groupname}                   \NC \NR
89            \NC privilege   \NC \xmlfirst{#1}{/priv}                        \NC \NR
90            \NC password    \NC \xmldoifelsetext{#1}{/password}{set}{unset} \NC \NR
91            \NC ipsec psk   \NC \xmldoifelsetext{#1}{/ipsecpsk}{set}{unset} \NC \NR
92            \NC certificate \NC \xmldoifelsetext{#1}{/cert}    {set}{unset} \NC \NR
93        \stoptabulate
94
95\stopxmlsetups
96
97\startxmlsetups xml:interfaces
98
99    \startsection[title={Interfaces}]
100
101        \xmlfilter{#1}{*/command(xml:interfaces:network)}
102
103    \stopsection
104
105\stopxmlsetups
106
107\startxmlsetups xml:interfaces:network
108
109    \startsubsection[title={\xmltag{#1}}]
110
111        % <blockpriv/> <blockbogons/> <spoofmac/> <enable/>
112
113        \starttabulate[|B|T|]
114            \NC interface         \NC \xmlfirst{#1}{/if}                      \NC \NR
115            \NC block private     \NC \xmldoifelse{#1}{/blockpriv}  {yes}{no} \NC \NR
116            \NC block bogons      \NC \xmldoifelse{#1}{/blockbogons}{yes}{no} \NC \NR
117            \NC spoof mac address \NC \xmldoifelse{#1}{/spoofmac}   {yes}{no} \NC \NR
118            \NC enable interface  \NC \xmldoifelse{#1}{/enable}     {yes}{no} \NC \NR
119            \NC ipaddress         \NC \xmlfirst{#1}{/ipaddr}                  \NC \NR
120            \NC subnet            \NC \xmlfirst{#1}{/subnet}                  \NC \NR
121            \NC gateway           \NC \xmlfirst{#1}{/gateway}                 \NC \NR
122            \NC description       \NC \xmlfirst{#1}{/descr}                   \NC \NR
123        \stoptabulate
124
125    \stopsubsection
126
127\stopxmlsetups
128
129\startxmlsetups xml:gateways
130
131    \startsection[title={Gateways}]
132
133        \xmlfilter{#1}{*/command(xml:gateways:entry)}
134
135    \stopsection
136
137\stopxmlsetups
138
139\startxmlsetups xml:gateways:entry
140
141    \starttabulate[|B|T|]
142        \NC interface       \NC \xmlfirst{#1}{/interface}       \NC \NR
143        \NC gateway         \NC \xmlfirst{#1}{/gateway}         \NC \NR
144        \NC name            \NC \xmlfirst{#1}{/name}            \NC \NR
145        \NC weight          \NC \xmlfirst{#1}{/weight}          \NC \NR
146        \NC interval        \NC \xmlfirst{#1}{/interval}        \NC \NR
147        \NC description     \NC \xmlfirst{#1}{/descr}           \NC \NR
148        \NC disable monitor \NC \xmlfirst{#1}{/monitor_disable} \NC \NR
149        \NC default gateway \NC \xmlfirst{#1}{/defaultgw}       \NC \NR
150    \stoptabulate
151
152\stopxmlsetups
153
154\startxmlsetups xml:virtualips
155
156    \startsection[title={Virtual ipadresses}]
157
158        \xmlfilter{#1}{*/command(xml:virtualips:entry)}
159
160    \stopsection
161
162\stopxmlsetups
163
164\startxmlsetups xml:virtualips:entry
165
166    \starttabulate[|B|T|]
167        \NC interface   \NC \xmlfirst{#1}{/interface}   \NC \NR
168        \NC type        \NC \xmlfirst{#1}{/type}        \NC \NR
169        \NC mode        \NC \xmlfirst{#1}{/mode}        \NC \NR
170        \NC subnet      \NC \xmlfirst{#1}{/subnet}
171                           /\xmlfirst{#1}{/subnet_bits} \NC \NR
172        \NC description \NC \xmlfirst{#1}{/descr}       \NC \NR
173    \stoptabulate
174
175\stopxmlsetups
176
177\startxmlsetups xml:dhcp
178
179    \startsection[title={DHCP}]
180
181        \xmlfilter{#1}{*/command(xml:dhcp:network)}
182
183    \stopsection
184
185\stopxmlsetups
186
187\startxmlsetups xml:dhcp:network
188
189    \startsubsection[title={\xmltag{#1}}]
190
191        \starttabulate[|B|T|]
192            \NC range      \NC \xmlfirst{#1}{/range/from} \endash\ \xmlfirst{#1}{/range/to}  \NC \NR
193            \NC domain     \NC \xmlfirst{#1}{/domain}     \NC \NR
194            \NC dnsserver  \NC \xmlfirst{#1}{/dnsserver}  \NC \NR
195            \NC gateway    \NC \xmlfirst{#1}{/gateway}    \NC \NR
196            \NC ddnsdomain \NC \xmlfirst{#1}{/ddnsdomain} \NC \NR
197        \stoptabulate
198
199        \xmldoif {#1} {/staticmap} {
200
201            \starttabulate[|T|T|T|p|]
202                \NC \rm\bf macaddress
203                \NC \rm\bf ipaddress
204                \NC \rm\bf hostname
205                \NC \rm\bf description
206                \NC \NR
207                \HL
208                \xmlfilter{#1}{/staticmap/command(xml:dhcp:network:entry)}
209            \stoptabulate
210
211        }
212
213    \stopsubsection
214
215\stopxmlsetups
216
217\startxmlsetups xml:dhcp:network:entry
218
219    \NC \xmlfirst{#1}{/mac}
220    \NC \xmlfirst{#1}{/ipaddr}
221    \NC \xmlfirst{#1}{/hostname}
222    \NC \xmlfirst{#1}{/descr}
223    \NC \NR
224
225\stopxmlsetups
226
227\startxmlsetups xml:dnsmasq
228
229    \startsection[title={DNS MASQ}]
230
231        \starttabulate[|T|T|T|p|]
232            \NC \rm\bf host
233            \NC \rm\bf domain
234            \NC \rm\bf ipaddress
235            \NC \rm\bf description
236            \NC \NR
237            \HL
238            \xmlfilter{#1}{/hosts/command(xml:dnsmasq:hosts)}
239        \stoptabulate
240
241    \stopsection
242
243\stopxmlsetups
244
245
246\startxmlsetups xml:dnsmasq:hosts
247
248    \NC \xmlfirst{#1}{/host}
249    \NC \xmlfirst{#1}{/domain}
250    \NC \xmlfirst{#1}{/ip}
251    \NC \xmlfirst{#1}{/descr}
252    \NC \NR
253
254\stopxmlsetups
255
256\startxmlsetups xml:nat
257
258    \startsection[title={NAT}]
259
260        \startsubsection[title={Rules}]
261
262            \starttabulate[|T|T|T|T|T|p|]
263                \NC \rm\bf interface
264                \NC \rm\bf protocol
265                \NC \rm\bf source
266                \NC \rm\bf destination
267                \NC \rm\bf target
268                \NC \rm\bf description
269                \NC \NR
270                \HL
271                \xmlfilter{#1}{/rule/command(xml:nat:rule)}
272            \stoptabulate
273
274        \stopsubsection
275
276        \startsubsection[title={One to one}]
277
278            \starttabulate[|T|T|T|T|T|p|]
279                \NC \rm\bf interface
280                \NC \rm\bf protocol
281                \NC \rm\bf source
282                \NC \rm\bf destination
283                \NC \rm\bf external
284                \NC \rm\bf description
285                \NC \NR
286                \HL
287                \xmlfilter{#1}{/onetoone/command(xml:nat:onetoone)}
288            \stoptabulate
289
290        \stopsubsection
291
292\stopsection
293
294\stopxmlsetups
295
296\startxmlsetups xml:nat:rule
297
298    \NC \xmlfilter{#1}{/interface/command(xml:checked)}
299    \NC \xmlfilter{#1}{/protocol/command(xml:checked)}
300    \NC \xmlfilter{#1}{/source/command(xml:checked)}
301    \NC \xmlfilter{#1}{/destination/(address|any)/command(xml:checked)}
302       :\xmlfilter{#1}{/destination/port/command(xml:checked)}
303    \NC \xmlfilter{#1}{/target/command(xml:checked)}
304       :\xmlfilter{#1}{/local-port/command(xml:checked)}
305    \NC \xmlfirst {#1}{/descr}
306    \NC \NR
307
308\stopxmlsetups
309
310\startxmlsetups xml:nat:onetoone
311
312    \NC \xmlfilter{#1}{/interface/command(xml:checked)}
313    \NC \xmlfilter{#1}{/protocol/command(xml:checked)}
314    \NC \xmlfilter{#1}{/source/command(xml:checked)}
315    \NC \xmlfilter{#1}{/destination/(address|any)/command(xml:checked)}
316       :\xmlfilter{#1}{/destination/port/command(xml:checked)}
317    \NC \xmlfilter{#1}{/external/command(xml:checked)}
318       :\xmlfilter{#1}{/local-port/command(xml:checked)}
319    \NC \xmlfirst {#1}{/descr}
320    \NC \NR
321
322\stopxmlsetups
323
324\startxmlsetups xml:checked
325    \xmldoifelse {#1} {/any} {
326        *
327    } {
328        \xmldoifelsetext {#1} {.} {
329            \xmlflush{#1}
330        } {
331            *
332        }
333    }
334\stopxmlsetups
335
336\startxmlsetups xml:filter
337
338    \startsection[title={Filter}]
339
340        \startsubsection[title={Rules}]
341
342            \starttabulate[|T|T|T|T|T|p|]
343                \NC \rm\bf type
344                \NC \rm\bf interface
345                \NC \rm\bf protocol
346                \NC \rm\bf source
347                \NC \rm\bf destination
348                \NC \rm\bf description
349                \NC \NR
350                \HL
351                \xmlfilter{#1}{/rule/command(xml:filter:rule)}
352            \stoptabulate
353
354        \stopsubsection
355
356    \stopsubsection
357
358\stopxmlsetups
359
360\startxmlsetups xml:filter:rule
361
362    \NC \xmlfilter{#1}{/type/command(xml:checked)}
363    \NC \xmlfilter{#1}{/interface/command(xml:checked)}
364    \NC \xmlfilter{#1}{/protocol/command(xml:checked)}
365    \NC \xmlfilter{#1}{/source/(address|any)/command(xml:checked)}:
366       :\xmlfilter{#1}{/source/port/command(xml:checked)}
367    \NC \xmlfilter{#1}{/destination/(address|any)/command(xml:checked)}
368       :\xmlfilter{#1}{/destination/port/command(xml:checked)}
369    \NC \xmlfirst {#1}{/descr}
370    \NC \NR
371
372\stopxmlsetups
373
374\starttext
375
376    \doifelse {\inputfilename} {x-pfs-01.mkiv} {
377
378        \xmlloadonly{main}{router.xml}{}
379
380        \setupheadertexts[router.xml][\pagenumber]
381
382    } {
383
384        \xmlloadonly{main}{\inputfilename}{}
385
386        \setupheadertexts[\inputfilename][\pagenumber]
387
388    }
389
390    \xmlfilter{main}{/pfsense/system/command(xml:system)}
391    \xmlfilter{main}{/pfsense/interfaces/command(xml:interfaces)}
392    \xmlfilter{main}{/pfsense/gateways/command(xml:gateways)}
393    \xmlfilter{main}{/pfsense/virtualip/command(xml:virtualips)}
394    \xmlfilter{main}{/pfsense/dhcpd/command(xml:dhcp)}
395    \xmlfilter{main}{/pfsense/dnsmasq/command(xml:dnsmasq)}
396    \xmlfilter{main}{/pfsense/nat/command(xml:nat)}
397    \xmlfilter{main}{/pfsense/filter/command(xml:filter)}
398
399\stoptext
400