3 Parses /etc/pam.conf and /etc/pam.d/* service files
5 Author: David Lutterkort <lutter@redhat.com>
8 This lens tries to keep as close as possible to `man pam.conf` where
12 This file is licensed under the LGPL v2+, like the rest of Augeas.
16 About: Configuration files
17 This lens autoloads /etc/pam.d/* for service specific files. See <filter>.
18 It provides a lens for /etc/pam.conf, which is used in the PamConf module.
24 let indent = Util.indent
26 (* For the control syntax of [key=value ..] we could split the key value *)
27 (* pairs into an array and generate a subtree control/N/KEY = VALUE *)
28 let control = /(\[[^]#\n]*\]|[^[ \t][^ \t]*)/
29 let word = /[^# \t\n]+/
31 let types = /(auth|session|account|password)/i
33 (* This isn't entirely right: arguments enclosed in [ .. ] can contain *)
34 (* a ']' if escaped with a '\' and can be on multiple lines ('\') *)
35 let argument = /(\[[^]#\n]+\]|[^[#\n \t][^#\n \t]*)/
37 let comment = Util.comment
38 let comment_or_eol = Util.comment_or_eol
39 let empty = Util.empty
42 (* Not mentioned in the man page, but Debian uses the syntax *)
45 let include = [ indent . Util.del_str "@" . key "include" .
46 Util.del_ws_spc . store word . eol ]
48 (* Shared with PamConf *)
49 let record = [ label "optional" . del "-" "-" ]? .
50 [ label "type" . store types ] .
52 [ label "control" . store control] .
54 [ label "module" . store word ] .
55 [ Sep.space . label "argument" . store argument ]* .
58 let record_svc = [ seq "record" . indent . record ]
60 let lns = ( empty | comment | include | record_svc ) *
62 let filter = incl "/etc/pam.d/*"
63 . excl "/etc/pam.d/allow.pamlist"
64 . excl "/etc/pam.d/README"
67 let xfm = transform lns filter
69 (* Local Variables: *)