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
25 let space = del /([ \t]|\\\\\n)+/ " "
27 (* For the control syntax of [key=value ..] we could split the key value *)
28 (* pairs into an array and generate a subtree control/N/KEY = VALUE *)
29 (* The valid control values if the [...] syntax is not used, is *)
30 (* required|requisite|optional|sufficient|include|substack *)
31 (* We allow more than that because this list is not case sensitive and *)
32 (* to be more lenient with typos *)
33 let control = /(\[[^]#\n]*\]|[a-zA-Z]+)/
34 let word = /([^# \t\n\\]|\\\\.)+/
36 let types = /(auth|session|account|password)/i
38 (* This isn't entirely right: arguments enclosed in [ .. ] can contain *)
39 (* a ']' if escaped with a '\' and can be on multiple lines ('\') *)
40 let argument = /(\[[^]#\n]+\]|[^[#\n \t\\][^#\n \t\\]*)/
42 let comment = Util.comment
43 let comment_or_eol = Util.comment_or_eol
44 let empty = Util.empty
47 (* Not mentioned in the man page, but Debian uses the syntax *)
50 let include = [ indent . Util.del_str "@" . key "include" .
51 space . store word . eol ]
53 (* Shared with PamConf *)
54 let record = [ label "optional" . del "-" "-" ]? .
55 [ label "type" . store types ] .
57 [ label "control" . store control] .
59 [ label "module" . store word ] .
60 [ space . label "argument" . store argument ]* .
63 let record_svc = [ seq "record" . indent . record ]
65 let lns = ( empty | comment | include | record_svc ) *
67 let filter = incl "/etc/pam.d/*"
68 . excl "/etc/pam.d/allow.pamlist"
69 . excl "/etc/pam.d/README"
72 let xfm = transform lns filter
74 (* Local Variables: *)