�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ� ���ͯj�ӣ��ƺ���ӣ� ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PKU1]=jelenses/dist/radicale.augnu[(* Radicale module for Augeas Based on Puppet lens. Manage config file for http://radicale.org/ /etc/radicale/config is a standard INI File. *) module Radicale = autoload xfm (************************************************************************ * INI File settings * * /etc/radicale/config only supports "#" as commentary and "=" as separator *************************************************************************) let comment = IniFile.comment "#" "#" let sep = IniFile.sep "=" "=" (************************************************************************ * ENTRY * /etc/radicale/config uses standard INI File entries *************************************************************************) let entry = IniFile.indented_entry IniFile.entry_re sep comment (************************************************************************ * RECORD * /etc/radicale/config uses standard INI File records *************************************************************************) let title = IniFile.indented_title IniFile.record_re let record = IniFile.record title entry (************************************************************************ * LENS & FILTER * /etc/radicale/config uses standard INI File records *************************************************************************) let lns = IniFile.lns record comment let filter = (incl "/etc/radicale/config") let xfm = transform lns filter PKU1]7 7 lenses/dist/sysconfig_route.augnu[(* Module: Sysconfig_Route Parses /etc/sysconfig/network-scripts/route-${device} Author: Stephen P. Schaefer About: Reference This lens allows manipulation of *one* IPv4 variant of the /etc/sysconfig/network-scripts/route-${device} script found in RHEL5+, CentOS5+ and Fedora. The variant handled consists of lines like "destination_subnet/cidr via router_ip", e.g., "10.132.11.0/24 via 10.10.2.1" There are other variants; if you use them, please enhance this lens. The natural key would be "10.132.11.0/24" with value "10.10.2.1", but since augeas cannot deal with slashes in the key value, I reverse them, so that the key is "10.10.2.1[1]" (and "10.10.2.1[2]"... if multiple subnets are reachable via that router). About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage Sample usage of this lens in augtool * Set the first subnet reachable by a router reachable on the eth0 subnet > set /files/etc/sysconfig/network-scripts/route-eth0/10.10.2.1[1] 172.16.254.0/24 * List all the subnets reachable by a router reachable on eth0 subnet > match /files/etc/sysconfig/network-scripts/route-eth0/10.10.2.1 About: Configuration files This lens applies to /etc/sysconfig/network-scripts/route-* About: Examples The file contains various examples and tests. *) module Sysconfig_Route = autoload xfm (****************************************************************************** * Group: USEFUL PRIMITIVES ******************************************************************************) (* Variable: router A router *) let router = Rx.ipv4 (* Variable: cidr A subnet mask can be 0 to 32 bits *) let cidr = /(3[012]|[12][0-9]|[0-9])/ (* Variable: subnet Subnet specification *) let subnet = Rx.ipv4 . "/" . cidr (****************************************************************************** * Group: ENTRY TYPES ******************************************************************************) (* View: entry One route *) let entry = [ store subnet . del /[ \t]*via[ \t]*/ " via " . key router . Util.del_str "\n" ] (****************************************************************************** * Group: LENS AND FILTER ******************************************************************************) (* View: lns *) let lns = entry+ (* View: filter *) let filter = incl "/etc/sysconfig/network-scripts/route-*" . Util.stdexcl let xfm = transform lns filter PKU1]Pjlenses/dist/passwd.augnu[(* Module: Passwd Parses /etc/passwd Author: Free Ekanayaka About: Reference - man 5 passwd - man 3 getpwnam Each line in the unix passwd file represents a single user record, whose colon-separated attributes correspond to the members of the passwd struct *) module Passwd = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Comments and empty lines *) let eol = Util.eol let comment = Util.comment let empty = Util.empty let dels = Util.del_str let word = Rx.word let integer = Rx.integer let colon = Sep.colon let sto_to_eol = store Rx.space_in let sto_to_col = store /[^:\r\n]+/ (* Store an empty string if nothing matches *) let sto_to_col_or_empty = store /[^:\r\n]*/ (************************************************************************ * Group: ENTRIES *************************************************************************) let username = /[_.A-Za-z0-9][-_.A-Za-z0-9]*\$?/ (* View: password pw_passwd *) let password = [ label "password" . sto_to_col? . colon ] (* View: uid pw_uid *) let uid = [ label "uid" . store integer . colon ] (* View: gid pw_gid *) let gid = [ label "gid" . store integer . colon ] (* View: name pw_gecos; the user's full name *) let name = [ label "name" . sto_to_col? . colon ] (* View: home pw_dir *) let home = [ label "home" . sto_to_col? . colon ] (* View: shell pw_shell *) let shell = [ label "shell" . sto_to_eol? ] (* View: entry struct passwd *) let entry = [ key username . colon . password . uid . gid . name . home . shell . eol ] (* NIS entries *) let niscommon = [ label "password" . sto_to_col ]? . colon . [ label "uid" . store integer ]? . colon . [ label "gid" . store integer ]? . colon . [ label "name" . sto_to_col ]? . colon . [ label "home" . sto_to_col ]? . colon . [ label "shell" . sto_to_eol ]? let nisentry = let overrides = colon . niscommon in [ dels "+@" . label "@nis" . store username . overrides . eol ] let nisuserplus = let overrides = colon . niscommon in [ dels "+" . label "@+nisuser" . store username . overrides . eol ] let nisuserminus = let overrides = colon . niscommon in [ dels "-" . label "@-nisuser" . store username . overrides . eol ] let nisdefault = let overrides = colon . [ label "password" . sto_to_col_or_empty . colon ] . [ label "uid" . store integer? . colon ] . [ label "gid" . store integer? . colon ] . [ label "name" . sto_to_col? . colon ] . [ label "home" . sto_to_col? . colon ] . [ label "shell" . sto_to_eol? ] in [ dels "+" . label "@nisdefault" . overrides? . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry|nisentry|nisdefault|nisuserplus|nisuserminus) * let filter = incl "/etc/passwd" let xfm = transform lns filter PKU1]2lenses/dist/sshd.augnu[(* Module: Sshd Parses /etc/ssh/sshd_config Author: David Lutterkort lutter@redhat.com Dominique Dumont dominique.dumont@hp.com About: Reference sshd_config man page. See http://www.openbsd.org/cgi-bin/man.cgi?query=sshd_config&sektion=5 About: License This file is licensed under the LGPL v2+. About: Lens Usage Sample usage of this lens in augtool: * Get your current setup > print /files/etc/ssh/sshd_config ... * Set X11Forwarding to "no" > set /files/etc/ssh/sshd_config/X11Forwarding "no" More advanced usage: * Set a Match section > set /files/etc/ssh/sshd_config/Match[1]/Condition/User "foo" > set /files/etc/ssh/sshd_config/Match[1]/Settings/X11Forwarding "yes" Saving your file: > save About: CAVEATS In sshd_config, Match blocks must be located at the end of the file. This means that any new "global" parameters (i.e. outside of a Match block) must be written before the first Match block. By default, Augeas will write new parameters at the end of the file. I.e. if you have a Match section and no ChrootDirectory parameter, this command: > set /files/etc/ssh/sshd_config/ChrootDirectory "foo" will be stored in a new node after the Match section and Augeas will refuse to save sshd_config file. To create a new parameter as the right place, you must first create a new Augeas node before the Match section: > ins ChrootDirectory before /files/etc/ssh/sshd_config/Match Then, you can set the parameter > set /files/etc/ssh/sshd_config/ChrootDirectory "foo" About: Configuration files This lens applies to /etc/ssh/sshd_config *) module Sshd = autoload xfm let eol = del /[ \t]*\n/ "\n" let sep = del /[ \t=]+/ " " let indent = del /[ \t]*/ " " let key_re = /[A-Za-z0-9]+/ - /MACs|Match|AcceptEnv|Subsystem|Ciphers|((GSSAPI|)Kex|HostKey|CASignature|PubkeyAccepted)Algorithms|PubkeyAcceptedKeyTypes|(Allow|Deny)(Groups|Users)/i let comment = Util.comment let comment_noindent = Util.comment_noindent let empty = Util.empty let array_entry (kw:regexp) (sq:string) = let bare = Quote.do_quote_opt_nil (store /[^"' \t\n=]+/) in let quoted = Quote.do_quote (store /[^"'\n]*[ \t]+[^"'\n]*/) in [ key kw . ( [ sep . seq sq . bare ] | [ sep . seq sq . quoted ] )* . eol ] let other_entry = let value = store /[^ \t\n=]+([ \t=]+[^ \t\n=]+)*/ in [ key key_re . sep . value . eol ] let accept_env = array_entry /AcceptEnv/i "AcceptEnv" let allow_groups = array_entry /AllowGroups/i "AllowGroups" let allow_users = array_entry /AllowUsers/i "AllowUsers" let deny_groups = array_entry /DenyGroups/i "DenyGroups" let deny_users = array_entry /DenyUsers/i "DenyUsers" let subsystemvalue = let value = store (/[^ \t\n=](.*[^ \t\n=])?/) in [ key /[A-Za-z0-9\-]+/ . sep . value . eol ] let subsystem = [ key /Subsystem/i . sep . subsystemvalue ] let list (kw:regexp) (sq:string) = let value = store /[^, \t\n=]+/ in [ key kw . sep . [ seq sq . value ] . ([ seq sq . Util.del_str "," . value])* . eol ] let macs = list /MACs/i "MACs" let ciphers = list /Ciphers/i "Ciphers" let kexalgorithms = list /KexAlgorithms/i "KexAlgorithms" let hostkeyalgorithms = list /HostKeyAlgorithms/i "HostKeyAlgorithms" let gssapikexalgorithms = list /GSSAPIKexAlgorithms/i "GSSAPIKexAlgorithms" let casignaturealgorithms = list /CASignatureAlgorithms/i "CASignatureAlgorithms" let pubkeyacceptedkeytypes = list /PubkeyAcceptedKeyTypes/i "PubkeyAcceptedKeyTypes" let pubkeyacceptedalgorithms = list /PubkeyAcceptedAlgorithms/i "PubkeyAcceptedAlgorithms" let entry = accept_env | allow_groups | allow_users | deny_groups | subsystem | deny_users | macs | ciphers | kexalgorithms | hostkeyalgorithms | gssapikexalgorithms | casignaturealgorithms | pubkeyacceptedkeytypes | pubkeyacceptedalgorithms | other_entry let condition_entry = let k = /[A-Za-z0-9]+/ in let no_spc = Quote.do_dquote_opt (store /[^"' \t\n=]+/) in let spc = Quote.do_quote (store /[^"'\t\n]* [^"'\t\n]*/) in [ sep . key k . sep . no_spc ] | [ sep . key k . sep . spc ] let match_cond = [ label "Condition" . condition_entry+ . eol ] let match_entry = indent . (entry | comment_noindent) | empty let match = [ key /Match/i . match_cond . [ label "Settings" . match_entry+ ] ] let lns = (entry | comment | empty)* . match* let filter = (incl "/etc/ssh/sshd_config" ) . ( incl "/etc/ssh/sshd_config.d/*.conf" ) let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) PKU1]o2lenses/dist/redis.augnu[(* Module: Redis Parses Redis's configuration files Author: Marc Fournier About: Reference This lens is based on Redis's default redis.conf About: Usage Example (start code) augtool> set /augeas/load/Redis/incl "/etc/redis/redis.conf" augtool> set /augeas/load/Redis/lens "Redis.lns" augtool> load augtool> get /files/etc/redis/redis.conf/vm-enabled /files/etc/redis/redis.conf/vm-enabled = no augtool> print /files/etc/redis/redis.conf/rename-command[1]/ /files/etc/redis/redis.conf/rename-command /files/etc/redis/redis.conf/rename-command/from = "CONFIG" /files/etc/redis/redis.conf/rename-command/to = "CONFIG2" augtool> set /files/etc/redis/redis.conf/activerehashing no augtool> save Saved 1 file(s) augtool> set /files/etc/redis/redis.conf/save[1]/seconds 123 augtool> set /files/etc/redis/redis.conf/save[1]/keys 456 augtool> save Saved 1 file(s) (end code) The file also contains various examples. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Redis = autoload xfm let k = Rx.word let v = /[^ \t\n'"]+/ let comment = Util.comment let empty = Util.empty let indent = Util.indent let eol = Util.eol let del_ws_spc = Util.del_ws_spc let dquote = Util.del_str "\"" (* View: standard_entry A standard entry is a key-value pair, separated by blank space, with optional blank spaces at line beginning & end. The value part can be optionnaly enclosed in single or double quotes. Comments at end-of-line ar NOT allowed by redis-server. *) let standard_entry = let reserved_k = "save" | "rename-command" | "replicaof" | "slaveof" | "bind" | "client-output-buffer-limit" | "sentinel" in let entry_noempty = [ indent . key (k - reserved_k) . del_ws_spc . Quote.do_quote_opt_nil (store v) . eol ] in let entry_empty = [ indent . key (k - reserved_k) . del_ws_spc . dquote . store "" . dquote . eol ] in entry_noempty | entry_empty let save = /save/ let seconds = [ label "seconds" . Quote.do_quote_opt_nil (store Rx.integer) ] let keys = [ label "keys" . Quote.do_quote_opt_nil (store Rx.integer) ] let save_val = let save_val_empty = del_ws_spc . dquote . store "" . dquote in let save_val_sec_keys = del_ws_spc . seconds . del_ws_spc . keys in save_val_sec_keys | save_val_empty (* View: save_entry Entries identified by the "save" keyword can be found more than once. They have 2 mandatory parameters, both integers or a single parameter that is empty double quoted string. The same rules as standard_entry apply for quoting, comments and whitespaces. *) let save_entry = [ indent . key save . save_val . eol ] let replicaof = /replicaof|slaveof/ let ip = [ label "ip" . Quote.do_quote_opt_nil (store Rx.ip) ] let port = [ label "port" . Quote.do_quote_opt_nil (store Rx.integer) ] (* View: replicaof_entry Entries identified by the "replicaof" keyword can be found more than once. They have 2 mandatory parameters, the 1st one is an IP address, the 2nd one is a port number. The same rules as standard_entry apply for quoting, comments and whitespaces. *) let replicaof_entry = [ indent . key replicaof . del_ws_spc . ip . del_ws_spc . port . eol ] let sentinel_global_entry = let keys = "deny-scripts-reconfig" | "current-epoch" | "myid" in store keys . del_ws_spc . [ label "value" . store ( Rx.word | Rx.integer ) ] let sentinel_cluster_setup = let keys = "config-epoch" | "leader-epoch" in store keys . del_ws_spc . [ label "cluster" . store Rx.word ] . del_ws_spc . [ label "epoch" . store Rx.integer ] let sentinel_cluster_instance_setup = let keys = "monitor" | "known-replica" in store keys . del_ws_spc . [ label "cluster" . store Rx.word ] . del_ws_spc. [ label "ip" . store Rx.ip ] . del_ws_spc . [ label "port" . store Rx.integer ] . (del_ws_spc . [ label "quorum" . store Rx.integer ])? let sentinel_clustering = let keys = "known-sentinel" in store keys . del_ws_spc . [ label "cluster" . store Rx.word ] . del_ws_spc . [ label "ip" . store Rx.ip ] . del_ws_spc . [ label "port" . store Rx.integer ] . del_ws_spc . [ label "id" . store Rx.word ] (* View: sentinel_entry *) let sentinel_entry = indent . [ key "sentinel" . del_ws_spc . (sentinel_global_entry | sentinel_cluster_setup | sentinel_cluster_instance_setup | sentinel_clustering) ] . eol (* View: bind_entry The "bind" entry can be passed one or several ip addresses. A bind statement "bind ip1 ip2 .. ipn" results in a tree { "bind" { "ip" = ip1 } { "ip" = ip2 } ... { "ip" = ipn } } *) let bind_entry = let ip = del_ws_spc . Quote.do_quote_opt_nil (store Rx.ip) in indent . [ key "bind" . [ label "ip" . ip ]+ ] . eol let renamecmd = /rename-command/ let from = [ label "from" . Quote.do_quote_opt_nil (store Rx.word) ] let to = [ label "to" . Quote.do_quote_opt_nil (store Rx.word) ] (* View: save_entry Entries identified by the "rename-command" keyword can be found more than once. They have 2 mandatory parameters, both strings. The same rules as standard_entry apply for quoting, comments and whitespaces. *) let renamecmd_entry = [ indent . key renamecmd . del_ws_spc . from . del_ws_spc . to . eol ] let cobl_cmd = /client-output-buffer-limit/ let class = [ label "class" . Quote.do_quote_opt_nil (store Rx.word) ] let hard_limit = [ label "hard_limit" . Quote.do_quote_opt_nil (store Rx.word) ] let soft_limit = [ label "soft_limit" . Quote.do_quote_opt_nil (store Rx.word) ] let soft_seconds = [ label "soft_seconds" . Quote.do_quote_opt_nil (store Rx.integer) ] (* View: client_output_buffer_limit_entry Entries identified by the "client-output-buffer-limit" keyword can be found more than once. They have four mandatory parameters, of which the first is a string, the last one is an integer and the others are either integers or words, although redis is very liberal and takes "4242yadayadabytes" as a valid limit. The same rules as standard_entry apply for quoting, comments and whitespaces. *) let client_output_buffer_limit_entry = [ indent . key cobl_cmd . del_ws_spc . class . del_ws_spc . hard_limit . del_ws_spc . soft_limit . del_ws_spc . soft_seconds . eol ] let entry = standard_entry | save_entry | renamecmd_entry | replicaof_entry | bind_entry | sentinel_entry | client_output_buffer_limit_entry (* View: lns The Redis lens *) let lns = (comment | empty | entry )* let filter = incl "/etc/redis.conf" . incl "/etc/redis/redis.conf" let xfm = transform lns filter PKU1]j)llenses/dist/netmasks.augnu[(* Module: Netmasks Parses /etc/inet/netmasks on Solaris Author: Dominic Cleal About: Reference This lens tries to keep as close as possible to `man 4 netmasks` where possible. About: Licence This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage About: Configuration files This lens applies to /etc/netmasks and /etc/inet/netmasks. See . *) module Netmasks = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES ************************************************************************) (* View: comment *) let comment = Util.comment (* View: comment_or_eol *) let comment_or_eol = Util.comment_or_eol (* View: indent *) let indent = Util.indent (* View: empty *) let empty = Util.empty (* View: sep The separator for network/mask entries *) let sep = Util.del_ws_tab (************************************************************************ * Group: ENTRIES ************************************************************************) (* View: entry Network / netmask line *) let entry = [ seq "network" . indent . [ label "network" . store Rx.ipv4 ] . sep . [ label "netmask" . store Rx.ipv4 ] . comment_or_eol ] (************************************************************************ * Group: LENS ************************************************************************) (* View: lns *) let lns = ( empty | comment | entry )* (* Variable: filter *) let filter = (incl "/etc/netmasks" . incl "/etc/inet/netmasks") let xfm = transform lns filter PKU1]7##lenses/dist/resolv.augnu[(* Module: Resolv Parses /etc/resolv.conf Author: Raphael Pinson About: Reference This lens tries to keep as close as possible to `man resolv.conf` where possible. About: Licence This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage About: Configuration files This lens applies to /etc/resolv.conf. See . *) module Resolv = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: comment *) let comment = Util.comment_generic /[ \t]*[;#][ \t]*/ "# " (* View: comment_eol *) let comment_eol = Util.comment_generic /[ \t]*[;#][ \t]*/ " # " (* View: empty *) let empty = Util.empty_generic_dos /[ \t]*[#;]?[ \t]*/ (************************************************************************ * Group: MAIN OPTIONS *************************************************************************) (* View: netmask A network mask for IP addresses *) let netmask = [ label "netmask" . Util.del_str "/" . store Rx.ip ] (* View: ipaddr An IP address or range with an optional mask *) let ipaddr = [label "ipaddr" . store Rx.ip . netmask?] (* View: nameserver A nameserver entry *) let nameserver = Build.key_value_line_comment "nameserver" Sep.space (store Rx.ip) comment_eol (* View: domain *) let domain = Build.key_value_line_comment "domain" Sep.space (store Rx.word) comment_eol (* View: search *) let search = Build.key_value_line_comment "search" Sep.space (Build.opt_list [label "domain" . store Rx.word] Sep.space) comment_eol (* View: sortlist *) let sortlist = Build.key_value_line_comment "sortlist" Sep.space (Build.opt_list ipaddr Sep.space) comment_eol (* View: lookup *) let lookup = let lookup_entry = Build.flag("bind"|"file"|"yp") in Build.key_value_line_comment "lookup" Sep.space (Build.opt_list lookup_entry Sep.space) comment_eol (* View: family *) let family = let family_entry = Build.flag("inet4"|"inet6") in Build.key_value_line_comment "family" Sep.space (Build.opt_list family_entry Sep.space) comment_eol (************************************************************************ * Group: SPECIAL OPTIONS *************************************************************************) (* View: ip6_dotint ip6-dotint option, which supports negation *) let ip6_dotint = let negate = [ del "no-" "no-" . label "negate" ] in [ negate? . key "ip6-dotint" ] (* View: options Options values *) let options = let options_entry = Build.key_value ("ndots"|"timeout"|"attempts") (Util.del_str ":") (store Rx.integer) | Build.flag ("debug"|"rotate"|"no-check-names" |"inet6"|"ip6-bytestring"|"edns0" |"single-request"|"single-request-reopen" |"no-tld-query"|"use-vc"|"no-reload" |"trust-ad") | ip6_dotint in Build.key_value_line_comment "options" Sep.space (Build.opt_list options_entry Sep.space) comment_eol (* View: entry *) let entry = nameserver | domain | search | sortlist | options | lookup | family (* View: lns *) let lns = ( empty | comment | entry )* (* Variable: filter *) let filter = (incl "/etc/resolv.conf") let xfm = transform lns filter PKU1]С0 lenses/dist/tmpfiles.augnu[(* Module: Tmpfiles Parses systemd tmpfiles.d files Author: Julien Pivotto About: Reference This lens tries to keep as close as possible to `man 5 tmpfiles.d` where possible. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files This lens applies to /etc/tmpfiles.d/*.conf /usr/lib/tmpfiles.d/*.conf and /run/tmpfiles.d/*.conf. See . About: Examples The file contains various examples and tests. *) module Tmpfiles = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Comments and empty lines *) (* View: sep_spc Space *) let sep_spc = Sep.space (* View: sep_opt_spc Optional space (for the beginning of the lines) *) let sep_opt_spc = Sep.opt_space (* View: comment Comments *) let comment = Util.comment (* View: empty Empty lines *) let empty = Util.empty (* Group: Lense-specific primitives *) (* View: type One letter. Some of them can have a "+" and all can have an exclamation mark ("!"), a minus sign ("-"), an equal sign ("="), a tilde character ("~") and/or a caret ("^"). Not all letters are valid. *) let type = /([fFwdDevqQpLcbCxXrRzZtThHaAm]|[fFwpLcbaA]\+)[-!=~^]*/ (* View: mode "-", or 3-4 bytes. Optionally starts with a "~" or a ":". *) let mode = /(-|(~|:)?[0-7]{3,4})/ (* View: age "-", or one of the formats seen in the manpage: 10d, 5seconds, 1y5days. optionally starts with a "~'. *) let age = /(-|(~?[0-9]+(s|m|min|h|d|w|ms|us|((second|minute|hour|day|week|millisecond|microsecond)s?))?)+)/ (* View: argument The last field. It can contain spaces. *) let argument = /([^# \t\n][^#\n]*[^# \t\n]|[^# \t\n])/ (* View: field Applies to the other fields: path, gid and uid fields *) let field = /[^# \t\n]+/ (* View: record A valid record, one line in the file. Only the two first fields are mandatory. *) let record = [ seq "record" . sep_opt_spc . [ label "type" . store type ] . sep_spc . [ label "path" . store field ] . ( sep_spc . [ label "mode" . store mode ] . ( sep_spc . [ label "uid" . store field ] . ( sep_spc . [ label "gid" . store field ] . ( sep_spc . [ label "age" . store age ] . ( sep_spc . [ label "argument" . store argument ] )? )? )? )? )? . Util.comment_or_eol ] (************************************************************************ * Group: THE TMPFILES LENSE *************************************************************************) (* View: lns The tmpfiles lens. Each line can be a comment, a record or empty. *) let lns = ( empty | comment | record ) * (* View: filter *) let filter = incl "/etc/tmpfiles.d/*.conf" . incl "/usr/lib/tmpfiles.d/*.conf" . incl "/run/tmpfiles.d/*.conf" let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) PKU1]8lenses/dist/dovecot.augnu[(* Module: Dovecot Parses dovecot configuration files. Author: Serge Smetana Acunote http://www.acunote.com Pluron, Inc. http://pluron.com About: License This file is licensed under the LGPL v2+. About: Configuration files This lens applies to /etc/dovecot/dovecot.conf and files in /etc/dovecot/conf.d/. See . About: Examples The file contains various examples and tests. About: TODO Support for multiline values like queries in dict-sql.conf *) module Dovecot = autoload xfm (****************************************************************** * Group: USEFUL PRIMITIVES ******************************************************************) (* View: indent *) let indent = Util.indent (* View: eol *) let eol = Util.eol (* View: empty Map empty lines. *) let empty = Util.empty (* View: comment Map comments in "#comment" nodes. *) let comment = Util.comment (* View: eq *) let eq = del /[ \t]*=/ " =" (* Variable: any *) let any = Rx.no_spaces (* Variable: value Match any value after " =". Should not start and end with spaces. May contain spaces inside *) let value = any . (Rx.space . any)* (* View: command_start *) let command_start = Util.del_str "!" (****************************************************************** * Group: ENTRIES ******************************************************************) (* Variable: commands *) let commands = /include|include_try/ (* Variable: block_names *) let block_names = /dict|userdb|passdb|protocol|service|plugin|namespace|map|fields|unix_listener|fifo_listener|inet_listener/ (* Variable: keys Match any possible key except commands and block names. *) let keys = Rx.word - (commands | block_names) (* View: entry Map simple "key = value" entries including "key =" entries with empty value. *) let entry = [ indent . key keys. eq . (Sep.opt_space . store value)? . eol ] (* View: command Map commands started with "!". *) let command = [ command_start . key commands . Sep.space . store Rx.fspath . eol ] (* View: dquote_spaces Make double quotes mandatory if value contains spaces, and optional if value doesn't contain spaces. Based off Quote.dquote_spaces Parameters: lns1:lens - the lens before lns2:lens - the lens after *) let dquote_spaces (lns1:lens) (lns2:lens) = (* bare has no spaces, and is optionally quoted *) let bare = Quote.do_dquote_opt (store /[^" \t\n]+/) (* quoted has at least one space, and must be quoted *) in let quoted = Quote.do_dquote (store /[^"\n]*[ \t]+[^"\n]*/) in [ lns1 . bare . lns2 ] | [ lns1 . quoted . lns2 ] let mailbox = indent . dquote_spaces (key /mailbox/ . Sep.space) (Build.block_newlines_spc entry comment . eol) let block_ldelim_newlines_re = /[ \t]+\{([ \t\n]*\n)?/ let block_newlines (entry:lens) (comment:lens) = let indent = del Rx.opt_space "\t" in del block_ldelim_newlines_re Build.block_ldelim_default . ((entry | comment) . (Util.empty | entry | comment)*)? . del Build.block_rdelim_newlines_re Build.block_rdelim_newlines_default (* View: block Map block enclosed in brackets recursively. Block may be indented and have optional argument. Block body may have entries, comments, empty lines, and nested blocks recursively. *) let rec block = [ indent . key block_names . (Sep.space . Quote.do_dquote_opt (store /!?[\/A-Za-z0-9_-]+/))? . block_newlines (entry|block|mailbox) comment . eol ] (****************************************************************** * Group: LENS AND FILTER ******************************************************************) (* View: lns The Dovecot lens *) let lns = (comment|empty|entry|command|block)* (* Variable: filter *) let filter = incl "/etc/dovecot/dovecot.conf" . (incl "/etc/dovecot/conf.d/*.conf") . incl "/usr/local/etc/dovecot/dovecot.conf" . (incl "/usr/local/etc/dovecot/conf.d/*.conf") . Util.stdexcl let xfm = transform lns filter PKU1]uylenses/dist/qpid.augnu[(* Module: Qpid Parses Apache Qpid daemon/client configuration files Author: Andrew Replogle About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Examples The file contains various examples and tests. *) module Qpid = autoload xfm (* View: entry *) let entry = Build.key_value_line Rx.word Sep.equal (store Rx.space_in) (* View: lns *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = incl "/etc/qpidd.conf" . incl "/etc/qpid/qpidc.conf" let xfm = transform lns filter PKU1]v44lenses/dist/automounter.augnu[(* Module: Automounter Parses automounter file based maps Author: Dominic Cleal About: Reference See autofs(5) About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files This lens applies to /etc/auto.*, auto_*, excluding known scripts. About: Examples The file contains various examples and tests. *) module Automounter = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: eol *) let eol = Util.eol (* View: empty *) let empty = Util.empty (* View: comment *) let comment = Util.comment (* View: path *) let path = /[^-+#: \t\n][^#: \t\n]*/ (* View: hostname *) let hostname = /[^-:#\(\), \n\t][^:#\(\), \n\t]*/ (* An option label can't contain comma, comment, equals, or space *) let optlabel = /[^,#:\(\)= \n\t]+/ let spec = /[^,#:\(\)= \n\t][^ \n\t]*/ (* View: weight *) let weight = Rx.integer (* View: map_name *) let map_name = /[^: \t\n]+/ (* View: entry_multimount_sep Separator for multimount entries, permits line spanning with "\" *) let entry_multimount_sep = del /[ \t]+(\\\\[ \t]*\n[ \t]+)?/ " " (************************************************************************ * Group: ENTRIES *************************************************************************) (* View: entry_key Key for a map entry *) let entry_mkey = store path (* View: entry_path Path component of an entry location *) let entry_path = [ label "path" . store path ] (* View: entry_host Host component with optional weight of an entry location *) let entry_host = [ label "host" . store hostname . ( Util.del_str "(" . [ label "weight" . store weight ] . Util.del_str ")" )? ] (* View: comma_sep_list Parses options for filesystems *) let comma_sep_list (l:string) = let value = [ label "value" . Util.del_str "=" . store Rx.neg1 ] in let lns = [ label l . store optlabel . value? ] in Build.opt_list lns Sep.comma (* View: entry_options *) let entry_options = Util.del_str "-" . comma_sep_list "opt" . Util.del_ws_tab (* View: entry_location A single location with one or more hosts, and one path *) let entry_location = ( entry_host . ( Sep.comma . entry_host )* )? . Sep.colon . entry_path (* View: entry_locations Multiple locations (each with one or more hosts), separated by spaces *) let entry_locations = [ label "location" . counter "location" . [ seq "location" . entry_location ] . ( [ Util.del_ws_spc . seq "location" . entry_location ] )* ] (* View: entry_multimount Parses one of many mountpoints given for a multimount line *) let entry_multimount = entry_mkey . Util.del_ws_tab . entry_options? . entry_locations (* View: entry_multimounts Parses multiple mountpoints given on an entry line *) let entry_multimounts = [ label "mount" . counter "mount" . [ seq "mount" . entry_multimount ] . ( [ entry_multimount_sep . seq "mount" . entry_multimount ] )* ] (* View: entry A single map entry from start to finish, including multi-mounts *) let entry = [ seq "entry" . entry_mkey . Util.del_ws_tab . entry_options? . ( entry_locations | entry_multimounts ) . Util.eol ] (* View: include An include line starting with a "+" and a map name *) let include = [ seq "entry" . store "+" . Util.del_opt_ws "" . [ label "map" . store map_name ] . Util.eol ] (* View: lns *) let lns = ( empty | comment | entry | include ) * (* Variable: filter Exclude scripts/executable maps from here *) let filter = incl "/etc/auto.*" . incl "/etc/auto_*" . excl "/etc/auto.master" . excl "/etc/auto_master" . excl "/etc/auto.net" . excl "/etc/auto.smb" . Util.stdexcl let xfm = transform lns filter PKU1]ƩIlenses/dist/termcap.augnu[(* Module: Termcap Parses termcap capability database Author: Matt Dainty About: Reference - man 5 termcap Each line represents a record consisting of a number of ':'-separated fields the first of which is the name or identifier for the record. The name can optionally be split by '|' and each subsequent value is considered an alias of the first. Records can be split across multiple lines with '\'. *) module Termcap = autoload xfm (* All termcap capabilities are two characters, optionally preceded by *) (* upto two periods and the only types are boolean, numeric or string *) let cfield = /\.{0,2}([a-zA-Z0-9]{2}|[@#%&*!][a-zA-Z0-9]|k;)(#?@|#[0-9]+|=([^:\\\\^]|\\\\[0-7]{3}|\\\\[:bBcCeEfFnNrRstT0\\^]|\^.)*)?/ let lns = ( Util.empty | Getcap.comment | Getcap.record cfield )* let filter = incl "/etc/termcap" . incl "/usr/share/misc/termcap" . Util.stdexcl let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) PKU1]0uulenses/dist/debctrl.augnu[(* Module: debctrl Parses ./debian/control Author: Dominique Dumont domi.dumont@free.fr or dominique.dumont@hp.com About: Reference http://augeas.net/page/Create_a_lens_from_bottom_to_top http://www.debian.org/doc/debian-policy/ch-controlfields.html About: License This file is licensed under the LGPL v2+. About: Lens Usage Since control file is not a system configuration file, you will have to use augtool -r option to point to 'debian' directory. Run augtool: $ augtool -r debian Sample usage of this lens in augtool: * Get the value stored in control file > print /files/control ... Saving your file: > save *) module Debctrl = autoload xfm let eol = Util.eol let del_ws_spc = del /[\t ]*/ " " let hardeol = del /\n/ "\n" let del_opt_ws = del /[\t ]*/ "" let colon = del /:[ \t]*/ ": " let simple_entry (k:regexp) = let value = store /[^ \t][^\n]+/ in [ key k . colon . value . hardeol ] let cont_line = del /\n[ \t]+/ "\n " let comma = del /,[ \t]*/ ", " let sep_comma_with_nl = del /[ \t\n]*,[ \t\n]*/ ",\n " (*= del_opt_ws . cont_line* . comma . cont_line**) let email = store ( /([A-Za-z]+ )+<[^\n>]+>/ | /[^\n,\t<> ]+/ ) let multi_line_array_entry (k:regexp) (v:lens) = [ key k . colon . [ counter "array" . seq "array" . v ] . [ seq "array" . sep_comma_with_nl . v ]* . hardeol ] (* dependency stuff *) let version_depends = [ label "version" . [ del / *\( */ " ( " . label "relation" . store /[<>=]+/ ] . [ del_ws_spc . label "number" . store ( /[a-zA-Z0-9_.-]+/ | /\$\{[a-zA-Z0-9:]+\}/ ) . del / *\)/ " )" ] ] let arch_depends = [ label "arch" . [ del / *\[ */ " [ " . label "prefix" . store /!?/ ] . [ label "name" . store /[a-zA-Z0-9_.-]+/ . del / *\]/ " ]" ] ] let package_depends = [ key ( /[a-zA-Z0-9_-]+/ | /\$\{[a-zA-Z0-9:]+\}/ ) . ( version_depends | arch_depends ) * ] let dependency = [ label "or" . package_depends ] . [ label "or" . del / *\| */ " | " . package_depends ] * let dependency_list (field:regexp) = [ key field . colon . [ label "and" . dependency ] . [ label "and" . sep_comma_with_nl . dependency ]* . eol ] (* source package *) let uploaders = multi_line_array_entry /Uploaders/ email let simple_src_keyword = "Source" | "Section" | "Priority" | "Standards\-Version" | "Homepage" | /Vcs\-Svn/ | /Vcs\-Browser/ | "Maintainer" | "DM-Upload-Allowed" | /XS?-Python-Version/ let depend_src_keywords = /Build\-Depends/ | /Build\-Depends\-Indep/ let src_entries = ( simple_entry simple_src_keyword | uploaders | dependency_list depend_src_keywords ) * (* package paragraph *) let multi_line_entry (k:string) = let line = /.*[^ \t\n].*/ in [ label k . del / / " " . store line . hardeol ] * let description = [ key "Description" . colon . [ label "summary" . store /[a-zA-Z][^\n]+/ . hardeol ] . multi_line_entry "text" ] (* binary package *) let simple_bin_keywords = "Package" | "Architecture" | "Section" | "Priority" | "Essential" | "Homepage" | "XB-Python-Version" let depend_bin_keywords = "Depends" | "Recommends" | "Suggests" | "Provides" let bin_entries = ( simple_entry simple_bin_keywords | dependency_list depend_bin_keywords ) + . description (* The whole stuff *) let lns = [ label "srcpkg" . src_entries ] . [ label "binpkg" . hardeol+ . bin_entries ]+ . eol* (* lens must be used with AUG_ROOT set to debian package source directory *) let xfm = transform lns (incl "/control") PKU1] GAjjlenses/dist/jmxaccess.augnu[(* Module: JMXAccess JMXAccess module for Augeas Author: Brian Redbeard About: Reference This lens ensures that files included in JMXAccess are properly handled by Augeas. About: License This file is licensed under the LGPL License. About: Lens Usage Sample usage of this lens in augtool: * Create a new user > ins user after /files/etc/activemq/jmx.access > set /files/etc/activemq/jmx.password/user[last()]/username redbeard > set /files/etc/activemq/jmx.password/user[last()]/access readonly ... * Delete the user named sample_user > rm /files/etc/activemq/jmx.password/user[*][username = "sample_user"] Saving your file: > save About: Configuration files This lens applies to relevant conf files located in /etc/activemq/ The following views correspond to the related files: * access_entry: /etc/activemq/jmx.access See . *) module JMXAccess = autoload xfm (* View: access_entry *) let access_entry = [ label "user" . [ label "username" . store Rx.word ] . Sep.space . [ label "access" . store /(readonly|readwrite)/i ] . Util.eol ] (* View: lns *) let lns = ( Util.comment | Util.empty | access_entry )* (* Variable: filter *) let filter = incl "/etc/activemq/jmx.access" let xfm = transform lns filter PKU1]2lenses/dist/cups.augnu[(* Module: Cups Parses cups configuration files Author: Raphael Pinson About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Examples The file contains various examples and tests. *) module Cups = autoload xfm (* View: lns *) let lns = Httpd.lns (* Variable: filter *) let filter = incl "/etc/cups/*.conf" let xfm = transform lns filter PKU1]{}}lenses/dist/interfaces.augnu[(* Interfaces module for Augeas Author: Free Ekanayaka Reference: man interfaces *) module Interfaces = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol (* Define separators *) (* a line can be extended across multiple lines by making the last *) (* character a backslash *) let sep_spc = del /([ \t]+|[ \t]*\\\\\n[ \t]*)/ " " (* Define fields *) let sto_to_eol = store /([^\\ \t\n].*[^\\ \t\n]|[^\\ \t\n])/ . eol let sto_to_spc = store /[^\\ \t\n]+/ (* Define comments and empty lines *) (* note that the comment definition from Util does not support *) (* splitting lines with a backlash *) let comment = Util.comment let empty = Util.empty (* Define tree stanza_ids *) let stanza_id (t:string) = key t . sep_spc . sto_to_spc let stanza_param (l:string) = [ sep_spc . label l . sto_to_spc ] (* Define reserved words and multi-value options *) let stanza_word = /(source(-directory)?|iface|auto|allow-[a-z-]+|mapping|bond-slaves|bridge-ports)/ (* Define stanza option indentation *) let stanza_indent = del /[ \t]*/ " " (* Define additional lines for multi-line stanzas *) let stanza_option = [ stanza_indent . key ( /[a-z0-9_-]+/ - stanza_word ) . sep_spc . sto_to_eol ] (* Define space-separated array *) let array (r:regexp) (t:string) = del r t . label t . counter t . [ sep_spc . seq t . sto_to_spc ]+ (************************************************************************ * AUTO *************************************************************************) let auto = [ array /(allow-)?auto/ "auto" . eol ] (************************************************************************ * GENERIC ALLOW *************************************************************************) let allow = [ key ( /allow-[a-z-]+/ - "allow-auto" ) . counter "allow_seq" . [ sep_spc . seq "allow_seq" . sto_to_spc ]+ . eol ] (************************************************************************ * MAPPING *************************************************************************) let mapping = [ stanza_id "mapping" . eol . (stanza_option|comment|empty)+ ] (************************************************************************ * IFACE *************************************************************************) let multi_option (t:string) = [ stanza_indent . array t t . eol ] let iface = [ Util.indent . stanza_id "iface" . stanza_param "family" . stanza_param "method" . eol . ( stanza_option | multi_option "bond-slaves" | multi_option "bridge-ports" | comment | empty )* ] (************************************************************************ * SOURCE *************************************************************************) let source = [ key "source" . sep_spc . sto_to_eol ] (************************************************************************ * SOURCE-DIRECTORY *************************************************************************) let source_directory = [ key "source-directory" . sep_spc . sto_to_eol ] (************************************************************************ * STANZAS *************************************************************************) (* The auto and hotplug stanzas always consist of one line only, while iface and mapping can spand along more lines. Comment nodes are inserted in the tree as direct children of the root node only when they come after an auto or hotplug stanza, otherwise they are considered part of an iface or mapping block *) let stanza_single = (auto|allow|source|source_directory) . (comment|empty)* let stanza_multi = iface|mapping (************************************************************************ * LENS & FILTER *************************************************************************) let lns = (comment|empty)* . (stanza_multi | stanza_single)* let filter = (incl "/etc/network/interfaces") . (incl "/etc/network/interfaces.d/*") . Util.stdexcl let xfm = transform lns filter PKU1] lenses/dist/anacron.augnu[(* Module: Anacron Parses /etc/anacrontab Author: Raphael Pinson About: Reference This lens tries to keep as close as possible to `man 5 anacrontab` where possible. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage About: Configuration files This lens applies to /etc/anacrontab. See . About: Examples The file contains various examples and tests. *) module Anacron = autoload xfm (************************************************************************ * Group: ENTRIES *************************************************************************) (************************************************************************ * View: shellvar * A shell variable in crontab *************************************************************************) let shellvar = Cron.shellvar (* View: period *) let period = [ label "period" . store Rx.integer ] (* Variable: period_name_re The valid values for . Currently only "monthly" *) let period_name_re = "monthly" (************************************************************************ * View: period_name * In the format "@keyword" *************************************************************************) let period_name = [ label "period_name" . Util.del_str "@" . store period_name_re ] (************************************************************************ * View: delay * The delay for an *************************************************************************) let delay = [ label "delay" . store Rx.integer ] (************************************************************************ * View: job_identifier * The job_identifier for an *************************************************************************) let job_identifier = [ label "job-identifier" . store Rx.word ] (************************************************************************ * View: entry * An anacrontab entry *************************************************************************) let entry = [ label "entry" . Util.indent . ( period | period_name ) . Sep.space . delay . Sep.space . job_identifier . Sep.space . store Rx.space_in . Util.eol ] (* * View: lns * The anacron lens *) let lns = ( Util.empty | Util.comment | shellvar | entry )* (* Variable: filter *) let filter = incl "/etc/anacrontab" let xfm = transform lns filter PKU1]JJ\qw w lenses/dist/cgconfig.augnu[(* Module: cgconfig Parses /etc/cgconfig.conf Author: Ivana Hutarova Varekova Raphael Pinson About: Licence This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage Sample usage of this lens in augtool * print all mounted cgroups print /files/etc/cgconfig.conf/mount About: Configuration files This lens applies to /etc/cgconfig.conf. See . *) module Cgconfig = autoload xfm let indent = Util.indent let eol = Util.eol let comment = Util.comment let empty = Util.empty let id = /[a-zA-Z0-9_\/.-]+/ let name = /[^#= \n\t{}\/]+/ let cont_name = /(cpuacct|cpu|devices|ns|cpuset|memory|freezer|net_cls|blkio|hugetlb|perf_event)/ let role_name = /(admin|task)/ let id_name = /(uid|gid|fperm|dperm)/ let address = /[^#; \n\t{}]+/ let qaddress = address|/"[^#;"\n\t{}]+"/ let lbracket = del /[ \t\n]*\{/ " {" let rbracket = del /[ \t]*\}/ "}" let eq = indent . Util.del_str "=" . indent (****************************************** * Function to deal with abc=def; entries ******************************************) let key_value (key_rx:regexp) (val_rx:regexp) = [ indent . key key_rx . eq . store val_rx . indent . Util.del_str ";" ] (* Function to deal with bracketted entries *) let brack_entry_base (lnsa:lens) (lnsb:lens) = [ indent . lnsa . lbracket . lnsb . rbracket ] let brack_entry_key (kw:regexp) (lns:lens) = let lnsa = key kw in brack_entry_base lnsa lns let brack_entry (kw:regexp) (lns:lens) = let full_lns = (lns | comment | empty)* in brack_entry_key kw full_lns (****************************************** * control groups ******************************************) let permission_setting = key_value id_name address (* task setting *) let t_info = brack_entry "task" permission_setting (* admin setting *) let a_info = brack_entry "admin" permission_setting (* permissions setting *) let perm_info = let ce = (comment|empty)* in let perm_info_lns = ce . ((t_info . ce . (a_info . ce)?) |(a_info . ce . (t_info . ce)?))? in brack_entry_key "perm" perm_info_lns let variable_setting = key_value name qaddress (* controllers setting *) let controller_info = let lnsa = label "controller" . store cont_name in let lnsb = ( variable_setting | comment | empty ) * in brack_entry_base lnsa lnsb (* group { ... } *) let group_data = let lnsa = key "group" . Util.del_ws_spc . store id in let lnsb = ( perm_info | controller_info | comment | empty )* in brack_entry_base lnsa lnsb (************************************************* * mount point *************************************************) (* controller = mount_point; *) let mount_point = key_value name address (* mount { .... } *) let mount_data = brack_entry "mount" mount_point (**************************************************** * namespace ****************************************************) (* controller = cgroup; *) let namespace_instance = key_value name address (* namespace { .... } *) let namespace = brack_entry "namespace" namespace_instance let lns = ( comment | empty | mount_data | group_data | namespace )* let xfm = transform lns (incl "/etc/cgconfig.conf") PKU1]ilenses/dist/limits.augnu[(* Limits module for Augeas Author: Free Ekanayaka Reference: /etc/security/limits.conf *) module Limits = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let comment_or_eol = Util.comment_or_eol let spc = Util.del_ws_spc let comment = Util.comment let empty = Util.empty let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ (************************************************************************ * ENTRIES *************************************************************************) let domain = label "domain" . store /[%@]?[A-Za-z0-9_.:-]+|\*/ let type_re = "soft" | "hard" | "-" let type = [ label "type" . store type_re ] let item_re = "core" | "data" | "fsize" | "memlock" | "nofile" | "rss" | "stack" | "cpu" | "nproc" | "as" | "maxlogins" | "maxsyslogins" | "priority" | "locks" | "sigpending" | "msgqueue" | "nice" | "rtprio" | "chroot" let item = [ label "item" . store item_re ] let value = [ label "value" . store /[A-Za-z0-9_.\/-]+/ ] let entry = [ domain . spc . type . spc . item . spc . value . comment_or_eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = incl "/etc/security/limits.conf" . incl "/etc/security/limits.d/*.conf" let xfm = transform lns filter PKU1]ծlenses/dist/wine.augnu[(* Lens for the textual representation of Windows registry files, as used *) (* by wine etc. *) (* This is pretty quick and dirty, as it doesn't put a lot of finesse on *) (* splitting up values that have structure, e.g. hex arrays or *) (* collections of paths. *) module Wine = (* We handle Unix and DOS line endings, though we can only add one or the *) (* other to new lines. Maybe provide a function to gather that from the *) (* current file ? *) let eol = del /[ \t]*\r?\n/ "\n" let comment = [ label "#comment" . del /[ \t]*;;[ \t]*/ ";; " . store /([^ \t\r\n].*[^ \t\r\n]|[^ \t\r\n])/ . eol ] let empty = [ eol ] let dels = Util.del_str let del_ws = Util.del_ws_spc let header = [ label "registry" . store /[a-zA-Z0-9 \t]*[a-zA-Z0-9]/ ] . del /[ \t]*Version[ \t]*/ " Version " . [ label "version" . store /[0-9.]+/ ] . eol let qstr = let re = /([^"\n]|\\\\.)*/ - /@|"@"/ in (* " Relax, emacs *) dels "\"" . store re . dels "\"" let typed_val = ([ label "type" . store /dword|hex(\\([0-9]+\\))?/ ] . dels ":" . [ label "value" . store /[a-zA-Z0-9,()]+(\\\\\r?\n[ \t]*[a-zA-Z0-9,]+)*/]) |([ label "type" . store /str\\([0-9]+\\)/ ] . dels ":" . dels "\"" . [ label "value" . store /[^"\n]*/ ] . dels "\"") (* " Relax, emacs *) let entry = let qkey = [ label "key" . qstr ] in let eq = del /[ \t]*=[ \t]*/ "=" in let qstore = [ label "value" . qstr ] in [ label "entry" . qkey . eq . (qstore|typed_val) . eol ] |[label "anon" . del /"?@"?/ "@" . eq . (qstore|typed_val) .eol ] let section = let ts = [ label "timestamp" . store Rx.integer ] in [ label "section" . del /[ \t]*\\[/ "[" . store /[^]\n]+/ . dels "]" . (del_ws . ts)? . eol . (entry|empty|comment)* ] let lns = header . (empty|comment)* . section* PKU1]fDqRlenses/dist/mongodbserver.augnu[(* Module: MongoDBServer Parses /etc/mongodb.conf Author: Brian Redbeard About: Reference For information on configuration options available to mongod reference one of the following resources: * The Mongo DB Manual - * The current options available for your operating system via: > man mongos About: License This file is licenced under the LGPL v2+, conforming to the other components of Augeas. About: Lens Usage Sample usage of this lens in augtool: * Get your current setup > print /files/etc/mongodb.conf ... * Change MongoDB port > set /files/etc/mongodb.conf/port 27117 Saving your file: > save About: Configuration files This lens applies to /etc/mongodb.conf. See . About: Examples The file contains various examples and tests. *) module MongoDBServer = autoload xfm (* View: entry *) let entry = Build.key_value_line Rx.word Sep.space_equal (store Rx.space_in) (* View: lns *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = incl "/etc/mongodb.conf" let xfm = transform lns filter PKU1]{lH lenses/dist/xymon.augnu[(* Xymon configuration By Jason Kincl - 2012 *) module Xymon = autoload xfm let empty = Util.empty let eol = Util.eol let word = Rx.word let space = Rx.space let ip = Rx.ip let del_ws_spc = Util.del_ws_spc let value_to_eol = store /[^ \t][^\n]+/ let eol_no_spc = Util.del_str "\n" let comment = Util.comment_generic /[ \t]*[;#][ \t]*/ "# " let include = [ key /include|dispinclude|netinclude|directory/ . del_ws_spc . value_to_eol . eol_no_spc ] let title = [ key "title" . del_ws_spc . value_to_eol . eol_no_spc ] (* Define host *) let tag = del_ws_spc . [ label "tag" . store /[^ \n\t]+/ ] let host_ip = [ label "ip" . store ip ] let host_hostname = [ label "fqdn" . store word ] let host_colon = del /[ \t]*#/ " #" let host = [ label "host" . host_ip . del space " " . host_hostname . host_colon . tag* . eol ] (* Define group-compress and group-only *) let group_extra = del_ws_spc . value_to_eol . eol_no_spc . (comment | empty | host | title)* let group = [ key "group" . group_extra ] let group_compress = [ key "group-compress" . group_extra ] let group_sorted = [ key "group-sorted" . group_extra ] let group_only_col = [ label "col" . store Rx.word ] let group_only_cols = del_ws_spc . group_only_col . ( Util.del_str "|" . group_only_col )* let group_only = [ key "group-only" . group_only_cols . group_extra ] (* Have to use namespacing because page's title overlaps plain title tag *) let page_name = store word let page_title = [ label "pagetitle" . del_ws_spc . value_to_eol . eol_no_spc ] let page_extra = del_ws_spc . page_name . (page_title | eol_no_spc) . (comment | empty | title | include | host)* . (group | group_compress | group_sorted | group_only)* let page = [ key /page|subpage/ . page_extra ] let subparent_parent = [ label "parent" . store word ] let subparent = [ key "subparent" . del_ws_spc . subparent_parent . page_extra ] let ospage = [ key "ospage" . del_ws_spc . store word . del_ws_spc . [ label "ospagetitle" . value_to_eol . eol_no_spc ] ] let lns = (empty | comment | include | host | title | ospage )* . (group | group_compress | group_sorted | group_only)* . (page | subparent)* let filter = incl "/etc/xymon/hosts.cfg" . incl "/etc/xymon/pages.cfg" let xfm = transform lns filter PKU1]kklenses/dist/phpvars.augnu[(* Phpvars module for Augeas Author: Free Ekanayaka Reference: PHP syntax *) module Phpvars = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let empty = Util.empty_c_style let open_php = del /<\?(php)?[ \t]*\n/i "\n[ \t\n]*)?/i "php?>\n" let sep_eq = del /[ \t\n]*=[ \t\n]*/ " = " let sep_opt_spc = Sep.opt_space let sep_spc = Sep.space let sep_dollar = del /\$/ "$" let sep_scl = del /[ \t]*;/ ";" let chr_blank = /[ \t]/ let chr_nblank = /[^ \t\n]/ let chr_any = /./ let chr_star = /\*/ let chr_nstar = /[^* \t\n]/ let chr_slash = /\// let chr_nslash = /[^\/ \t\n]/ let chr_variable = /\$[A-Za-z0-9'"_:-]+/ let sto_to_scl = store (/([^ \t\n].*[^ \t\n;]|[^ \t\n;])/ - /.*;[ \t]*(\/\/|#).*/) (* " *) let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ (************************************************************************ * COMMENTS *************************************************************************) (* Both c-style and shell-style comments are valid Default to c-style *) let comment_one_line = Util.comment_generic /[ \t]*(\/\/|#)[ \t]*/ "// " let comment_eol = Util.comment_generic /[ \t]*(\/\/|#)[ \t]*/ " // " let comment = Util.comment_multiline | comment_one_line let eol_or_comment = eol | comment_eol (************************************************************************ * ENTRIES *************************************************************************) let simple_line (kw:regexp) (lns:lens) = [ key kw . lns . sep_scl . eol_or_comment ] let global = simple_line "global" (sep_opt_spc . sep_dollar . sto_to_scl) let assignment = let arraykey = [ label "@arraykey" . store /\[[][A-Za-z0-9'"_:-]+\]/ ] in (* " *) simple_line chr_variable (arraykey? . (sep_eq . sto_to_scl)) let variable = Util.indent . assignment let classvariable = Util.indent . del /(public|var)/ "public" . Util.del_ws_spc . assignment let include = simple_line "@include" (sep_opt_spc . sto_to_scl) let generic_function (kw:regexp) (lns:lens) = let lbracket = del /[ \t]*\([ \t]*/ "(" in let rbracket = del /[ \t]*\)/ ")" in simple_line kw (lbracket . lns . rbracket) let define = let variable_re = /[A-Za-z0-9'_:-]+/ in let quote = del /["']/ "'" in let sep_comma = del /["'][ \t]*,[ \t]*/ "', " in let sto_to_rbracket = store (/[^ \t\n][^\n]*[^ \t\n\)]|[^ \t\n\)]/ - /.*;[ \t]*(\/\/|#).*/) in generic_function "define" (quote . store variable_re . sep_comma . [ label "value" . sto_to_rbracket ]) let simple_function (kw:regexp) = let sto_to_rbracket = store (/[^ \t\n][^\n]*[^ \t\n\)]|[^ \t\n\)]/ - /.*;[ \t]*(\/\/|#).*/) in generic_function kw sto_to_rbracket let entry = Util.indent . ( global | include | define | simple_function "include" | simple_function "include_once" | simple_function "echo" ) let class = let classname = key /[A-Za-z0-9'"_:-]+/ in (* " *) del /class[ \t]+/ "class " . [ classname . Util.del_ws_spc . del "{" "{" . (empty|comment|entry|classvariable)* ] . del "}" "}" (************************************************************************ * LENS *************************************************************************) let lns = open_php . (empty|comment|entry|class|variable)* . close_php let filter = incl "/etc/squirrelmail/config.php" let xfm = transform lns filter PKU1]~i&lenses/dist/monit.augnu[(* Monit module for Augeas Author: Free Ekanayaka Reference: man monit (1), section "HOW TO MONITOR" "A monit control file consists of a series of service entries and global option statements in a free-format, token-oriented syntax. Comments begin with a # and extend through the end of the line. There are three kinds of tokens in the control file: grammar keywords, numbers and strings. On a semantic level, the control file consists of three types of statements: 1. Global set-statements A global set-statement starts with the keyword set and the item to configure. 2. Global include-statement The include statement consists of the keyword include and a glob string. 3. One or more service entry statements. A service entry starts with the keyword check followed by the service type" *) module Monit = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let spc = Sep.space let comment = Util.comment let empty = Util.empty let sto_to_spc = store Rx.space_in let sto_no_spc = store Rx.no_spaces let word = Rx.word let value = Build.key_value_line word spc sto_to_spc (************************************************************************ * ENTRIES *************************************************************************) (* set statement *) let set = Build.key_value "set" spc value (* include statement *) let include = Build.key_value_line "include" spc sto_to_spc (* service statement *) let service = Build.key_value "check" spc (Build.list value spc) let entry = (set|include|service) (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = incl "/etc/monit/monitrc" . incl "/etc/monitrc" let xfm = transform lns filter PKU1]Q=lenses/dist/jettyrealm.augnu[(* Module: JettyRealm JettyRealm Properties for Augeas Author: Brian Redbeard About: Reference This lens ensures that properties files for JettyRealms are properly handled by Augeas. About: License This file is licensed under the LGPL License. About: Lens Usage Sample usage of this lens in augtool: * Create a new user > ins user after /files/etc/activemq/jetty-realm.properties/user > set /files/etc/activemq/jetty-realm.properties/user[last()]/username redbeard > set /files/etc/activemq/jetty-realm.properties/user[last()]/password testing > set /files/etc/activemq/jetty-realm.properties/user[last()]/realm admin ... * Delete the user named sample_user > rm /files/etc/activemq/jetty-realm.properties/user[*][username = "sample_user"] Saving your file: > save About: Configuration files This lens applies to jetty-realm.properties files. See . *) module JettyRealm = autoload xfm (* View: comma_sep *) let comma_sep = del /,[ \t]*/ ", " (* View: realm_entry *) let realm_entry = [ label "user" . [ label "username" . store Rx.word ] . del /[ \t]*:[ \t]*/ ": " . [ label "password" . store Rx.word ] . [ label "realm" . comma_sep . store Rx.word ]* . Util.eol ] (* View: lns *) let lns = ( Util.comment | Util.empty | realm_entry )* (* Variable: filter *) let filter = incl "/etc/activemq/jetty-realm.properties" let xfm = transform lns filter PKU1]Eīlenses/dist/fstab.augnu[(* Parsing /etc/fstab *) module Fstab = autoload xfm let sep_tab = Sep.tab let sep_spc = Sep.space let comma = Sep.comma let eol = Util.eol let comment = Util.comment let empty = Util.empty let file = /[^# \t\n]+/ (* An option label can't contain comma, comment, equals, or space *) let optlabel = /[^,#= \n\t]+/ let spec = /[^,# \n\t][^ \n\t]*/ let comma_sep_list (l:string) = let value = [ label "value" . Util.del_str "=" . ( store Rx.neg1 )? ] in let lns = [ label l . store optlabel . value? ] in Build.opt_list lns comma let record = [ seq "mntent" . Util.indent . [ label "spec" . store spec ] . sep_tab . [ label "file" . store file ] . sep_tab . comma_sep_list "vfstype" . (sep_tab . comma_sep_list "opt" . (sep_tab . [ label "dump" . store /[0-9]+/ ] . ( sep_spc . [ label "passno" . store /[0-9]+/ ])? )? )? . Util.comment_or_eol ] let lns = ( empty | comment | record ) * let filter = incl "/etc/fstab" . incl "/etc/mtab" let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) PKU1]0xbsslenses/dist/xymon_alerting.augnu[(* Module: Xymon_Alerting Parses xymon alerting files Author: Francois Maillard About: Reference This lens tries to keep as close as possible to `man 5 alerts.cfg` where possible. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Not supported File inclusion are not followed About: Configuration files This lens applies to /etc/xymon/alerts.d/*.cfg and /etc/xymon/alerts.cfg. See . About: Examples The file contains various examples and tests. *) module Xymon_Alerting = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: store_word *) let store_word = store /[^ =\t\n#]+/ (* View: comparison The greater and lesser than operators *) let comparison = store /[<>]/ (* View: equal *) let equal = Sep.equal (* View: ws *) let ws = Sep.space (* View: eol *) let eol = Util.eol (* View: ws_or_eol *) let ws_or_eol = del /([ \t]+|[ \t]*\n[ \t]*)/ " " (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* View: include *) let include = [ key "include" . ws . store_word . eol ] (************************************************************************ * Group: MACRO DEFINITION *************************************************************************) (* View: macrodefinition A string that starts with $ and that is assigned something *) let macrodefinition = [ key /\$[^ =\t\n#\/]+/ . Sep.space_equal . store Rx.space_in . eol ] (* View: flag A flag value *) let flag (kw:string) = Build.flag kw (* View: kw_word A key=value value *) let kw_word (kw:regexp) = Build.key_value kw equal store_word (************************************************************************ * Group: FILTERS *************************************************************************) (* View: page The (ex)?page filter definition *) let page = kw_word /(EX)?PAGE/ (* View: group The (ex)?group filter definition *) let group = kw_word /(EX)?GROUP/ (* View: host The (ex)?host filter definition *) let host = kw_word /(EX)?HOST/ (* View: service The (ex)?service filter definition *) let service = kw_word /(EX)?SERVICE/ (* View: color The color filter definition *) let color = kw_word "COLOR" (* View: time The time filter definition *) let time = kw_word "TIME" (* View: duration The duration filter definition *) let duration = [ key "DURATION" . [ label "operator" . comparison ] . [ label "value" . store_word ] ] (* View: recover The recover filter definition *) let recover = flag "RECOVER" (* View: notice The notice filter definition *) let notice = flag "NOTICE" (* View: rule_filter Filters are made out of any of the above filter definitions *) let rule_filter = page | group | host | service | color | time | duration | recover | notice (* View: filters One or more filters *) let filters = [ label "filters" . Build.opt_list rule_filter ws ] (* View: filters_opt Zero, one or more filters *) let filters_opt = [ label "filters" . (ws . Build.opt_list rule_filter ws)? ] (* View: kw_word_filters_opt A entry with optional filters *) let kw_word_filters_opt (kw:string) = [ key kw . equal . store_word . filters_opt ] (* View: flag_filters_opt A with optional filters *) let flag_filters_opt (kw:string) = [ key kw . filters_opt ] (************************************************************************ * Group: RECIPIENTS *************************************************************************) (* View: mail The mail recipient definition *) let mail = [ key "MAIL" . ws . store_word . filters_opt ] (* View: script The script recipient definition *) let script = [ key "SCRIPT" . ws . [ label "script" . store_word ] . ws . [ label "recipient" . store_word ] . filters_opt ] (* View: ignore The ignore recipient definition *) let ignore = flag_filters_opt "IGNORE" (* View: format The format recipient definition *) let format = kw_word_filters_opt "FORMAT" (* View: repeat The repeat recipient definition *) let repeat = kw_word_filters_opt "REPEAT" (* View: unmatched The unmatched recipient definition *) let unmatched = flag_filters_opt "UNMATCHED" (* View: stop The stop recipient definition *) let stop = flag_filters_opt "STOP" (* View: macro The macro recipient definition *) let macro = [ key /\$[^ =\t\n#\/]+/ . filters_opt ] (* View: recipient Recipients are made out of any of the above recipient definitions *) let recipient = mail | script | ignore | format | repeat | unmatched | stop | macro let recipients = [ label "recipients" . Build.opt_list recipient ws_or_eol ] (************************************************************************ * Group: RULES *************************************************************************) (* View: rule Rules are made of rule_filter and then recipients sperarated by a whitespace *) let rule = [ seq "rules" . filters . ws_or_eol . recipients . eol ] (* View: lns The Xymon_Alerting lens *) let lns = ( rule | macrodefinition | include | empty | comment )* (* Variable: filter *) let filter = incl "/etc/xymon/alerts.d/*.cfg" . incl "/etc/xymon/alerts.cfg" . Util.stdexcl let xfm = transform lns filter PKU1]e3xlenses/dist/cobblersettings.augnu[(* Parse the /etc/cobbler/settings file which is in YAML 1.0 format. The lens can handle the following constructs * key: value * key: "value" * key: 'value' * key: [value1, value2] * key: - value1 - value2 * key: key2: value1 key3: value2 Author: Bryan Kearney About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module CobblerSettings = autoload xfm let kw = /[a-zA-Z0-9_]+/ (* TODO Would be better if this stripped off the "" and '' characters *) let kv = /([^]['", \t\n#:@-]+|"[^"\n]*"|'[^'\n]*')/ let lbr = del /\[/ "[" let rbr = del /\]/ "]" let colon = del /[ \t]*:[ \t]*/ ": " let dash = del /-[ \t]*/ "- " (* let comma = del /,[ \t]*(\n[ \t]+)?/ ", " *) let comma = del /[ \t]*,[ \t]*/ ", " let eol_only = del /\n/ "\n" (* TODO Would be better to make items a child of a document *) let docmarker = /-{3}/ let eol = Util.eol let comment = Util.comment let empty = Util.empty let indent = del /[ \t]+/ "\t" let ws = del /[ \t]*/ " " let value_list = Build.opt_list [label "item" . store kv] comma let setting = [key kw . colon . store kv] . eol let simple_setting_suffix = store kv . eol let setting_list_suffix = [label "sequence" . lbr . ws . (value_list . ws)? . rbr ] . eol let indendented_setting_list_suffix = eol_only . (indent . setting)+ let indented_list_suffix = [label "list" . eol_only . ([ label "value" . indent . dash . store kv] . eol)+] (* Break out setting because of a current bug in augeas *) let nested_setting = [key kw . colon . ( (* simple_setting_suffix | *) setting_list_suffix | indendented_setting_list_suffix | indented_list_suffix ) ] let document = [label "---" . store docmarker] . eol let lns = (document | comment | empty | setting | nested_setting )* let xfm = transform lns (incl "/etc/cobbler/settings") (* Local Variables: *) (* mode: caml *) (* End: *) PKU1]h6lenses/dist/json.augnu[module Json = (* A generic lens for Json files *) (* Based on the following grammar from http://www.json.org/ *) (* Object ::= '{'Members ? '}' *) (* Members ::= Pair+ *) (* Pair ::= String ':' Value *) (* Array ::= '[' Elements ']' *) (* Elements ::= Value ( "," Value )* *) (* Value ::= String | Number | Object | Array | "true" | "false" | "null" *) (* String ::= "\"" Char* "\"" *) (* Number ::= /-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?/ *) let ws = del /[ \t\n]*/ "" let comment = Util.empty_c_style | Util.comment_c_style | Util.comment_multiline let comments = comment* . Sep.opt_space let comma = Util.del_str "," . comments let colon = Util.del_str ":" . comments let lbrace = Util.del_str "{" . comments let rbrace = Util.del_str "}" let lbrack = Util.del_str "[" . comments let rbrack = Util.del_str "]" (* This follows the definition of 'string' at https://www.json.org/ It's a little wider than what's allowed there as it would accept nonsensical \u escapes *) let str_store = Quote.dquote . store /([^\\"]|\\\\["\/bfnrtu\\])*/ . Quote.dquote let number = [ label "number" . store /-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?/ . comments ] let str = [ label "string" . str_store . comments ] let const (r:regexp) = [ label "const" . store r . comments ] let fix_value (value:lens) = let array = [ label "array" . lbrack . ( ( Build.opt_list value comma . rbrack . comments ) | (rbrack . ws) ) ] in let pair = [ label "entry" . str_store . ws . colon . value ] in let obj = [ label "dict" . lbrace . ( ( Build.opt_list pair comma. rbrace . comments ) | (rbrace . ws ) ) ] in (str | number | obj | array | const /true|false|null/) (* Process arbitrarily deeply nested JSON objects *) let rec rlns = fix_value rlns let lns = comments . rlns PKU1]H y[[lenses/dist/authorized_keys.augnu[(* Module: Authorized_Keys Parses SSH authorized_keys Author: Raphael Pinson About: Reference This lens tries to keep as close as possible to `man 5 authorized_keys` where possible. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files This lens applies to SSH authorized_keys. See . About: Examples The file contains various examples and tests. *) module Authorized_Keys = autoload xfm (* View: option A key option *) let option = let kv_re = "command" | "environment" | "from" | "permitopen" | "principals" | "tunnel" in let flag_re = "cert-authority" | "no-agent-forwarding" | "no-port-forwarding" | "no-pty" | "no-user-rc" | "no-X11-forwarding" in let option_value = Util.del_str "\"" . store /((\\\\")?[^\\\n"]*)+/ . Util.del_str "\"" in Build.key_value kv_re Sep.equal option_value | Build.flag flag_re (* View: key_options A list of key