File manager - Edit - /home/ferretapmx/public_html/augeas.tar
Back
lenses/abrt.aug 0000644 00000000646 15231153062 0007467 0 ustar 00 module Abrt = autoload xfm let lns = Libreport.lns let filter = (incl "/etc/abrt/*" ) . (excl "/etc/abrt/plugins") . (incl "/etc/abrt/plugins/*") . (incl "/usr/share/abrt/conf.d/*") . (excl "/usr/share/abrt/conf.d/plugins") . (incl "/usr/share/abrt/conf.d/plugins/*") . Util.stdexcl let xfm = transform lns filter lenses/dist/rabbitmq.aug 0000644 00000007352 15231153062 0011304 0 ustar 00 (* Module: Rabbitmq Parses Rabbitmq configuration files Author: Raphael Pinson <raphael.pinson@camptocamp.com> About: Reference This lens tries to keep as close as possible to `http://www.rabbitmq.com/configure.html` 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 Rabbitmq configuration files. See <filter>. About: Examples The <Test_Rabbitmq> file contains various examples and tests. *) module Rabbitmq = autoload xfm (* View: listeners A tcp/ssl listener *) let listeners = let value = Erlang.make_value Erlang.integer | Erlang.tuple Erlang.quoted Erlang.integer in Erlang.list /(tcp|ssl)_listeners/ value (* View: ssl_options (Incomplete) list of SSL options *) let ssl_options = let option = Erlang.value /((ca)?cert|key)file/ Erlang.path | Erlang.value "verify" Erlang.bare | Erlang.value "verify_fun" Erlang.boolean | Erlang.value /fail_if_no_peer_cert|reuse_sessions/ Erlang.boolean | Erlang.value "depth" Erlang.integer | Erlang.value "password" Erlang.quoted in Erlang.list "ssl_options" option (* View: disk_free_limit *) let disk_free_limit = let value = Erlang.integer | Erlang.tuple Erlang.bare Erlang.decimal in Erlang.value "disk_free_limit" value (* View: log_levels *) let log_levels = let category = Erlang.tuple Erlang.bare Erlang.bare in Erlang.list "log_levels" category (* View: cluster_nodes Can be a tuple `(nodes, node_type)` or simple `nodes` *) let cluster_nodes = let nodes = Erlang.opt_list (Erlang.make_value Erlang.quoted) in let value = Erlang.tuple nodes Erlang.bare | nodes in Erlang.value "cluster_nodes" value (* View: tcp_listen_options *) let tcp_listen_options = let value = Erlang.make_value Erlang.bare | Erlang.tuple Erlang.bare Erlang.bare in Erlang.list "tcp_listen_options" value (* View: parameters Top-level parameters for the lens *) let parameters = listeners | ssl_options | disk_free_limit | log_levels | Erlang.value "vm_memory_high_watermark" Erlang.decimal | Erlang.value "frame_max" Erlang.integer | Erlang.value "heartbeat" Erlang.integer | Erlang.value /default_(vhost|user|pass)/ Erlang.glob | Erlang.value_list "default_user_tags" Erlang.bare | Erlang.value_list "default_permissions" Erlang.glob | cluster_nodes | Erlang.value_list "server_properties" Erlang.bare | Erlang.value "collect_statistics" Erlang.bare | Erlang.value "collect_statistics_interval" Erlang.integer | Erlang.value_list "auth_mechanisms" Erlang.quoted | Erlang.value_list "auth_backends" Erlang.bare | Erlang.value "delegate_count" Erlang.integer | Erlang.value_list "trace_vhosts" Erlang.bare | tcp_listen_options | Erlang.value "hipe_compile" Erlang.boolean | Erlang.value "msg_store_index_module" Erlang.bare | Erlang.value "backing_queue_module" Erlang.bare | Erlang.value "msg_store_file_size_limit" Erlang.integer | Erlang.value "queue_index_max_ journal_entries" Erlang.integer (* View: rabbit The rabbit <Erlang.application> config *) let rabbit = Erlang.application "rabbit" parameters (* View: lns A top-level <Erlang.config> *) let lns = Erlang.config rabbit (* Variable: filter *) let filter = incl "/etc/rabbitmq/rabbitmq.config" let xfm = transform lns filter lenses/dist/networks.aug 0000644 00000002134 15231153062 0011350 0 ustar 00 (* Module: Networks Parses /etc/networks Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 networks` 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/networks. See <filter>. *) module Networks = autoload xfm (* View: ipv4 A network IP, trailing .0 may be omitted *) let ipv4 = let dot = "." in let digits = /(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/ in digits . (dot . digits . (dot . digits . (dot . digits)?)?)? (*View: entry *) let entry = let alias = [ seq "alias" . store Rx.word ] in [ seq "network" . counter "alias" . [ label "name" . store Rx.word ] . [ Sep.space . label "number" . store ipv4 ] . [ Sep.space . label "aliases" . Build.opt_list alias Sep.space ]? . (Util.eol|Util.comment) ] (* View: lns *) let lns = ( Util.empty | Util.comment | entry )* (* View: filter *) let filter = incl "/etc/networks" let xfm = transform lns filter lenses/dist/dns_zone.aug 0000644 00000005623 15231153062 0011321 0 ustar 00 (* Module: Dns_Zone Lens for parsing DNS zone files Authors: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> About: Reference RFC 1035, RFC 2782, RFC 3403 About: License This file is licensed under the LGPL v2+ *) module Dns_Zone = autoload xfm let eol = del /([ \t\n]*(;[^\n]*)?\n)+/ "\n" let opt_eol = del /([ \t\n]*(;[^\n]*)?\n)*/ "" let ws = del /[ \t]+|(([ \t\n]*;[^\n]*)?\n)+[ \t]*/ " " let opt_ws = del /(([ \t\n]*;[^\n]*)?\n)*[ \t]*/ "" let token = /([^ \t\n";()\\]|\\\\.)+|"([^"\\]|\\\\.)*"/ let control = [ key /\$[^ \t\n\/]+/ . Util.del_ws_tab . store token . eol ] let labeled_token (lbl:string) (re:regexp) (sep:lens) = [ label lbl . store re . sep ] let regexp_token (lbl:string) (re:regexp) = labeled_token lbl re Util.del_ws_tab let type_token (re:regexp) = regexp_token "type" re let simple_token (lbl:string) = regexp_token lbl token let enclosed_token (lbl:string) = labeled_token lbl token ws let last_token (lbl:string) = labeled_token lbl token eol let class_re = /IN/ let ttl = regexp_token "ttl" /[0-9]+[DHMWdhmw]?/ let class = regexp_token "class" class_re let rr = let simple_type = /[A-Z]+/ - class_re - /MX|NAPTR|SOA|SRV/ in type_token simple_type . last_token "rdata" let mx = type_token "MX" . simple_token "priority" . last_token "exchange" let naptr = type_token "NAPTR" . simple_token "order" . simple_token "preference" . simple_token "flags" . simple_token "service" . simple_token "regexp" . last_token "replacement" let soa = type_token "SOA" . simple_token "mname" . simple_token "rname" . Util.del_str "(" . opt_ws . enclosed_token "serial" . enclosed_token "refresh" . enclosed_token "retry" . enclosed_token "expiry" . labeled_token "minimum" token opt_ws . Util.del_str ")" . eol let srv = type_token "SRV" . simple_token "priority" . simple_token "weight" . simple_token "port" . last_token "target" let record = seq "owner" . ((ttl? . class?) | (class . ttl)) . (rr|mx|naptr|soa|srv) let ws_record = [ Util.del_ws_tab . record ] let records (k:regexp) = [ key k . counter "owner" . ws_record+ ] let any_record_block = records /[^ \t\n;\/$][^ \t\n;\/]*/ let non_root_records = records /@[^ \t\n;\/]+|[^ \t\n;\/$@][^ \t\n;\/]*/ let root_records = [ del /@?/ "@" . Util.del_ws_tab . label "@" . counter "owner" . [ record ] . ws_record* ] let lns = opt_eol . control* . ( (root_records|non_root_records) . (control|any_record_block)* )? let filter = incl "/var/bind/pri/*.zone" let xfm = transform Dns_Zone.lns filter lenses/dist/activemq_conf.aug 0000644 00000002745 15231153062 0012322 0 ustar 00 (* Module: ActiveMQ_Conf ActiveMQ / FuseMQ conf module for Augeas Author: Brian Redbeard <redbeard@dead-city.org> About: Reference This lens ensures that conf files included in ActiveMQ /FuseMQ 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: * Get your current setup > print /files/etc/activemq.conf ... * Change ActiveMQ Home > set /files/etc/activemq.conf/ACTIVEMQ_HOME /usr/share/activemq Saving your file: > save About: Configuration files This lens applies to relevant conf files located in /etc/activemq/ and the file /etc/activemq.conf . See <filter>. *) module ActiveMQ_Conf = autoload xfm (* Variable: blank_val *) let blank_val = del /^\z/ (* View: entry *) let entry = Build.key_value_line Rx.word Sep.space_equal Quote.any_opt (* View: empty_entry *) let empty_entry = Build.key_value_line Rx.word Sep.equal Quote.dquote_opt_nil (* View: lns *) let lns = (Util.empty | Util.comment | entry | empty_entry )* (* Variable: filter *) let filter = incl "/etc/activemq.conf" . incl "/etc/activemq/*" . excl "/etc/activemq/*.xml" . excl "/etc/activemq/jmx.*" . excl "/etc/activemq/jetty-realm.properties" . excl "/etc/activemq/*.ts" . excl "/etc/activemq/*.ks" . excl "/etc/activemq/*.cert" . Util.stdexcl let xfm = transform lns filter lenses/dist/aliases.aug 0000644 00000004267 15231153062 0011126 0 ustar 00 (* Module: Aliases Parses /etc/aliases Author: David Lutterkort <lutter@redhat.com> About: Reference This lens tries to keep as close as possible to `man 5 aliases` where possible. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage See <lns>. About: Configuration files This lens applies to /etc/aliases. About: Examples The <Test_Aliases> file contains various examples and tests. *) module Aliases = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: basic tokens *) (* Variable: word *) let word = /[^|", \t\n]+/ (* Variable: name *) let name = /([^ \t\n#:|@]+|"[^"|\n]*")/ (* " make emacs calm down *) (* Variable: command * a command can contain spaces, if enclosed in double quotes, the case * without spaces is taken care with <word> *) let command = /(\|([^", \t\n]+|"[^"\n]+"))|("\|[^"\n]+")/ (* Group: Comments and empty lines *) (* View: eol *) let eol = Util.eol (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* Group: separators *) (* View: colon * Separation between the alias and it's destinations *) let colon = del /[ \t]*:[ \t]*/ ":\t" (* View: comma * Separation between multiple destinations *) let comma = del /[ \t]*,[ \t]*(\n[ \t]+)?/ ", " (* Group: alias *) (* View: destination * Can be either a word (no spaces included) or a command with spaces *) let destination = ( word | command ) (* View: value_list * List of destinations *) let value_list = Build.opt_list ([ label "value" . store destination]) comma (* View: alias * a name with one or more destinations *) let alias = [ seq "alias" . [ label "name" . store name ] . colon . value_list ] . eol (* View: lns *) let lns = (comment | empty | alias)* let xfm = transform lns (incl "/etc/aliases") (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/logrotate.aug 0000644 00000010251 15231153062 0011473 0 ustar 00 (* Logrotate module for Augeas *) (* Author: Raphael Pinson <raphink@gmail.com> *) (* Patches from: *) (* Sean Millichamp <sean@bruenor.org> *) (* *) (* Supported : *) (* - defaults *) (* - rules *) (* - (pre|post)rotate entries *) (* *) (* Todo : *) (* *) module Logrotate = autoload xfm let sep_spc = Sep.space let sep_val = del /[ \t]*=[ \t]*|[ \t]+/ " " let eol = Util.eol let num = Rx.relinteger let word = /[^,#= \n\t{}]+/ let filename = /\/[^,#= \n\t{}]+/ let size = num . /[kMG]?/ let indent = del Rx.opt_space "\t" (* define omments and empty lines *) let comment = Util.comment let empty = Util.empty (* Useful functions *) let list_item = [ sep_spc . key /[^\/+,# \n\t{}]+/ ] let select_to_eol (kw:string) (select:regexp) = [ label kw . store select ] let value_to_eol (kw:string) (value:regexp) = Build.key_value kw sep_val (store value) let flag_to_eol (kw:string) = Build.flag kw let list_to_eol (kw:string) = [ key kw . list_item+ ] (* Defaults *) let create = let mode = sep_spc . [ label "mode" . store num ] in let owner = sep_spc . [ label "owner" . store word ] in let group = sep_spc . [ label "group" . store word ] in [ key "create" . ( mode | mode . owner | mode . owner . group )? ] let su = let owner = sep_spc . [ label "owner" . store word ] in let group = sep_spc . [ label "group" . store word ] in [ key "su" . ( owner | owner . group )? ] let tabooext = [ key "tabooext" . ( sep_spc . store /\+/ )? . list_item+ ] let attrs = select_to_eol "schedule" /(daily|weekly|monthly|yearly)/ | value_to_eol "rotate" num | create | flag_to_eol "nocreate" | su | value_to_eol "include" word | select_to_eol "missingok" /(no)?missingok/ | select_to_eol "compress" /(no)?compress/ | select_to_eol "delaycompress" /(no)?delaycompress/ | select_to_eol "ifempty" /(not)?ifempty/ | select_to_eol "sharedscripts" /(no)?sharedscripts/ | value_to_eol "size" size | tabooext | value_to_eol "olddir" word | flag_to_eol "noolddir" | value_to_eol "mail" word | flag_to_eol "mailfirst" | flag_to_eol "maillast" | flag_to_eol "nomail" | value_to_eol "errors" word | value_to_eol "extension" word | select_to_eol "dateext" /(no)?dateext/ | value_to_eol "dateformat" word | value_to_eol "compresscmd" word | value_to_eol "uncompresscmd" word | value_to_eol "compressext" word | list_to_eol "compressoptions" | select_to_eol "copy" /(no)?copy/ | select_to_eol "copytruncate" /(no)?copytruncate/ | value_to_eol "maxage" num | value_to_eol "minsize" size | value_to_eol "maxsize" size | select_to_eol "shred" /(no)?shred/ | value_to_eol "shredcycles" num | value_to_eol "start" num (* Define hooks *) let hook_lines = let line_re = /.*/ - /[ \t]*endscript[ \t]*/ in store ( line_re . ("\n" . line_re)* )? . Util.del_str "\n" let hooks = let hook_names = /(pre|post)rotate|(first|last)action/ in [ key hook_names . eol . hook_lines? . del /[ \t]*endscript/ "\tendscript" ] (* Define rule *) let body = Build.block_newlines (indent . (attrs | hooks) . eol) Util.comment let rule = let filename_entry = [ label "file" . store filename ] in let filename_sep = del /[ \t\n]+/ " " in let filenames = Build.opt_list filename_entry filename_sep in [ label "rule" . Util.indent . filenames . body . eol ] let lns = ( comment | empty | (attrs . eol) | rule )* let filter = incl "/etc/logrotate.d/*" . incl "/etc/logrotate.conf" . Util.stdexcl let xfm = transform lns filter lenses/dist/httpd.aug 0000644 00000007521 15231153062 0010624 0 ustar 00 (* Apache HTTPD lens for Augeas Authors: David Lutterkort <lutter@redhat.com> Francis Giraldeau <francis.giraldeau@usherbrooke.ca> Raphael Pinson <raphink@gmail.com> About: Reference Online Apache configuration manual: http://httpd.apache.org/docs/trunk/ About: License This file is licensed under the LGPL v2+. About: Lens Usage Sample usage of this lens in augtool Apache configuration is represented by two main structures, nested sections and directives. Sections are used as labels, while directives are kept as a value. Sections and directives can have positional arguments inside values of "arg" nodes. Arguments of sections must be the firsts child of the section node. This lens doesn't support automatic string quoting. Hence, the string must be quoted when containing a space. Create a new VirtualHost section with one directive: > clear /files/etc/apache2/sites-available/foo/VirtualHost > set /files/etc/apache2/sites-available/foo/VirtualHost/arg "172.16.0.1:80" > set /files/etc/apache2/sites-available/foo/VirtualHost/directive "ServerAdmin" > set /files/etc/apache2/sites-available/foo/VirtualHost/*[self::directive="ServerAdmin"]/arg "admin@example.com" About: Configuration files This lens applies to files in /etc/httpd and /etc/apache2. See <filter>. *) module Httpd = autoload xfm (****************************************************************** * Utilities lens *****************************************************************) let dels (s:string) = del s s (* deal with continuation lines *) let sep_spc = del /([ \t]+|[ \t]*\\\\\r?\n[ \t]*)/ " " let sep_osp = Sep.opt_space let sep_eq = del /[ \t]*=[ \t]*/ "=" let nmtoken = /[a-zA-Z:_][a-zA-Z0-9:_.-]*/ let word = /[a-zA-Z][a-zA-Z0-9._-]*/ let comment = Util.comment let eol = Util.doseol let empty = Util.empty_dos let indent = Util.indent (* borrowed from shellvars.aug *) let char_arg_dir = /[^\\ '"\t\r\n]|\\\\"|\\\\'/ let char_arg_sec = /[^ '"\t\r\n>]|\\\\"|\\\\'/ let cdot = /\\\\./ let cl = /\\\\\n/ let dquot = let no_dquot = /[^"\\\r\n]/ in /"/ . (no_dquot|cdot|cl)* . /"/ let squot = let no_squot = /[^'\\\r\n]/ in /'/ . (no_squot|cdot|cl)* . /'/ let comp = /[<>=]?=/ (****************************************************************** * Attributes *****************************************************************) let arg_dir = [ label "arg" . store (char_arg_dir+|dquot|squot) ] let arg_sec = [ label "arg" . store (char_arg_sec+|comp|dquot|squot) ] let argv (l:lens) = l . (sep_spc . l)* let directive = [ indent . label "directive" . store word . (sep_spc . argv arg_dir)? . eol ] let section (body:lens) = (* opt_eol includes empty lines *) let opt_eol = del /([ \t]*#?\r?\n)*/ "\n" in let inner = (sep_spc . argv arg_sec)? . sep_osp . dels ">" . opt_eol . ((body|comment) . (body|empty|comment)*)? . indent . dels "</" in let kword = key word in let dword = del word "a" in [ indent . dels "<" . square kword inner dword . del ">" ">" . eol ] let rec content = section (content|directive) let lns = (content|directive|comment|empty)* let filter = (incl "/etc/apache2/apache2.conf") . (incl "/etc/apache2/httpd.conf") . (incl "/etc/apache2/ports.conf") . (incl "/etc/apache2/conf.d/*") . (incl "/etc/apache2/conf-available/*.conf") . (incl "/etc/apache2/mods-available/*") . (incl "/etc/apache2/sites-available/*") . (incl "/etc/httpd/conf.d/*.conf") . (incl "/etc/httpd/httpd.conf") . (incl "/etc/httpd/conf/httpd.conf") . Util.stdexcl let xfm = transform lns filter lenses/dist/modules.aug 0000644 00000001345 15231153062 0011147 0 ustar 00 (* Module: Modules Parses /etc/modules About: Reference This lens tries to keep as close as possible to `man 5 modules` 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/modules. See <filter>. *) module Modules = autoload xfm (* View: word *) let word = /[^#, \n\t\/]+/ (* View: sto_line *) let sto_line = store /[^# \t\n].*[^ \t\n]|[^# \t\n]/ (* View: record *) let record = [ key word . (Util.del_ws_tab . sto_line)? . Util.eol ] (* View: lns *) let lns = ( Util.empty | Util.comment | record ) * (* View: filter *) let filter = incl "/etc/modules" let xfm = transform lns filter lenses/dist/quote.aug 0000644 00000015324 15231153062 0010636 0 ustar 00 (* Module: Quote Generic module providing useful primitives for quoting Author: Raphael Pinson <raphael.pinson@camptocamp.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage This is a generic module which doesn't apply to files directly. You can use its definitions to build lenses that require quoted values. It provides several levels of definitions, allowing to define more or less fine-grained quoted values: - the quote separators are separators that are useful to define quoted values; - the quoting functions are useful wrappers to easily enclose a lens in various kinds of quotes (single, double, any, optional or not); - the quoted values definitions are common quoted patterns. They use the quoting functions in order to provide useful shortcuts for commonly met needs. In particular, the <quote_spaces> (and similar) function force values that contain spaces to be quoted, but allow values without spaces to be unquoted. About: Examples The <Test_Quote> file contains various examples and tests. *) module Quote = (* Group: QUOTE SEPARATORS *) (* Variable: dquote A double quote *) let dquote = Util.del_str "\"" (* Variable: dquote_opt An optional double quote, default to double *) let dquote_opt = del /"?/ "\"" (* Variable: dquote_opt_nil An optional double quote, default to nothing *) let dquote_opt_nil = del /"?/ "" (* Variable: squote A single quote *) let squote = Util.del_str "'" (* Variable: squote_opt An optional single quote, default to single *) let squote_opt = del /'?/ "'" (* Variable: squote_opt_nil An optional single quote, default to nothing *) let squote_opt_nil = del /'?/ "" (* Variable: quote A quote, either double or single, default to double *) let quote = del /["']/ "\"" (* Variable: quote_opt An optional quote, either double or single, default to double *) let quote_opt = del /["']?/ "\"" (* Variable: quote_opt_nil An optional quote, either double or single, default to nothing *) let quote_opt_nil = del /["']?/ "" (* Group: QUOTING FUNCTIONS *) (* View: do_dquote Enclose a lens in <dquote>s Parameters: body:lens - the lens to be enclosed *) let do_dquote (body:lens) = square dquote body dquote (* View: do_dquote_opt Enclose a lens in optional <dquote>s, use <dquote>s by default. Parameters: body:lens - the lens to be enclosed *) let do_dquote_opt (body:lens) = square dquote_opt body dquote_opt (* View: do_dquote_opt_nil Enclose a lens in optional <dquote>s, default to no quotes. Parameters: body:lens - the lens to be enclosed *) let do_dquote_opt_nil (body:lens) = square dquote_opt_nil body dquote_opt_nil (* View: do_squote Enclose a lens in <squote>s Parameters: body:lens - the lens to be enclosed *) let do_squote (body:lens) = square squote body squote (* View: do_squote_opt Enclose a lens in optional <squote>s, use <squote>s by default. Parameters: body:lens - the lens to be enclosed *) let do_squote_opt (body:lens) = square squote_opt body squote_opt (* View: do_squote_opt_nil Enclose a lens in optional <squote>s, default to no quotes. Parameters: body:lens - the lens to be enclosed *) let do_squote_opt_nil (body:lens) = square squote_opt_nil body squote_opt_nil (* View: do_quote Enclose a lens in <quote>s. Parameters: body:lens - the lens to be enclosed *) let do_quote (body:lens) = square quote body quote (* View: do_quote Enclose a lens in options <quote>s. Parameters: body:lens - the lens to be enclosed *) let do_quote_opt (body:lens) = square quote_opt body quote_opt (* View: do_quote Enclose a lens in options <quote>s, default to no quotes. Parameters: body:lens - the lens to be enclosed *) let do_quote_opt_nil (body:lens) = square quote_opt_nil body quote_opt_nil (* Group: QUOTED VALUES *) (* View: double A double-quoted value *) let double = let body = store /[^\n]*/ in do_dquote body (* Variable: double_opt_re The regexp to store when value is optionally double-quoted *) let double_opt_re = /[^\n\t "]([^\n"]*[^\n\t "])?/ (* View: double_opt An optionaly double-quoted value Double quotes are not allowed in value Value cannot begin or end with spaces *) let double_opt = let body = store double_opt_re in do_dquote_opt body (* View: single A single-quoted value *) let single = let body = store /[^\n]*/ in do_squote body (* Variable: single_opt_re The regexp to store when value is optionally single-quoted *) let single_opt_re = /[^\n\t ']([^\n']*[^\n\t '])?/ (* View: single_opt An optionaly single-quoted value Single quotes are not allowed in value Value cannot begin or end with spaces *) let single_opt = let body = store single_opt_re in do_squote_opt body (* View: any A quoted value *) let any = let body = store /[^\n]*/ in do_quote body (* Variable: any_opt_re The regexp to store when value is optionally single- or double-quoted *) let any_opt_re = /[^\n\t "']([^\n"']*[^\n\t "'])?/ (* View: any_opt An optionaly quoted value Double or single quotes are not allowed in value Value cannot begin or end with spaces *) let any_opt = let body = store any_opt_re in do_quote_opt body (* View: quote_spaces Make quotes mandatory if value contains spaces, and optional if value doesn't contain spaces. Parameters: lns:lens - the lens to be enclosed *) let quote_spaces (lns:lens) = (* bare has no spaces, and is optionally quoted *) let bare = Quote.do_quote_opt (store /[^"' \t\n]+/) (* quoted has at least one space, and must be quoted *) in let quoted = Quote.do_quote (store /[^"'\n]*[ \t]+[^"'\n]*/) in [ lns . bare ] | [ lns . quoted ] (* View: dquote_spaces Make double quotes mandatory if value contains spaces, and optional if value doesn't contain spaces. Parameters: lns:lens - the lens to be enclosed *) let dquote_spaces (lns: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 [ lns . bare ] | [ lns . quoted ] (* View: squote_spaces Make single quotes mandatory if value contains spaces, and optional if value doesn't contain spaces. Parameters: lns:lens - the lens to be enclosed *) let squote_spaces (lns:lens) = (* bare has no spaces, and is optionally quoted *) let bare = Quote.do_squote_opt (store /[^' \t\n]+/) (* quoted has at least one space, and must be quoted *) in let quoted = Quote.do_squote (store /[^'\n]*[ \t]+[^'\n]*/) in [ lns . bare ] | [ lns . quoted ] lenses/dist/cobblersettings.aug 0000644 00000004365 15231153062 0012675 0 ustar 00 (* Parse the /etc/cobbler/settings file which is in YAML 1.0 format. The lens can handle the following contructs * 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 '' chracters *) 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: *) lenses/dist/openshift_quickstarts.aug 0000644 00000002107 15231153062 0014130 0 ustar 00 (* Module: OpenShift_Quickstarts Parses - /etc/openshift/quickstarts.json Author: Brian Redbeard <redbeard@dead-city.org> 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/openshift/quickstarts.json ... * Delete the quickstart named WordPress > rm /files/etc/openshift/quickstarts.json/array/dict[*]/entry/dict/entry[*][string = 'WordPress']/../../../ Saving your file: > save About: Configuration files /etc/openshift/quickstarts.json - Quickstarts available via the OpenShift Console. About: Examples The <Test_OpenShift_Quickstarts> file contains various examples and tests. *) module OpenShift_Quickstarts = autoload xfm (* View: json *) let json = Json.lns (* View: lns *) let lns = (Util.empty | json )* (* Variable: filter *) let filter = incl "/etc/openshift/quickstarts.json" let xfm = transform lns filter (* vim: set ts=4 expandtab sw=4: *) lenses/dist/smbusers.aug 0000644 00000001353 15231153062 0011341 0 ustar 00 (* Module: SmbUsers Parses Samba username maps Author: Raphael Pinson <raphink@gmail.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Examples The <Test_SmbUsers> file contains various examples and tests. *) module SmbUsers = autoload xfm (* View: entry *) let entry = let username = [ label "username" . store Rx.no_spaces ] in let usernames = Build.opt_list username Sep.space in Build.key_value_line Rx.word Sep.space_equal usernames (* View: lns *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = incl "/etc/samba/smbusers" . incl "/etc/samba/usermap.txt" let xfm = transform lns filter lenses/dist/json.aug 0000644 00000003655 15231153062 0010456 0 ustar 00 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 spc = /[ \t\n]*/ let ws = del spc "" let eol = del spc "\n" let delim (c:string) (d:string) = del (c . spc) d let dels (s:string) = del s s let comma = delim "," "," let colon = delim ":" ":" let lbrace = delim "{" "{" let rbrace = delim "}" "}" let lbrack = delim "[" "[" let rbrack = delim "]" "]" let str_store = let q = del "\"" "\"" in q . store /[^"]*/ . q . ws (* " Emacs, relax *) let number = [ label "number" . store /-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?/ . ws ] let str = [ label "string" . str_store ] let const (r:regexp) = [ label "const" . store r . ws ] let value0 = str | number | const /true|false|null/ let fix_value (value:lens) = let array = [ label "array" . lbrack . (Build.opt_list value comma)? . rbrack ] in let pair = [ label "entry" . str_store . colon . value ] in let obj = [ label "dict" . lbrace . (Build.opt_list pair comma)? . rbrace ] in (str | number | obj | array | const /true|false|null/) (* Typecheck finitely deep nesting *) let value1 = fix_value value0 let value2 = fix_value value1 (* Process arbitrarily deeply nested JSON objects *) let rec rlns = fix_value rlns let lns = ws . rlns lenses/dist/redis.aug 0000644 00000011142 15231153062 0010601 0 ustar 00 (* Module: Redis Parses Redis's configuration files Author: Marc Fournier <marc.fournier@camptocamp.com> 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 <Test_Redis> 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" | "slaveof" | "client-output-buffer-limit" in let entry_noempty = [ indent . key 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) ] (* View: save_entry Entries identified by the "save" keyword can be found more than once. They have 2 mandatory parameters, both integers. The same rules as standard_entry apply for quoting, comments and whitespaces. *) let save_entry = [ indent . key save . del_ws_spc . seconds . del_ws_spc . keys . eol ] let slaveof = /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: slaveof_entry Entries identified by the "slaveof" 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 slaveof_entry = [ indent . key slaveof . del_ws_spc . ip . del_ws_spc . port . 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 paramters, 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 | slaveof_entry | client_output_buffer_limit_entry (* View: lns The Redis lens *) let lns = (comment | empty | entry )* let filter = incl "/etc/redis/redis.conf" let xfm = transform lns filter lenses/dist/collectd.aug 0000644 00000001545 15231153062 0011272 0 ustar 00 (* Module: Collectd Parses collectd configuration files Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 collectd.conf` 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 collectd configuration files. See <filter>. About: Examples The <Test_Collectd> file contains various examples and tests. *) module Collectd = autoload xfm (* View: lns Collectd is essentially Httpd-compliant configuration files *) let lns = Httpd.lns (* Variable: filter *) let filter = incl "/etc/collectd.conf" . incl "/etc/collectd/*.conf" . incl "/usr/share/doc/collectd/examples/collection3/etc/collection.conf" let xfm = transform lns filter lenses/dist/rsyncd.aug 0000644 00000003741 15231153062 0011003 0 ustar 00 (* Rsyncd module for Augeas Author: Marc Fournier <marc.fournier@camptocamp.com> Reference: man rsyncd.conf(5) *) module Rsyncd = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment IniFile.comment_re "#" let sep = IniFile.sep IniFile.sep_re IniFile.sep_default let indent = del /[ \t]*/ " " (* Import useful INI File primitives *) let eol = IniFile.eol let empty = IniFile.empty let sto_to_comment = Util.del_opt_ws " " . store /[^;# \t\n][^;#\n]*[^;# \t\n]|[^;# \t\n]/ (************************************************************************ * ENTRY * rsyncd.conf allows indented entries, but by default entries outside * sections are unindented *************************************************************************) let entry_re = /[A-Za-z0-9_.-][A-Za-z0-9 _.-]*[A-Za-z0-9_.-]/ let entry = IniFile.indented_entry entry_re sep comment (************************************************************************ * RECORD & TITLE * We use IniFile.title_label because there can be entries * outside of sections whose labels would conflict with section names *************************************************************************) let title = IniFile.indented_title ( IniFile.record_re - ".anon" ) let record = IniFile.record title entry let record_anon = [ label ".anon" . ( entry | empty )+ ] (************************************************************************ * LENS & FILTER * There can be entries before any section * IniFile.entry includes comment management, so we just pass entry to lns *************************************************************************) let lns = record_anon? . record* let filter = (incl "/etc/rsyncd.conf") let xfm = transform lns filter lenses/dist/lightdm.aug 0000644 00000003401 15231153062 0011122 0 ustar 00 (* Module: Lightdm Lightdm module for Augeas for which parses /etc/lightdm/*.conf files which are standard INI file format. Author: David Salmen <dsalmen@dsalmen.com> 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/lightdm/*.conf. See <filter>. About: Tests The tests/test_lightdm.aug file contains unit tests. *) module Lightdm = autoload xfm (************************************************************************ * INI File settings * * lightdm.conf only supports "# as commentary and "=" as separator *************************************************************************) let comment = IniFile.comment "#" "#" let sep = IniFile.sep "=" "=" (************************************************************************ * ENTRY * lightdm.conf uses standard INI File entries *************************************************************************) let entry = IniFile.indented_entry IniFile.entry_re sep comment (************************************************************************ * RECORD * lightdm.conf uses standard INI File records *************************************************************************) let title = IniFile.indented_title IniFile.record_re let record = IniFile.record title entry (************************************************************************ * LENS & FILTER * lightdm.conf uses standard INI File records *************************************************************************) let lns = IniFile.lns record comment let filter = (incl "/etc/lightdm/*.conf") let xfm = transform lns filter lenses/dist/approx.aug 0000644 00000002406 15231153062 0011007 0 ustar 00 (* Module: Approx Parses /etc/approx/approx.conf Author: David Lutterkort <lutter@redhat.com> About: Reference This lens tries to keep as close as possible to `man 5 approx.conf` where possible. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage See <lns>. About: Configuration files This lens applies to /etc/approx/approx.conf. About: Examples The <Test_Approx> file contains various examples and tests. *) module Approx = autoload xfm (* Variable: eol An <Util.eol> *) let eol = Util.eol (* Variable: indent An <Util.indent> *) let indent = Util.indent (* Variable: key_re *) let key_re = /\$?[A-Za-z0-9_.-]+/ (* Variable: sep *) let sep = /[ \t]+/ (* Variable: value_re *) let value_re = /[^ \t\n](.*[^ \t\n])?/ (* View: comment *) let comment = [ indent . label "#comment" . del /[#;][ \t]*/ "# " . store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ . eol ] (* View: empty An <Util.empty> *) let empty = Util.empty (* View: kv *) let kv = [ indent . key key_re . del sep " " . store value_re . eol ] (* View: lns *) let lns = (empty | comment | kv) * (* View: filter *) let filter = incl "/etc/approx/approx.conf" let xfm = transform lns filter lenses/dist/carbon.aug 0000644 00000003046 15231153062 0010743 0 ustar 00 (* Module: Carbon Parses Carbon's configuration files Author: Marc Fournier <marc.fournier@camptocamp.com> About: Reference This lens is based on the conf/*.conf.example files from the Carbon package. About: Configuration files This lens applies to most files in /etc/carbon/. See <filter>. NB: whitelist.conf and blacklist.conf use a different syntax. This lens doesn't support them. About: Usage Example (start code) $ augtool augtool> ls /files/etc/carbon/carbon.conf/ cache/ = (none) relay/ = (none) aggregator/ = (none) augtool> get /files/etc/carbon/carbon.conf/cache/ENABLE_UDP_LISTENER /files/etc/carbon/carbon.conf/cache/ENABLE_UDP_LISTENER = False augtool> set /files/etc/carbon/carbon.conf/cache/ENABLE_UDP_LISTENER True augtool> save Saved 1 file(s) (end code) The <Test_Carbon> file also contains various examples. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Carbon = autoload xfm let comment = IniFile.comment "#" "#" let sep = IniFile.sep "=" "=" let entry = IniFile.entry IniFile.entry_re sep comment let title = IniFile.title IniFile.record_re let record = IniFile.record title entry let lns = IniFile.lns record comment let filter = incl "/etc/carbon/carbon.conf" . incl "/etc/carbon/relay-rules.conf" . incl "/etc/carbon/rewrite-rules.conf" . incl "/etc/carbon/storage-aggregation.conf" . incl "/etc/carbon/storage-schemas.conf" let xfm = transform lns filter lenses/dist/krb5.aug 0000644 00000015374 15231153062 0010351 0 ustar 00 module Krb5 = autoload xfm let comment = Inifile.comment IniFile.comment_re "#" let empty = Inifile.empty let eol = Inifile.eol let dels = Util.del_str let indent = del /[ \t]*/ "" let comma_or_space_sep = del /[ \t,]{1,}/ " " let eq = del /[ \t]*=[ \t]*/ " = " let eq_openbr = del /[ \t]*=[ \t\n]*\{[ \t]*\n/ " = {\n" let closebr = del /[ \t]*\}/ "}" (* These two regexps for realms and apps are not entirely true - strictly speaking, there's no requirement that a realm is all upper case and an application only uses lowercase. But it's what's used in practice. Without that distinction we couldn't distinguish between applications and realms in the [appdefaults] section. *) let include_re = /include(dir)?/ let realm_re = /[A-Z0-9][.a-zA-Z0-9-]*/ let realm_anycase_re = /[A-Za-z0-9][.a-zA-Z0-9-]*/ let app_re = /[a-z][a-zA-Z0-9_]*/ let name_re = /[.a-zA-Z0-9_-]+/ - include_re let value_br = store /[^;# \t\r\n{}]+/ let value = store /[^;# \t\r\n]+/ let entry (kw:regexp) (sep:lens) (value:lens) (comment:lens) = [ indent . key kw . sep . value . (comment|eol) ] | comment let subsec_entry (kw:regexp) (sep:lens) (comment:lens) = ( entry kw sep value_br comment ) | empty let simple_section (n:string) (k:regexp) = let title = Inifile.indented_title n in let entry = entry k eq value comment in Inifile.record title entry let record (t:string) (e:lens) = let title = Inifile.indented_title t in Inifile.record title e let v4_name_convert (subsec:lens) = [ indent . key "v4_name_convert" . eq_openbr . subsec* . closebr . eol ] (* For the enctypes this appears to be a list of the valid entries: c4-hmac arcfour-hmac aes128-cts rc4-hmac arcfour-hmac-md5 des3-cbc-sha1 des-cbc-md5 des-cbc-crc *) let enctype_re = /[a-zA-Z0-9-]{3,}/ let enctypes = /permitted_enctypes|default_tgs_enctypes|default_tkt_enctypes/i (* An #eol label prevents ambiguity between "k = v1 v2" and "k = v1\n k = v2" *) let enctype_list (nr:regexp) (ns:string) = indent . del nr ns . eq . Build.opt_list [ label ns . store enctype_re ] comma_or_space_sep . (comment|eol) . [ label "#eol" ] let libdefaults = let option = entry (name_re - ("v4_name_convert" |enctypes)) eq value comment in let enctype_lists = enctype_list /permitted_enctypes/i "permitted_enctypes" | enctype_list /default_tgs_enctypes/i "default_tgs_enctypes" | enctype_list /default_tkt_enctypes/i "default_tkt_enctypes" in let subsec = [ indent . key /host|plain/ . eq_openbr . (subsec_entry name_re eq comment)* . closebr . eol ] in record "libdefaults" (option|enctype_lists|v4_name_convert subsec) let login = let keys = /krb[45]_get_tickets|krb4_convert|krb_run_aklog/ |/aklog_path|accept_passwd/ in simple_section "login" keys let appdefaults = let option = entry (name_re - ("realm" | "application")) eq value_br comment in let realm = [ indent . label "realm" . store realm_re . eq_openbr . (option|empty)* . closebr . eol ] in let app = [ indent . label "application" . store app_re . eq_openbr . (realm|option|empty)* . closebr . eol] in record "appdefaults" (option|realm|app) let realms = let simple_option = /kdc|admin_server|database_module|default_domain/ |/v4_realm|auth_to_local(_names)?|master_kdc|kpasswd_server/ |/admin_server|ticket_lifetime|pkinit_(anchors|identities|identity|pool)/ |/krb524_server/ in let subsec_option = /v4_instance_convert/ in let option = subsec_entry simple_option eq comment in let subsec = [ indent . key subsec_option . eq_openbr . (subsec_entry name_re eq comment)* . closebr . eol ] in let v4subsec = [ indent . key /host|plain/ . eq_openbr . (subsec_entry name_re eq comment)* . closebr . eol ] in let realm = [ indent . label "realm" . store realm_anycase_re . eq_openbr . (option|subsec|(v4_name_convert v4subsec))* . closebr . eol ] in record "realms" (realm|comment) let domain_realm = simple_section "domain_realm" name_re let logging = let keys = /kdc|admin_server|default/ in let xchg (m:regexp) (d:string) (l:string) = del m d . label l in let xchgs (m:string) (l:string) = xchg m m l in let dest = [ xchg /FILE[=:]/ "FILE=" "file" . value ] |[ xchgs "STDERR" "stderr" ] |[ xchgs "CONSOLE" "console" ] |[ xchgs "DEVICE=" "device" . value ] |[ xchgs "SYSLOG" "syslog" . ([ xchgs ":" "severity" . store /[A-Za-z0-9]+/ ]. [ xchgs ":" "facility" . store /[A-Za-z0-9]+/ ]?)? ] in let entry = [ indent . key keys . eq . dest . (comment|eol) ] | comment in record "logging" entry let capaths = let realm = [ indent . key realm_re . eq_openbr . (entry realm_re eq value_br comment)* . closebr . eol ] in record "capaths" (realm|comment) let dbdefaults = let keys = /database_module|ldap_kerberos_container_dn|ldap_kdc_dn/ |/ldap_kadmind_dn|ldap_service_password_file|ldap_servers/ |/ldap_conns_per_server/ in simple_section "dbdefaults" keys let dbmodules = let subsec_key = /database_name|db_library|disable_last_success/ |/disable_lockout|ldap_conns_per_server|ldap_(kdc|kadmind)_dn/ |/ldap_(kdc|kadmind)_sasl_mech|ldap_(kdc|kadmind)_sasl_authcid/ |/ldap_(kdc|kadmind)_sasl_authzid|ldap_(kdc|kadmind)_sasl_realm/ |/ldap_kerberos_container_dn|ldap_servers/ |/ldap_service_password_file|mapsize|max_readers|nosync/ |/unlockiter/ in let subsec_option = subsec_entry subsec_key eq comment in let key = /db_module_dir/ in let option = entry key eq value comment in let realm = [ indent . label "realm" . store realm_re . eq_openbr . (subsec_option)* . closebr . eol ] in record "dbmodules" (option|realm) (* This section is not documented in the krb5.conf manpage, but the Fermi example uses it. *) let instance_mapping = let value = dels "\"" . store /[^;# \t\r\n{}]*/ . dels "\"" in let map_node = label "mapping" . store /[a-zA-Z0-9\/*]+/ in let mapping = [ indent . map_node . eq . [ label "value" . value ] . (comment|eol) ] in let instance = [ indent . key name_re . eq_openbr . (mapping|comment)* . closebr . eol ] in record "instancemapping" instance let kdc = simple_section "kdc" /profile/ let pam = simple_section "pam" name_re let includes = Build.key_value_line include_re Sep.space (store Rx.fspath) let include_lines = includes . (comment|empty)* let lns = (comment|empty)* . (libdefaults|login|appdefaults|realms|domain_realm |logging|capaths|dbdefaults|dbmodules|instance_mapping|kdc|pam|include_lines)* let filter = (incl "/etc/krb5.conf.d/*.conf") . (incl "/etc/krb5.conf") let xfm = transform lns filter lenses/dist/puppetfile.aug 0000644 00000002714 15231153062 0011655 0 ustar 00 (* Module: Puppetfile Parses libarian-puppet's Puppetfile format Author: Raphael Pinson <raphael.pinson@camptocamp.com> About: Reference See https://github.com/rodjek/librarian-puppet 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 Puppetfiles. About: Examples The <Test_Puppetfile> file contains various examples and tests. *) module Puppetfile = (* View: comma a comma, optionally preceded or followed by spaces or newlines *) let comma = del /[ \t\n]*,[ \t\n]*/ ", " (* View: forge a forge entry *) let forge = [ Util.indent . key "forge" . Sep.space . Quote.any . Util.eol ] (* View: metadata a metadata entry *) let metadata = [ Util.indent . key "metadata" . Util.eol ] (* View: mod a module entry, with optional version and options *) let mod = let mod_name = Quote.do_quote (store (Rx.word . /[\/-]/ . Rx.word)) in let version = [ label "@version" . Quote.do_quote (store /[^:\n]+/) ] in let opt = [ Util.del_str ":" . key Rx.word . del /[ \t]*=>[ \t]*/ " => " . Quote.do_quote (store /[^,\n]*/) ] in let opts = Build.opt_list opt comma in [ Util.indent . Util.del_str "mod" . seq "mod" . Sep.space . mod_name . (comma . version)? . (comma . opts)? . Util.eol ] (* View: lns the Puppetfile lens *) let lns = (Util.empty | Util.comment | forge | metadata | mod)* lenses/dist/automaster.aug 0000644 00000006477 15231153062 0011676 0 ustar 00 (* Module: Automaster Parses autofs' auto.master files Author: Dominic Cleal <dcleal@redhat.com> About: Reference See auto.master(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.master, auto_master and /etc/auto.master.d/* files. About: Examples The <Test_Automaster> file contains various examples and tests. *) module Automaster = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: eol *) let eol = Util.eol (* View: empty *) let empty = Util.empty (* View: comment *) let comment = Util.comment (* View mount *) let mount = /[^+ \t\n#]+/ (* View: type yp, file, dir etc but not ldap *) let type = Rx.word - /ldap/ (* View: format sun, hesoid *) let format = Rx.word (* View: name *) let name = /[^: \t\n]+/ (* View: host *) let host = /[^:# \n\t]+/ (* View: dn *) let dn = /[^:# \n\t]+/ (* An option label can't contain comma, comment, equals, or space *) let optlabel = /[^,#= \n\t]+/ let spec = /[^,# \n\t][^ \n\t]*/ (* View: optsep *) let optsep = del /[ \t,]+/ "," (************************************************************************ * Group: ENTRIES *************************************************************************) (* View: map_format *) let map_format = [ label "format" . store format ] (* View: map_type *) let map_type = [ label "type" . store type ] (* View: map_name *) let map_name = [ label "map" . store name ] (* View: map_generic Used for all except LDAP maps which are parsed further *) let map_generic = ( map_type . ( Sep.comma . map_format )? . Sep.colon )? . map_name (* View: map_ldap_name Split up host:dc=foo into host/map nodes *) let map_ldap_name = ( [ label "host" . store host ] . Sep.colon )? . [ label "map" . store dn ] (* View: map_ldap *) let map_ldap = [ label "type" . store "ldap" ] . ( Sep.comma . map_format )? . Sep.colon . map_ldap_name (* View: comma_spc_sep_list Parses options either for filesystems or autofs *) let comma_spc_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 optsep (* View: map_mount Mountpoint and whitespace, followed by the map info *) let map_mount = [ seq "map" . store mount . Util.del_ws_tab . ( map_generic | map_ldap ) . ( Util.del_ws_spc . comma_spc_sep_list "opt" )? . Util.eol ] (* map_master "+" to include more master entries and optional whitespace *) let map_master = [ seq "map" . store "+" . Util.del_opt_ws "" . ( map_generic | map_ldap ) . ( Util.del_ws_spc . comma_spc_sep_list "opt" )? . Util.eol ] (* View: lns *) let lns = ( empty | comment | map_mount | map_master ) * (* Variable: filter *) let filter = incl "/etc/auto.master" . incl "/etc/auto_master" . incl "/etc/auto.master.d/*" . Util.stdexcl let xfm = transform lns filter lenses/dist/postfix_access.aug 0000644 00000001334 15231153062 0012512 0 ustar 00 (* Parsing /etc/postfix/access *) module Postfix_Access = autoload xfm let sep_tab = Util.del_ws_tab let sep_spc = Util.del_ws_spc let eol = del /[ \t]*\n/ "\n" let indent = del /[ \t]*/ "" let comment = Util.comment let empty = Util.empty let char = /[^# \n\t]/ let text = let cont = /\n[ \t]+/ in let any = /[^#\n]/ in char | (char . (any | cont)* .char) let word = char+ let record = [ seq "spec" . [ label "pattern" . store word ] . sep_tab . [ label "action" . store word ] . [ label "parameters" . sep_spc . store text ]? . eol ] let lns = ( empty | comment | record )* let xfm = transform lns (incl "/etc/postfix/access") lenses/dist/sssd.aug 0000644 00000001535 15231153062 0010454 0 ustar 00 (* Module Sssd Lens for parsing sssd.conf Author: Erinn Looney-Triggs <erinn.looneytriggs@gmail.com> About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Configuration files This lens applies to /etc/sssd/sssd.conf. See <filter>. *) module Sssd = autoload xfm let comment = IniFile.comment /[#;]/ "#" let sep = IniFile.sep "=" "=" let entry = IniFile.indented_entry IniFile.entry_re sep comment (* View: title An sssd.conf section title *) let title = IniFile.indented_title_label "target" IniFile.record_label_re (* View: record An sssd.conf record *) let record = IniFile.record title entry (* View: lns The sssd.conf lens *) let lns = ( comment | IniFile.empty )* . (record)* (* View: filter *) let filter = (incl "/etc/sssd/sssd.conf") let xfm = transform lns filter lenses/dist/puppet.aug 0000644 00000003026 15231153062 0011012 0 ustar 00 (* Puppet module for Augeas Author: Raphael Pinson <raphink@gmail.com> puppet.conf is a standard INI File. *) module Puppet = autoload xfm (************************************************************************ * INI File settings * * puppet.conf only supports "# as commentary and "=" as separator *************************************************************************) let comment = IniFile.comment "#" "#" let sep = IniFile.sep "=" "=" (************************************************************************ * ENTRY * puppet.conf uses standard INI File entries *************************************************************************) let entry = IniFile.indented_entry IniFile.entry_re sep comment (************************************************************************ * RECORD * puppet.conf uses standard INI File records *************************************************************************) let title = IniFile.indented_title IniFile.record_re let record = IniFile.record title entry (************************************************************************ * LENS & FILTER * puppet.conf uses standard INI File records *************************************************************************) let lns = IniFile.lns record comment let filter = (incl "/etc/puppet/puppet.conf" .incl "/usr/local/etc/puppet/puppet.conf" .incl "/etc/puppetlabs/puppet/puppet.conf") let xfm = transform lns filter lenses/dist/spacevars.aug 0000644 00000002543 15231153062 0011467 0 ustar 00 (* Spacevars module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: man interfaces This is a generic lens for simple key/value configuration files where keys and values are separated by a sequence of spaces or tabs. *) module Spacevars = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let comment = Util.comment let empty = Util.empty (************************************************************************ * ENTRIES *************************************************************************) let entry = Build.key_ws_value /[A-Za-z0-9._-]+(\[[0-9]+\])?/ (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry)* let simple_lns = lns (* An alias for compatibility reasons *) (* configuration files that can be parsed without customizing the lens *) let filter = incl "/etc/havp/havp.config" . incl "/etc/ldap.conf" . incl "/etc/ldap/ldap.conf" . incl "/etc/libnss-ldap.conf" . incl "/etc/pam_ldap.conf" let xfm = transform lns filter lenses/dist/bbhosts.aug 0000644 00000010366 15231153062 0011146 0 ustar 00 (* BB-hosts module for Augeas *) (* Author: Raphael Pinson <raphink@gmail.com> *) (* *) (* Supported : *) (* *) (* Todo : *) (* *) module BBhosts = autoload xfm (* Define useful shortcuts *) let eol = Util.eol let eol_no_spc = Util.del_str "\n" let sep_spc = Sep.space let sep_opt_spc = Sep.opt_space let word = store /[^|;# \n\t]+/ let value_to_eol = store /[^ \t][^\n]+/ let ip = store Rx.ipv4 let url = store /https?:[^# \n\t]+/ let word_cont = store /[^;# \n\t]+/ (* Define comments and empty lines *) let comment = Util.comment let empty = Util.empty (* Define host *) let host_ip = [ label "ip" . ip ] let host_fqdn = [ label "fqdn" . sep_spc . word ] let host_test_url = [ label "url" . url ] let host_test_cont (kw:string) = [ store /!?/ . key kw . (Util.del_str ";" . [ label "url" . word_cont ] . (Util.del_str ";" . [ label "keyword" . word ])? )? ] (* DOWNTIME=[columns:]day:starttime:endtime:cause[,day:starttime:endtime:cause] *) let host_test_downtime = let probe = [ label "probe" . store (Rx.word | "*") ] in let probes = Build.opt_list probe Sep.comma in let day = [ label "day" . store (Rx.word | "*") ] in let starttime = [ label "starttime" . store Rx.integer ] in let endtime = [ label "endtime" . store Rx.integer ] in let cause = [ label "cause" . Util.del_str "\"" . store /[^"]*/ . Util.del_str "\"" ] in [ key "DOWNTIME" . Sep.equal . (probes . Sep.colon)? . day . Sep.colon . starttime . Sep.colon . endtime . Sep.colon . cause ] let host_test_flag_value = [ label "value" . Util.del_str ":" . store Rx.word ] let host_test_flag (kw:regexp) = [ store /!?/ . key kw . host_test_flag_value? ] let host_test = host_test_cont "cont" | host_test_cont "contInsecure" | host_test_cont "dns" | host_test_flag "BBDISPLAY" | host_test_flag "BBNET" | host_test_flag "BBPAGER" | host_test_flag "CDB" | host_test_flag "GTM" | host_test_flag "XYMON" | host_test_flag "ajp13" | host_test_flag "bbd" | host_test_flag "clamd" | host_test_flag "cupsd" | host_test_flag "front" | host_test_flag /ftps?/ | host_test_flag /imap[2-4s]?/ | host_test_flag /ldaps?/ | host_test_flag /nntps?/ | host_test_flag "noconn" | host_test_flag "nocont" | host_test_flag "noping" | host_test_flag "notrends" | host_test_flag "oratns" | host_test_flag /pop-?[2-3]?s?/ | host_test_flag "qmqp" | host_test_flag "qmtp" | host_test_flag "rsync" | host_test_flag /smtps?/ | host_test_flag "spamd" | host_test_flag /ssh[1-2]?/ | host_test_flag /telnets?/ | host_test_flag "vnc" | host_test_url | host_test_downtime let host_test_list = Build.opt_list host_test sep_spc let host_opts = [ label "probes" . sep_spc . Util.del_str "#" . (sep_opt_spc . host_test_list)? ] let host = [ label "host" . host_ip . host_fqdn . host_opts . eol ] (* Define group-compress and group-only *) let group_compress = [ key /group(-compress)?/ . (sep_spc . value_to_eol)? . eol_no_spc . ( comment | empty | host)* ] let group_only_col = [ label "col" . word ] let group_only_cols = sep_spc . group_only_col . ( Util.del_str "|" . group_only_col )* let group_only = [ key "group-only" . group_only_cols . sep_spc . value_to_eol . eol_no_spc . ( comment | empty | host)* ] (* Define page *) let page_title = [ label "title" . sep_spc . value_to_eol ] let page = [ key "page" . sep_spc . word . page_title? . eol_no_spc . ( comment | empty | host )* . ( group_compress | group_only )* ] (* Define lens *) let lns = (comment | empty)* . page* let filter = incl "/etc/bb/bb-hosts" let xfm = transform lns filter lenses/dist/pythonpaste.aug 0000644 00000003763 15231153062 0012063 0 ustar 00 (* Python paste config file lens for Augeas Author: Dan Prince <dprince@redhat.com> *) module PythonPaste = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment "#" "#" let sep = IniFile.sep "=" "=" let eol = Util.eol (************************************************************************ * ENTRY *************************************************************************) let url_entry = /\/[\/A-Za-z0-9.-_]* ?[:|=] [A-Za-z0-9.-_]+/ let set_kw = [ Util.del_str "set" . Util.del_ws_spc . label "@set" ] let no_inline_comment_entry (kw:regexp) (sep:lens) (comment:lens) = [ set_kw? . key kw . sep . IniFile.sto_to_eol? . eol ] | comment | [ seq "urls" . store url_entry . eol ] let entry_re = ( /[A-Za-z][:#A-Za-z0-9._-]+/ ) let entry = no_inline_comment_entry entry_re sep comment (************************************************************************ * RECORD *************************************************************************) let title = IniFile.title IniFile.record_re let record = IniFile.record title entry (************************************************************************ * LENS & FILTER *************************************************************************) let lns = IniFile.lns record comment let filter = ((incl "/etc/glance/*.ini") . (incl "/etc/keystone/keystone.conf") . (incl "/etc/nova/api-paste.ini") . (incl "/etc/swift/swift.conf") . (incl "/etc/swift/proxy-server.conf") . (incl "/etc/swift/account-server/*.conf") . (incl "/etc/swift/container-server/*.conf") . (incl "/etc/swift/object-server/*.conf")) let xfm = transform lns filter lenses/dist/cron.aug 0000644 00000010024 15231153062 0010432 0 ustar 00 (* Module: Cron Parses /etc/cron.d/*, /etc/crontab Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 crontab` where possible. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage Sample usage of this lens in augtool * Get the entry that launches '/usr/bin/ls' > match '/files/etc/crontab/entry[. = "/usr/bin/ls"]' About: Configuration files This lens applies to /etc/cron.d/* and /etc/crontab. See <filter>. *) module Cron = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Generic primitives *) (* Variable: eol *) let eol = Util.eol (* Variable: indent *) let indent = Util.indent (* Variable: comment *) let comment = Util.comment (* Variable: empty *) let empty = Util.empty (* Variable: num *) let num = /[0-9*][0-9\/,*-]*/ (* Variable: alpha *) let alpha = /[A-Za-z]{3}/ (* Variable: alphanum *) let alphanum = (num|alpha) . ("-" . (num|alpha))? (* Variable: entry_prefix *) let entry_prefix = /-/ (* Group: Separators *) (* Variable: sep_spc *) let sep_spc = Util.del_ws_spc (* Variable: sep_eq *) let sep_eq = Util.del_str "=" (************************************************************************ * Group: ENTRIES *************************************************************************) (************************************************************************ * View: shellvar * A shell variable in crontab *************************************************************************) let shellvar = let key_re = /[A-Za-z-1-9_]+(\[[0-9]+\])?/ - "entry" in let sto_to_eol = store /[^\n]*[^ \t\n]/ in [ key key_re . sep_eq . sto_to_eol . eol ] (* View: - prefix of an entry *) let prefix = [ label "prefix" . store entry_prefix ] (* View: minute *) let minute = [ label "minute" . store num ] (* View: hour *) let hour = [ label "hour" . store num ] (* View: dayofmonth *) let dayofmonth = [ label "dayofmonth" . store num ] (* View: month *) let month = [ label "month" . store alphanum ] (* View: dayofweek *) let dayofweek = [ label "dayofweek" . store alphanum ] (* View: user *) let user = [ label "user" . store Rx.word ] (************************************************************************ * View: time * Time in the format "minute hour dayofmonth month dayofweek" *************************************************************************) let time = [ label "time" . minute . sep_spc . hour . sep_spc . dayofmonth . sep_spc . month . sep_spc . dayofweek ] (* Variable: the valid values for schedules *) let schedule_re = "reboot" | "yearly" | "annually" | "monthly" | "weekly" | "daily" | "midnight" | "hourly" (************************************************************************ * View: schedule * Time in the format "@keyword" *************************************************************************) let schedule = [ label "schedule" . Util.del_str "@" . store schedule_re ] (************************************************************************ * View: entry * A crontab entry *************************************************************************) let entry = [ label "entry" . indent . prefix? . ( time | schedule ) . sep_spc . user . sep_spc . store Rx.space_in . eol ] (* * View: lns * The cron lens *) let lns = ( empty | comment | shellvar | entry )* (* Variable: filter *) let filter = incl "/etc/cron.d/*" . incl "/etc/crontab" . excl "/etc/cron.d/at.allow" . excl "/etc/cron.d/at.deny" . excl "/etc/cron.d/cron.allow" . excl "/etc/cron.d/cron.deny" . Util.stdexcl let xfm = transform lns filter lenses/dist/debctrl.aug 0000644 00000007165 15231153062 0011124 0 ustar 00 (* 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") lenses/dist/nagiosobjects.aug 0000644 00000003104 15231153062 0012324 0 ustar 00 (* Module: NagiosObjects Parses /etc/{nagios{3,},icinga}/objects/*.cfg Authors: Sebastien Aperghis-Tramoni <sebastien@aperghis.net> Raphaël Pinson <raphink@gmail.com> 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/{nagios{3,},icinga}/objects/*.cfg. See <filter>. *) module NagiosObjects = autoload xfm (* basic atoms *) let eol = Util.eol let ws = Sep.space let keyword = key /[A-Za-z0-9_]+/ (* optional, but preferred, whitespace *) let opt_ws = del Rx.opt_space " " (* define an empty line *) let empty = Util.empty (* define a comment *) let comment = Util.comment_generic /[ \t]*[#;][ \t]*/ "# " (* define a field *) let object_field = let field_name = keyword in let field_value = store Rx.space_in in [ Util.indent . field_name . ws . field_value . eol ] (* define an object *) let object_def = let object_type = keyword in [ Util.indent . Util.del_str "define" . ws . object_type . opt_ws . Util.del_str "{" . eol . ( empty | comment | object_field )* . Util.indent . Util.del_str "}" . eol ] (* main structure *) let lns = ( empty | comment | object_def )* let filter = incl "/etc/nagios3/objects/*.cfg" . incl "/etc/nagios/objects/*.cfg" . incl "/etc/icinga/objects/*.cfg" let xfm = transform lns filter lenses/dist/dhcpd_140.aug 0000644 00000051463 15231153062 0011153 0 ustar 00 (* Module: Dhcpd_140 BIND dhcp 3 server configuration module for Augeas This module is compatible with Augeas 1.4.0, but is not loaded by default. Author: Francis Giraldeau <francis.giraldeau@usherbrooke.ca> About: Reference Reference: manual of dhcpd.conf and dhcp-eval Follow dhclient module for tree structure About: License This file is licensed under the GPL. About: Lens Usage Sample usage of this lens in augtool Directive without argument. Set this dhcpd server authoritative on the domain. > clear /files/etc/dhcp3/dhcpd.conf/authoritative Directives with integer or string argument. Set max-lease-time to one hour: > set /files/etc/dhcp3/dhcpd.conf/max-lease-time 3600 Options are declared as a list, even for single values. Set the domain of the network: > set /files/etc/dhcp3/dhcpd.conf/option/domain-name/arg example.org Set two name server: > set /files/etc/dhcp3/dhcpd.conf/option/domain-name-servers/arg[1] foo.example.org > set /files/etc/dhcp3/dhcpd.conf/option/domain-name-servers/arg[2] bar.example.org Create the subnet 172.16.0.1 with 10 addresses: > clear /files/etc/dhcp3/dhcpd.conf/subnet[last() + 1] > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/network 172.16.0.0 > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/netmask 255.255.255.0 > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/range/from 172.16.0.10 > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/range/to 172.16.0.20 Create a new group "foo" with one static host. Nodes type and address are ordered. > ins group after /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/*[last()] > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[last()]/host foo > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[host='foo']/host/hardware/type "ethernet" > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[host='foo']/host/hardware/address "00:00:00:aa:bb:cc" > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[host='foo']/host/fixed-address 172.16.0.100 About: Configuration files This lens applies to /etc/dhcpd3/dhcpd.conf. See <filter>. *) module Dhcpd_140 = (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let dels (s:string) = del s s let eol = Util.eol let comment = Util.comment let empty = Util.empty let indent = Util.indent let eos = comment? (* Define separators *) let sep_spc = del /[ \t]+/ " " let sep_osp = del /[ \t]*/ "" let sep_scl = del /[ \t]*;([ \t]*\n)*/ ";\n" let sep_obr = del /[ \t\n]*\{([ \t]*\n)*/ " {\n" let sep_cbr = del /[ \t]*\}([ \t]*\n)*/ "}\n" let sep_com = del /[ \t\n]*,[ \t\n]*/ ", " let sep_slh = del "\/" "/" let sep_col = del ":" ":" let sep_eq = del /[ \t\n]*=[ \t\n]*/ "=" let scl = del ";" ";" (* Define basic types *) let word = /[A-Za-z0-9_.-]+(\[[0-9]+\])?/ let ip = Rx.ipv4 (* Define fields *) (* adapted from sysconfig.aug *) (* Chars allowed in a bare string *) let bchar = /[^ \t\n"'\\{}#,()\/]|\\\\./ let qchar = /["']/ (* " *) (* We split the handling of right hand sides into a few cases: * bare - strings that contain no spaces, optionally enclosed in * single or double quotes * dquot - strings that contain at least one space, apostrophe or slash * which must be enclosed in double quotes * squot - strings that contain an unescaped double quote *) let bare = del qchar? "" . store (bchar+) . del qchar? "" let quote = Quote.do_quote (store (bchar* . /[ \t'\/]/ . bchar*)+) let dquote = Quote.do_dquote (store (bchar+)) (* these two are for special cases. bare_to_scl is for any bareword that is * space or semicolon terminated. dquote_any allows almost any character in * between the quotes. *) let bare_to_scl = Quote.do_dquote_opt (store /[^" \t\n;]+/) let dquote_any = Quote.do_dquote (store /[^"\n]*[ \t]+[^"\n]*/) let sto_to_spc = store /[^\\#,;\{\}" \t\n]+|"[^\\#"\n]+"/ let sto_to_scl = store /[^ \t;][^;\n=]+[^ \t;]|[^ \t;=]+/ let sto_number = store /[0-9][0-9]*/ (************************************************************************ * NO ARG STATEMENTS *************************************************************************) let stmt_noarg_re = "authoritative" | "primary" | "secondary" let stmt_noarg = [ indent . key stmt_noarg_re . sep_scl . eos ] (************************************************************************ * INT ARG STATEMENTS *************************************************************************) let stmt_integer_re = "default-lease-time" | "max-lease-time" | "min-lease-time" | /lease[ ]+limit/ | "port" | /peer[ ]+port/ | "max-response-delay" | "max-unacked-updates" | "mclt" | "split" | /load[ ]+balance[ ]+max[ ]+seconds/ | "max-lease-misbalance" | "max-lease-ownership" | "min-balance" | "max-balance" | "adaptive-lease-time-threshold" | "dynamic-bootp-lease-length" | "local-port" | "min-sec" | "omapi-port" | "ping-timeout" | "remote-port" let stmt_integer = [ indent . key stmt_integer_re . sep_spc . sto_number . sep_scl . eos ] (************************************************************************ * STRING ARG STATEMENTS *************************************************************************) let stmt_string_re = "ddns-update-style" | "ddns-updates" | "ddns-hostname" | "ddns-domainname" | "ddns-rev-domainname" | "log-facility" | "server-name" | "fixed-address" | /failover[ ]+peer/ | "use-host-decl-names" | "next-server" | "address" | /peer[ ]+address/ | "type" | "file" | "algorithm" | "secret" | "key" | "include" | "hba" | "boot-unknown-clients" | "db-time-format" | "do-forward-updates" | "dynamic-bootp-lease-cutoff" | "get-lease-hostnames" | "infinite-is-reserved" | "lease-file-name" | "local-address" | "one-lease-per-client" | "pid-file-name" | "ping-check" | "server-identifier" | "site-option-space" | "stash-agent-options" | "update-conflict-detection" | "update-optimization" | "update-static-leases" | "use-host-decl-names" | "use-lease-addr-for-default-route" | "vendor-option-space" | "primary" | "omapi-key" let stmt_string_tpl (kw:regexp) (l:lens) = [ indent . key kw . sep_spc . l . sep_scl . eos ] let stmt_string = stmt_string_tpl stmt_string_re bare | stmt_string_tpl stmt_string_re quote | stmt_string_tpl "filename" dquote (************************************************************************ * RANGE STATEMENTS *************************************************************************) let stmt_range = [ indent . key "range" . sep_spc . [ label "flag" . store /dynamic-bootp/ . sep_spc ]? . [ label "from" . store ip . sep_spc ]? . [ label "to" . store ip ] . sep_scl . eos ] (************************************************************************ * HARDWARE STATEMENTS *************************************************************************) let stmt_hardware = [ indent . key "hardware" . sep_spc . [ label "type" . store /ethernet|tokenring|fddi/ ] . sep_spc . [ label "address" . store /[a-fA-F0-9:-]+/ ] . sep_scl . eos ] (************************************************************************ * SET STATEMENTS *************************************************************************) let stmt_set = [ indent . key "set" . sep_spc . store word . sep_spc . Sep.equal . sep_spc . [ label "value" . sto_to_scl ] . sep_scl . eos ] (************************************************************************ * OPTION STATEMENTS *************************************************************************) (* The general case is considering options as a list *) let stmt_option_value = /((array of[ \t]+)?(((un)?signed[ \t]+)?integer (8|16|32)|string|ip6?-address|boolean|domain-list|text)|encapsulate [A-Za-z0-9_.-]+)/ let stmt_option_list = ([ label "arg" . bare ] | [ label "arg" . quote ]) . ( sep_com . ([ label "arg" . bare ] | [ label "arg" . quote ]))* let del_trail_spc = del /[ \t\n]*/ "" let stmt_record = counter "record" . Util.del_str "{" . sep_spc . ([seq "record" . store stmt_option_value . sep_com]* . [seq "record" . store stmt_option_value . del_trail_spc])? . Util.del_str "}" let stmt_option_code = [ label "label" . store word . sep_spc ] . [ key "code" . sep_spc . store word ] . sep_eq . ([ label "type" . store stmt_option_value ] |[ label "record" . stmt_record ]) let stmt_option_basic = [ key word . sep_spc . stmt_option_list ] let stmt_option_extra = [ key word . sep_spc . store /true|false/ . sep_spc . stmt_option_list ] let stmt_option_body = stmt_option_basic | stmt_option_extra let stmt_option1 = [ indent . key "option" . sep_spc . stmt_option_body . sep_scl . eos ] let stmt_option2 = [ indent . dels "option" . label "rfc-code" . sep_spc . stmt_option_code . sep_scl . eos ] let stmt_option = stmt_option1 | stmt_option2 (************************************************************************ * SUBCLASS STATEMENTS *************************************************************************) (* this statement is not well documented in the manual dhcpd.conf we support basic use case *) let stmt_subclass = [ indent . key "subclass" . sep_spc . ( [ label "name" . bare_to_scl ]|[ label "name" . dquote_any ] ) . sep_spc . ( [ label "value" . bare_to_scl ]|[ label "value" . dquote_any ] ) . sep_scl . eos ] (************************************************************************ * ALLOW/DENY STATEMENTS *************************************************************************) (* We have to use special key for allow/deny members of to avoid ambiguity in the put direction *) let allow_deny_re = /unknown(-|[ ]+)clients/ | /known(-|[ ]+)clients/ | /all[ ]+clients/ | /dynamic[ ]+bootp[ ]+clients/ | /authenticated[ ]+clients/ | /unauthenticated[ ]+clients/ | "bootp" | "booting" | "duplicates" | "declines" | "client-updates" | "leasequery" let stmt_secu_re = "allow" | "deny" let del_allow = del /allow[ ]+members[ ]+of/ "allow members of" let del_deny = del /deny[ \t]+members[ \t]+of/ "deny members of" (* bare is anything but whitespace, quote marks or semicolon. * technically this should be locked down to mostly alphanumerics, but the * idea right now is just to make things work. Also ideally I would use * dquote_space but I had a whale of a time with it. It doesn't like * semicolon termination and my attempts to fix that led me to 3 hours of * frustration and back to this :) *) let stmt_secu_tpl (l:lens) (s:string) = [ indent . l . sep_spc . label s . bare_to_scl . sep_scl . eos ] | [ indent . l . sep_spc . label s . dquote_any . sep_scl . eos ] let stmt_secu = [ indent . key stmt_secu_re . sep_spc . store allow_deny_re . sep_scl . eos ] | stmt_secu_tpl del_allow "allow-members-of" | stmt_secu_tpl del_deny "deny-members-of" (************************************************************************ * MATCH STATEMENTS *************************************************************************) let sto_com = /[^ \t\n,\(\)][^,\(\)]*[^ \t\n,\(\)]|[^ \t\n,\(\)]+/ | word . /[ \t]*\([^)]*\)/ (* this is already the most complicated part of this module and it's about to * get worse. match statements can be way more complicated than this * * examples: * using or: * match if ((option vendor-class-identifier="Banana Bready") or (option vendor-class-identifier="Cherry Sunfire")); * unneeded parenthesis: * match if (option vendor-class-identifier="Hello"); * * and of course the fact that the above two rules used one of infinately * many potential options instead of a builtin function. *) (* sto_com doesn't support quoted strings as arguments. It also doesn't support single arguments (needs to match a comma) It will need to be updated for lcase, ucase and log to be workable. it also doesn't support no arguments, so gethostbyname() doesn't work. option and config-option are considered operators. They should be matched in stmt_entry but also available under "match if" and "if" conditionals leased-address, host-decl-name, both take no args and return a value. We might need to treat them as variable names in the parser. things like this may be near-impossible to parse even with recursion because we have no way of knowing when or if a subfunction takes arguments set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); even if we could parse it, they could get arbitrarily complicated like: binary-to-ascii(16, 8, ":", substring(hardware, 1, 6) and substring(hardware, 2, 3)); so at some point we may need to programmatically knock it off and tell people to put weird stuff in an include file that augeas doesn't parse. the other option is to change the API to not parse the if statement at all, just pull in the conditional as a string. *) let fct_re = "substring" | "binary-to-ascii" | "suffix" | "lcase" | "ucase" | "gethostbyname" | "packet" | "concat" | "reverse" | "encode-int" | "extract-int" | "lease-time" | "client-state" | "exists" | "known" | "static" | "pick-first-value" | "log" | "execute" (* not needs to be different because it's a negation of whatever happens next *) let op_re = "~="|"="|"~~"|"and"|"or" let fct_args = [ label "args" . dels "(" . sep_osp . ([ label "arg" . store sto_com ] . [ label "arg" . sep_com . store sto_com ]+) . sep_osp . dels ")" ] let stmt_match_ifopt = [ dels "if" . sep_spc . key "option" . sep_spc . store word . sep_eq . ([ label "value" . bare_to_scl ]|[ label "value" . dquote_any ]) ] let stmt_match_func = [ store fct_re . sep_osp . label "function" . fct_args ] . sep_eq . ([ label "value" . bare_to_scl ]|[ label "value" . dquote_any ]) let stmt_match_pfv = [ label "function" . store "pick-first-value" . sep_spc . dels "(" . sep_osp . [ label "args" . [ label "arg" . store sto_com ] . [ sep_com . label "arg" . store sto_com ]+ ] . dels ")" ] let stmt_match_tpl (l:lens) = [ indent . key "match" . sep_spc . l . sep_scl . eos ] let stmt_match = stmt_match_tpl (dels "if" . sep_spc . stmt_match_func | stmt_match_pfv | stmt_match_ifopt) (************************************************************************ * BLOCK STATEMENTS *************************************************************************) (* Blocks doesn't support comments at the end of the closing bracket *) let stmt_entry = stmt_secu | stmt_option | stmt_hardware | stmt_range | stmt_string | stmt_integer | stmt_noarg | stmt_match | stmt_subclass | stmt_set | empty | comment let stmt_block_noarg_re = "pool" | "group" let stmt_block_noarg (body:lens) = [ indent . key stmt_block_noarg_re . sep_obr . body* . sep_cbr ] let stmt_block_arg_re = "host" | "class" | "shared-network" | /failover[ ]+peer/ | "zone" | "group" | "on" let stmt_block_arg (body:lens) = ([ indent . key stmt_block_arg_re . sep_spc . dquote_any . sep_obr . body* . sep_cbr ] |[ indent . key stmt_block_arg_re . sep_spc . bare_to_scl . sep_obr . body* . sep_cbr ] |[ indent . del /key/ "key" . label "key_block" . sep_spc . dquote_any . sep_obr . body* . sep_cbr . del /(;([ \t]*\n)*)?/ "" ] |[ indent . del /key/ "key" . label "key_block" . sep_spc . bare_to_scl . sep_obr . body* . sep_cbr . del /(;([ \t]*\n)*)?/ "" ]) let stmt_block_subnet (body:lens) = [ indent . key "subnet" . sep_spc . [ label "network" . store ip ] . sep_spc . [ key "netmask" . sep_spc . store ip ] . sep_obr . body* . sep_cbr ] let conditional (body:lens) = let condition = /[^{ \r\t\n][^{\n]*[^{ \r\t\n]|[^{ \t\n\r]/ in let elsif = [ indent . Build.xchgs "elsif" "@elsif" . sep_spc . store condition . sep_obr . body* . sep_cbr ] in let else = [ indent . Build.xchgs "else" "@else" . sep_obr . body* . sep_cbr ] in [ indent . Build.xchgs "if" "@if" . sep_spc . store condition . sep_obr . body* . sep_cbr . elsif* . else? ] let all_block (body:lens) = let lns1 = stmt_block_subnet body in let lns2 = stmt_block_arg body in let lns3 = stmt_block_noarg body in let lns4 = conditional body in (lns1 | lns2 | lns3 | lns4 | stmt_entry) let rec lns_staging = stmt_entry|all_block lns_staging let lns = (lns_staging)* lenses/dist/aptpreferences.aug 0000644 00000003447 15231153062 0012512 0 ustar 00 (* Module: AptPreferences Apt/preferences module for Augeas Author: Raphael Pinson <raphael.pinson@camptocamp.com> *) module AptPreferences = autoload xfm (************************************************************************ * Group: Entries ************************************************************************) (* View: colon *) let colon = del /:[ \t]*/ ": " (* View: pin_gen A generic pin Parameters: lbl:string - the label *) let pin_gen (lbl:string) = store lbl . [ label lbl . Sep.space . store Rx.no_spaces ] (* View: pin_keys *) let pin_keys = let space_in = store /[^, \r\t\n][^,\n]*[^, \r\t\n]|[^, \t\n\r]/ in Build.key_value /[aclnov]/ Sep.equal space_in (* View: pin_options *) let pin_options = let comma = Util.delim "," in store "release" . Sep.space . Build.opt_list pin_keys comma (* View: version_pin *) let version_pin = pin_gen "version" (* View: origin_pin *) let origin_pin = pin_gen "origin" (* View: pin *) let pin = let pin_value = pin_options | version_pin | origin_pin in Build.key_value_line "Pin" colon pin_value (* View: entries *) let entries = Build.key_value_line ("Explanation"|"Package"|"Pin-Priority") colon (store Rx.space_in) | pin | Util.comment (* View: record *) let record = [ seq "record" . entries+ ] (************************************************************************ * Group: Lens ************************************************************************) (* View: lns *) let lns = Util.empty* . (Build.opt_list record Util.eol+ . Util.empty*)? (* View: filter *) let filter = incl "/etc/apt/preferences" . incl "/etc/apt/preferences.d/*" . Util.stdexcl let xfm = transform lns filter lenses/dist/rx.aug 0000644 00000010077 15231153062 0010132 0 ustar 00 (* Module: Rx Generic regexps to build lenses Author: Raphael Pinson <raphink@gmail.com> About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Rx = (* Group: Spaces *) (* Variable: space A mandatory space or tab *) let space = /[ \t]+/ (* Variable: opt_space An optional space or tab *) let opt_space = /[ \t]*/ (* Variable: cl A continued line with a backslash *) let cl = /[ \t]*\\\\\n[ \t]*/ (* Variable: cl_or_space A <cl> or a <space> *) let cl_or_space = cl | space (* Variable: cl_or_opt_space A <cl> or a <opt_space> *) let cl_or_opt_space = cl | opt_space (* Group: General strings *) (* Variable: space_in A string which not starting or ending with a space *) let space_in = /[^ \r\t\n].*[^ \r\t\n]|[^ \t\n\r]/ (* Variable: no_spaces A string with no spaces *) let no_spaces = /[^ \t\r\n]+/ (* Variable: word An alphanumeric string *) let word = /[A-Za-z0-9_.-]+/ (* Variable: integer One or more digits *) let integer = /[0-9]+/ (* Variable: relinteger A relative <integer> *) let relinteger = /[-+]?[0-9]+/ (* Variable: relinteger_noplus A relative <integer>, without explicit plus sign *) let relinteger_noplus = /[-]?[0-9]+/ (* Variable: decimal A decimal value (using ',' or '.' as a separator) *) let decimal = /[0-9]+([.,][0-9]+)?/ (* Variable: reldecimal A relative <decimal> *) let reldecimal = /[+-]?[0-9]+([.,][0-9]+)?/ (* Variable: byte A byte (0 - 255) *) let byte = /25[0-5]?|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9]/ (* Variable: hex A hex value *) let hex = /0x[0-9a-fA-F]+/ (* Variable: octal An octal value *) let octal = /0[0-7]+/ (* Variable: fspath A filesystem path *) let fspath = /[^ \t\n]+/ (* Group: All but... *) (* Variable: neg1 Anything but a space, a comma or a comment sign *) let neg1 = /[^,# \n\t]+/ (* * Group: IPs * Cf. http://blog.mes-stats.fr/2008/10/09/regex-ipv4-et-ipv6/ (in fr) *) (* Variable: ipv4 *) let ipv4 = let dot = "." in byte . dot . byte . dot . byte . dot . byte (* Variable: ipv6 *) let ipv6 = /(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})/ | ( /([0-9A-Fa-f]{1,4}:){6}/ . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/ . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/ ) | ( /([0-9A-Fa-f]{1,4}:){0,5}:/ . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/ . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/ ) | ( /::([0-9A-Fa-f]{1,4}:){0,5}/ . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/ . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/ ) | ( /[0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}/ . /[0-9A-Fa-f]{1,4}/ ) | /(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){1,7}:)/ (* Variable: ip An <ipv4> or <ipv6> *) let ip = ipv4 | ipv6 (* Variable: hostname A valid RFC 1123 hostname *) let hostname = /(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*( [A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])/ (* * Variable: device_name * A Linux device name like eth0 or i2c-0. Might still be too restrictive *) let device_name = /[a-zA-Z0-9_?.+:!-]+/ (* * Variable: email_addr * To be refined *) let email_addr = /[A-Za-z0-9_+.-]+@[A-Za-z0-9_.-]+/ (* * Variable: iso_8601 * ISO 8601 date time format *) let year = /[0-9]{4}/ let relyear = /[-+]?/ . year let monthday = /W?[0-9]{2}(-?[0-9]{1,2})?/ let time = let sep = /[T \t]/ in let digits = /[0-9]{2}(:?[0-9]{2}(:?[0-9]{2})?)?/ in let precis = /[.,][0-9]+/ in let zone = "Z" | /[-+]?[0-9]{2}(:?[0-9]{2})?/ in sep . digits . precis? . zone? let iso_8601 = year . ("-"? . monthday . time?)? lenses/dist/nginx.aug 0000644 00000005555 15231153062 0010631 0 ustar 00 (* Module: Nginx Nginx module for Augeas Authors: Ian Berry <iberry@barracuda.com> Raphael Pinson <raphael.pinson@camptocamp.com> About: Reference This module was built to support a limited subset of nginx configuration syntax. It works fine with simple blocks and field/value lines. 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/nginx/nginx.conf. See <filter>. About: Examples The <Test_Nginx> file contains various examples and tests. About: TODO * Convert statement keyworks for a regex * Support more advanced block syntax (location) *) module Nginx = autoload xfm (* Variable: block_re The keywords reserved for block entries *) let block_re = "http" | "events" | "server" | "mail" | "stream" (* All block keywords, including the ones we treat specially *) let block_re_all = block_re | "if" | "location" | "geo" | "map" | "split_clients" | "upstream" (* View: simple A simple entry *) let simple = let kw = Rx.word - block_re_all in let sto = store /[^ \t\n;][^;]*/ . Sep.semicolon in [ Util.indent . key kw . Sep.space . sto . (Util.eol|Util.comment_eol) ] let arg (name:string) (rx:regexp) = [ label name . Sep.space . store rx ] (* Match any argument (as much as possible) *) let any_rx = let bare_rx = /[^" \t\n{][^ \t\n{]*/ in let dquote_rx = /"([^\"]|\\.)*"/ in bare_rx | dquote_rx let any_arg (name:string) = arg name any_rx (* 'if' conditions are enclosed in matching parens which we can't match precisely with a regular expression. Instead, we gobble up anything that doesn't contain an opening brace. That can of course lead to trouble if a condition actually contains an opening brace *) let block_if = key "if" . arg "#cond" /\(([^ \t\n{]|[ \t\n][^{])*\)/ let block_location = key "location" . (arg "#comp" /=|~|~\*|\^~/)? . any_arg "#uri" let block_geo = key "geo" . (any_arg "#address")? . any_arg "#geo" let block_map = key "map" . any_arg "#source" . any_arg "#variable" let block_split_clients = key "split_clients" . any_arg "#string" . any_arg "#variable" let block_upstream = key "upstream" . any_arg "#name" let block_head = key block_re | block_if | block_location | block_geo | block_map | block_split_clients | block_upstream (* View: block A block containing <simple> entries *) let block (entry : lens) = [ Util.indent . block_head . Build.block_newlines entry Util.comment . Util.eol ] let rec directive = simple | block directive (* View: lns *) let lns = ( Util.comment | Util.empty | directive )* (* Variable: filter *) let filter = incl "/etc/nginx/nginx.conf" . incl "/etc/nginx/conf.d/*.conf" . incl "/usr/portage/www-servers/nginx/files/nginx.conf" let xfm = transform lns filter lenses/dist/subversion.aug 0000644 00000005401 15231153062 0011673 0 ustar 00 (* Module: Subversion Parses subversion's INI files Authors: Marc Fournier <marc.fournier@camptocamp.com> Raphael Pinson <raphael.pinson@camptocamp.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Examples The <Test_Subversion> file contains various examples and tests. *) module Subversion = autoload xfm (************************************************************************ * Group: INI File settings * * subversion only supports comments starting with "#" * *************************************************************************) (* View: comment *) let comment = IniFile.comment_noindent "#" "#" (* View: empty An empty line or a non-indented empty comment *) let empty = IniFile.empty_noindent (* View: sep *) let sep = IniFile.sep IniFile.sep_default IniFile.sep_default (************************************************************************ * Group: ENTRY * * subversion doesn't support indented entries * *************************************************************************) (* Variable: comma_list_re *) let comma_list_re = "password-stores" (* Variable: space_list_re *) let space_list_re = "global-ignores" | "preserved-conflict-file-exts" (* Variable: std_re *) let std_re = /[^ \t\r\n\/=#]+/ - (comma_list_re | space_list_re) (* View: entry_std A standard entry Similar to a <IniFile.entry_multiline_nocomment> entry, but allows ';' *) let entry_std = IniFile.entry_multiline_generic (key std_re) sep "#" comment IniFile.eol (* View: entry *) let entry = let comma_list_re = "password-stores" in let space_list_re = "global-ignores" | "preserved-conflict-file-exts" in let std_re = /[^ \t\r\n\/=#]+/ - (comma_list_re | space_list_re) in entry_std | IniFile.entry_list_nocomment comma_list_re sep Rx.word Sep.comma | IniFile.entry_list_nocomment space_list_re sep Rx.no_spaces (del /(\r?\n)?[ \t]+/ " ") (************************************************************************ * Group: TITLE * * subversion doesn't allow anonymous entries (outside sections) * *************************************************************************) (* View: title *) let title = IniFile.title IniFile.entry_re (* View: record Use the non-indented <empty> *) let record = IniFile.record_noempty title (entry|empty) (************************************************************************ * Group: LENS & FILTER *************************************************************************) (* View: lns *) let lns = IniFile.lns record comment (* Variable: filter *) let filter = incl "/etc/subversion/config" . incl "/etc/subversion/servers" let xfm = transform lns filter lenses/dist/htpasswd.aug 0000644 00000002023 15231153062 0011326 0 ustar 00 (* Module: Htpasswd Parses htpasswd and rsyncd.secrets files Author: Marc Fournier <marc.fournier@camptocamp.com> About: Reference This lens is based on examples in htpasswd(1) and rsyncd.conf(5) About: Usage Example (start code) augtool> set /augeas/load/Htpasswd/lens "Htpasswd.lns" augtool> set /augeas/load/Htpasswd/incl "/var/www/.htpasswd" augtool> load augtool> get /files/var/www/.htpasswd/foo /files/var/www/.htpasswd/foo = $apr1$e2WS6ARQ$lYhqy9CLmwlxR/07TLR46. augtool> set /files/var/www/.htpasswd/foo bar augtool> save Saved 1 file(s) $ cat /var/www/.htpasswd foo:bar (end code) About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Htpasswd = autoload xfm let entry = Build.key_value_line Rx.word Sep.colon (store Rx.space_in) let lns = (Util.empty | Util.comment | entry)* let filter = incl "/etc/httpd/htpasswd" . incl "/etc/apache2/htpasswd" . incl "/etc/rsyncd.secrets" let xfm = transform lns filter lenses/dist/ssh.aug 0000644 00000005653 15231153062 0010302 0 ustar 00 (* Module: Ssh Parses ssh client configuration Author: Jiri Suchomel <jsuchome@suse.cz> About: Reference ssh_config man page About: License This file is licensed under the GPL. About: Lens Usage Sample usage of this lens in augtool (start code) augtool> set /files/etc/ssh/ssh_config/Host example.com augtool> set /files/etc/ssh/ssh_config/Host[.='example.com']/RemoteForward/machine1:1234 machine2:5678 augtool> set /files/etc/ssh/ssh_config/Host[.='example.com']/Ciphers/1 aes128-ctr augtool> set /files/etc/ssh/ssh_config/Host[.='example.com']/Ciphers/2 aes192-ctr (end code) *) module Ssh = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) let eol = Util.doseol let spc = Util.del_ws_spc let comment = Util.comment let empty = Util.empty let comma = Util.del_str "," let indent = Util.indent let value_to_eol = store Rx.space_in let value_to_spc = store Rx.no_spaces let value_to_comma = store /[^, \t\r\n]+/ (************************************************************************ * Group: ENTRIES *************************************************************************) let array_entry (k:regexp) = [ indent . key k . counter "array_entry" . [ spc . seq "array_entry" . value_to_spc]* . eol ] let commas_entry (k:regexp) = let value = [ seq "commas_entry" . value_to_comma] in [ indent . key k . counter "commas_entry" . spc . Build.opt_list value comma . eol ] let fw_entry (k:regexp) = [ indent . key k . spc . [ key /[^ \t\r\n\/]+/ . spc . value_to_eol . eol ]] let send_env = array_entry /SendEnv/i let proxy_command = [ indent . key /ProxyCommand/i . spc . value_to_eol . eol ] let remote_fw = fw_entry /RemoteForward/i let local_fw = fw_entry /LocalForward/i let ciphers = commas_entry /Ciphers/i let macs = commas_entry /MACs/i let special_entry = send_env | proxy_command | remote_fw | local_fw | macs | ciphers let key_re = /[A-Za-z0-9]+/ - /SendEnv|Host|ProxyCommand|RemoteForward|LocalForward|MACs|Ciphers/i let other_entry = [ indent . key key_re . spc . value_to_spc . eol ] let entry = comment | empty | special_entry | other_entry let host = [ key /Host/i . spc . value_to_eol . eol . entry* ] (************************************************************************ * Group: LENS *************************************************************************) let lns = entry* . host* let xfm = transform lns (incl "/etc/ssh/ssh_config" . incl (Sys.getenv("HOME") . "/.ssh/config")) lenses/dist/logwatch.aug 0000644 00000002701 15231153062 0011304 0 ustar 00 (* Logwatch module for Augeas Author: Francois Lebel <francois@flebel.com> Based on the dnsmasq lens written by Free Ekanayaka. Reference: man logwatch (8) "Format is one option per line, legal options are the same as the long options legal on the command line. See "logwatch.pl --help" or "man 8 logwatch" for details." *) module Logwatch = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let spc = Util.del_ws_spc let comment = Util.comment let empty = Util.empty let sep_eq = del / = / " = " let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ (************************************************************************ * ENTRIES *************************************************************************) let entry_re = /[A-Za-z0-9._-]+/ let entry = [ key entry_re . sep_eq . sto_to_eol . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = incl "/etc/logwatch/conf/logwatch.conf" . excl ".*" . Util.stdexcl let xfm = transform lns filter lenses/dist/dpkg.aug 0000644 00000005444 15231153062 0010430 0 ustar 00 (* Module: Dpkg Parses /etc/dpkg/dpkg.cfg Author: Robin Lee Powell <rlpowell@digitalkingdom.org> About: License This file, and the attendant test_dpgk.aug, are explicitely placed in the public domain. About: Description dpkg.cfg is a simple list of options, the same ones as the command line options, with or without a value. The tree is a list of either comments or option/value pairs by name. Use "set" to set an option with a value, and "clear" for a bare option. About: Usage Example (start code) $ augtool -n augtool> ls /files/etc/dpkg/dpkg.cfg #comment[1] = dpkg configuration file #comment[2] = This file can contain default options for dpkg. All command-line #comment[3] = options are allowed. Values can be specified by putting them after #comment[4] = the option, separated by whitespace and/or an `=' sign. #comment[5] = Do not enable debsig-verify by default; since the distribution is not using #comment[6] = embedded signatures, debsig-verify would reject all packages. no-debsig = (none) #comment[7] = Log status changes and actions to a file. log = /var/log/dpkg.log augtool> get /files/etc/dpkg/dpkg.cfg/no-debsig /files/etc/dpkg/dpkg.cfg/no-debsig (none) augtool> get /files/etc/dpkg/dpkg.cfg/log /files/etc/dpkg/dpkg.cfg/log = /var/log/dpkg.log augtool> clear /files/etc/dpkg/dpkg.cfg/testopt augtool> set /files/etc/dpkg/dpkg.cfg/testopt2 test augtool> save Saved 1 file(s) augtool> $ cat /etc/dpkg/dpkg.cfg.augnew # dpkg configuration file # # This file can contain default options for dpkg. All command-line # options are allowed. Values can be specified by putting them after # the option, separated by whitespace and/or an `=' sign. # # Do not enable debsig-verify by default; since the distribution is not using # embedded signatures, debsig-verify would reject all packages. no-debsig # Log status changes and actions to a file. log /var/log/dpkg.log testopt testopt2 test (end code) *) module Dpkg = autoload xfm let sep_tab = Util.del_ws_tab let sep_spc = Util.del_ws_spc let eol = del /[ \t]*\n/ "\n" let comment = Util.comment let empty = Util.empty let word = /[^,# \n\t]+/ let keyword = /[^,# \n\t\/]+/ (* View: record Keyword, followed by optional whitespace and value, followed by EOL. The actual file specification doesn't require EOL, but the likelyhood of the file not having one is pretty slim, and this way things we add have EOL. *) let record = [ key keyword . (sep_spc . store word)? . eol ] (* View: lns Any number of empty lines, comments, and records. *) let lns = ( empty | comment | record ) * let xfm = transform lns (incl "/etc/dpkg/dpkg.cfg") lenses/dist/shellvars.aug 0000644 00000022235 15231153062 0011503 0 ustar 00 (* Module: Shellvars Generic lens for shell-script config files like the ones found in /etc/sysconfig About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented *) module Shellvars = autoload xfm (* Delete a blank line, rather than mapping it *) let del_empty = del (Util.empty_generic_re . "\n") "\n" let empty = Util.empty let empty_part_re = Util.empty_generic_re . /\n+/ let eol = del (/[ \t]+|[ \t]*[;\n]/ . empty_part_re*) "\n" let semicol_eol = del (/[ \t]*[;\n]/ . empty_part_re*) "\n" let key_re = /[A-Za-z0-9_]+(\[[0-9A-Za-z_,]+\])?/ - ("unset" | "export") let matching_re = "${!" . key_re . /[\*@]\}/ let eq = Util.del_str "=" let eol_for_comment = del /([ \t]*\n)([ \t]*(#[ \t]*)?\n)*/ "\n" let comment = Util.comment_generic_seteol /[ \t]*#[ \t]*/ " # " eol_for_comment (* comment_eol in shell MUST begin with a space *) let comment_eol = Util.comment_generic_seteol /[ \t]+#[ \t]*/ " # " eol_for_comment let comment_or_eol = comment_eol | semicol_eol let xchgs = Build.xchgs let semicol = del /;?/ "" let char = /[^`;() '"\t\n]|\\\\"/ let dquot = let char = /[^"\\]|\\\\./ | Rx.cl in "\"" . char* . "\"" (* " Emacs, relax *) let squot = /'[^']*'/ let bquot = /`[^`\n]*`/ (* dbquot don't take spaces or semi-colons *) let dbquot = /``[^` \t\n;]+``/ let dollar_assign = /\$\([^\(\)#\n]*\)/ let dollar_arithm = /\$\(\([^\)#\n]*\)\)/ let anyquot = (dquot|squot)+ | bquot | dbquot | dollar_assign | dollar_arithm let to_semicol_re = /[^#; \t\n][^#;\n]+[^#; \t\n]|[^#; \t\n]+/ let sto_to_semicol = store to_semicol_re let sto_to_semicol_quot = let no_semicol_re = /[^"'#;\n]/ in let no_semicol_spc_re = /[^"'#; \t\n]/ in let multi_chars = no_semicol_spc_re . (no_semicol_re|anyquot)+ . no_semicol_spc_re in store (no_semicol_spc_re | multi_chars) (* Array values of the form '(val1 val2 val3)'. We do not handle empty *) (* arrays here because of typechecking headaches. Instead, they are *) (* treated as a simple value *) let array = let array_value = store (char+ | anyquot) in del /\([ \t]*/ "(" . counter "values" . [ seq "values" . array_value ] . [ del /[ \t\n]+/ " " . seq "values" . array_value ] * . del /[ \t]*\)/ ")" (* Treat an empty list () as a value '()'; that's not quite correct *) (* but fairly close. *) let simple_value = let empty_array = /\([ \t]*\)/ in store (char* | anyquot | empty_array) let export = [ key "export" . Util.del_ws_spc ] let kv = Util.indent . export? . key key_re . eq . (simple_value | array) let var_action (name:string) = Util.indent . del name name . Util.del_ws_spc . label ("@" . name) . counter "var_action" . Build.opt_list [ seq "var_action" . store (key_re | matching_re) ] Util.del_ws_spc let unset = var_action "unset" let bare_export = var_action "export" let source = Util.indent . del /\.|source/ "." . label ".source" . Util.del_ws_spc . store /[^;=# \t\n]+/ let shell_builtin_cmds = "ulimit" | "shift" | "exit" let builtin = Util.indent . label "@builtin" . store shell_builtin_cmds . (Util.del_ws_spc . [ label "args" . sto_to_semicol ])? let keyword (kw:string) = Util.indent . Util.del_str kw let keyword_label (kw:string) (lbl:string) = keyword kw . label lbl let return = Util.indent . label "@return" . Util.del_str "return" . ( Util.del_ws_spc . store Rx.integer )? (************************************************************************ * Group: CONDITIONALS AND LOOPS *************************************************************************) let generic_cond_start (start_kw:string) (lbl:string) (then_kw:string) (contents:lens) = keyword_label start_kw lbl . Sep.space . sto_to_semicol_quot . semicol_eol . keyword then_kw . eol . contents let generic_cond (start_kw:string) (lbl:string) (then_kw:string) (contents:lens) (end_kw:string) = [ generic_cond_start start_kw lbl then_kw contents . keyword end_kw . comment_or_eol ] let cond_if (entry:lens) = let elif = [ generic_cond_start "elif" "@elif" "then" entry+ ] in let else = [ keyword_label "else" "@else" . eol . entry+ ] in generic_cond "if" "@if" "then" (entry+ . elif* . else?) "fi" let loop_for (entry:lens) = generic_cond "for" "@for" "do" entry+ "done" let loop_while (entry:lens) = generic_cond "while" "@while" "do" entry+ "done" let loop_until (entry:lens) = generic_cond "until" "@until" "do" entry+ "done" let loop_select (entry:lens) = generic_cond "select" "@select" "do" entry+ "done" let case (entry:lens) (entry_noeol:lens) = let case_entry = [ label "@case_entry" . Util.indent . store /[^ \t\n\)]+/ . Util.del_str ")" . eol . entry* . entry_noeol? . Util.indent . Util.del_str ";;" . eol ] in [ keyword_label "case" "@case" . Sep.space . store (char+ | ("\"" . char+ . "\"")) . del /[ \t\n]+/ " " . Util.del_str "in" . eol . (empty* . comment* . case_entry)* . empty* . comment* . keyword "esac" . comment_or_eol ] let function (entry:lens) = [ Util.indent . label "@function" . del /(function[ \t]+)?/ "" . store Rx.word . del /[ \t]*\(\)/ "()" . eol . Util.del_str "{" . eol . entry+ . Util.indent . Util.del_str "}" . eol ] let entry_eol = let entry_eol_item (item:lens) = [ item . comment_or_eol ] in entry_eol_item source | entry_eol_item kv | entry_eol_item unset | entry_eol_item bare_export | entry_eol_item builtin | entry_eol_item return let entry_noeol = let entry_item (item:lens) = [ item ] in entry_item source | entry_item kv | entry_item unset | entry_item bare_export | entry_item builtin | entry_item return let rec rec_entry = let entry = comment | entry_eol | rec_entry in cond_if entry | loop_for entry | loop_select entry | loop_while entry | loop_until entry | case entry entry_noeol | function entry let lns_norec = del_empty* . (comment | entry_eol) * let lns = del_empty* . (comment | entry_eol | rec_entry) * let sc_incl (n:string) = (incl ("/etc/sysconfig/" . n)) let sc_excl (n:string) = (excl ("/etc/sysconfig/" . n)) let filter_sysconfig = sc_incl "*" . sc_excl "anaconda" . sc_excl "bootloader" . sc_excl "hw-uuid" . sc_excl "hwconf" . sc_excl "ip*tables" . sc_excl "ip*tables.save" . sc_excl "kernel" . sc_excl "*.pub" . sc_excl "sysstat.ioconf" . sc_excl "system-config-firewall" . sc_excl "system-config-securitylevel" . sc_incl "network/config" . sc_incl "network/dhcp" . sc_incl "network/dhcp6r" . sc_incl "network/dhcp6s" . sc_incl "network/ifcfg-*" . sc_incl "network/if-down.d/*" . sc_incl "network/ifroute-*" . sc_incl "network/if-up.d/*" . sc_incl "network/providers/*" . sc_excl "network-scripts" . sc_incl "network-scripts/ifcfg-*" . sc_excl "rhn" . sc_incl "rhn/allowed-actions/*" . sc_excl "rhn/allowed-actions/script" . sc_incl "rhn/allowed-actions/script/*" . sc_incl "rhn/rhnsd" . sc_excl "SuSEfirewall2.d" . sc_incl "SuSEfirewall2.d/cobbler" . sc_incl "SuSEfirewall2.d/services/*" . sc_excl "SuSEfirewall2.d/services/TEMPLATE" . sc_excl "*.systemd" let filter_default = incl "/etc/default/*" . excl "/etc/default/grub_installdevice*" . excl "/etc/default/rmt" . excl "/etc/default/whoopsie" let filter_misc = incl "/etc/arno-iptables-firewall/debconf.cfg" . incl "/etc/cron-apt/config" . incl "/etc/environment" . incl "/etc/firewalld/firewalld.conf" . incl "/etc/blkid.conf" . incl "/etc/adduser.conf" . incl "/etc/cowpoke.conf" . incl "/etc/cvs-cron.conf" . incl "/etc/cvs-pserver.conf" . incl "/etc/devscripts.conf" . incl "/etc/lintianrc" . incl "/etc/lsb-release" . incl "/etc/os-release" . incl "/etc/periodic.conf" . incl "/etc/popularity-contest.conf" . incl "/etc/rc.conf" . incl "/etc/rc.conf.local" . incl "/etc/selinux/config" . incl "/etc/ucf.conf" . incl "/etc/locale.conf" . incl "/etc/vconsole.conf" let filter = filter_sysconfig . filter_default . filter_misc . Util.stdexcl let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/cups.aug 0000644 00000000713 15231153062 0010447 0 ustar 00 (* Module: Cups Parses cups configuration files Author: Raphael Pinson <raphink@gmail.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Examples The <Test_Cups> 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 lenses/dist/simplevars.aug 0000644 00000002667 15231153062 0011674 0 ustar 00 (* Module: Simplevars Parses simple key = value conffiles Author: Raphael Pinson <raphink@gmail.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Examples The <Test_Simplevars> file contains various examples and tests. *) module Simplevars = autoload xfm (* Variable: to_comment_re The regexp to match the value *) let to_comment_re = let to_comment_squote = /'[^\n']*'/ in let to_comment_dquote = /"[^\n"]*"/ in let to_comment_noquote = /[^\n \t'"#][^\n#]*[^\n \t#]|[^\n \t'"#]/ in to_comment_squote | to_comment_dquote | to_comment_noquote (* View: entry *) let entry = let some_value = Sep.space_equal . store to_comment_re (* Avoid ambiguity in tree by making a subtree here *) in let empty_value = [del /[ \t]*=/ "="] . store "" in [ Util.indent . key Rx.word . (some_value? | empty_value) . (Util.eol | Util.comment_eol) ] (* View: lns *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = incl "/etc/kernel-img.conf" . incl "/etc/kerneloops.conf" . incl "/etc/updatedb.conf" . incl "/etc/wgetrc" . incl "/etc/zabbix/*.conf" . incl "/etc/audit/auditd.conf" . incl "/etc/mixerctl.conf" . incl "/etc/wsconsctlctl.conf" . incl "/etc/selinux/semanage.conf" let xfm = transform lns filter lenses/dist/pylonspaste.aug 0000644 00000004467 15231153062 0012070 0 ustar 00 (* Module: PylonsPaste Parses Pylons Paste ini configuration files. Author: Andrew Colin Kissa <andrew@topdog.za.net> Baruwa Enterprise Edition http://www.baruwa.com About: License This file is licensed under the LGPL v2+. About: Configuration files This lens applies to /etc/baruwa See <filter>. *) module Pylonspaste = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = IniFile.sep "=" "=" let eol = Util.eol let optspace = del /\n/ "\n" let entry_re = ( /[A-Za-z][:#A-Za-z0-9._-]+/) let plugin_re = /[A-Za-z][;:#A-Za-z0-9._-]+/ let plugins_kw = /plugins/ let debug_kw = /debug/ let normal_opts = entry_re - (debug_kw|plugins_kw) let del_opt_ws = del /[\t ]*/ "" let new_ln_sep = optspace . del_opt_ws . store plugin_re let plugins_multiline = sep . counter "items" . [ seq "items" . new_ln_sep]* let sto_multiline = optspace . Sep.opt_space . store (Rx.space_in . (/[ \t]*\n/ . Rx.space . Rx.space_in)*) (************************************************************************ * Group: ENTRY *************************************************************************) let set_option = Util.del_str "set " let no_inline_comment_entry (kw:regexp) (sep:lens) (comment:lens) = [ set_option . key debug_kw . sep . IniFile.sto_to_eol . eol ] | [ key plugins_kw . plugins_multiline . eol] | [ key kw . sep . IniFile.sto_to_eol? . eol ] | comment let entry = no_inline_comment_entry normal_opts sep comment (************************************************************************ * RECORD *************************************************************************) let title = IniFile.title IniFile.record_re let record = IniFile.record title entry (************************************************************************ * Group: LENS & FILTER *************************************************************************) let lns = IniFile.lns record comment let filter = incl "/etc/baruwa/*.ini" let xfm = transform lns filter lenses/dist/nagioscfg.aug 0000644 00000004132 15231153062 0011434 0 ustar 00 (* Module: NagiosConfig Parses /etc/{nagios{3,},icinga}/*.cfg Authors: Sebastien Aperghis-Tramoni <sebastien@aperghis.net> Raphaël Pinson <raphink@gmail.com> 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/{nagios{3,},icinga}/*.cfg. See <filter>. *) module NagiosCfg = autoload xfm (************************************************************************ * Group: Utility variables/functions ************************************************************************) (* View: param_def define a field *) let param_def = let space_in = /[^ \t\n][^\n=]*[^ \t\n]|[^ \t\n]/ in key /[A-Za-z0-9_]+/ . Sep.opt_space . Sep.equal . Sep.opt_space . store space_in (* View: macro_def Macro line, as used in resource.cfg *) let macro_def = let macro = /\$[A-Za-z0-9]+\$/ in let macro_decl = Rx.word | Rx.fspath in key macro . Sep.space_equal . store macro_decl (************************************************************************ * Group: Entries ************************************************************************) (* View: param Params can have sub params *) let param = [ Util.indent . param_def . [ Sep.space . param_def ]* . Util.eol ] (* View: macro *) let macro = [ Util.indent . macro_def . Util.eol ] (************************************************************************ * Group: Lens ************************************************************************) (* View: entry Define the accepted entries, such as param for regular configuration files, and macro for resources.cfg .*) let entry = param | macro (* View: lns main structure *) let lns = ( Util.empty | Util.comment | entry )* (* View: filter *) let filter = incl "/etc/nagios3/*.cfg" . incl "/etc/nagios/*.cfg" . incl "/etc/icinga/*.cfg" . excl "/etc/nagios3/commands.cfg" . excl "/etc/nagios/commands.cfg" . excl "/etc/nagios/nrpe.cfg" . incl "/etc/icinga/commands.cfg" let xfm = transform lns filter lenses/dist/splunk.aug 0000644 00000002335 15231153062 0011013 0 ustar 00 (* Module: Splunk Parses /opt/splunk/etc/* Author: Tim Brigham About: Reference http://docs.splunk.com/Documentation/Splunk/5.0.2/Admin/AboutConfigurationFiles About: License This file is licenced under the LGPL v2+ About: Lens Usage Works like IniFile lens, with anonymous section for entries without enclosing section. About: Configuration files This lens applies to conf files under /opt/splunk/etc See <filter>. About: Examples The <Test_Splunk> file contains various examples and tests. *) module Splunk = autoload xfm let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = IniFile.sep IniFile.sep_re IniFile.sep_default let empty = IniFile.empty let setting = IniFile.entry_re let title = IniFile.indented_title_label "target" IniFile.record_label_re let entry = [ key IniFile.entry_re . sep . IniFile.sto_to_eol? . IniFile.eol ] | comment let record = IniFile.record title entry let anon = [ label ".anon" . (entry|empty)+ ] let lns = anon . (record)* | (record)* let filter = incl "/opt/splunk/etc/system/local/*.conf" . incl "/opt/splunk/etc/apps/*/local/*.conf" let xfm = transform lns filter lenses/dist/modules_conf.aug 0000644 00000002054 15231153062 0012152 0 ustar 00 (* Module: Modules_conf Parses /etc/modules.conf and /etc/conf.modules Based on the similar Modprobe lens Not all directives currently listed in modules.conf(5) are currently supported. *) module Modules_conf = autoload xfm let comment = Util.comment let empty = Util.empty let eol = Util.eol | Util.comment (* Basic file structure is the same as modprobe.conf *) let sto_to_eol = Modprobe.sto_to_eol let sep_space = Modprobe.sep_space let path = [ key "path" . Util.del_str "=" . sto_to_eol . eol ] let keep = [ key "keep" . eol ] let probeall = Build.key_value_line_comment "probeall" sep_space sto_to_eol comment let entry = Modprobe.alias | Modprobe.options | Modprobe.kv_line_command /install|pre-install|post-install/ | Modprobe.kv_line_command /remove|pre-remove|post-remove/ | keep | path | probeall let lns = (comment|empty|entry)* let filter = (incl "/etc/modules.conf") . (incl "/etc/conf.modules") let xfm = transform lns filter lenses/dist/cobblermodules.aug 0000644 00000000616 15231153062 0012500 0 ustar 00 module CobblerModules = autoload xfm let comment = IniFile.comment "#" "#" let sep = IniFile.sep "=" "=" let entry = IniFile.entry IniFile.entry_re sep comment let title = IniFile.indented_title IniFile.record_re let record = IniFile.record title entry let lns = IniFile.lns record comment let filter = (incl "/etc/cobbler/modules.conf") let xfm = transform lns filter lenses/dist/reprepro_uploaders.aug 0000644 00000011377 15231153062 0013421 0 ustar 00 (* Module: Reprepro_Uploaders Parses reprepro's uploaders files Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 1 reprepro` where possible. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage See <lns>. About: Configuration files This lens applies to reprepro's uploaders files. About: Examples The <Test_Reprepro_Uploaders> file contains various examples and tests. *) module Reprepro_Uploaders = (* View: logic_construct_condition A logical construction for <condition> and <condition_list> *) let logic_construct_condition (kw:string) (lns:lens) = [ label kw . lns ] . [ Sep.space . key kw . Sep.space . lns ]* (* View: logic_construct_field A generic definition for <condition_field> *) let logic_construct_field (kw:string) (sep:string) (lns:lens) = [ label kw . lns ] . [ Build.xchgs sep kw . lns ]* (* View: condition_re A condition can be of several types: - source - byhand - sections - sections contain - binaries - binaries contain - architectures - architectures contain While the lens technically also accepts "source contain" and "byhand contain", these are not understood by reprepro. The "contain" types are built by adding a "contain" subnode. See the <condition_field> definition. *) let condition_re = "source" | "byhand" | "sections" | "binaries" | "architectures" (* View: condition_field A single condition field is an 'or' node. It may contain several values, listed in 'or' subnodes: > $reprepro/allow[1]/and/or = "architectures" > $reprepro/allow[1]/and/or/or[1] = "i386" > $reprepro/allow[1]/and/or/or[2] = "amd64" > $reprepro/allow[1]/and/or/or[3] = "all" *) let condition_field = let sto_condition = Util.del_str "'" . store /[^'\n]+/ . Util.del_str "'" in [ key "not" . Sep.space ]? . store condition_re . [ Sep.space . key "contain" ]? . Sep.space . logic_construct_field "or" "|" sto_condition (* View: condition A condition is an 'and' node, representing a union of <condition_fields>, listed under 'or' subnodes: > $reprepro/allow[1]/and > $reprepro/allow[1]/and/or = "architectures" > $reprepro/allow[1]/and/or/or[1] = "i386" > $reprepro/allow[1]/and/or/or[2] = "amd64" > $reprepro/allow[1]/and/or/or[3] = "all" *) let condition = logic_construct_condition "or" condition_field (* View: condition_list A list of <conditions>, inspired by Debctrl.dependency_list An upload condition list is either the wildcard '*', stored verbatim, or an intersection of conditions listed under 'and' subnodes: > $reprepro/allow[1]/and[1] > $reprepro/allow[1]/and[1]/or = "architectures" > $reprepro/allow[1]/and[1]/or/or[1] = "i386" > $reprepro/allow[1]/and[1]/or/or[2] = "amd64" > $reprepro/allow[1]/and[1]/or/or[3] = "all" > $reprepro/allow[1]/and[2] > $reprepro/allow[1]/and[2]/or = "sections" > $reprepro/allow[1]/and[2]/or/contain > $reprepro/allow[1]/and[2]/or/or = "main" *) let condition_list = store "*" | logic_construct_condition "and" condition (* View: by_key When a key is used to authenticate packages, the value can either be a key ID or "any": > $reprepro/allow[1]/by/key = "ABCD1234" > $reprepro/allow[2]/by/key = "any" *) let by_key = let any_key = [ store "any" . Sep.space . key "key" ] in let named_key = [ key "key" . Sep.space . store (Rx.word - "any") ] in value "key" . (any_key | named_key) (* View: by <by> statements define who is allowed to upload. It can be simple keywords, like "anybody" or "unsigned", or a key ID, in which case a "key" subnode is added: > $reprepro/allow[1]/by/key = "ABCD1234" > $reprepro/allow[2]/by/key = "any" > $reprepro/allow[3]/by = "anybody" > $reprepro/allow[4]/by = "unsigned" *) let by = [ key "by" . Sep.space . ( store ("anybody"|"unsigned") | by_key ) ] (* View: entry An entry is an allow statement, e.g.: > $reprepro/allow[1] > $reprepro/allow[1]/and[1] > $reprepro/allow[1]/and[1]/or = "architectures" > $reprepro/allow[1]/and[1]/or/or[1] = "i386" > $reprepro/allow[1]/and[1]/or/or[2] = "amd64" > $reprepro/allow[1]/and[1]/or/or[3] = "all" > $reprepro/allow[1]/and[2] > $reprepro/allow[1]/and[2]/or = "sections" > $reprepro/allow[1]/and[2]/or/contain > $reprepro/allow[1]/and[2]/or/or = "main" > $reprepro/allow[1]/by = "key" > $reprepro/allow[1]/by/key = "ABCD1234" *) let entry = [ key "allow" . Sep.space . condition_list . Sep.space . by . Util.eol ] (* View: lns The lens is made of <Util.empty>, <Util.comment> and <entry> lines *) let lns = (Util.empty|Util.comment|entry)* lenses/dist/cyrus_imapd.aug 0000644 00000003012 15231153062 0012007 0 ustar 00 (* Cyrus_Imapd module for Augeas Author: Free Ekanayaka <free@64studio.com> *) module Cyrus_Imapd = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let indent = del /[ \t]*(\n[ \t]+)?/ " " let comment = Util.comment let empty = Util.empty let eq = del /[ \t]*:/ ":" let word = /[A-Za-z0-9_.-]+/ (* The value of a parameter, after the '=' sign. Postfix allows that * lines are continued by starting continuation lines with spaces. * The definition needs to make sure we don't add indented comment lines * into values *) let value = let chr = /[^# \t\n]/ in let any = /.*/ in let line = (chr . any* . chr | chr) in let lines = line . (/\n[ \t]+/ . line)* in store lines (************************************************************************ * ENTRIES *************************************************************************) let entry = [ key word . eq . (indent . value)? . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = (incl "/etc/imapd.conf") . (incl "/etc/imap/*.conf") . Util.stdexcl let xfm = transform lns filter lenses/dist/activemq_xml.aug 0000644 00000001540 15231153062 0012165 0 ustar 00 (* Module: ActiveMQ_XML ActiveMQ / FuseMQ XML module for Augeas Author: Brian Redbeard <redbeard@dead-city.org> About: Reference This lens ensures that XML files included in ActiveMQ / FuseMQ 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: * Get your current setup > print /files/etc/activemq/activemq.xml ... * Change OpenShift domain > set /files/etc/openshift/broker.conf/CLOUD_DOMAIN ose.example.com Saving your file: > save About: Configuration files This lens applies to relevant XML files located in /etc/activemq/ . See <filter>. *) module ActiveMQ_XML = autoload xfm let lns = Xml.lns let filter = (incl "/etc/activemq/*.xml") . Util.stdexcl let xfm = transform lns filter lenses/dist/shellvars_list.aug 0000644 00000003363 15231153062 0012537 0 ustar 00 (* Generic lens for shell-script config files like the ones found *) (* in /etc/sysconfig, where a string needs to be split into *) (* single words. *) module Shellvars_list = autoload xfm let eol = Util.eol let key_re = /[A-Za-z0-9_]+/ let eq = Util.del_str "=" let comment = Util.comment let comment_or_eol = Util.comment_or_eol let empty = Util.empty let indent = Util.indent let sqword = /[^ '\t\n]+/ let dqword = /([^ "\\\t\n]|\\\\.)+/ let uqword = /([^ `"'\\\t\n]|\\\\.)+/ let bqword = /`[^`\n]*`/ let space_or_nl = /[ \t\n]+/ let space_or_cl = space_or_nl | Rx.cl (* lists values of the form ... val1 val2 val3 ... *) let list (word:regexp) (sep:regexp) = let list_value = store word in indent . [ label "value" . list_value ] . [ del sep " " . label "value" . list_value ]* . indent (* handle single quoted lists *) let squote_arr = [ label "quote" . store /'/ ] . (list sqword space_or_nl)? . del /'/ "'" (* similarly handle double qouted lists *) let dquote_arr = [ label "quote" . store /"/ ] . (list dqword space_or_cl)? . del /"/ "\"" (* handle unquoted single value *) let unquot_val = [ label "quote" . store "" ] . [ label "value" . store (uqword+ | bqword)]? (* lens for key value pairs *) let kv = [ key key_re . eq . ( (squote_arr | dquote_arr) . comment_or_eol | unquot_val . eol ) ] let lns = ( comment | empty | kv )* let filter = incl "/etc/sysconfig/bootloader" . incl "/etc/sysconfig/kernel" let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/build.aug 0000644 00000041225 15231153062 0010577 0 ustar 00 (* Module: Build Generic functions to build lenses Author: Raphael Pinson <raphink@gmail.com> About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Reference This file provides generic functions to build Augeas lenses *) module Build = let eol = Util.eol (************************************************************************ * Group: GENERIC CONSTRUCTIONS ************************************************************************) (************************************************************************ * View: brackets * Put a lens inside brackets * * Parameters: * l:lens - the left bracket lens * r: lens - the right bracket lens * lns:lens - the lens to put inside brackets ************************************************************************) let brackets (l:lens) (r:lens) (lns:lens) = l . lns . r (************************************************************************ * Group: LIST CONSTRUCTIONS ************************************************************************) (************************************************************************ * View: list * Build a list of identical lenses separated with a given separator * (at least 2 elements) * * Parameters: * lns:lens - the lens to repeat in the list * sep:lens - the separator lens, which can be taken from the <Sep> module ************************************************************************) let list (lns:lens) (sep:lens) = lns . ( sep . lns )+ (************************************************************************ * View: opt_list * Same as <list>, but there might be only one element in the list * * Parameters: * lns:lens - the lens to repeat in the list * sep:lens - the separator lens, which can be taken from the <Sep> module ************************************************************************) let opt_list (lns:lens) (sep:lens) = lns . ( sep . lns )* (************************************************************************ * Group: LABEL OPERATIONS ************************************************************************) (************************************************************************ * View: xchg * Replace a pattern with a different label in the tree, * thus emulating a key but allowing to replace the keyword * with a different value than matched * * Parameters: * m:regexp - the pattern to match * d:string - the default value when a node in created * l:string - the label to apply for such nodes ************************************************************************) let xchg (m:regexp) (d:string) (l:string) = del m d . label l (************************************************************************ * View: xchgs * Same as <xchg>, but the pattern is the default string * * Parameters: * m:string - the string to replace, also used as default * l:string - the label to apply for such nodes ************************************************************************) let xchgs (m:string) (l:string) = xchg m m l (************************************************************************ * Group: SUBNODE CONSTRUCTIONS ************************************************************************) (************************************************************************ * View: key_value_line * A subnode with a keyword, a separator and a storing lens, * and an end of line * * Parameters: * kw:regexp - the pattern to match as key * sep:lens - the separator lens, which can be taken from the <Sep> module * sto:lens - the storing lens ************************************************************************) let key_value_line (kw:regexp) (sep:lens) (sto:lens) = [ key kw . sep . sto . eol ] (************************************************************************ * View: key_value_line_comment * Same as <key_value_line>, but allows to have a comment in the end of a line * and an end of line * * Parameters: * kw:regexp - the pattern to match as key * sep:lens - the separator lens, which can be taken from the <Sep> module * sto:lens - the storing lens * comment:lens - the comment lens, which can be taken from <Util> ************************************************************************) let key_value_line_comment (kw:regexp) (sep:lens) (sto:lens) (comment:lens) = [ key kw . sep . sto . (eol|comment) ] (************************************************************************ * View: key_value * Same as <key_value_line>, but does not end with an end of line * * Parameters: * kw:regexp - the pattern to match as key * sep:lens - the separator lens, which can be taken from the <Sep> module * sto:lens - the storing lens ************************************************************************) let key_value (kw: regexp) (sep:lens) (sto:lens) = [ key kw . sep . sto ] (************************************************************************ * View: key_ws_value * * Store a key/value pair where key and value are separated by whitespace * and the value goes to the end of the line. Leading and trailing * whitespace is stripped from the value. The end of line is consumed by * this lens * * Parameters: * kw:regexp - the pattern to match as key ************************************************************************) let key_ws_value (kw:regexp) = key_value_line kw Util.del_ws_spc (store Rx.space_in) (************************************************************************ * View: flag * A simple flag subnode, consisting of a single key * * Parameters: * kw:regexp - the pattern to match as key ************************************************************************) let flag (kw:regexp) = [ key kw ] (************************************************************************ * View: flag_line * A simple flag line, consisting of a single key * * Parameters: * kw:regexp - the pattern to match as key ************************************************************************) let flag_line (kw:regexp) = [ key kw . eol ] (************************************************************************ * Group: BLOCK CONSTRUCTIONS ************************************************************************) (************************************************************************ * View: block_generic * A block enclosed in brackets * * Parameters: * entry:lens - the entry to be stored inside the block. * This entry should include <Util.empty> * or its equivalent if necessary. * entry_noindent:lens - the entry to be stored inside the block, * without indentation. * This entry should not include <Util.empty> * entry_noeol:lens - the entry to be stored inside the block, * without eol. * This entry should not include <Util.empty> * entry_noindent_noeol:lens - the entry to be stored inside the block, * without indentation or eol. * This entry should not include <Util.empty> * comment:lens - the comment lens used in the block * comment_noindent:lens - the comment lens used in the block, * without indentation. * ldelim_re:regexp - regexp for the left delimiter * rdelim_re:regexp - regexp for the right delimiter * ldelim_default:string - default value for the left delimiter * rdelim_default:string - default value for the right delimiter ************************************************************************) let block_generic (entry:lens) (entry_noindent:lens) (entry_noeol:lens) (entry_noindent_noeol:lens) (comment:lens) (comment_noindent:lens) (ldelim_re:regexp) (rdelim_re:regexp) (ldelim_default:string) (rdelim_default:string) = let block_single = entry_noindent_noeol | comment_noindent in let block_start = entry_noindent | comment_noindent in let block_middle = (entry | comment)* in let block_end = entry_noeol | comment in del ldelim_re ldelim_default . ( ( block_start . block_middle . block_end ) | block_single ) . del rdelim_re rdelim_default (************************************************************************ * View: block_setdefault * A block enclosed in brackets * * Parameters: * entry:lens - the entry to be stored inside the block. * This entry should not include <Util.empty>, * <Util.comment> or <Util.comment_noindent>, * should not be indented or finish with an eol. * ldelim_re:regexp - regexp for the left delimiter * rdelim_re:regexp - regexp for the left delimiter * ldelim_default:string - default value for the left delimiter * rdelim_default:string - default value for the right delimiter ************************************************************************) let block_setdelim (entry:lens) (ldelim_re:regexp) (rdelim_re:regexp) (ldelim_default:string) (rdelim_default:string) = block_generic (Util.empty | Util.indent . entry . eol) (entry . eol) (Util.indent . entry) entry Util.comment Util.comment_noindent ldelim_re rdelim_re ldelim_default rdelim_default (* Variable: block_ldelim_re *) let block_ldelim_re = /[ \t\n]+\{[ \t\n]*/ (* Variable: block_rdelim_re *) let block_rdelim_re = /[ \t\n]*\}/ (* Variable: block_ldelim_default *) let block_ldelim_default = " {\n" (* Variable: block_rdelim_default *) let block_rdelim_default = "}" (************************************************************************ * View: block * A block enclosed in brackets * * Parameters: * entry:lens - the entry to be stored inside the block. * This entry should not include <Util.empty>, * <Util.comment> or <Util.comment_noindent>, * should not be indented or finish with an eol. ************************************************************************) let block (entry:lens) = block_setdelim entry block_ldelim_re block_rdelim_re block_ldelim_default block_rdelim_default (* Variable: block_ldelim_newlines_re *) let block_ldelim_newlines_re = /[ \t\n]*\{([ \t\n]*\n)?/ (* Variable: block_rdelim_newlines_re *) let block_rdelim_newlines_re = /[ \t]*\}/ (* Variable: block_ldelim_newlines_default *) let block_ldelim_newlines_default = "\n{\n" (* Variable: block_rdelim_newlines_default *) let block_rdelim_newlines_default = "}" (************************************************************************ * View: block_newline * A block enclosed in brackets, with newlines forced * and indentation defaulting to a tab. * * Parameters: * entry:lens - the entry to be stored inside the block. * This entry should not include <Util.empty>, * <Util.comment> or <Util.comment_noindent>, * should be indented and finish with an eol. ************************************************************************) let block_newlines (entry:lens) (comment:lens) = del block_ldelim_newlines_re block_ldelim_newlines_default . ((entry | comment) . (Util.empty | entry | comment)*)? . del block_rdelim_newlines_re block_rdelim_newlines_default (************************************************************************ * View: block_newlines_spc * A block enclosed in brackets, with newlines forced * and indentation defaulting to a tab. The opening brace * must be preceded by whitespace * * Parameters: * entry:lens - the entry to be stored inside the block. * This entry should not include <Util.empty>, * <Util.comment> or <Util.comment_noindent>, * should be indented and finish with an eol. ************************************************************************) let block_newlines_spc (entry:lens) (comment:lens) = del (/[ \t\n]/ . block_ldelim_newlines_re) block_ldelim_newlines_default . ((entry | comment) . (Util.empty | entry | comment)*)? . del block_rdelim_newlines_re block_rdelim_newlines_default (************************************************************************ * View: named_block * A named <block> enclosed in brackets * * Parameters: * kw:regexp - the regexp for the block name * entry:lens - the entry to be stored inside the block * this entry should not include <Util.empty> ************************************************************************) let named_block (kw:regexp) (entry:lens) = [ key kw . block entry . eol ] (************************************************************************ * Group: COMBINATORICS ************************************************************************) (************************************************************************ * View: combine_two_ord * Combine two lenses, ensuring first lens is first * * Parameters: * a:lens - the first lens * b:lens - the second lens ************************************************************************) let combine_two_ord (a:lens) (b:lens) = a . b (************************************************************************ * View: combine_two * Combine two lenses * * Parameters: * a:lens - the first lens * b:lens - the second lens ************************************************************************) let combine_two (a:lens) (b:lens) = combine_two_ord a b | combine_two_ord b a (************************************************************************ * View: combine_two_opt_ord * Combine two lenses optionally, ensuring first lens is first * (a, and optionally b) * * Parameters: * a:lens - the first lens * b:lens - the second lens ************************************************************************) let combine_two_opt_ord (a:lens) (b:lens) = a . b? (************************************************************************ * View: combine_two_opt * Combine two lenses optionally * (either a, b, or both, in any order) * * Parameters: * a:lens - the first lens * b:lens - the second lens ************************************************************************) let combine_two_opt (a:lens) (b:lens) = combine_two_opt_ord a b | combine_two_opt_ord b a (************************************************************************ * View: combine_three_ord * Combine three lenses, ensuring first lens is first * (a followed by either b, c, in any order) * * Parameters: * a:lens - the first lens * b:lens - the second lens * c:lens - the third lens ************************************************************************) let combine_three_ord (a:lens) (b:lens) (c:lens) = combine_two_ord a (combine_two b c) (************************************************************************ * View: combine_three * Combine three lenses * * Parameters: * a:lens - the first lens * b:lens - the second lens * c:lens - the third lens ************************************************************************) let combine_three (a:lens) (b:lens) (c:lens) = combine_three_ord a b c | combine_three_ord b a c | combine_three_ord c b a (************************************************************************ * View: combine_three_opt_ord * Combine three lenses optionally, ensuring first lens is first * (a followed by either b, c, or any of them, in any order) * * Parameters: * a:lens - the first lens * b:lens - the second lens * c:lens - the third lens ************************************************************************) let combine_three_opt_ord (a:lens) (b:lens) (c:lens) = combine_two_opt_ord a (combine_two_opt b c) (************************************************************************ * View: combine_three_opt * Combine three lenses optionally * (either a, b, c, or any of them, in any order) * * Parameters: * a:lens - the first lens * b:lens - the second lens * c:lens - the third lens ************************************************************************) let combine_three_opt (a:lens) (b:lens) (c:lens) = combine_three_opt_ord a b c | combine_three_opt_ord b a c | combine_three_opt_ord c b a lenses/dist/samba.aug 0000644 00000003333 15231153062 0010561 0 ustar 00 (* Samba module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: man smb.conf(5) *) module Samba = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = del /[ \t]*=/ " =" let indent = del /[ \t]*/ " " (* Import useful INI File primitives *) let eol = IniFile.eol let empty = IniFile.empty let sto_to_comment = Util.del_opt_ws " " . store /[^;# \t\r\n][^;#\r\n]*[^;# \t\r\n]|[^;# \t\r\n]/ (************************************************************************ * ENTRY * smb.conf allows indented entries *************************************************************************) let entry_re = /[A-Za-z0-9_.-][A-Za-z0-9 _.:\*-]*[A-Za-z0-9_.\*-]/ let entry = let kw = entry_re in [ indent . key kw . sep . sto_to_comment? . (comment|eol) ] | comment (************************************************************************ * TITLE *************************************************************************) let title = IniFile.title_label "target" IniFile.record_label_re let record = IniFile.record title entry (************************************************************************ * LENS & FILTER *************************************************************************) let lns = IniFile.lns record comment let filter = (incl "/etc/samba/smb.conf") let xfm = transform lns filter lenses/dist/soma.aug 0000644 00000002217 15231153062 0010435 0 ustar 00 (* Soma module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: man 5 soma.cfg *) module Soma = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let comment = Util.comment let empty = Util.empty let sep_eq = del /[ \t]*=[ \t]*/ " = " let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ let word = /[A-Za-z0-9_.-]+/ (************************************************************************ * ENTRIES *************************************************************************) let entry = [ key word . sep_eq . sto_to_eol . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = incl "/etc/somad/soma.cfg" let xfm = transform lns filter lenses/dist/ldso.aug 0000644 00000002075 15231153062 0010441 0 ustar 00 (* Module: Keepalived Parses /etc/ld.so.conf and /etc/ld.so.conf.d/* Author: Raphael Pinson <raphink@gmail.com> 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/ld.so.conf and /etc/ld.so.conf.d/*. See <filter>. About: Examples The <Test_Ldso> file contains various examples and tests. *) module LdSo = autoload xfm (* View: path *) let path = [ label "path" . store /[^# \t\n][^ \t\n]*/ . Util.eol ] (* View: include *) let include = Build.key_value_line "include" Sep.space (store Rx.fspath) (* View: hwcap *) let hwcap = let hwcap_val = [ label "bit" . store Rx.integer ] . Sep.space . [ label "name" . store Rx.word ] in Build.key_value_line "hwcap" Sep.space hwcap_val (* View: lns *) let lns = (Util.empty | Util.comment | path | include | hwcap)* (* Variable: filter *) let filter = incl "/etc/ld.so.conf" . incl "/etc/ld.so.conf.d/*" . Util.stdexcl let xfm = transform lns filter lenses/dist/sysctl.aug 0000644 00000001633 15231153062 0011020 0 ustar 00 (* Module: Sysctl Parses /etc/sysctl.conf and /etc/sysctl.d/* Author: David Lutterkort <lutter@redhat.com> About: Reference 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/sysctl.conf and /etc/sysctl.d/*. See <filter>. About: Examples The <Test_Sysctl> file contains various examples and tests. *) module Sysctl = autoload xfm (* Variable: filter *) let filter = incl "/boot/loader.conf" . incl "/etc/sysctl.conf" . incl "/etc/sysctl.d/*" . excl "/etc/sysctl.d/README" . excl "/etc/sysctl.d/README.sysctl" . Util.stdexcl (* View: comment *) let comment = Util.comment_generic /[ \t]*[#;][ \t]*/ "# " (* View: lns The sysctl lens *) let lns = (Util.empty | comment | Simplevars.entry)* let xfm = transform lns filter lenses/dist/xml.aug 0000644 00000014136 15231153062 0010301 0 ustar 00 (* XML lens for Augeas Author: Francis Giraldeau <francis.giraldeau@usherbrooke.ca> Reference: http://www.w3.org/TR/2006/REC-xml11-20060816/ *) module Xml = autoload xfm (************************************************************************ * Utilities lens *************************************************************************) let dels (s:string) = del s s let spc = /[ \t\r\n]+/ let osp = /[ \t\r\n]*/ let sep_spc = del /[ \t\r\n]+/ " " let sep_osp = del /[ \t\r\n]*/ "" let sep_eq = del /[ \t\r\n]*=[ \t\r\n]*/ "=" let nmtoken = /[a-zA-Z:_][a-zA-Z0-9:_.-]*/ let word = /[a-zA-Z][a-zA-Z0-9._-]*/ let char = /.|(\r?\n)/ (* if we hide the quotes, then we can only accept single or double quotes *) (* otherwise a put ambiguity is raised *) let sto_dquote = dels "\"" . store /[^"]*/ . dels "\"" (* " *) let sto_squote = dels "'" . store /[^']*/ . dels "'" let comment = [ label "#comment" . dels "<!--" . store /([^-]|-[^-])*/ . dels "-->" ] let pi_target = nmtoken - /[Xx][Mm][Ll]/ let empty = Util.empty let del_end = del />[\r?\n]?/ ">\n" let del_end_simple = dels ">" (* This is siplified version of processing instruction * pi has to not start or end with a white space and the string * must not contain "?>". We restrict too much by not allowing any * "?" nor ">" in PI *) let pi = /[^ \r\n\t]|[^ \r\n\t][^?>]*[^ \r\n\t]/ (************************************************************************ * Attributes *************************************************************************) let decl = [ label "#decl" . sep_spc . store /[^> \t\n\r]|[^> \t\n\r][^>\t\n\r]*[^> \t\n\r]/ ] let decl_def (r:regexp) (b:lens) = [ dels "<" . key r . sep_spc . store nmtoken . b . sep_osp . del_end_simple ] let elem_def = decl_def /!ELEMENT/ decl let enum = "(" . osp . nmtoken . ( osp . "|" . osp . nmtoken )* . osp . ")" let att_type = /CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/ | enum let id_def = [ sep_spc . key /PUBLIC/ . [ label "#literal" . sep_spc . sto_dquote ]* ] | [ sep_spc . key /SYSTEM/ . sep_spc . sto_dquote ] let notation_def = decl_def /!NOTATION/ id_def let att_def = counter "att_id" . [ sep_spc . seq "att_id" . [ label "#name" . store word . sep_spc ] . [ label "#type" . store att_type . sep_spc ] . ([ key /#REQUIRED|#IMPLIED/ ] | [ label "#FIXED" . del /#FIXED[ \r\n\t]*|/ "" . sto_dquote ]) ]* let att_list_def = decl_def /!ATTLIST/ att_def let entity_def = decl_def /!ENTITY/ ([sep_spc . label "#decl" . sto_dquote ]) let decl_def_item = elem_def | entity_def | att_list_def | notation_def let decl_outer = sep_osp . del /\[[ \n\t\r]*/ "[\n" . (decl_def_item . sep_osp )* . dels "]" (* let dtd_def = [ sep_spc . key "SYSTEM" . sep_spc . sto_dquote ] *) let doctype = decl_def /!DOCTYPE/ (decl_outer|id_def) (* General shape of an attribute * q is the regexp matching the quote character for the value * qd is the default quote character * brx is what the actual attribute value must match *) let attval (q:regexp) (qd:string) (brx:regexp) = let quote = del q qd in let body = store brx in [ sep_spc . key nmtoken . sep_eq . square quote body quote ] (* We treat attributes according to one of the following three patterns: attval1 : values that must be quoted with single quotes attval2 : values that must be quoted with double quotes attval3 : values that can be quoted with either *) let attributes = let attval1 = attval "'" "'" /[^']*"[^']*/ in (* " *) let attval2 = attval "\"" "\"" /[^"]*'[^"]*/ in let attval3 = attval /['"]/ "\"" /(\\\\|[^'\"])*/ in (* " *) [ label "#attribute" . (attval1|attval2|attval3)+ ] let prolog = [ label "#declaration" . dels "<?xml" . attributes . sep_osp . dels "?>" ] (************************************************************************ * Tags *************************************************************************) (* we consider entities as simple text *) let text_re = /[^<]+/ - /([^<]*\]\]>[^<]*)/ let text = [ label "#text" . store text_re ] let cdata = [ label "#CDATA" . dels "<![CDATA[" . store (char* - (char* . "]]>" . char*)) . dels "]]>" ] (* the value of nmtoken_del is always the nmtoken_key string *) let nmtoken_key = key nmtoken let nmtoken_del = del nmtoken "a" let element (body:lens) = let h = attributes? . sep_osp . dels ">" . body* . dels "</" in [ dels "<" . square nmtoken_key h nmtoken_del . sep_osp . del_end ] let empty_element = [ dels "<" . nmtoken_key . value "#empty" . attributes? . sep_osp . del /\/>[\r?\n]?/ "/>\n" ] let pi_instruction = [ dels "<?" . label "#pi" . [ label "#target" . store pi_target ] . [ sep_spc . label "#instruction" . store pi ]? . sep_osp . del /\?>/ "?>" ] (* Typecheck is weaker on rec lens, detected by unfolding *) (* let content1 = element text let rec content2 = element (content1|text|comment) *) let rec content = element (text|comment|content|empty_element|pi_instruction|cdata) (* Constraints are weaker here, but it's better than being too strict *) let doc = (sep_osp . (prolog | comment | doctype | pi_instruction))* . ((sep_osp . content) | (sep_osp . empty_element)) . (sep_osp . (comment | pi_instruction ))* . sep_osp let lns = doc let filter = (incl "/etc/xml/*.xml") . (incl "/etc/xml/catalog") let xfm = transform lns filter lenses/dist/pamconf.aug 0000644 00000002356 15231153062 0011125 0 ustar 00 (* Module: PamConf Parses /etc/pam.conf files Author: Dominic Cleal <dcleal@redhat.com> About: Reference This lens tries to keep as close as possible to `man pam.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/pam.conf. See <filter>. *) module PamConf = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) let indent = Util.indent let comment = Util.comment let empty = Util.empty let include = Pam.include let service = Rx.word (************************************************************************ * Group: LENSES *************************************************************************) let record = [ seq "record" . indent . [ label "service" . store service ] . Util.del_ws_tab . Pam.record ] let lns = ( empty | comment | include | record ) * let filter = incl "/etc/pam.conf" let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/updatedb.aug 0000644 00000002011 15231153062 0011256 0 ustar 00 (* Module: UpdateDB Parses /etc/updatedb.conf Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 updatedb.conf` 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/updatedb.conf. See <filter>. About: Examples The <Test_UpdateDB> file contains various examples and tests. *) module UpdateDB = (* View: list A list entry *) let list = let entry = [ label "entry" . store Rx.no_spaces ] in let entry_list = Build.opt_list entry Sep.space in [ key /PRUNE(FS|NAMES|PATHS)/ . Sep.space_equal . Quote.do_dquote entry_list . Util.doseol ] (* View: bool A boolean entry *) let bool = [ key "PRUNE_BIND_MOUNTS" . Sep.space_equal . Quote.do_dquote (store /[01]|no|yes/) . Util.doseol ] (* View: lns The <UpdateDB> lens *) let lns = (Util.empty|Util.comment|list|bool)* lenses/dist/systemd.aug 0000644 00000013236 15231153062 0011171 0 ustar 00 (* Module: Systemd Parses systemd unit files. Author: Dominic Cleal <dcleal@redhat.com> About: Reference This lens tries to keep as close as possible to systemd.unit(5) and systemd.service(5) etc 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 /lib/systemd/system/* and /etc/systemd/system/*. See <filter>. *) module Systemd = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: eol *) let eol = Util.eol (* View: eol_comment An <IniFile.comment> entry for standalone comment lines (; or #) *) let comment = IniFile.comment IniFile.comment_re "#" (* View: eol_comment An <IniFile.comment> entry for end of line comments (# only) *) let eol_comment = IniFile.comment "#" "#" (* View: sep An <IniFile.sep> entry *) let sep = IniFile.sep "=" "=" (* Variable: entry_single_kw *) let entry_single_kw = "Description" (* Variable: entry_command_kw *) let entry_command_kw = /Exec[A-Za-z][A-Za-z0-9._-]+/ (* Variable: entry_env_kw *) let entry_env_kw = "Environment" (* Variable: entry_multi_kw *) let entry_multi_kw = let forbidden = entry_single_kw | entry_command_kw | entry_env_kw in /[A-Za-z][A-Za-z0-9._-]+/ - forbidden (* Variable: value_single_re *) let value_single_re = /[^# \t\n\\][^#\n\\]*[^# \t\n\\]|[^# \t\n\\]/ (* View: sto_value_single Support multiline values with a backslash *) let sto_value_single = Util.del_opt_ws "" . store (value_single_re . (/\\\\\n/ . value_single_re)*) (* View: sto_value *) let sto_value = store /[^# \t\n]*[^# \t\n\\]/ (* Variable: value_sep Multi-value entries separated by whitespace or backslash and newline *) let value_sep = del /[ \t]+|[ \t]*\\\\[ \t]*\n[ \t]*/ " " (* Variable: value_cmd_re Don't parse @ and - prefix flags *) let value_cmd_re = /[^#@ \t\n\\-][^#@ \t\n\\-][^# \t\n\\]*/ (* Variable: env_key *) let env_key = /[A-Za-z0-9_]+(\[[0-9]+\])?/ (************************************************************************ * Group: ENTRIES *************************************************************************) (* Supported entry features, selected by key names: * multi-value space separated attrs (the default) * single-value attrs (Description) * systemd.service: Exec* attrs with flags, command and arguments * systemd.service: Environment NAME=arg *) (* View: entry_fn Prototype for our various key=value lines, with optional comment *) let entry_fn (kw:regexp) (val:lens) = [ key kw . sep . val . (eol_comment|eol) ] (* View: entry_value Store a value that doesn't contain spaces *) let entry_value = [ label "value" . sto_value ] (* View: entry_single Entry that takes a single value containing spaces *) let entry_single = entry_fn entry_single_kw [ label "value" . sto_value_single ]? (* View: entry_command Entry that takes a space separated set of values (the default) *) let entry_multi = entry_fn entry_multi_kw ( Util.del_opt_ws "" . Build.opt_list entry_value value_sep )? (* View: entry_command_flags Exec* flags "@" and "-". Order is important, see systemd.service(8) *) let entry_command_flags = let exit = [ label "ignoreexit" . Util.del_str "-" ] in let arg0 = [ label "arg0" . Util.del_str "@" ] in exit? . arg0? (* View: entry_command Entry that takes a command, arguments and the optional prefix flags *) let entry_command = let cmd = [ label "command" . store value_cmd_re ] in let arg = [ seq "args" . sto_value ] in let args = [ counter "args" . label "arguments" . (value_sep . arg)+ ] in entry_fn entry_command_kw ( entry_command_flags . cmd . args? )? (* View: entry_env Entry that takes a space separated set of ENV=value key/value pairs *) let entry_env = let envkv (env_val:lens) = key env_key . Util.del_str "=" . env_val (* bare has no spaces, and is optionally quoted *) in let bare = Quote.do_quote_opt (envkv (store /[^#'" \t\n]*[^#'" \t\n\\]/)?) in let bare_dqval = envkv (store /"[^#" \t\n]*[^#" \t\n\\]"/) in let bare_sqval = envkv (store /'[^#' \t\n]*[^#' \t\n\\]'/) (* quoted has at least one space, and must be quoted *) in let quoted = Quote.do_quote (envkv (store /[^#"'\n]*[ \t]+[^#"'\n]*/)) in let envkv_quoted = [ bare ] | [ bare_dqval ] | [ bare_sqval ] | [ quoted ] in entry_fn entry_env_kw ( Build.opt_list envkv_quoted value_sep ) (************************************************************************ * Group: LENS *************************************************************************) (* View: entry An <IniFile.entry> *) let entry = entry_single | entry_multi | entry_command | entry_env | comment (* View: include Includes another file at this position *) let include = [ key ".include" . Util.del_ws_spc . sto_value . (eol_comment|eol) ] (* View: title An <IniFile.title> *) let title = IniFile.title IniFile.record_re (* View: record An <IniFile.record> *) let record = IniFile.record title (entry|include) (* View: lns An <IniFile.lns> *) let lns = IniFile.lns record (comment|include) (* View: filter *) let filter = incl "/lib/systemd/system/*" . incl "/lib/systemd/system/*/*" . incl "/etc/systemd/system/*" . incl "/etc/systemd/system/*/*" . incl "/etc/sysconfig/*.systemd" . Util.stdexcl let xfm = transform lns filter lenses/dist/pagekite.aug 0000644 00000005147 15231153062 0011274 0 ustar 00 (* Module: Pagekite Parses /etc/pagekite.d/ Author: Michael Pimmer <blubb@fonfon.at> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. *) module Pagekite = autoload xfm (* View: lns *) (* Variables *) let equals = del /[ \t]*=[ \t]*/ "=" let neg2 = /[^# \n\t]+/ let neg3 = /[^# \:\n\t]+/ let eol = del /\n/ "\n" (* Match everything from here to eol, cropping whitespace at both ends *) let to_eol = /[^ \t\n](.*[^ \t\n])?/ (* A key followed by comma-separated values k: name of the key key_sep: separator between key and values value_sep: separator between values sto: store for values *) let key_csv_line (k:string) (key_sep:lens) (value_sep:lens) (sto:lens) = [ key k . key_sep . [ seq k . sto ] . [ seq k . value_sep . sto ]* . Util.eol ] (* entries for pagekite.d/10_account.rc *) let domain = [ key "domain" . equals . store neg2 . Util.comment_or_eol ] let frontend = Build.key_value_line ("frontend" | "frontends") equals (store Rx.neg1) let host = Build.key_value_line "host" equals (store Rx.ip) let ports = key_csv_line "ports" equals Sep.comma (store Rx.integer) let protos = key_csv_line "protos" equals Sep.comma (store Rx.word) (* entries for pagekite.d/20_frontends.rc *) let kitesecret = Build.key_value_line "kitesecret" equals (store Rx.space_in) let kv_frontend = Build.key_value_line ( "kitename" | "fe_certname" | "ca_certs" | "tls_endpoint" ) equals (store Rx.neg1) (* entries for services like 80_httpd.rc *) let service_colon = del /[ \t]*:[ \t]*/ " : " let service_on = [ key "service_on" . [ seq "service_on" . equals . [ label "protocol" . store neg3 ] . service_colon . [ label "kitename" . (store neg3) ] . service_colon . [ label "backend_host" . (store neg3) ] . service_colon . [ label "backend_port" . (store neg3) ] . service_colon . ( [ label "secret" . (store Rx.no_spaces) . Util.eol ] | eol ) ] ] let service_cfg = [ key "service_cfg" . equals . store to_eol . eol ] let flags = ( "defaults" | "isfrontend" | "abort_not_configured" | "insecure" ) let entries = Build.flag_line flags | domain | frontend | host | ports | protos | kv_frontend | kitesecret | service_on | service_cfg let lns = ( entries | Util.empty | Util.comment )* (* View: filter *) let filter = incl "/etc/pagekite.d/*.rc" . Util.stdexcl let xfm = transform lns filter lenses/dist/keepalived.aug 0000644 00000024330 15231153062 0011607 0 ustar 00 (* Module: Keepalived Parses /etc/keepalived/keepalived.conf Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 keepalived.conf` 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/keepalived/keepalived.conf. See <filter>. About: Examples The <Test_Keepalived> file contains various examples and tests. *) module Keepalived = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Comments and empty lines *) (* View: indent *) let indent = Util.indent (* View: eol *) let eol = Util.eol (* View: opt_eol *) let opt_eol = del /[ \t]*\n?/ " " (* View: sep_spc *) let sep_spc = Sep.space (* View: comment Map comments in "#comment" nodes *) let comment = Util.comment_generic /[ \t]*[#!][ \t]*/ "# " (* View: comment_eol Map comments at eol *) let comment_eol = Util.comment_generic /[ \t]*[#!][ \t]*/ " # " (* View: comment_or_eol A <comment_eol> or <eol> *) let comment_or_eol = comment_eol | (del /[ \t]*[#!]?\n/ "\n") (* View: empty Map empty lines *) let empty = Util.empty (* View: sto_email_addr *) let sto_email_addr = store Rx.email_addr (* Variable: word *) let word = Rx.word (* Variable: word_slash *) let word_slash = word | "/" (* View: sto_word *) let sto_word = store word (* View: sto_num *) let sto_num = store Rx.relinteger (* View: sto_to_eol *) let sto_to_eol = store /[^#! \t\n][^#!\n]*[^#! \t\n]|[^#! \t\n]/ (* View: field *) let field (kw:regexp) (sto:lens) = indent . Build.key_value_line_comment kw sep_spc sto comment_eol (* View: flag A single word *) let flag (kw:regexp) = [ indent . key kw . comment_or_eol ] (* View: ip_port An IP <space> port pair *) let ip_port = [ label "ip" . sto_word ] . sep_spc . [ label "port" . sto_num ] (* View: lens_block A generic block with a title lens. The definition is very similar to Build.block_newlines but uses a different type of <comment>. *) let lens_block (title:lens) (sto:lens) = [ indent . title . Build.block_newlines sto comment . eol ] (* View: block A simple block with just a block title *) let block (kw:regexp) (sto:lens) = lens_block (key kw) sto (* View: named_block A block with a block title and name *) let named_block (kw:string) (sto:lens) = lens_block (key kw . sep_spc . sto_word) sto (* View: named_block_arg_title A title lens for named_block_arg *) let named_block_arg_title (kw:string) (name:string) (arg:string) = key kw . sep_spc . [ label name . sto_word ] . sep_spc . [ label arg . sto_word ] (* View: named_block_arg A block with a block title, a name and an argument *) let named_block_arg (kw:string) (name:string) (arg:string) (sto:lens) = lens_block (named_block_arg_title kw name arg) sto (************************************************************************ * Group: GLOBAL CONFIGURATION *************************************************************************) (* View: email A simple email address entry *) let email = [ indent . label "email" . sto_email_addr . comment_or_eol ] (* View: global_defs_field Possible fields in the global_defs block *) let global_defs_field = let word_re = "smtp_server"|"lvs_id"|"router_id" in let num_re = "smtp_connect_timeout" in block "notification_email" email | field "notification_email_from" sto_email_addr | field word_re sto_word | field num_re sto_num (* View: global_defs A global_defs block *) let global_defs = block "global_defs" global_defs_field (* View: prefixlen A prefix for IP addresses *) let prefixlen = [ label "prefixlen" . Util.del_str "/" . sto_num ] (* View: ipaddr An IP address or range with an optional mask *) let ipaddr = label "ipaddr" . store /[0-9.-]+/ . prefixlen? (* View: ipdev A device for IP addresses *) let ipdev = [ key "dev" . sep_spc . sto_word ] (* View: static_ipaddress_field The whole string is fed to ip addr add. You can truncate the string anywhere you like and let ip addr add use defaults for the rest of the string. To be refined with fields according to `ip addr help`. *) let static_ipaddress_field = [ indent . ipaddr . (sep_spc . ipdev)? . comment_or_eol ] (* View: static_routes_field src $SRC_IP to $DST_IP dev $SRC_DEVICE *) let static_routes_field = [ indent . label "route" . [ key "src" . sto_word ] . sep_spc . [ key "to" . sto_word ] . sep_spc . [ key "dev" . sto_word ] . comment_or_eol ] (* View: static_routes *) let static_routes = block "static_ipaddress" static_ipaddress_field | block "static_routes" static_routes_field (* View: global_conf A global configuration entry *) let global_conf = global_defs | static_routes (************************************************************************ * Group: VRRP CONFIGURATION *************************************************************************) (*View: vrrp_sync_group_field *) let vrrp_sync_group_field = block "group" [ indent . key word . comment_or_eol ] (* View: vrrp_sync_group *) let vrrp_sync_group = named_block "vrrp_sync_group" vrrp_sync_group_field (* View: vrrp_instance_field *) let vrrp_instance_field = let word_re = "state" | "interface" | "lvs_sync_daemon_interface" in let num_re = "virtual_router_id" | "priority" | "advert_int" | "garp_master_delay" in let to_eol_re = /notify_(master|backup|fault)/ in let flag_re = "smtp_alert" | "nopreempt" | "ha_suspend" | "debug" in field word_re sto_word | field num_re sto_num | field to_eol_re sto_to_eol | flag flag_re | block "authentication" ( field /auth_(type|pass)/ sto_word ) | block "virtual_ipaddress" static_ipaddress_field | block /track_(interface|script)/ ( flag word ) (* View: vrrp_instance *) let vrrp_instance = named_block "vrrp_instance" vrrp_instance_field (* View: vrrp_script_field *) let vrrp_script_field = let num_re = "interval" | "weight" in let to_eol_re = "script" in field to_eol_re sto_to_eol | field num_re sto_num (* View: vrrp_script *) let vrrp_script = named_block "vrrp_script" vrrp_script_field (* View: vrrpd_conf contains subblocks of VRRP synchronization group(s) and VRRP instance(s) *) let vrrpd_conf = vrrp_sync_group | vrrp_instance | vrrp_script (************************************************************************ * Group: REAL SERVER CHECKS CONFIGURATION *************************************************************************) (* View: tcp_check_field *) let tcp_check_field = let word_re = "bindto" in let num_re = /connect_(timeout|port)/ in field word_re sto_word | field num_re sto_num (* View: misc_check_field *) let misc_check_field = let flag_re = "misc_dynamic" in let num_re = "misc_timeout" in let to_eol_re = "misc_path" in field num_re sto_num | flag flag_re | field to_eol_re sto_to_eol (* View: smtp_host_check_field *) let smtp_host_check_field = let word_re = "connect_ip" | "bindto" in let num_re = "connect_port" in field word_re sto_word | field num_re sto_num (* View: smtp_check_field *) let smtp_check_field = let word_re = "connect_ip" | "bindto" in let num_re = "connect_timeout" | "retry" | "delay_before_retry" in let to_eol_re = "helo_name" in field word_re sto_word | field num_re sto_num | field to_eol_re sto_to_eol | block "host" smtp_host_check_field (* View: http_url_check_field *) let http_url_check_field = let word_re = "digest" in let num_re = "status_code" in let to_eol_re = "path" in field word_re sto_word | field num_re sto_num | field to_eol_re sto_to_eol (* View: http_check_field *) let http_check_field = let num_re = /connect_(timeout|port)/ | "nb_get_retry" | "delay_before_retry" in field num_re sto_num | block "url" http_url_check_field (* View: real_server_field *) let real_server_field = let num_re = "weight" in let flag_re = "inhibit_on_failure" in let to_eol_re = /notify_(up|down)/ in field num_re sto_num | flag flag_re | field to_eol_re sto_to_eol | block "TCP_CHECK" tcp_check_field | block "MISC_CHECK" misc_check_field | block "SMTP_CHECK" smtp_check_field | block /(HTTP|SSL)_GET/ http_check_field (************************************************************************ * Group: LVS CONFIGURATION *************************************************************************) (* View: virtual_server_field *) let virtual_server_field = let num_re = "delay_loop" | "persistence_timeout" | "quorum" | "hysteresis" in let word_re = /lb_(algo|kind)/ | "nat_mask" | "protocol" | "persistence_granularity" | "virtualhost" in let flag_re = "ops" | "ha_suspend" | "alpha" | "omega" in let to_eol_re = /quorum_(up|down)/ in let ip_port_re = "sorry_server" in field num_re sto_num | field word_re sto_word | flag flag_re | field to_eol_re sto_to_eol | field ip_port_re ip_port | named_block_arg "real_server" "ip" "port" real_server_field (* View: virtual_server *) let virtual_server = named_block_arg "virtual_server" "ip" "port" virtual_server_field (* View: virtual_server_group_field *) let virtual_server_group_field = [ indent . label "vip" . [ ipaddr ] . sep_spc . [ label "port" . sto_num ] . comment_or_eol ] (* View: virtual_server_group *) let virtual_server_group = named_block "virtual_server_group" virtual_server_group_field (* View: lvs_conf contains subblocks of Virtual server group(s) and Virtual server(s) *) let lvs_conf = virtual_server | virtual_server_group (* View: lns The keepalived lens *) let lns = ( empty | comment | global_conf | vrrpd_conf | lvs_conf )* (* Variable: filter *) let filter = incl "/etc/keepalived/keepalived.conf" let xfm = transform lns filter lenses/dist/group.aug 0000644 00000003333 15231153062 0010632 0 ustar 00 (* Group module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: man 5 group *) module Group = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let comment = Util.comment let empty = Util.empty let dels = Util.del_str let colon = Sep.colon let comma = Sep.comma let sto_to_spc = store Rx.space_in let sto_to_col = store /[^:\n]+/ let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ let word = Rx.word let password = /[A-Za-z0-9_.!*-]*/ let integer = Rx.integer (************************************************************************ * ENTRIES *************************************************************************) let user = [ label "user" . store word ] let user_list = Build.opt_list user comma let params = [ label "password" . store password . colon ] . [ label "gid" . store integer . colon ] . user_list? let entry = Build.key_value_line word colon params let nisdefault = let overrides = colon . [ label "password" . store word? . colon ] . [ label "gid" . store integer? . colon ] . user_list? in [ dels "+" . label "@nisdefault" . overrides? . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry|nisdefault) * let filter = incl "/etc/group" let xfm = transform lns filter lenses/dist/dput.aug 0000644 00000004245 15231153062 0010455 0 ustar 00 (* Dput module for Augeas Author: Raphael Pinson <raphink@gmail.com> Reference: dput uses Python's ConfigParser: http://docs.python.org/lib/module-ConfigParser.html *) module Dput = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = IniFile.sep IniFile.sep_re IniFile.sep_default let setting = "allow_dcut" | "allow_non-us_software" | "allow_unsigned_uploads" | "check_version" | "default_host_main" | "default_host_non-us" | "fqdn" | "hash" | "incoming" | "login" | "method" | "passive_ftp" | "post_upload_command" | "pre_upload_command" | "progress_indicator" | "run_dinstall" | "run_lintian" | "scp_compress" | "ssh_config_options" | "allowed_distributions" (************************************************************************ * "name: value" entries, with continuations in the style of RFC 822; * "name=value" is also accepted * leading whitespace is removed from values *************************************************************************) let entry = IniFile.entry setting sep comment (************************************************************************ * sections, led by a "[section]" header * We can't use titles as node names here since they could contain "/" * We remove #comment from possible keys * since it is used as label for comments * We also remove / as first character * because augeas doesn't like '/' keys (although it is legal in INI Files) *************************************************************************) let title = IniFile.title_label "target" IniFile.record_label_re let record = IniFile.record title entry let lns = IniFile.lns record comment let filter = (incl "/etc/dput.cf") . (incl (Sys.getenv("HOME") . "/.dput.cf")) let xfm = transform lns filter lenses/dist/sshd_140.aug 0000644 00000007430 15231153062 0011025 0 ustar 00 (* Module: Sshd_140 Parses /etc/ssh/sshd_config This module is compatible with Augeas 1.4.0, but is not loaded by default. 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_140 = let eol = del /[ \t]*\n/ "\n" let sep = Util.del_ws_spc let indent = del /[ \t]*/ " " let key_re = /[A-Za-z0-9]+/ - /MACs|Match|AcceptEnv|Subsystem|Ciphers|KexAlgorithms|(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 value = store /[^ \t\n]+/ in [ key kw . [ sep . seq sq . value]* . 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 entry = accept_env | allow_groups | allow_users | deny_groups | subsystem | deny_users | macs | ciphers | kexalgorithms | other_entry let condition_entry = let value = store /[^ \t\n]+/ in [ sep . key /[A-Za-z0-9]+/ . sep . value ] 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* (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/resolv.aug 0000644 00000007543 15231153062 0011017 0 ustar 00 (* Module: Resolv Parses /etc/resolv.conf Author: Raphael Pinson <raphink@gmail.com> 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 <filter>. *) 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 (************************************************************************ * 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-reopen") | 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 lenses/dist/pg_hba.aug 0000644 00000005641 15231153062 0010722 0 ustar 00 (* Module: Pg_Hba Parses PostgreSQL's pg_hba.conf Author: Aurelien Bompard <aurelien@bompard.org> About: Reference The file format is described in PostgreSQL's documentation: http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Configuration files This lens applies to pg_hba.conf. See <filter> for exact locations. *) module Pg_Hba = autoload xfm (* Group: Generic primitives *) let eol = Util.eol let word = Rx.neg1 (* Variable: ipaddr CIDR or ip+netmask *) let ipaddr = /[0-9a-fA-F:.]+(\/[0-9]+|[ \t]+[0-9.]+)/ (* Variable: hostname Hostname, FQDN or part of an FQDN possibly starting with a dot. Taken from the syslog lens. *) let hostname = /\.?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*/ let comma_sep_list (l:string) = let lns = [ label l . store word ] in Build.opt_list lns Sep.comma (* Group: Columns definitions *) (* View: ipaddr_or_hostname *) let ipaddr_or_hostname = ipaddr | hostname (* View: database TODO: support for quoted strings *) let database = comma_sep_list "database" (* View: user TODO: support for quoted strings *) let user = comma_sep_list "user" (* View: address *) let address = [ label "address" . store ipaddr_or_hostname ] (* View: option part of <method> *) let option = let value_start = label "value" . Sep.equal in [ label "option" . store Rx.word . (Quote.quote_spaces value_start)? ] (* View: method can contain an <option> *) let method = [ label "method" . store /[A-Za-z][A-Za-z0-9]+/ . ( Sep.tab . option )* ] (* Group: Records definitions *) (* View: record_local when type is "local", there is no "address" field *) let record_local = [ label "type" . store "local" ] . Sep.tab . database . Sep.tab . user . Sep.tab . method (* Variable: remtypes non-local connection types *) let remtypes = "host" | "hostssl" | "hostnossl" (* View: record_remote *) let record_remote = [ label "type" . store remtypes ] . Sep.tab . database . Sep.tab . user . Sep.tab . address . Sep.tab . method (* View: record A sequence of <record_local> or <record_remote> entries *) let record = [ seq "entries" . (record_local | record_remote) . eol ] (* View: filter The pg_hba.conf conf file *) let filter = (incl "/var/lib/pgsql/data/pg_hba.conf" . incl "/var/lib/pgsql/*/data/pg_hba.conf" . incl "/etc/postgresql/*/*/pg_hba.conf" ) (* View: lns The pg_hba.conf lens *) let lns = ( record | Util.comment | Util.empty ) * let xfm = transform lns filter lenses/dist/iproute2.aug 0000644 00000000503 15231153062 0011243 0 ustar 00 module IPRoute2 = autoload xfm let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ] let id = Rx.hex | Rx.integer let record = [ key id . del /[ \t]+/ "\t" . store /[a-zA-Z0-9\/-]+/ . Util.comment_or_eol ] let lns = ( empty | Util.comment | record ) * let xfm = transform lns (incl "/etc/iproute2/*" . Util.stdexcl) lenses/dist/gdm.aug 0000644 00000003461 15231153062 0010247 0 ustar 00 (* Gdm module for Augeas *) (* Author: Free Ekanayaka <freek@64studio.com> *) (* *) module Gdm = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = IniFile.sep IniFile.sep_re IniFile.sep_default let empty = IniFile.empty (************************************************************************ * ENTRY * Entry keywords can be bare digits as well (the [server] section) *************************************************************************) let entry_re = ( /[A-Za-z0-9][A-Za-z0-9._-]*/ ) let entry = IniFile.entry entry_re sep comment (************************************************************************ * TITLE * * We use IniFile.title_label because there can be entries * outside of sections whose labels would conflict with section names *************************************************************************) let title = IniFile.title ( IniFile.record_re - ".anon" ) let record = IniFile.record title entry let record_anon = [ label ".anon" . ( entry | empty )+ ] (************************************************************************ * LENS & FILTER * There can be entries before any section * IniFile.entry includes comment management, so we just pass entry to lns *************************************************************************) let lns = record_anon? . record* let filter = (incl "/etc/gdm/gdm.conf*") . (incl "/etc/gdm/custom.conf") . Util.stdexcl let xfm = transform lns filter lenses/dist/openshift_config.aug 0000644 00000004734 15231153062 0013030 0 ustar 00 (* Module: OpenShift_Config Parses - /etc/openshift/broker.conf - /etc/openshift/broker-dev.conf - /etc/openshift/console.conf - /etc/openshift/console-dev.conf - /etc/openshift/node.conf - /etc/openshift/plugins.d/*.conf Author: Brian Redbeard <redbeard@dead-city.org> 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/openshift ... * Change OpenShift domain > set /files/etc/openshift/broker.conf/CLOUD_DOMAIN ose.example.com Saving your file: > save About: Configuration files /etc/openshift/broker.conf - Configuration file for an OpenShift Broker running in production mode. /etc/openshift/broker-dev.conf - Configuration file for an OpenShift Broker running in development mode. /etc/openshift/console.conf - Configuration file for an OpenShift console running in production mode. /etc/openshift/console-dev.conf - Configuration file for an OpenShift console running in development mode. /etc/openshift/node.conf - Configuration file for an OpenShift node /etc/openshift/plugins.d/*.conf - Configuration files for OpenShift plugins (i.e. mcollective configuration, remote auth, dns updates) About: Examples The <Test_OpenShift_Config> file contains various examples and tests. *) module OpenShift_Config = autoload xfm (* Variable: blank_val *) let blank_val = del /["']{2}/ "\"\"" (* View: primary_entry *) let primary_entry = Build.key_value_line Rx.word Sep.equal Quote.any_opt (* View: empty_entry *) let empty_entry = Build.key_value_line Rx.word Sep.equal blank_val (* View: lns *) let lns = (Util.empty | Util.comment | primary_entry | empty_entry )* (* Variable: filter *) let filter = incl "/etc/openshift/broker.conf" . incl "/etc/openshift/broker-dev.conf" . incl "/etc/openshift/console.conf" . incl "/etc/openshift/resource_limits.conf" . incl "/etc/openshift/console-dev.conf" . incl "/etc/openshift/node.conf" . incl "/etc/openshift/plugins.d/*.conf" . incl "/var/www/openshift/broker/conf/broker.conf" . incl "/var/www/openshift/broker/conf/plugins.d/*.conf" . Util.stdexcl let xfm = transform lns filter (* vim: set ts=4 expandtab sw=4: *) lenses/dist/postfix_master.aug 0000644 00000003534 15231153062 0012550 0 ustar 00 (* Postfix_Master module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: *) module Postfix_Master = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let ws = del /[ \t\n]+/ " " let comment = Util.comment let empty = Util.empty let word = /[A-Za-z0-9_.:-]+/ let words = let char_start = /[A-Za-z0-9$!(){}=_.,:@-]/ in let char_end = char_start | /[]["\/]/ in let char_middle = char_end | " " in char_start . char_middle* . char_end let bool = /y|n|-/ let integer = /([0-9]+|-)\??/ let command = words . (/[ \t]*\n[ \t]+/ . words)* let field (l:string) (r:regexp) = [ label l . store r ] (************************************************************************ * ENTRIES *************************************************************************) let entry = [ key word . ws . field "type" /inet|unix|fifo|pass/ . ws . field "private" bool . ws . field "unprivileged" bool . ws . field "chroot" bool . ws . field "wakeup" integer . ws . field "limit" integer . ws . field "command" command . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = incl "/etc/postfix/master.cf" let xfm = transform lns filter lenses/dist/postfix_virtual.aug 0000644 00000002417 15231153062 0012742 0 ustar 00 (* Module: Postfix_Virtual Parses /etc/postfix/virtual Author: Raphael Pinson <raphael.pinson@camptocamp.com> About: Reference This lens tries to keep as close as possible to `man 5 virtual` 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/postfix/virtual. See <filter>. About: Examples The <Test_Postfix_Virtual> file contains various examples and tests. *) module Postfix_Virtual = autoload xfm (* Variable: space_or_eol_re *) let space_or_eol_re = /([ \t]*\n)?[ \t]+/ (* View: space_or_eol *) let space_or_eol (sep:regexp) (default:string) = del (space_or_eol_re? . sep . space_or_eol_re?) default (* View: word *) let word = store /[A-Za-z0-9@\*.+=-]+/ (* View: comma *) let comma = space_or_eol "," ", " (* View: destination *) let destination = [ label "destination" . word ] (* View: record *) let record = let destinations = Build.opt_list destination comma in [ label "pattern" . word . space_or_eol Rx.space " " . destinations . Util.eol ] (* View: lns *) let lns = (Util.empty | Util.comment | record)* (* Variable: filter *) let filter = incl "/etc/postfix/virtual" let xfm = transform lns filter lenses/dist/access.aug 0000644 00000007125 15231153062 0010742 0 ustar 00 (* Module: Access Parses /etc/security/access.conf Author: Lorenzo Dalrio <lorenzo.dalrio@gmail.com> About: Reference Some examples of valid entries can be found in access.conf or "man access.conf" About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage Sample usage of this lens in augtool * Add a rule to permit login of all users from local sources (tty's, X, cron) > set /files/etc/security/access.conf[0] + > set /files/etc/security/access.conf[0]/user ALL > set /files/etc/security/access.conf[0]/origin LOCAL About: Configuration files This lens applies to /etc/security/access.conf. See <filter>. About: Examples The <Test_Access> file contains various examples and tests. *) module Access = autoload xfm (* Group: Comments and empty lines *) (* Variable: comment *) let comment = Util.comment (* Variable: empty *) let empty = Util.empty (* Group: Useful primitives *) (* Variable: colon * this is the standard field separator " : " *) let colon = del (Rx.opt_space . ":" . Rx.opt_space) " : " (************************************************************************ * Group: ENTRY LINE *************************************************************************) (* View: access * Allow (+) or deny (-) access *) let access = label "access" . store /[+-]/ (* Variable: identifier_re Regex for user/group identifiers *) let identifier_re = /[A-Za-z0-9_.\\-]+/ (* View: user_re * Regex for user/netgroup fields *) let user_re = identifier_re - /[Ee][Xx][Cc][Ee][Pp][Tt]/ (* View: user * user can be a username, username@hostname or a group *) let user = [ label "user" . ( store user_re | store Rx.word . Util.del_str "@" . [ label "host" . store Rx.word ] ) ] (* View: group * Format is (GROUP) *) let group = [ label "group" . Util.del_str "(" . store identifier_re . Util.del_str ")" ] (* View: netgroup * Format is @NETGROUP[@@NISDOMAIN] *) let netgroup = [ label "netgroup" . Util.del_str "@" . store user_re . [ label "nisdomain" . Util.del_str "@@" . store Rx.word ]? ] (* View: user_list * A list of users or netgroups to apply the rule to *) let user_list = Build.opt_list (user|group|netgroup) Sep.space (* View: origin_list * origin_list can be a single ipaddr/originname/domain/fqdn or a list of those values *) let origin_list = let origin_re = Rx.no_spaces - /[Ee][Xx][Cc][Ee][Pp][Tt]/ in Build.opt_list [ label "origin" . store origin_re ] Sep.space (* View: except * The except operator makes it possible to write very compact rules. *) let except (lns:lens) = [ label "except" . Sep.space . del /[Ee][Xx][Cc][Ee][Pp][Tt]/ "EXCEPT" . Sep.space . lns ] (* View: entry * A valid entry line * Definition: * > entry ::= access ':' user ':' origin_list *) let entry = [ access . colon . user_list . (except user_list)? . colon . origin_list . (except origin_list)? . Util.eol ] (************************************************************************ * Group: LENS & FILTER *************************************************************************) (* View: lns The access.conf lens, any amount of * <empty> lines * <comments> * <entry> *) let lns = (comment|empty|entry) * (* Variable: filter *) let filter = incl "/etc/security/access.conf" (* xfm *) let xfm = transform lns filter lenses/dist/yum.aug 0000644 00000004113 15231153062 0010305 0 ustar 00 (* Parsing yum's config files *) module Yum = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment "#" "#" let sep = IniFile.sep "=" "=" let empty = Util.empty let eol = IniFile.eol (************************************************************************ * ENTRY *************************************************************************) let list_entry (list_key:string) = let list_value = store /[^# \t\r\n,][^ \t\r\n,]*[^# \t\r\n,]|[^# \t\r\n,]/ in let list_sep = del /([ \t]*(,[ \t]*|\r?\n[ \t]+))|[ \t]+/ "\n\t" in [ key list_key . sep . Sep.opt_space . list_value ] . (list_sep . Build.opt_list [ label list_key . list_value ] list_sep)? . eol let entry_re = IniFile.entry_re - ("baseurl" | "gpgkey" | "exclude") let entry = IniFile.entry entry_re sep comment | empty let entries = let list_entry_elem (k:string) = list_entry k . entry* in entry* | entry* . Build.combine_three_opt (list_entry_elem "baseurl") (list_entry_elem "gpgkey") (list_entry_elem "exclude") (***********************************************************************a * TITLE *************************************************************************) let title = IniFile.title IniFile.record_re let record = [ title . entries ] (************************************************************************ * LENS & FILTER *************************************************************************) let lns = (empty | comment)* . record* let filter = (incl "/etc/yum.conf") . (incl "/etc/yum.repos.d/*.repo") . (incl "/etc/yum/yum-cron*.conf") . (incl "/etc/yum/pluginconf.d/*") . (excl "/etc/yum/pluginconf.d/versionlock.list") . Util.stdexcl let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/php.aug 0000644 00000004354 15231153062 0010271 0 ustar 00 (* PHP module for Augeas *) (* Author: Raphael Pinson <raphink@gmail.com> *) (* *) module PHP = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = IniFile.sep IniFile.sep_re IniFile.sep_default let empty = IniFile.empty (************************************************************************ * ENTRY * * We have to remove the keyword "section" from possible entry keywords * otherwise it would lead to an ambiguity with the "section" label * since PHP allows entries outside of sections. *************************************************************************) let entry = let word = IniFile.entry_re in let entry_re = word . ( "[" . word . "]" )? in IniFile.indented_entry entry_re sep comment (************************************************************************ * TITLE * * We use IniFile.title_label because there can be entries * outside of sections whose labels would conflict with section names *************************************************************************) let title = IniFile.title ( IniFile.record_re - ".anon" ) let record = IniFile.record title entry let record_anon = [ label ".anon" . ( entry | empty )+ ] (************************************************************************ * LENS & FILTER * There can be entries before any section * IniFile.entry includes comment management, so we just pass entry to lns *************************************************************************) let lns = record_anon? . record* let filter = (incl "/etc/php*/*/*.ini") . (incl "/etc/php.ini") . (incl "/etc/php.d/*.ini") (* PHPFPM Support *) . (incl "/etc/php*/fpm/pool.d/*.conf") (* Zend Community edition *) . (incl "/usr/local/zend/etc/php.ini") . (incl "/usr/local/zend/etc/conf.d/*.ini") . Util.stdexcl let xfm = transform lns filter lenses/dist/afs_cellalias.aug 0000644 00000003102 15231153062 0012252 0 ustar 00 (* Module: AFS_cellalias Parses AFS configuration file CellAlias Author: Pat Riehecky <riehecky@fnal.gov> About: Reference This lens is targeted at the OpenAFS CellAlias file About: Lens Usage Sample usage of this lens in augtool * Add a CellAlias for fnal.gov/files to fnal-files > set /files/usr/vice/etc/CellAlias/target[99] fnal.gov/files > set /files/usr/vice/etc/CellAlias/target[99]/linkname fnal-files About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module AFS_cellalias = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Comments and empty lines *) (* View: eol *) let eol = Util.eol (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* Group: separators *) (* View: space * Separation between key and value *) let space = Util.del_ws_spc let target = /[^ \t\n#]+/ let linkname = Rx.word (************************************************************************ * Group: ENTRIES *************************************************************************) (* View: entry *) let entry = [ label "target" . store target . space . [ label "linkname" . store linkname . eol ] ] (* View: lns *) let lns = (empty | comment | entry)* let xfm = transform lns (incl "/usr/vice/etc/CellAlias") (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/device_map.aug 0000644 00000001154 15231153062 0011571 0 ustar 00 (* Parsing grub's device.map *) module Device_map = autoload xfm let sep_tab = Sep.tab let eol = Util.eol let fspath = Rx.fspath let del_str = Util.del_str let comment = Util.comment let empty = Util.empty let dev_name = /(h|f|c)d[0-9]+(,[0-9a-zA-Z]+){0,2}/ let dev_hex = Rx.hex let dev_dec = /[0-9]+/ let device = del_str "(" . key ( dev_name | dev_hex | dev_dec ) . del_str ")" let map = [ device . sep_tab . store fspath . eol ] let lns = ( empty | comment | map ) * let xfm = transform lns (incl "/boot/*/device.map") (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/hosts_access.aug 0000644 00000010512 15231153062 0012154 0 ustar 00 (* Module: Hosts_Access Parses /etc/hosts.{allow,deny} Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 hosts_access` and `man 5 hosts_options` 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/hosts.{allow,deny}. See <filter>. *) module Hosts_Access = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: colon *) let colon = del /[ \t]*(\\\\[ \t]*\n[ \t]+)?:[ \t]*(\\\\[ \t]*\n[ \t]+)?/ ": " (* Variable: comma_sep *) let comma_sep = /([ \t]|(\\\\\n))*,([ \t]|(\\\\\n))*/ (* Variable: ws_sep *) let ws_sep = / +/ (* View: list_sep *) let list_sep = del ( comma_sep | ws_sep ) ", " (* View: list_item *) let list_item = store ( Rx.word - /EXCEPT/i ) (* View: client_host_item Allows @ for netgroups, supports [ipv6] syntax *) let client_host_item = let client_hostname_rx = /[A-Za-z0-9_.@?*-][A-Za-z0-9_.?*-]*/ in let client_ipv6_rx = "[" . /[A-Za-z0-9:?*%]+/ . "]" in let client_host_rx = client_hostname_rx | client_ipv6_rx in let netmask = [ Util.del_str "/" . label "netmask" . store Rx.word ] in store ( client_host_rx - /EXCEPT/i ) . netmask? (* View: client_file_item *) let client_file_item = let client_file_rx = /\/[^ \t\n,:]+/ in store ( client_file_rx - /EXCEPT/i ) (* Variable: option_kw Since either an option or a shell command can be given, use an explicit list of known options to avoid misinterpreting a command as an option *) let option_kw = "severity" | "spawn" | "twist" | "keepalive" | "linger" | "rfc931" | "banners" | "nice" | "setenv" | "umask" | "user" | /allow/i | /deny/i (* Variable: shell_command_rx *) let shell_command_rx = /[^ \t\n:][^\n]*[^ \t\n]|[^ \t\n:\\\\]/ - ( option_kw . /.*/ ) (* View: sto_to_colon Allows escaped colon sequences *) let sto_to_colon = store /[^ \t\n:=][^\n:]*((\\\\:|\\\\[ \t]*\n[ \t]+)[^\n:]*)*[^ \\\t\n:]|[^ \t\n:\\\\]/ (* View: except * The except operator makes it possible to write very compact rules. *) let except (lns:lens) = [ label "except" . Sep.space . del /except/i "EXCEPT" . Sep.space . lns ] (************************************************************************ * Group: ENTRY TYPES *************************************************************************) (* View: daemon *) let daemon = let host = [ label "host" . Util.del_str "@" . list_item ] in [ label "process" . list_item . host? ] (* View: daemon_list A list of <daemon>s *) let daemon_list = Build.opt_list daemon list_sep (* View: client *) let client = let user = [ label "user" . list_item . Util.del_str "@" ] in [ label "client" . user? . client_host_item ] (* View: client_file *) let client_file = [ label "file" . client_file_item ] (* View: client_list A list of <client>s *) let client_list = Build.opt_list ( client | client_file ) list_sep (* View: option Optional extensions defined in hosts_options(5) *) let option = [ key option_kw . ( del /([ \t]*=[ \t]*|[ \t]+)/ " " . sto_to_colon )? ] (* View: shell_command *) let shell_command = [ label "shell_command" . store shell_command_rx ] (* View: entry *) let entry = [ seq "line" . daemon_list . (except daemon_list)? . colon . client_list . (except client_list)? . ( (colon . option)+ | (colon . shell_command)? ) . Util.eol ] (************************************************************************ * Group: LENS AND FILTER *************************************************************************) (* View: lns *) let lns = (Util.empty | Util.comment | entry)* (* View: filter *) let filter = incl "/etc/hosts.allow" . incl "/etc/hosts.deny" let xfm = transform lns filter lenses/dist/pam.aug 0000644 00000004414 15231153062 0010254 0 ustar 00 (* Module: Pam Parses /etc/pam.conf and /etc/pam.d/* service files Author: David Lutterkort <lutter@redhat.com> About: Reference This lens tries to keep as close as possible to `man pam.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 autoloads /etc/pam.d/* for service specific files. See <filter>. It provides a lens for /etc/pam.conf, which is used in the PamConf module. *) module Pam = autoload xfm let eol = Util.eol let indent = Util.indent (* For the control syntax of [key=value ..] we could split the key value *) (* pairs into an array and generate a subtree control/N/KEY = VALUE *) let control = /(\[[^]#\n]*\]|[^[ \t][^ \t]*)/ let word = /[^# \t\n]+/ (* Allowed types *) let types = /(auth|session|account|password)/i (* This isn't entirely right: arguments enclosed in [ .. ] can contain *) (* a ']' if escaped with a '\' and can be on multiple lines ('\') *) let argument = /(\[[^]#\n]+\]|[^[#\n \t][^#\n \t]*)/ let comment = Util.comment let comment_or_eol = Util.comment_or_eol let empty = Util.empty (* Not mentioned in the man page, but Debian uses the syntax *) (* @include module *) (* quite a bit *) let include = [ indent . Util.del_str "@" . key "include" . Util.del_ws_spc . store word . eol ] (* Shared with PamConf *) let record = [ label "optional" . del "-" "-" ]? . [ label "type" . store types ] . Util.del_ws_tab . [ label "control" . store control] . Util.del_ws_tab . [ label "module" . store word ] . [ Util.del_ws_tab . label "argument" . store argument ]* . comment_or_eol let record_svc = [ seq "record" . indent . record ] let lns = ( empty | comment | include | record_svc ) * let filter = incl "/etc/pam.d/*" . excl "/etc/pam.d/allow.pamlist" . excl "/etc/pam.d/README" . Util.stdexcl let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/modprobe.aug 0000644 00000006534 15231153062 0011313 0 ustar 00 (* Module: Modprobe Parses /etc/modprobe.conf and /etc/modprobe.d/* Original Author: David Lutterkort <lutter@redhat.com> Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 modprobe.conf` 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/modprobe.conf and /etc/modprobe.d/*. See <filter>. *) module Modprobe = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* View: sep_space *) let sep_space = del /([ \t]|(\\\\\n))+/ " " (* View: sto_no_spaces *) let sto_no_spaces = store /[^# \t\n\\\\]+/ (* View: sto_no_colons *) let sto_no_colons = store /[^:# \t\n\\\\]+/ (* View: sto_to_eol *) let sto_to_eol = store /(([^# \t\n\\\\][^#\n\\\\]*[ \t]*\\\\[ \t]*\n[ \t]*)*([^# \t\n\\\\][^#\n\\\\]*[^# \t\n\\\\]|[^# \t\n\\\\])|[^# \t\n\\\\])/ (* View: alias *) let alias = let modulename = [ label "modulename" . sto_no_spaces ] in Build.key_value_line_comment "alias" sep_space (sto_no_spaces . sep_space . modulename) comment (************************************************************************ * Group: ENTRY TYPES *************************************************************************) (* View: options *) let options = let opt_value = /[^#" \t\n\\\\]+|"[^#"\n\\\\]*"/ in let option = [ key Rx.word . (del /[ \t]*=[ \t]*/ "=" . store opt_value)? ] in [ key "options" . sep_space . sto_no_spaces . (sep_space . option)* . Util.comment_or_eol ] (* View: install_remove *) let kv_line_command (kw:regexp) = let command = [ label "command" . sto_to_eol ] in [ key kw . sep_space . sto_no_spaces . sep_space . command . Util.comment_or_eol ] (* View: blacklist *) let blacklist = Build.key_value_line_comment "blacklist" sep_space sto_no_spaces comment (* View: config *) let config = Build.key_value_line_comment "config" sep_space (store /binary_indexes|yes|no/) comment (* View: softdep *) let softdep = let premod = [ label "pre" . sep_space . sto_no_colons ] in let pre = sep_space . Util.del_str "pre:" . premod+ in let postmod = [ label "post" . sep_space . sto_no_colons ] in let post = sep_space . Util.del_str "post:" . postmod+ in [ key "softdep" . sep_space . sto_no_colons . pre? . post? . Util.comment_or_eol ] (* View: entry *) let entry = alias | options | kv_line_command /install|remove/ | blacklist | config | softdep (************************************************************************ * Group: LENS AND FILTER *************************************************************************) (* View: lns *) let lns = (comment|empty|entry)* (* View: filter *) let filter = (incl "/etc/modprobe.conf") . (incl "/etc/modprobe.d/*"). (incl "/etc/modprobe.conf.local"). Util.stdexcl let xfm = transform lns filter lenses/dist/monit.aug 0000644 00000004206 15231153062 0010624 0 ustar 00 (* Monit module for Augeas Author: Free Ekanayaka <free@64studio.com> 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 lenses/dist/hosts.aug 0000644 00000000745 15231153062 0010642 0 ustar 00 (* Parsing /etc/hosts *) module Hosts = autoload xfm let word = /[^# \n\t]+/ let record = [ seq "host" . Util.indent . [ label "ipaddr" . store word ] . Sep.tab . [ label "canonical" . store word ] . [ label "alias" . Sep.space . store word ]* . Util.comment_or_eol ] let lns = ( Util.empty | Util.comment | record ) * let xfm = transform lns (incl "/etc/hosts") lenses/dist/dhcpd.aug 0000644 00000036757 15231153062 0010600 0 ustar 00 (* Module: Dhcpd BIND dhcp 3 server configuration module for Augeas Author: Francis Giraldeau <francis.giraldeau@usherbrooke.ca> About: Reference Reference: manual of dhcpd.conf and dhcp-eval Follow dhclient module for tree structure About: License This file is licensed under the GPL. About: Lens Usage Sample usage of this lens in augtool Directive without argument. Set this dhcpd server authoritative on the domain. > clear /files/etc/dhcp3/dhcpd.conf/authoritative Directives with integer or string argument. Set max-lease-time to one hour: > set /files/etc/dhcp3/dhcpd.conf/max-lease-time 3600 Options are declared as a list, even for single values. Set the domain of the network: > set /files/etc/dhcp3/dhcpd.conf/option/domain-name/arg example.org Set two name server: > set /files/etc/dhcp3/dhcpd.conf/option/domain-name-servers/arg[1] foo.example.org > set /files/etc/dhcp3/dhcpd.conf/option/domain-name-servers/arg[2] bar.example.org Create the subnet 172.16.0.1 with 10 addresses: > clear /files/etc/dhcp3/dhcpd.conf/subnet[last() + 1] > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/network 172.16.0.0 > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/netmask 255.255.255.0 > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/range/from 172.16.0.10 > set /files/etc/dhcp3/dhcpd.conf/subnet[last()]/range/to 172.16.0.20 Create a new group "foo" with one static host. Nodes type and address are ordered. > ins group after /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/*[last()] > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[last()]/host foo > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[host='foo']/host/hardware/type "ethernet" > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[host='foo']/host/hardware/address "00:00:00:aa:bb:cc" > set /files/etc/dhcp3/dhcpd.conf/subnet[network='172.16.0.0']/group[host='foo']/host/fixed-address 172.16.0.100 About: Configuration files This lens applies to /etc/dhcpd3/dhcpd.conf. See <filter>. *) module Dhcpd = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let dels (s:string) = del s s let eol = Util.eol let comment = Util.comment let empty = Util.empty let indent = Util.indent let eos = comment? (* Define separators *) let sep_spc = del /[ \t]+/ " " let sep_osp = del /[ \t]*/ "" let sep_scl = del /[ \t]*;([ \t]*\n)*/ ";\n" let sep_obr = del /[ \t]*\{([ \t]*\n)*/ " {\n" let sep_cbr = del /[ \t]*\}([ \t]*\n)*/ "}\n" let sep_com = del /[ \t\n]*,[ \t\n]*/ ", " let sep_slh = del "\/" "/" let sep_col = del ":" ":" let sep_eq = del /[ \t]*=[ \t]*/ "=" let scl = del ";" ";" (* Define basic types *) let word = /[A-Za-z0-9_.-]+(\[[0-9]+\])?/ let ip = Rx.ipv4 (* Define fields *) (* adapted from sysconfig.aug *) (* Chars allowed in a bare string *) let bchar = /[^ \t\n"'\\{}#,()\/]|\\\\./ let qchar = /["']/ (* " *) (* We split the handling of right hand sides into a few cases: * bare - strings that contain no spaces, optionally enclosed in * single or double quotes * dquot - strings that contain at least one space, apostrophe or slash * which must be enclosed in double quotes * squot - strings that contain an unescaped double quote *) let bare = del qchar? "" . store (bchar+) . del qchar? "" let quote = Quote.do_quote (store (bchar* . /[ \t'\/]/ . bchar*)+) let dquote = Quote.do_dquote (store (bchar+)) let sto_to_spc = store /[^\\#,;\{\}" \t\n]+|"[^\\#"\n]+"/ let sto_to_scl = store /[^ \t;][^;\n=]+[^ \t;]|[^ \t;=]+/ let sto_number = store /[0-9][0-9]*/ (************************************************************************ * NO ARG STATEMENTS *************************************************************************) let stmt_noarg_re = "authoritative" | "primary" | "secondary" let stmt_noarg = [ indent . key stmt_noarg_re . sep_scl . eos ] (************************************************************************ * INT ARG STATEMENTS *************************************************************************) let stmt_integer_re = "default-lease-time" | "max-lease-time" | "min-lease-time" | /lease[ ]+limit/ | "port" | /peer[ ]+port/ | "max-response-delay" | "max-unacked-updates" | "mclt" | "split" | /load[ ]+balance[ ]+max[ ]+seconds/ | "max-lease-misbalance" | "max-lease-ownership" | "min-balance" | "max-balance" | "adaptive-lease-time-threshold" | "dynamic-bootp-lease-length" | "local-port" | "min-sec" | "omapi-port" | "ping-timeout" | "remote-port" let stmt_integer = [ indent . key stmt_integer_re . sep_spc . sto_number . sep_scl . eos ] (************************************************************************ * STRING ARG STATEMENTS *************************************************************************) let stmt_string_re = "ddns-update-style" | "ddns-updates" | "ddns-hostname" | "ddns-domainname" | "ddns-rev-domainname" | "log-facility" | "server-name" | "fixed-address" | /failover[ ]+peer/ | "use-host-decl-names" | "next-server" | "address" | /peer[ ]+address/ | "type" | "file" | "algorithm" | "secret" | "key" | "include" | "hba" | "boot-unknown-clients" | "db-time-format" | "do-forward-updates" | "dynamic-bootp-lease-cutoff" | "get-lease-hostnames" | "infinite-is-reserved" | "lease-file-name" | "local-address" | "one-lease-per-client" | "pid-file-name" | "ping-check" | "server-identifier" | "site-option-space" | "stash-agent-options" | "update-conflict-detection" | "update-optimization" | "update-static-leases" | "use-host-decl-names" | "use-lease-addr-for-default-route" | "vendor-option-space" | "primary" let stmt_string_tpl (kw:regexp) (l:lens) = [ indent . key kw . sep_spc . l . sep_scl . eos ] let stmt_string = stmt_string_tpl stmt_string_re bare | stmt_string_tpl stmt_string_re quote | stmt_string_tpl "filename" dquote (************************************************************************ * RANGE STATEMENTS *************************************************************************) let stmt_range = [ indent . key "range" . sep_spc . [ label "flag" . store /dynamic-bootp/ . sep_spc ]? . [ label "from" . store ip . sep_spc ]? . [ label "to" . store ip ] . sep_scl . eos ] (************************************************************************ * HARDWARE STATEMENTS *************************************************************************) let stmt_hardware = [ indent . key "hardware" . sep_spc . [ label "type" . store /ethernet|tokenring/ ] . sep_spc . [ label "address" . store /[a-fA-F0-9:-]+/ ] . sep_scl . eos ] (************************************************************************ * OPTION STATEMENTS *************************************************************************) (* The general case is considering options as a list *) let stmt_option_code = [ label "label" . store word . sep_spc ] . [ key "code" . sep_spc . store word ] . sep_eq . [ label "type" . store word ] let stmt_option_list = ([ label "arg" . bare ] | [ label "arg" . quote ]) . ( sep_com . ([ label "arg" . bare ] | [ label "arg" . quote ]))* let stmt_option_basic = [ key word . sep_spc . stmt_option_list ] let stmt_option_extra = [ key word . sep_spc . store /true|false/ . sep_spc . stmt_option_list ] let stmt_option_body = stmt_option_basic | stmt_option_extra let stmt_option1 = [ indent . key "option" . sep_spc . stmt_option_body . sep_scl . eos ] let stmt_option2 = [ indent . dels "option" . label "rfc-code" . sep_spc . stmt_option_code . sep_scl . eos ] let stmt_option = stmt_option1 | stmt_option2 (************************************************************************ * SUBCLASS STATEMENTS *************************************************************************) (* this statement is not well documented in the manual dhcpd.conf we support basic use case *) let stmt_subclass = [ indent . key "subclass" . sep_spc . ([ label "name" . quote ]| [ label "name" . bare ]) . sep_spc . [ label "value" . bare ] . sep_scl . eos ] (************************************************************************ * ALLOW/DENY STATEMENTS *************************************************************************) (* We have to use special key for allow/deny members of to avoid ambiguity in the put direction *) let allow_deny_re = "unknown-clients" | /dynamic[ ]+bootp[ ]+clients/ | /authenticated[ ]+clients/ | /unauthenticated[ ]+clients/ let stmt_secu_re = "allow" | "deny" let del_allow = del /allow[ ]+members[ ]+of/ "allow members of" let del_deny = del /deny[ \t]+members[ \t]+of/ "deny members of" let stmt_secu_tpl (l:lens) (s:string) = [ indent . l . sep_spc . label s . bare . sep_scl . eos ] | [ indent . l . sep_spc . label s . quote . sep_scl . eos ] let stmt_secu = [ indent . key stmt_secu_re . sep_spc . store allow_deny_re . sep_scl . eos ] | stmt_secu_tpl del_allow "allow-members-of" | stmt_secu_tpl del_deny "deny-members-of" (************************************************************************ * MATCH STATEMENTS *************************************************************************) let sto_fct = store (word . /[ \t]*\([^)]*\)/) let sto_option = store (/option[ ]+/ . word) let sto_com = /[^ \t\n,\(\)][^,\(\)]*[^ \t\n,\(\)]|[^ \t\n,\(\)]+/ | word . /[ \t]*\([^)]*\)/ let fct_re = "substring" | "binary-to-ascii" let fct_args = [ label "args" . dels "(" . sep_osp . ([ label "arg" . store sto_com ] . [ label "arg" . sep_com . store sto_com ]+) . sep_osp . dels ")" ] let stmt_match_if = [ dels "if" . sep_spc . store fct_re . sep_osp . label "function" . fct_args ] . sep_eq . ([ label "value" . bare ]|[ label "value" . quote ]) let stmt_match_pfv = [ label "function" . store "pick-first-value" . sep_spc . dels "(" . sep_osp . [ label "args" . [ label "arg" . store sto_com ] . [ sep_com . label "arg" . store sto_com ]+ ] . dels ")" ] let stmt_match_tpl (l:lens) = [ indent . key "match" . sep_spc . l . sep_scl . eos ] let stmt_match = stmt_match_tpl (stmt_match_if | stmt_match_pfv ) (************************************************************************ * BLOCK STATEMENTS *************************************************************************) (* Blocks doesn't support comments at the end of the closing bracket *) let stmt_entry = stmt_secu | stmt_option | stmt_hardware | stmt_range | stmt_string | stmt_integer | stmt_noarg | stmt_match | stmt_subclass | empty | comment let stmt_block_noarg_re = "pool" | "group" | "allow-update" let stmt_block_noarg (body:lens) = [ indent . key stmt_block_noarg_re . sep_obr . body* . sep_cbr ] let stmt_block_arg_re = "host" | "class" | "shared-network" | /failover[ ]+peer/ | "zone" | "key" let stmt_block_arg (body:lens) = [ indent . key stmt_block_arg_re . sep_spc . sto_to_spc . sep_obr . body* . sep_cbr ] let stmt_block_subnet (body:lens) = [ indent . key "subnet" . sep_spc . [ label "network" . store ip ] . sep_spc . [ key "netmask" . sep_spc . store ip ] . sep_obr . body* . sep_cbr ] let all_block (body:lens) = let lns1 = stmt_block_subnet body in let lns2 = stmt_block_arg body in let lns3 = stmt_block_noarg body in (lns1 | lns2 | lns3 | stmt_entry) let rec lns_staging = stmt_entry|all_block lns_staging let lns = (lns_staging)* let filter = incl "/etc/dhcp3/dhcpd.conf" . incl "/etc/dhcp/dhcpd.conf" . incl "/etc/dhcpd.conf" let xfm = transform lns filter lenses/dist/jmxaccess.aug 0000644 00000002552 15231153062 0011460 0 ustar 00 (* Module: JMXAccess JMXAccess module for Augeas Author: Brian Redbeard <redbeard@dead-city.org> 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 <filter>. *) 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 lenses/dist/rmt.aug 0000644 00000001424 15231153062 0010277 0 ustar 00 (* Module: Rmt Parses rmt's configuration file Author: Dominic Cleal <dcleal@redhat.com> About: Reference This lens is based on rmt(1) About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Rmt = autoload xfm let sto_to_tab = store Rx.no_spaces let debug = Build.key_value_line "DEBUG" Sep.equal ( store Rx.fspath ) let user = Build.key_value_line "USER" Sep.equal sto_to_tab let access = Build.key_value_line "ACCESS" Sep.equal ( [ label "name" . sto_to_tab ] . Sep.tab . [ label "host" . sto_to_tab ] . Sep.tab . [ label "path" . sto_to_tab ] ) let lns = ( debug | user | access | Util.comment | Util.empty )* let filter = incl "/etc/default/rmt" let xfm = transform lns filter lenses/dist/gtkbookmarks.aug 0000644 00000001527 15231153062 0012177 0 ustar 00 (* Module: GtkBookmarks Parses $HOME/.gtk-bookmarks Author: Raphael Pinson <raphael.pinson@camptocamp.com> 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 $HOME/.gtk-bookmarks. See <filter>. About: Examples The <Test_GtkBookmarks> file contains various examples and tests. *) module GtkBookmarks = autoload xfm (* View: empty Comment are not allowed, even empty comments *) let empty = Util.empty_generic Rx.opt_space (* View: entry *) let entry = [ label "bookmark" . store Rx.no_spaces . (Sep.space . [ label "label" . store Rx.space_in ])? . Util.eol ] (* View: lns *) let lns = (empty | entry)* (* View: xfm *) let xfm = transform lns (incl (Sys.getenv("HOME") . "/.gtk-bookmarks")) lenses/dist/services.aug 0000644 00000005507 15231153062 0011326 0 ustar 00 (* Module: Services Parses /etc/services Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to 'man services' where possible. The definitions from 'man services' are put as commentaries for reference throughout the file. More information can be found in the manual. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage Sample usage of this lens in augtool * Get the name of the service running on port 22 with protocol tcp > match "/files/etc/services/service-name[port = '22'][protocol = 'tcp']" * Remove the tcp entry for "domain" service > rm "/files/etc/services/service-name[. = 'domain'][protocol = 'tcp']" * Add a tcp service named "myservice" on port 55234 > ins service-name after /files/etc/services/service-name[last()] > set /files/etc/services/service-name[last()] "myservice" > set "/files/etc/services/service-name[. = 'myservice']/port" "55234" > set "/files/etc/services/service-name[. = 'myservice']/protocol" "tcp" About: Configuration files This lens applies to /etc/services. See <filter>. *) module Services = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Generic primitives *) (* Variable: eol *) let eol = del /[ \t]*(#)?[ \t]*\n/ "\n" let indent = Util.indent let comment = Util.comment let comment_or_eol = Util.comment_or_eol let empty = Util.empty let protocol_re = /[a-zA-Z]+/ let word_re = /[a-zA-Z0-9_.+*\/:-]+/ let num_re = /[0-9]+/ (* Group: Separators *) let sep_spc = Util.del_ws_spc (************************************************************************ * Group: LENSES *************************************************************************) (* View: port *) let port = [ label "port" . store num_re ] (* View: port_range *) let port_range = [ label "start" . store num_re ] . Util.del_str "-" . [ label "end" . store num_re ] (* View: protocol *) let protocol = [ label "protocol" . store protocol_re ] (* View: alias *) let alias = [ label "alias" . store word_re ] (* * View: record * A standard /etc/services record * TODO: make sure a space is added before a comment on new nodes *) let record = [ label "service-name" . store word_re . sep_spc . (port | port_range) . del "/" "/" . protocol . ( sep_spc . alias )* . comment_or_eol ] (* View: lns The services lens is either <empty>, <comment> or <record> *) let lns = ( empty | comment | record )* (* View: filter *) let filter = (incl "/etc/services") let xfm = transform lns filter lenses/dist/puppet_auth.aug 0000644 00000003721 15231153062 0012035 0 ustar 00 (* Module: Puppet_Auth Parses /etc/puppet/auth.conf Author: Raphael Pinson <raphael.pinson@camptocamp.com> About: Reference This lens tries to keep as close as possible to `http://docs.puppetlabs.com/guides/rest_auth_conf.html` 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/puppet/auth.conf. See <filter>. About: Examples The <Test_Puppet_Auth> file contains various examples and tests. *) module Puppet_Auth = autoload xfm (* View: list A list of values *) let list (kw:string) (val:regexp) = let item = [ seq kw . store val ] in let comma = del /[ \t]*,[ \t]*/ ", " in [ Util.indent . key kw . Sep.space . Build.opt_list item comma . Util.comment_or_eol ] (* View: auth An authentication stanza *) let auth = [ Util.indent . Build.xchg /auth(enticated)?/ "auth" "auth" . Sep.space . store /yes|no|on|off|any/ . Util.comment_or_eol ] (* View: reset_counters *) let reset_counters = counter "environment" . counter "method" . counter "allow" . counter "allow_ip" (* View: setting *) let setting = list "environment" Rx.word | list "method" /find|search|save|destroy/ | list "allow" /[^# \t\n,][^#\n,]*[^# \t\n,]|[^# \t\n,]/ | list "allow_ip" /[A-Za-z0-9.:\/]+/ | auth (* View: record *) let record = let operator = [ label "operator" . store "~" ] in [ Util.indent . key "path" . (Sep.space . operator)? . Sep.space . store /[^~# \t\n][^#\n]*[^# \t\n]|[^~# \t\n]/ . Util.eol . reset_counters . (Util.empty | Util.comment | setting)* . setting ] (* View: lns *) let lns = (Util.empty | Util.comment | record)* (* Variable: filter *) let filter = (incl "/etc/puppet/auth.conf" .incl "/usr/local/etc/puppet/auth.conf" .incl "/etc/puppetlabs/puppet/auth.conf") let xfm = transform lns filter lenses/dist/exports.aug 0000644 00000004567 15231153062 0011214 0 ustar 00 (* Lens for Linux syntax of NFS exports(5) *) (* Module: Exports Parses /etc/exports Author: David Lutterkort <lutter@redhat.com> About: Description /etc/exports contains lines associating a directory with one or more hosts, and NFS options for each host. About: Usage Example (start code) $ augtool augtool> ls /files/etc/exports/ comment[1] = /etc/exports: the access control list for filesystems which may be exported comment[2] = to NFS clients. See exports(5). comment[3] = sample /etc/exports file dir[1]/ = / dir[2]/ = /projects dir[3]/ = /usr dir[4]/ = /home/joe augtool> ls /files/etc/exports/dir[1] client[1]/ = master client[2]/ = trusty (end code) The corresponding line in the file is: (start code) / master(rw) trusty(rw,no_root_squash) (end code) Digging further: (start code) augtool> ls /files/etc/exports/dir[1]/client[1] option = rw To add a new entry, you'd do something like this: (end code) (start code) augtool> set /files/etc/exports/dir[10000] /foo augtool> set /files/etc/exports/dir[last()]/client[1] weeble augtool> set /files/etc/exports/dir[last()]/client[1]/option[1] ro augtool> set /files/etc/exports/dir[last()]/client[1]/option[2] all_squash augtool> save Saved 1 file(s) (end code) Which creates the line: (start code) /foo weeble(ro,all_squash) (end code) About: Limitations This lens cannot handle options without a host, as with the last example line in "man 5 exports": /pub (ro,insecure,all_squash) In this case, though, you can just do: /pub *(ro,insecure,all_squash) It also can't handle whitespace before the directory name. *) module Exports = autoload xfm let client_re = /[][a-zA-Z0-9.@*?\/:-]+/ let eol = Util.eol let lbracket = Util.del_str "(" let rbracket = Util.del_str ")" let sep_com = Sep.comma let sep_spc = Sep.space let option = [ label "option" . store /[^,)]*/ ] let client = [ label "client" . store client_re . ( Build.brackets lbracket rbracket ( Build.opt_list option sep_com ) )? ] let entry = [ label "dir" . store /\/[^ \t]*/ . sep_spc . Build.opt_list client sep_spc . eol ] let lns = (Util.empty | Util.comment | entry)* let xfm = transform lns (incl "/etc/exports") lenses/dist/tuned.aug 0000644 00000000603 15231153062 0010612 0 ustar 00 (* Module: Tuned Parses Tuned's configuration files Author: Pat Riehecky <riehecky@fnal.gov> About: Reference This lens is based on tuned's tuned-main.conf About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Tuned = autoload xfm let lns = Simplevars.lns let filter = incl "/etc/tuned/tuned-main.conf" let xfm = transform lns filter lenses/dist/jaas.aug 0000644 00000002500 15231153062 0010407 0 ustar 00 (* Module Jaas *) (* Author: Simon Vocella <voxsim@gmail.com> *) module Jaas = autoload xfm let space_equal = del (/[ \t]*/ . "=" . /[ \t]*/) (" = ") let lbrace = del (/[ \t\n]*/ . "{") "{" let rbrace = del ("};") "};" let word = /[A-Za-z0-9_.-]+/ let wordonly = /[A-Za-z0-9_.-]+;/ let value_re = let value_squote = /'[^\n']*'/ in let value_squote_2 = /'[^\n']*';/ in let value_dquote = /"[^\n"]*"/ in let value_dquote_2 = /"[^\n"]*";/ in let value_tf = /(true|false);/ in let value_tf_2 = /(true|false);/ in value_squote | value_squote_2 | value_dquote | value_dquote_2 | value_tf | value_tf_2 let moduleOption = [Util.del_opt_ws "" . key word . space_equal . (store value_re . Util.comment_or_eol)] let flag = [label "flag" . ((store word . Util.eol . moduleOption+) | (store wordonly . Util.eol))] let loginModuleClass = [Util.del_opt_ws "" . label "loginModuleClass" . (store word . Util.del_ws_spc) . flag] let content = (Util.empty | Util.comment_c_style | Util.comment_multiline | loginModuleClass)* let loginModule = [Util.del_opt_ws "" . label "login" . (store word . lbrace) . (content . rbrace)] let lns = (Util.empty | Util.comment_c_style | Util.comment_multiline | loginModule)* let filter = incl "/opt/shibboleth-idp/conf/login.config" let xfm = transform lns filter lenses/dist/mke2fs.aug 0000644 00000011257 15231153062 0010671 0 ustar 00 (* Module: Mke2fs Parses /etc/mke2fs.conf Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 mke2fs.conf` 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/mke2fs.conf. See <filter>. *) module Mke2fs = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: comment *) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default (* View: sep *) let sep = IniFile.sep /=[ \t]*/ "=" (* View: empty *) let empty = IniFile.empty (************************************************************************ * Group: RECORD TYPES *************************************************************************) (* View: entry A generic entry for lens lns *) let entry (kw:regexp) (lns:lens) = Build.key_value_line kw sep lns (* View: list_sto A list of values with given lens *) let list_sto (kw:regexp) (lns:lens) = counter "item" . entry kw (Build.opt_list [lns] Sep.comma) (* View: entry_sto Store a regexp as entry value *) let entry_sto (kw:regexp) (val:regexp) = entry kw (store val) (************************************************************************ * Group: COMMON ENTRIES *************************************************************************) (* View: common_entry Entries shared between <defaults> and <fs_types> sections *) let common_entry = list_sto ("base_features"|"default_features") (key Rx.word) | entry_sto "blocksize" ("-"? . Rx.integer) | entry_sto "hash_alg" ("legacy"|"half_md4"|"tea") | entry_sto ("inode_ratio"|"inode_size") Rx.integer (************************************************************************ * Group: DEFAULTS SECTION *************************************************************************) (* View: defaults_entry Possible entries under the <defaults> section *) let defaults_entry = entry_sto "force_undo" ("true"|"false") | entry_sto "fs_type" Rx.word | entry_sto "undo_dir" Rx.fspath | list_sto "default_mntopts" (key Rx.word) | entry_sto "enable_periodic_fsck" Rx.integer (* View: defaults_title Title for the <defaults> section *) let defaults_title = IniFile.title "defaults" (* View: defaults A defaults section *) let defaults = IniFile.record defaults_title ((Util.indent . (defaults_entry|common_entry)) | comment) (************************************************************************ * Group: FS_TYPES SECTION *************************************************************************) (* View: fs_types_entry Possible entries under a <fs_types_record> group *) let fs_types_entry =list_sto "features" ([del /\^/ "^" . label "disable"]? . key Rx.word) | list_sto "options" (key Rx.word . Util.del_str "=" . store Rx.word) | entry_sto "lazy_itable_init" ("true"|"false") | entry_sto ("flex_bg_size"|"auto_64-bit_support") Rx.integer (* View: fs_types_record Fs group records under the <fs_types> section *) let fs_types_record = [ label "filesystem" . Util.indent . store Rx.word . del /[ \t]*=[ \t]*\{[ \t]*\n/ " = {\n" . ((Util.indent . (fs_types_entry|common_entry)) | empty | comment)* . del /[ \t]*\}[ \t]*\n/ " }\n" ] (* View: fs_types_title Title for the <fs_types> section *) let fs_types_title = IniFile.title "fs_types" (* View: fs_types A fs_types section *) let fs_types = IniFile.record fs_types_title (fs_types_record | comment) (************************************************************************ * Group: LENS AND FILTER *************************************************************************) (* View: lns The mke2fs lens *) let lns = (empty|comment)* . (defaults|fs_types)* (* Variable: filter *) let filter = incl "/etc/mke2fs.conf" let xfm = transform lns filter lenses/dist/automounter.aug 0000644 00000010064 15231153062 0012057 0 ustar 00 (* Module: Automounter Parses automounter file based maps Author: Dominic Cleal <dcleal@redhat.com> 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 <Test_Automounter> 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 lenses/dist/cgconfig.aug 0000644 00000006567 15231153062 0011271 0 ustar 00 (* Module: cgconfig Parses /etc/cgconfig.conf Author: Ivana Hutarova Varekova <varekova@redhat.com> Raphael Pinson <raphink@gmail.com> 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 <filter>. *) 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") lenses/dist/slapd_140.aug 0000644 00000012213 15231153062 0011162 0 ustar 00 (* Slapd module for Augeas This module is compatible with Augeas 1.4.0, but is not loaded by default. Author: Free Ekanayaka <free@64studio.com> Reference: man slapd.conf(5), man slapd.access (5) *) module Slapd_140 = (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let spc = Util.del_ws_spc let sep = del /[ \t\n]+/ " " let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ let sto_to_spc = store /[^\\# \t\n]+/ let comment = Util.comment let empty = Util.empty (************************************************************************ * ACCESS TO *************************************************************************) let access_re = "access to" let control_re = "stop" | "continue" | "break" let what = [ spc . label "access" . store (/[^\\# \t\n]+/ - ("by" | control_re)) ] (* TODO: parse the control field, see man slapd.access (5) *) let control = [ spc . label "control" . store control_re ] let by = [ sep . key "by" . spc . sto_to_spc . what? . control? ] let access = [ key access_re . spc. sto_to_spc . by+ . eol ] (************************************************************************ * GLOBAL *************************************************************************) (* TODO: parse special field separately, see man slapd.conf (5) *) let global_re = "allow" | "argsfile" | "attributeoptions" | "attributetype" | "authz-policy" | "ldap" | "dn" | "concurrency" | "cron_max_pending" | "conn_max_pending_auth" | "defaultsearchbase" | "disallow" | "ditcontentrule" | "gentlehup" | "idletimeout" | "include" | "index_substr_if_minlen" | "index_substr_if_maxlen" | "index_substr_any_len" | "index_substr_any_step" | "localSSF" | "loglevel" | "moduleload" | "modulepath" | "objectclass" | "objectidentifier" | "password-hash" | "password-crypt-salt-format" | "pidfile" | "referral" | "replica-argsfile" | "replica-pidfile" | "replicationinterval" | "require" | "reverse-lookup" | "rootDSE" | "sasl-host " | "sasl-realm" | "sasl-secprops" | "schemadn" | "security" | "sizelimit" | "sockbuf_max_incoming " | "sockbuf_max_incoming_auth" | "threads" | "timelimit time" | "tool-threads" | "TLSCipherSuite" | "TLSCACertificateFile" | "TLSCACertificatePath" | "TLSCertificateFile" | "TLSCertificateKeyFile" | "TLSDHParamFile" | "TLSRandFile" | "TLSVerifyClient" | "TLSCRLCheck" | "backend" let global = Build.key_ws_value global_re (************************************************************************ * DATABASE *************************************************************************) (* TODO: support all types of database backend *) let database_hdb = "cachesize" | "cachefree" | "checkpoint" | "dbconfig" | "dbnosync" | "directory" | "dirtyread" | "idlcachesize" | "index" | "linearindex" | "lockdetect" | "mode" | "searchstack" | "shm_key" let database_re = "suffix" | "lastmod" | "limits" | "maxderefdepth" | "overlay" | "readonly" | "replica uri" | "replogfile" | "restrict" | "rootdn" | "rootpw" | "subordinate" | "syncrepl rid" | "updatedn" | "updateref" | database_hdb let database_entry = let val = Quote.double_opt in Build.key_value_line database_re Sep.space val let database = [ key "database" . spc . sto_to_eol . eol . (comment|empty|database_entry|access)* ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|global|access)* . (database)* lenses/dist/avahi.aug 0000644 00000002611 15231153062 0010564 0 ustar 00 (* Module: Avahi Avahi module for Augeas Author: Athir Nuaimi <athir@nuaimi.com> avahi-daemon.conf is a standard INI File. *) module Avahi = autoload xfm (************************************************************************ * Group: INI File settings * avahi-daemon.conf only supports "# as commentary and "=" as separator *************************************************************************) (* View: comment *) let comment = IniFile.comment "#" "#" (* View: sep *) let sep = IniFile.sep "=" "=" (************************************************************************ * Group: Entry *************************************************************************) (* View: entry *) let entry = IniFile.indented_entry IniFile.entry_re sep comment (************************************************************************ * Group: Record *************************************************************************) (* View: title *) let title = IniFile.indented_title IniFile.record_re (* View: record *) let record = IniFile.record title entry (************************************************************************ * Group: Lens and filter *************************************************************************) (* View: lns *) let lns = IniFile.lns record comment (* View: filter *) let filter = (incl "/etc/avahi/avahi-daemon.conf") let xfm = transform lns filter lenses/dist/sysconfig.aug 0000644 00000004766 15231153062 0011515 0 ustar 00 (* Variation of the Shellvars lens *) (* Supports only what's needed to handle sysconfig files *) (* Modified to strip quotes. In the put direction, add double quotes *) (* around values that need them *) (* To keep things simple, we also do not support shell variable arrays *) module Sysconfig = let eol = Shellvars.eol let semicol_eol = Shellvars.semicol_eol let key_re = Shellvars.key_re let eq = Util.del_str "=" let eol_for_comment = del /([ \t]*\n)([ \t]*(#[ \t]*)?\n)*/ "\n" let comment = Util.comment_generic_seteol /[ \t]*#[ \t]*/ "# " eol_for_comment let comment_or_eol = Shellvars.comment_or_eol let empty = Util.empty let bchar = /[^; \t\n"'\\]|\\\\./ (* " Emacs, relax *) let qchar = /["']/ (* " Emacs, relax *) (* We split the handling of right hand sides into a few cases: * bare - strings that contain no spaces, optionally enclosed in * single or double quotes * quot - strings that must be enclosed in single or double quotes * dquot - strings that contain at least one space or apostrophe, * which must be enclosed in double quotes * squot - strings that contain an unescaped double quote *) let bare = Quote.do_quote_opt (store bchar+) let quot = let word = bchar* . /[; \t]/ . bchar* in Quote.do_quote (store word+) let dquot = let char = /[^"\\]|\\\\./ in (* " *) let word = char* . "'" . char* in Quote.do_dquote (store word+) let squot = (* We do not allow escaped double quotes in single quoted strings, as *) (* that leads to a put ambiguity with bare, e.g. for the string '\"'. *) let char = /[^'\\]|\\\\[^"]/ in (* " *) let word = char* . "\"" . char* in Quote.do_squote (store word+) let kv (value:lens) = let export = Shellvars.export in let indent = Util.del_opt_ws "" in [ indent . export? . key key_re . eq . value . comment_or_eol ] let assign = let nothing = del /(""|'')?/ "" . value "" in kv nothing | kv bare | kv quot | kv dquot | kv squot let var_action = Shellvars.var_action let unset = [ var_action "unset" . comment_or_eol ] let bare_export = [ var_action "export" . comment_or_eol ] let source = [ Shellvars.source . comment_or_eol ] let lns = empty* . (comment | source | assign | unset | bare_export)* (* Examples: abc -> abc -> abc "abc" -> abc -> abc "a b" -> a b -> "a b" 'a"b' -> a"b -> 'a"b' *) lenses/dist/passwd.aug 0000644 00000007031 15231153062 0010776 0 ustar 00 (* Module: Passwd Parses /etc/passwd Author: Free Ekanayaka <free@64studio.com> 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 lenses/dist/phpvars.aug 0000644 00000007553 15231153062 0011171 0 ustar 00 (* Phpvars module for Augeas Author: Free Ekanayaka <free@64studio.com> 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 "<?php\n" let close_php = del /([ \t]*(php)?\?>\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 lenses/dist/erlang.aug 0000644 00000010101 15231153062 0010735 0 ustar 00 (* Module: Erlang Parses Erlang configuration files Author: Raphael Pinson <raphael.pinson@camptocamp.com> About: Reference This lens tries to keep as close as possible to `http://www.erlang.org/doc/man/config.html` 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 Erlang configuration files. See <filter>. About: Examples The <Test_Erlang> file contains various examples and tests. *) module Erlang = (* Group: Spacing Functions *) (* View: space *) let space = del /[ \t\n]*/ "" (* View: lspace Add spaces to the left of char *) let lspace (char:string) = del (/[ \t\n]*/ . char) char (* View: rspace Add spaces to the right of char *) let rspace (char:string) = del (char . /[ \t\n]*/ ) char (* View: lrspace Add spaces to the left or right of char *) let lrspace (char:string) = del (/[ \t\n]*/ . char . /[ \t\n]*/ ) char (* Group: Separators *) (* Variable: lbrace Left square bracket *) let lbrace = "{" (* Variable: rbrace Right square bracket *) let rbrace = "}" (* Variable: lbrack Left curly brackets *) let lbrack = "[" (* Variable: rbrack Right curly brackets *) let rbrack = "]" (* Variable: lglob Left glob separator *) let lglob = "<<\"" (* Variable: rglob Right glob separator *) let rglob = "\">>" (* Variable: comma *) let comma = "," (* Group: Value types *) (* View: opt_list An optional list of elements, in square brackets *) let opt_list (lns:lens) = rspace lbrack . (Build.opt_list lns (lrspace comma) . space)? . Util.del_str rbrack (* View: integer Store a <Rx.integer> *) let integer = store Rx.integer (* View: decimal Store a decimal value *) let decimal = store /[0-9]+(.[0-9]+)?/ (* View: quoted Store a quoted value *) let quoted = Quote.do_quote (store /[^,\n}{]+/) (* View: bare Store a bare <Rx.word> *) let bare = store Rx.word (* View: boolean Store a boolean value *) let boolean = store /true|false/ (* View: path Store a path (<quoted>) *) let path = quoted (* View: glob Store a glob *) let glob = Util.del_str lglob . store /[^\n"]+/ . Util.del_str rglob (* View: make_value Make a "value" subnode for arrays/tuples *) let make_value (lns:lens) = [ label "value" . lns ] (* Group: Store types *) (* View: value A single value *) let value (kw:regexp) (sto:lens) = [ rspace lbrace . key kw . lrspace comma . sto . lspace rbrace ] (* View: tuple A tuple of values *) let tuple (one:lens) (two:lens) = [ rspace lbrace . label "tuple" . [ label "value" . one ] . lrspace comma . [ label "value" . two ] . lspace rbrace ] (* View: list A list of lenses *) let list (kw:regexp) (lns:lens) = [ rspace lbrace . key kw . lrspace comma . opt_list lns . lspace rbrace ] (* View: value_list A <list> of seq entries *) let value_list (kw:regexp) (sto:lens) = list kw (make_value sto) (* View: application *) let application (name:regexp) (parameter:lens) = list name parameter (* View: kernel_parameters Config parameters accepted for kernel app *) let kernel_parameters = value "browser_cmd" path | value "dist_auto_connect" (store /never|once/) | value "error_logger" (store /tty|false|silent/) | value "net_setuptime" integer | value "net_ticktime" integer | value "shutdown_timeout" integer | value "sync_nodes_timeout" integer | value "start_dist_ac" boolean | value "start_boot_server" boolean | value "start_disk_log" boolean | value "start_pg2" boolean | value "start_timer" boolean (* View: kernel Core Erlang kernel app configuration *) let kernel = application "kernel" kernel_parameters (* View: comment *) let comment = Util.comment_generic /%[ \t]*/ "% " (* View: config A top-level config *) let config (app:lens) = (Util.empty | comment)* . rspace lbrack . Build.opt_list (kernel | app) (lrspace comma) . lrspace rbrack . Util.del_str "." . Util.eol . (Util.empty | comment)* lenses/dist/host_conf.aug 0000644 00000003605 15231153062 0011462 0 ustar 00 (* Module: Host_Conf Parses /etc/host.conf Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 host.conf` 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/host.conf. See <filter>. *) module Host_Conf = autoload xfm (************************************************************************ * Group: ENTRY TYPES *************************************************************************) (* View: sto_bool Store a boolean value *) let sto_bool = store ("on"|"off") (* View: sto_bool_warn Store a boolean value *) let sto_bool_warn = store ("on"|"off"|"warn"|"nowarn") (* View: bool A boolean switch *) let bool (kw:regexp) = Build.key_value_line kw Sep.space sto_bool (* View: bool_warn A boolean switch with extended values *) let bool_warn (kw:regexp) = Build.key_value_line kw Sep.space sto_bool_warn (* View: list A list of items *) let list (kw:regexp) (elem:string) = let list_elems = Build.opt_list [seq elem . store Rx.word] (Sep.comma) in Build.key_value_line kw Sep.space list_elems (* View: trim *) let trim = let trim_list = Build.opt_list [seq "trim" . store Rx.word] (del /[:;,]/ ":") in Build.key_value_line "trim" Sep.space trim_list (* View: entry *) let entry = bool ("multi"|"nospoof"|"spoofalert"|"reorder") | bool_warn "spoof" | list "order" "order" | trim (************************************************************************ * Group: LENS AND FILTER *************************************************************************) (* View: lns *) let lns = ( Util.empty | Util.comment | entry )* (* View: filter *) let filter = incl "/etc/host.conf" let xfm = transform lns filter lenses/dist/sshd.aug 0000644 00000006564 15231153062 0010450 0 ustar 00 (* 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 = Util.del_ws_spc let key_re = /[A-Za-z0-9]+/ - /MACs|Match|AcceptEnv|Subsystem|(Allow|Deny)(Groups|Users)/ let comment = Util.comment let empty = Util.empty let array_entry (k:string) = let value = store /[^ \t\n]+/ in [ key k . [ sep . seq k . value]* . 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" let allow_groups = array_entry "AllowGroups" let allow_users = array_entry "AllowUsers" let deny_groups = array_entry "DenyGroups" let deny_users = array_entry "DenyUsers" let subsystemvalue = let value = store (/[^ \t\n](.*[^ \t\n])?/) in [ key /[A-Za-z0-9\-]+/ . sep . value . eol ] let subsystem = [ key "Subsystem" . sep . subsystemvalue ] let macs = let mac_value = store /[^, \t\n]+/ in [ key "MACs" . sep . [ seq "macs" . mac_value ] . ([ seq "macs" . Util.del_str "," . mac_value])* . eol ] let condition_entry = let value = store /[^ \t\n]+/ in [ sep . key /[A-Za-z0-9]+/ . sep . value ] let match_cond = [ label "Condition" . condition_entry+ . eol ] let match_entry = ( comment | empty | (Util.indent . other_entry) ) let match = [ key "Match" . match_cond . [ label "Settings" . match_entry+ ] ] let lns = (comment | empty | accept_env | allow_groups | allow_users | deny_groups | subsystem | deny_users | macs | other_entry ) * . match* let xfm = transform lns (incl "/etc/ssh/sshd_config") (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/mysql.aug 0000644 00000003636 15231153062 0010651 0 ustar 00 (* MySQL module for Augeas *) (* Author: Tim Stoop <tim@kumina.nl> *) (* Heavily based on php.aug by Raphael Pinson *) (* <raphink@gmail.com> *) (* *) module MySQL = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment IniFile.comment_re "#" let sep = IniFile.sep IniFile.sep_re IniFile.sep_default let entry = let bare = Quote.do_dquote_opt_nil (store /[^#;" \t\r\n]+([ \t]+[^#;" \t\r\n]+)*/) in let quoted = Quote.do_dquote (store /[^"\r\n]*[#;]+[^"\r\n]*/) in [ Util.indent . key IniFile.entry_re . sep . Sep.opt_space . bare . (comment|IniFile.eol) ] | [ Util.indent . key IniFile.entry_re . sep . Sep.opt_space . quoted . (comment|IniFile.eol) ] | [ Util.indent . key IniFile.entry_re . store // . (comment|IniFile.eol) ] | comment (************************************************************************ * sections, led by a "[section]" header * We can't use titles as node names here since they could contain "/" * We remove #comment from possible keys * since it is used as label for comments * We also remove / as first character * because augeas doesn't like '/' keys (although it is legal in INI Files) *************************************************************************) let title = IniFile.indented_title_label "target" IniFile.record_label_re let record = IniFile.record title entry let includedir = Build.key_value_line /!include(dir)?/ Sep.space (store Rx.fspath) . (comment|IniFile.empty)* let lns = (comment|IniFile.empty)* . (record|includedir)* let filter = (incl "/etc/mysql/my.cnf") . (incl "/etc/mysql/conf.d/*.cnf") . (incl "/etc/my.cnf") let xfm = transform lns filter lenses/dist/inittab.aug 0000644 00000001414 15231153062 0011126 0 ustar 00 (* Parsing /etc/inittab *) module Inittab = autoload xfm let sep = Util.del_str ":" let eol = Util.del_str "\n" let id = /[^\/#:\n]{1,4}/ let value = /[^#:\n]*/ let comment = Util.comment|Util.empty let record = let field (name:string) = [ label name . store value ] in let process = [ label "process" . store /[^#\n]*/ ] in let eolcomment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n].*[^ \t\n]|[^ \t\n]?)/ ] in [ key id . sep . field "runlevels" . sep . field "action" . sep . process . eolcomment? . eol ] let lns = ( comment | record ) * let xfm = transform lns (incl "/etc/inittab") (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/backuppchosts.aug 0000644 00000001766 15231153062 0012357 0 ustar 00 (* Module: BackupPCHosts Parses /etc/backuppc/hosts About: Reference This lens tries to keep as close as possible to `man backuppc` 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/backuppc/hosts. See <filter>. *) module BackupPCHosts = autoload xfm (* View: word *) let word = /[^#, \n\t\/]+/ (* View: record *) let record = let moreusers = Build.opt_list [ label "moreusers" . store word ] Sep.comma in [ seq "host" . [ label "host" . store word ] . Util.del_ws_tab . [ label "dhcp" . store word ] . Util.del_ws_tab . [ label "user" . store word ] . (Util.del_ws_tab . moreusers)? . (Util.comment|Util.eol) ] (* View: lns *) let lns = ( Util.empty | Util.comment | record ) * (* View: filter *) let filter = incl "/etc/backuppc/hosts" let xfm = transform lns filter lenses/dist/postgresql.aug 0000644 00000004045 15231153062 0011702 0 ustar 00 (* Module: Postgresql Parses postgresql.conf Author: Raphael Pinson <raphink@gmail.com> About: Reference http://www.postgresql.org/docs/current/static/config-setting.html 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 postgresql.conf. See <filter>. About: Examples The <Test_Postgresql> file contains various examples and tests. *) module Postgresql = autoload xfm (* View: sep Key and values are separated by either spaces or an equal sign *) let sep = del /([ \t]+)|([ \t]*=[ \t]*)/ " = " (* Variable: word_opt_quot_re Strings that don't require quotes *) let word_opt_quot_re = /[A-Za-z][A-Za-z0-9_]*/ (* View: word_opt_quot Storing a <word_opt_quot_re>, with or without quotes *) let word_opt_quot = Quote.do_squote_opt (store word_opt_quot_re) (* Variable: number_re A relative decimal number, optionally with unit *) let number_re = Rx.reldecimal . /[kMG]?B|[m]?s|min|h|d/? (* View: number Storing <number_re>, with or without quotes *) let number = Quote.do_squote_opt (store number_re) (* View: word_quot Anything other than <word_opt_quot> or <number> Quotes are mandatory *) let word_quot = let esc_squot = /\\\\'/ in let no_quot = /[^#'\n]/ in let forbidden = word_opt_quot_re | number_re in let value = (no_quot|esc_squot)* - forbidden in Quote.do_squote (store value) (* View: entry_gen Builder to construct entries *) let entry_gen (lns:lens) = Util.indent . Build.key_value_line_comment Rx.word sep lns Util.comment_eol (* View: entry *) let entry = entry_gen number | entry_gen word_opt_quot | entry_gen word_quot (* anything else *) (* View: lns *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = (incl "/var/lib/pgsql/data/postgresql.conf" . incl "/var/lib/pgsql/*/data/postgresql.conf" . incl "/etc/postgresql/*/*/postgresql.conf" ) let xfm = transform lns filter lenses/dist/xendconfsxp.aug 0000644 00000002111 15231153062 0012026 0 ustar 00 module Xendconfsxp = autoload xfm let spc1 = /[ \t\n]+/ let ws = del spc1 " " let lbrack = del /[ \t]*\([ \t\n]*/ "(" let rbrack = del /[ \t\n]*\)/ ")" let empty_line = [ del /[ \t]*\n/ "\n" ] let no_ws_comment = [ label "#comment" . del /#[ \t]*/ "# " . store /[^ \t]+[^\n]*/ . del /\n/ "\n" ] let standalone_comment = [ label "#scomment" . del /#/ "#" . store /.*/ . del /\n/ "\n" ] (* Minor bug: The initial whitespace is stored, not deleted. *) let ws_and_comment = ws . no_ws_comment (* Either a word or a quoted string *) let str_store = store /[A-Za-z0-9_.\/-]+|\"([^\"\\\\]|(\\\\.))*\"|'([^'\\\\]|(\\\\.))*'/ let str = [ label "string" . str_store ] let var_name = key Rx.word let rec thing = let array = [ label "array" . lbrack . Build.opt_list thing ws . ws_and_comment? . rbrack ] in let str = [ label "item" . str_store ] in str | array let sexpr = [ lbrack . var_name . ws . no_ws_comment? . thing . ws_and_comment? . rbrack ] let lns = ( empty_line | standalone_comment | sexpr ) * let filter = incl "xend-config.sxp" let xfm = transform lns filter lenses/dist/jettyrealm.aug 0000644 00000003020 15231153062 0011647 0 ustar 00 (* Module: JettyRealm JettyRealm Properties for Augeas Author: Brian Redbeard <redbeard@dead-city.org> 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 <filter>. *) 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 lenses/dist/inputrc.aug 0000644 00000002712 15231153062 0011162 0 ustar 00 (* Module: Inputrc Parses /etc/inputrc Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 3 readline` 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/inputrc. See <filter>. About: Examples The <Test_Inputrc> file contains various examples and tests. *) module Inputrc = autoload xfm (* View: entry An inputrc mapping entry *) let entry = let mapping = [ label "mapping" . store Rx.word ] in [ label "entry" . Util.del_str "\"" . store /[^" \t\n]+/ . Util.del_str "\":" . Sep.space . mapping . Util.eol ] (* View: variable An inputrc variable declaration *) let variable = [ Util.del_str "set" . Sep.space . key (Rx.word - "entry") . Sep.space . store Rx.word . Util.eol ] (* View: condition An "if" declaration, recursive *) let rec condition = [ Util.del_str "$if" . label "@if" . Sep.space . store Rx.space_in . Util.eol . (Util.empty | Util.comment | condition | variable | entry)* . Util.del_str "$endif" . Util.eol ] (* View: lns The inputrc lens *) let lns = (Util.empty | Util.comment | condition | variable | entry)* (* Variable: filter *) let filter = incl "/etc/inputrc" let xfm = transform lns filter lenses/dist/fonts.aug 0000644 00000001463 15231153062 0010631 0 ustar 00 (* Module: Fonts Parses the /etc/fonts directory Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 fonts-conf` 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 files in the /etc/fonts directory. See <filter>. About: Examples The <Test_Fonts> file contains various examples and tests. *) module Fonts = autoload xfm (* View: lns *) let lns = Xml.lns (* Variable: filter *) let filter = incl "/etc/fonts/fonts.conf" . incl "/etc/fonts/conf.avail/*" . incl "/etc/fonts/conf.d/*" . excl "/etc/fonts/*/README" . Util.stdexcl let xfm = transform lns filter lenses/dist/nrpe.aug 0000644 00000003375 15231153062 0010450 0 ustar 00 (* Module: Nrpe Parses nagios-nrpe configuration files. Author: Marc Fournier <marc.fournier@camptocamp.com> About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Nrpe = autoload xfm let eol = Util.eol let eq = Sep.equal (* View: word *) let word = /[^=\n\t ]+/ (* View: item_re *) let item_re = /[^#=\n\t\/ ]+/ - (/command\[[^]\/\n]+\]/ | "include" | "include_dir") (* View: command nrpe.cfg usually has many entries defining commands to run > command[check_foo]=/path/to/nagios/plugin -w 123 -c 456 > command[check_bar]=/path/to/another/nagios/plugin --option *) let command = let obrkt = del /\[/ "[" in let cbrkt = del /\]/ "]" in [ key "command" . [ obrkt . key /[^]\/\n]+/ . cbrkt . eq . store /[^\n]+/ . del /\n/ "\n" ] ] (* View: item regular entries > allow_bash_command_substitution=0 *) let item = [ key item_re . eq . store word . eol ] (* View: include An include entry. nrpe.cfg can include more than one file or directory of files > include=/path/to/file1.cfg > include=/path/to/file2.cfg *) let include = [ key "include" . [ label "file" . eq . store word . eol ] ] (* View: include_dir > include_dir=/path/to/dir/ *) let include_dir = [ key "include_dir" . [ label "dir" . eq . store word . eol ] ] (* View: comment Nrpe comments must start at beginning of line *) let comment = Util.comment_generic /#[ \t]*/ "# " (* blank lines and empty comments *) let empty = Util.empty (* View: lns The Nrpe lens *) let lns = ( command | include | include_dir | item | comment | empty ) * (* View: filter File filter *) let filter = incl "/etc/nrpe.cfg" . incl "/etc/nagios/nrpe.cfg" let xfm = transform lns (filter) lenses/dist/qpid.aug 0000644 00000001236 15231153062 0010433 0 ustar 00 (* Module: Qpid Parses Apache Qpid daemon/client configuration files Author: Andrew Replogle <areplogl@redhat.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Examples The <Test_Qpid> 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 lenses/dist/pbuilder.aug 0000644 00000001176 15231153062 0011307 0 ustar 00 (* Module: Pbuilder Parses /etc/pbuilderrc, /etc/pbuilder/pbuilderrc Author: Raphael Pinson <raphink@gmail.com> About: Reference Pbuilderrc is a standard shellvars file. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Configuration files This lens applies to /etc/pbuilderrc and /etc/pbuilder/pbuilderrc. See <filter>. *) module Pbuilder = autoload xfm (* View: filter The pbuilder conffiles *) let filter = incl "/etc/pbuilder/pbuilderrc" . incl "/etc/pbuilderrc" (* View: lns The pbuilder lens *) let lns = Shellvars.lns let xfm = transform lns filter lenses/dist/mcollective.aug 0000644 00000002130 15231153062 0011776 0 ustar 00 (* Module: MCollective Parses MCollective's configuration files Author: Marc Fournier <marc.fournier@camptocamp.com> About: Reference This lens is based on MCollective's default client.cfg and server.cfg. About: Usage Example (start code) augtool> get /files/etc/mcollective/client.cfg/plugin.psk /files/etc/mcollective/client.cfg/plugin.psk = unset augtool> ls /files/etc/mcollective/client.cfg/ topicprefix = /topic/ main_collective = mcollective collectives = mcollective [...] augtool> set /files/etc/mcollective/client.cfg/plugin.stomp.password example123 augtool> save Saved 1 file(s) (end code) The <Test_MCollective> file also contains various examples. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module MCollective = autoload xfm let lns = Simplevars.lns let filter = incl "/etc/mcollective/client.cfg" . incl "/etc/mcollective/server.cfg" . incl "/etc/puppetlabs/mcollective/client.cfg" . incl "/etc/puppetlabs/mcollective/server.cfg" let xfm = transform lns filter lenses/dist/iscsid.aug 0000644 00000001254 15231153062 0010754 0 ustar 00 (* Module: Iscsid Parses iscsid configuration file Author: Joey Boggs <jboggs@redhat.com> About: Reference This lens is targeted at /etc/iscsi/iscsid.conf *) module Iscsid = autoload xfm let filter = incl "/etc/iscsi/iscsid.conf" let eol = Util.eol let indent = Util.indent let key_re = /[][A-Za-z0-9_.-]+/ let eq = del /[ \t]*=[ \t]*/ " = " let value_re = /[^ \t\n](.*[^ \t\n])?/ let comment = [ indent . label "#comment" . del /[#;][ \t]*/ "# " . store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ . eol ] let empty = Util.empty let kv = [ indent . key key_re . eq . store value_re . eol ] let lns = (empty | comment | kv) * let xfm = transform lns filter lenses/dist/netmasks.aug 0000644 00000003304 15231153062 0011321 0 ustar 00 (* Module: Netmasks Parses /etc/inet/netmasks on Solaris Author: Dominic Cleal <dcleal@redhat.com> 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 <filter>. *) 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 lenses/dist/fai_diskconfig.aug 0000644 00000022436 15231153062 0012442 0 ustar 00 (* Module: FAI_DiskConfig Parses disk_config files for FAI Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to the FAI wiki where possible: http://wiki.fai-project.org/wiki/Setup-storage#New_configuration_file_syntax About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Examples The <Test_FAI_DiskConfig> file contains various examples and tests. *) module FAI_DiskConfig = (* autoload xfm *) (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Generic primitives *) (* Variable: eol *) let eol = Util.eol (* Variable: space *) let space = Sep.space (* Variable: empty *) let empty = Util.empty (* Variable: comment *) let comment = Util.comment (* Variable: tag A generic tag beginning with a colon *) let tag (re:regexp) = [ Util.del_str ":" . key re ] (* Variable: generic_opt A generic key/value option *) let generic_opt (type:string) (kw:regexp) = [ key type . Util.del_str ":" . store kw ] (* Variable: generic_opt_list A generic key/list option *) let generic_opt_list (type:string) (kw:regexp) = [ key type . Util.del_str ":" . counter "locallist" . Build.opt_list [seq "locallist" . store kw] Sep.comma ] (************************************************************************ * Group: RECORDS *************************************************************************) (* Group: volume *) (* Variable: mountpoint_kw *) let mountpoint_kw = "-" (* do not mount *) | "swap" (* swap space *) (* fully qualified path; if :encrypt is given, the partition * will be encrypted, the key is generated automatically *) | /\/[^: \t\n]*/ (* Variable: encrypt encrypt tag *) let encrypt = tag "encrypt" (* Variable: mountpoint *) let mountpoint = [ label "mountpoint" . store mountpoint_kw (* encrypt is only for the fspath, but we parse it anyway *) . encrypt?] (* Variable: resize resize tag *) let resize = tag "resize" (* Variable: size_kw Regexps for size *) let size_kw = /[0-9]+[kMGTP%]?(-([0-9]+[kMGTP%]?)?)?/ | /-[0-9]+[kMGTP%]?/ (* Variable: size *) let size = [ label "size" . store size_kw . resize? ] (* Variable: filesystem_kw Regexps for filesystem *) let filesystem_kw = "-" | "swap" (* NOTE: Restraining this regexp would improve perfs *) | (Rx.no_spaces - ("-" | "swap")) (* mkfs.xxx must exist *) (* Variable: filesystem *) let filesystem = [ label "filesystem" . store filesystem_kw ] (* Variable: mount_option_value *) let mount_option_value = [ label "value" . Util.del_str "=" . store /[^,= \t\n]+/ ] (* Variable: mount_option Counting options *) let mount_option = [ seq "mount_option" . store /[^,= \t\n]+/ . mount_option_value? ] (* Variable: mount_options An array of <mount_option>s *) let mount_options = [ label "mount_options" . counter "mount_option" . Build.opt_list mount_option Sep.comma ] (* Variable: fs_option *) let fs_option = [ key /createopts|tuneopts/ . Util.del_str "=\"" . store /[^"\n]*/ . Util.del_str "\"" ] (* Variable: fs_options An array of <fs_option>s *) let fs_options = (* options to append to mkfs.xxx and to the filesystem-specific * tuning tool *) [ label "fs_options" . Build.opt_list fs_option Sep.space ] (* Variable: volume_full *) let volume_full (type:lens) (third_field:lens) = [ type . space . mountpoint .space (* The third field changes depending on types *) . third_field . space . filesystem . space . mount_options . (space . fs_options)? . eol ] (* Variable: name LVM volume group name *) let name = [ label "name" . store /[^\/ \t\n]+/ ] (* Variable: partition An optional partition number for <disk> *) let partition = [ label "partition" . Util.del_str "." . store /[0-9]+/ ] (* Variable: disk *) let disk = [ label "disk" . store /[^., \t\n]+/ . partition? ] (* Variable: vg_option An option for <volume_vg> *) let vg_option = [ key "pvcreateopts" . Util.del_str "=\"" . store /[^"\n]*/ . Util.del_str "\"" ] (* Variable: volume_vg *) let volume_vg = [ key "vg" . space . name . space . disk . (space . vg_option)? . eol ] (* Variable: spare_missing *) let spare_missing = tag /spare|missing/ (* Variable: disk_with_opt A <disk> with a spare/missing option for raids *) let disk_with_opt = [ label "disk" . store /[^:., \t\n]+/ . partition? . spare_missing* ] (* Variable: disk_list A list of <disk_with_opt>s *) let disk_list = Build.opt_list disk_with_opt Sep.comma (* Variable: type_label_lv *) let type_label_lv = label "lv" . [ label "vg" . store (/[^# \t\n-]+/ - "raw") ] . Util.del_str "-" . [ label "name" . store /[^ \t\n]+/ ] (* Variable: volume_tmpfs *) let volume_tmpfs = [ key "tmpfs" . space . mountpoint .space . size . space . mount_options . (space . fs_options)? . eol ] (* Variable: volume_lvm *) let volume_lvm = volume_full type_label_lv size (* lvm logical volume: vg name and lv name *) | volume_vg (* Variable: volume_raid *) let volume_raid = volume_full (key /raid[0156]/) disk_list (* raid level *) (* Variable: device *) let device = [ label "device" . store Rx.fspath ] (* Variable: volume_cryptsetup *) let volume_cryptsetup = volume_full (key ("swap"|"tmp"|"luks")) device (* Variable: volume *) let volume = volume_full (key "primary") size (* for physical disks only *) | volume_full (key "logical") size (* for physical disks only *) | volume_full (key "raw-disk") size (* Variable: volume_or_comment A succesion of <volume>s and <comment>s *) let volume_or_comment (vol:lens) = (vol|empty|comment)* . vol (* Variable: disk_config_entry *) let disk_config_entry (kw:regexp) (opt:lens) (vol:lens) = [ key "disk_config" . space . store kw . (space . opt)* . eol . (volume_or_comment vol)? ] (* Variable: lvmoption *) let lvmoption = (* preserve partitions -- always *) generic_opt "preserve_always" /[^\/, \t\n-]+-[^\/, \t\n-]+(,[^\/, \t\n-]+-[^\/, \t\n-]+)*/ (* preserve partitions -- unless the system is installed * for the first time *) | generic_opt "preserve_reinstall" /[^\/, \t\n-]+-[^\/, \t\n-]+(,[^\/, \t\n-]+-[^\/, \t\n-]+)*/ (* attempt to resize partitions *) | generic_opt "resize" /[^\/, \t\n-]+-[^\/, \t\n-]+(,[^\/, \t\n-]+-[^\/, \t\n-]+)*/ (* when creating the fstab, the key used for defining the device * may be the device (/dev/xxx), a label given using -L, or the uuid *) | generic_opt "fstabkey" /device|label|uuid/ (* Variable: raidoption *) let raidoption = (* preserve partitions -- always *) generic_opt_list "preserve_always" (Rx.integer | "all") (* preserve partitions -- unless the system is installed * for the first time *) | generic_opt_list "preserve_reinstall" Rx.integer (* when creating the fstab, the key used for defining the device * may be the device (/dev/xxx), a label given using -L, or the uuid *) | generic_opt "fstabkey" /device|label|uuid/ (* Variable: option *) let option = (* preserve partitions -- always *) generic_opt_list "preserve_always" (Rx.integer | "all") (* preserve partitions -- unless the system is installed for the first time *) | generic_opt_list "preserve_reinstall" Rx.integer (* attempt to resize partitions *) | generic_opt_list "resize" Rx.integer (* write a disklabel - default is msdos *) | generic_opt "disklabel" /msdos|gpt/ (* mark a partition bootable, default is / *) | generic_opt "bootable" Rx.integer (* do not assume the disk to be a physical device, use with xen *) | [ key "virtual" ] (* when creating the fstab, the key used for defining the device * may be the device (/dev/xxx), a label given using -L, or the uuid *) | generic_opt "fstabkey" /device|label|uuid/ | generic_opt_list "always_format" Rx.integer | generic_opt "sameas" Rx.fspath let cryptoption = [ key "randinit" ] (* Variable: disk_config *) let disk_config = let excludes = "lvm" | "raid" | "end" | /disk[0-9]+/ | "cryptsetup" | "tmpfs" in let other_label = Rx.fspath - excludes in disk_config_entry "lvm" lvmoption volume_lvm | disk_config_entry "raid" raidoption volume_raid | disk_config_entry "tmpfs" option volume_tmpfs | disk_config_entry "end" option volume (* there shouldn't be an option here *) | disk_config_entry /disk[0-9]+/ option volume | disk_config_entry "cryptsetup" cryptoption volume_cryptsetup | disk_config_entry other_label option volume (* Variable: lns The disk_config lens *) let lns = (disk_config|comment|empty)* (* let xfm = transform lns Util.stdexcl *) lenses/dist/crypttab.aug 0000644 00000006017 15231153062 0011330 0 ustar 00 (* Module: Crypttab Parses /etc/crypttab from the cryptsetup package. Author: Frédéric Lespez <frederic.lespez@free.fr> About: Reference This lens tries to keep as close as possible to `man crypttab` where possible. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage Sample usage of this lens in augtool * Create a new entry for an encrypted block devices > ins 01 after /files/etc/crypttab/*[last()] > set /files/etc/crypttab/01/target crypt_sda2 > set /files/etc/crypttab/01/device /dev/sda2 > set /files/etc/crypttab/01/password /dev/random > set /files/etc/crypttab/01/opt swap * Print the entry applying to the "/dev/sda2" device > print /files/etc/crypttab/01 * Remove the entry applying to the "/dev/sda2" device > rm /files/etc/crypttab/*[device="/dev/sda2"] About: Configuration files This lens applies to /etc/crypttab. See <filter>. *) module Crypttab = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Separators *) (* Variable: sep_tab *) let sep_tab = Sep.tab (* Variable: comma *) let comma = Sep.comma (* Group: Generic primitives *) (* Variable: eol *) let eol = Util.eol (* Variable: comment *) let comment = Util.comment (* Variable: empty *) let empty = Util.empty (* Variable: word *) let word = Rx.word (* Variable: optval *) let optval = /[A-Za-z0-9_.:-]+/ (* Variable: target *) let target = Rx.device_name (* Variable: fspath *) let fspath = Rx.fspath (************************************************************************ * Group: ENTRIES *************************************************************************) (************************************************************************ * View: comma_sep_list * A comma separated list of options (opt=value or opt) *************************************************************************) let comma_sep_list (l:string) = let value = [ label "value" . Util.del_str "=" . store optval ] in let lns = [ label l . store word . value? ] in Build.opt_list lns comma (************************************************************************ * View: record * A crypttab record *************************************************************************) let record = [ seq "entry" . [ label "target" . store target ] . sep_tab . [ label "device" . store fspath ] . (sep_tab . [ label "password" . store fspath ] . ( sep_tab . comma_sep_list "opt")? )? . eol ] (* * View: lns * The crypttab lens *) let lns = ( empty | comment | record ) * (* Variable: filter *) let filter = (incl "/etc/crypttab") let xfm = transform lns filter (* coding: utf-8 *) lenses/dist/ntpd.aug 0000644 00000011375 15231153062 0010450 0 ustar 00 (* Module: Ntpd Parses OpenNTPD's ntpd.conf Author: Jasper Lievisse Adriaanse <jasper@jasper.la> About: Reference This lens is used to parse OpenNTPD's configuration file, ntpd.conf. http://openntpd.org/ About: Usage Example To be documented About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Configuration files This lens applies to /etc/ntpd.conf. See <filter>. *) module Ntpd = autoload xfm (************************************************************************ * Group: Utility variables/functions ************************************************************************) (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* View: eol *) let eol = Util.eol (* View: space *) let space = Sep.space (* View: word *) let word = Rx.word (* View: device_re *) let device_re = Rx.device_name | /\*/ (* View: address_re *) let address_re = Rx.ip | /\*/ | Rx.hostname (* View: stratum_re value between 1 and 15 *) let stratum_re = /1[0-5]|[1-9]/ (* View: refid_re string with length < 5 *) let refid_re = /[A-Za-z0-9_.-]{1,5}/ (* View: weight_re value between 1 and 10 *) let weight_re = /10|[1-9]/ (* View: rtable_re 0 - RT_TABLE_MAX *) let rtable_re = Rx.byte (* View: correction_re should actually only match between -127000000 and 127000000 *) let correction_re = Rx.relinteger_noplus (************************************************************************ * View: key_opt_rtable_line * A subnode with a keyword, an optional routing table id and an end * of line. * * Parameters: * kw:regexp - the pattern to match as key * sto:lens - the storing lens ************************************************************************) let key_opt_rtable_line (kw:regexp) (sto:lens) = let rtable = [ Util.del_str "rtable" . space . label "rtable" . store rtable_re ] in [ key kw . space . sto . (space . rtable)? . eol ] (************************************************************************ * View: key_opt_weight_rtable_line * A subnode with a keyword, an optional routing table id, an optional * weight-value and an end of line. * of line. * * Parameters: * kw:regexp - the pattern to match as key * sto:lens - the storing lens ************************************************************************) let key_opt_weight_rtable_line (kw:regexp) (sto:lens) = let rtable = [ Util.del_str "rtable" . space . label "rtable" . store rtable_re ] in let weight = [ Util.del_str "weight" . space . label "weight" . store weight_re ] in [ key kw . space . sto . (space . weight)? . (space . rtable)? . eol ] (************************************************************************ * View: opt_value * A subnode for optional values. * * Parameters: * s:string - the option name and subtree label * r:regexp - the pattern to match as store ************************************************************************) let opt_value (s:string) (r:regexp) = Build.key_value s space (store r) (************************************************************************ * Group: Keywords ************************************************************************) (* View: listen listen on address [rtable table-id] *) let listen = let addr = [ label "address" . store address_re ] in key_opt_rtable_line "listen on" addr (* View: server server address [weight weight-value] [rtable table-id] *) let server = let addr = [ label "address" . store address_re ] in key_opt_weight_rtable_line "server" addr (* View: servers servers address [weight weight-value] [rtable table-id] *) let servers = let addr = [ label "address" . store address_re ] in key_opt_weight_rtable_line "servers" addr (* View: sensor sensor device [correction microseconds] [weight weight-value] [refid string] [stratum stratum-value] *) let sensor = let device = [ label "device" . store device_re ] in let correction = opt_value "correction" correction_re in let weight = opt_value "weight" weight_re in let refid = opt_value "refid" refid_re in let stratum = opt_value "stratum" stratum_re in [ key "sensor" . space . device . (space . correction)? . (space . weight)? . (space . refid)? . (space . stratum)? . eol ] (************************************************************************ * Group: Lens ************************************************************************) (* View: keyword *) let keyword = listen | server | servers | sensor (* View: lns *) let lns = ( empty | comment | keyword )* (* View: filter *) let filter = (incl "/etc/ntpd.conf") let xfm = transform lns filter lenses/dist/lvm.aug 0000644 00000004037 15231153062 0010276 0 ustar 00 (* Module: LVM Parses LVM metadata. Author: Gabriel de Perthuis <g2p.code+augeas@gmail.com> About: License This file is licensed under the LGPL v2+. About: Configuration files This lens applies to files in /etc/lvm/backup and /etc/lvm/archive. About: Examples The <Test_LVM> file contains various examples and tests. *) module LVM = autoload xfm (* See lvm2/libdm/libdm-config.c for tokenisation; * libdm uses a blacklist but I prefer the safer whitelist approach. *) (* View: identifier * The left hand side of a definition *) let identifier = /[a-zA-Z0-9_-]+/ (* strings can contain backslash-escaped dquotes, but I don't know * how to get the message across to augeas *) let str = [label "str". Quote.do_dquote (store /([^\"]|\\\\.)*/)] let int = [label "int". store Rx.relinteger] (* View: flat_literal * A literal without structure *) let flat_literal = int|str (* allow multiline and mixed int/str, used for raids and stripes *) (* View: list * A list containing flat literals *) let list = [ label "list" . counter "list" . del /\[[ \t\n]*/ "[" .([seq "list". flat_literal . del /,[ \t\n]*/ ", "]* . [seq "list". flat_literal . del /[ \t\n]*/ ""])? . Util.del_str "]"] (* View: val * Any value that appears on the right hand side of an assignment *) let val = flat_literal | list (* View: nondef * A line that doesn't contain a statement *) let nondef = Util.empty | Util.comment (* Build.block couldn't be reused, because of recursion and * a different philosophy of whitespace handling. *) (* View: def * An assignment, or a block containing definitions *) let rec def = [ Util.indent . key identifier . ( del /[ \t]*\{\n/ " {\n" .[label "dict".(nondef | def)*] . Util.indent . Util.del_str "}\n" |Sep.space_equal . val . Util.comment_or_eol)] (* View: lns * The main lens *) let lns = (nondef | def)* let filter = incl "/etc/lvm/archive/*.vg" . incl "/etc/lvm/backup/*" . incl "/etc/lvm/lvm.conf" . Util.stdexcl let xfm = transform lns filter lenses/dist/mailscanner.aug 0000644 00000003243 15231153062 0011772 0 ustar 00 (* Module: Mailscanner Parses MailScanner configuration files. Author: Andrew Colin Kissa <andrew@topdog.za.net> Baruwa Enterprise Edition http://www.baruwa.com About: License This file is licensed under the LGPL v2+. About: Configuration files This lens applies to /etc/MailScanner/MailScanner.conf and files in /etc/MailScanner/conf.d/. See <filter>. *) module Mailscanner = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) let comment = Util.comment let empty = Util.empty let space = Sep.space let eol = Util.eol let non_eq = /[^ =\t\r\n]+/ let non_space = /[^# \t\n]/ let any = /.*/ let word = /[A-Za-z%][ :<>%A-Za-z0-9_.-]+[A-Za-z%2]/ let include_kw = /include/ let keys = word - include_kw let eq = del /[ \t]*=/ " =" let indent = del /[ \t]*(\n[ \t]+)?/ " " let line_value = store (non_space . any . non_space | non_space) (************************************************************************ * Group: Entries *************************************************************************) let include_line = Build.key_value_line include_kw space (store non_eq) let normal_line = [ key keys . eq . (indent . line_value)? . eol ] (************************************************************************ * Group: Lns and Filter *************************************************************************) let lns = (empty|include_line|normal_line|comment) * let filter = (incl "/etc/MailScanner/MailScanner.conf") . (incl "/etc/MailScanner/conf.d/*.conf") let xfm = transform lns filter lenses/dist/ldif.aug 0000644 00000017231 15231153062 0010416 0 ustar 00 (* Module: Ldif Parses the LDAP Data Interchange Format (LDIF) Author: Dominic Cleal <dcleal@redhat.com> About: Reference This lens tries to keep as close as possible to RFC2849 <http://tools.ietf.org/html/rfc2849> and OpenLDAP's ldif(5) About: Licence This file is licensed under the LGPLv2+, like the rest of Augeas. *) module Ldif = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES ************************************************************************) (* View: comment *) let comment = Util.comment_generic /#[ \t]*/ "# " (* View: empty Map empty lines, including empty comments *) let empty = [ del /#?[ \t]*\n/ "\n" ] (* View: eol Only eol, don't include whitespace *) let eol = Util.del_str "\n" (* View: sep_colon The separator for attributes and values *) let sep_colon = del /:[ \t]*/ ": " (* View: sep_base64 The separator for attributes and base64 encoded values *) let sep_base64 = del /::[ \t]*/ ":: " (* View: sep_url The separator for attributes and URL-sourced values *) let sep_url = del /:<[ \t]*/ ":< " (* Variable: ldapoid_re Format of an LDAP OID from RFC 2251 *) let ldapoid_re = /[0-9][0-9\.]*/ (* View: sep_modspec Separator between modify operations *) let sep_modspec = Util.del_str "-" . eol (************************************************************************ * Group: BASIC ATTRIBUTES ************************************************************************) (* Different types of values, all permitting continuation where the next line begins with whitespace *) let attr_safe_string = let line = /[^ \t\n:<][^\n]*/ in let lines = line . (/\n[ \t]+[^ \t\n][^\n]*/)* in sep_colon . store lines let attr_base64_string = let line = /[a-zA-Z0-9=+]+/ in let lines = line . (/\n[ \t]+/ . line)* in sep_base64 . [ label "@base64" . store lines ] let attr_url_string = let line = /[^ \t\n][^\n]*/ in let lines = line . (/\n[ \t]+/ . line)* in sep_url . [ label "@url" . store lines ] let attr_intflag = sep_colon . store /0|1/ (* View: attr_version version-spec = "version:" FILL version-number *) let attr_version = Build.key_value_line "version" sep_colon (store /[0-9]+/) (* View: attr_dn dn-spec = "dn:" (FILL distinguishedName / ":" FILL base64-distinguishedName) *) let attr_dn = del /dn/i "dn" . ( attr_safe_string | attr_base64_string ) . eol (* View: attr_type AttributeType = ldap-oid / (ALPHA *(attr-type-chars)) *) let attr_type = ldapoid_re | /[a-zA-Z][a-zA-Z0-9-]*/ - /dn/i - /changeType/i - /include/i (* View: attr_option options = option / (option ";" options) *) let attr_option = Util.del_str ";" . [ label "@option" . store /[a-zA-Z0-9-]+/ ] (* View: attr_description Attribute name, possibly with options *) let attr_description = key attr_type . attr_option* (* View: attr_val_spec Generic attribute with a value *) let attr_val_spec = [ attr_description . ( attr_safe_string | attr_base64_string | attr_url_string ) . eol ] (* View: attr_changetype Parameters: t:regexp - value of changeType *) let attr_changetype (t:regexp) = key /changeType/i . sep_colon . store t . eol (* View: attr_modspec *) let attr_modspec = key /add|delete|replace/ . sep_colon . store attr_type . attr_option* . eol (* View: attr_dn_value Parses an attribute line with a DN on the RHS Parameters: k:regexp - match attribute name as key *) let attr_dn_value (k:regexp) = [ key k . ( attr_safe_string | attr_base64_string ) . eol ] (* View: sep_line *) let sep_line = empty | comment (* View: attr_include OpenLDAP extension, must be separated by blank lines *) let attr_include = eol . [ key "include" . sep_colon . store /[^ \t\n][^\n]*/ . eol . comment* . eol ] (* View: sep_record *) let sep_record = ( sep_line | attr_include )* (************************************************************************ * Group: LDIF CONTENT RECORDS ************************************************************************) (* View: ldif_attrval_record ldif-attrval-record = dn-spec SEP 1*attrval-spec *) let ldif_attrval_record = [ seq "record" . attr_dn . ( sep_line* . attr_val_spec )+ ] (* View: ldif_content ldif-content = version-spec 1*(1*SEP ldif-attrval-record) *) let ldif_content = [ label "@content" . ( sep_record . attr_version )? . ( sep_record . ldif_attrval_record )+ . sep_record ] (************************************************************************ * Group: LDIF CHANGE RECORDS ************************************************************************) (* View: change_add change-add = "add" SEP 1*attrval-spec *) let change_add = [ attr_changetype "add" ] . ( sep_line* . attr_val_spec )+ (* View: change_delete change-delete = "add" SEP 1*attrval-spec *) let change_delete = [ attr_changetype "delete" ] (* View: change_modspec change-modspec = add/delete/replace: AttributeDesc SEP *attrval-spec "-" *) let change_modspec = attr_modspec . ( sep_line* . attr_val_spec )* (* View: change_modify change-modify = "modify" SEP *mod-spec *) let change_modify = [ attr_changetype "modify" ] . ( sep_line* . [ change_modspec . sep_line* . sep_modspec ] )+ (* View: change_modrdn ("modrdn" / "moddn") SEP newrdn/newsuperior/deleteoldrdn *) let change_modrdn = let attr_deleteoldrdn = [ key "deleteoldrdn" . attr_intflag . eol ] in let attrs_modrdn = attr_dn_value "newrdn" | attr_dn_value "newsuperior" | attr_deleteoldrdn in [ attr_changetype /modr?dn/ ] . ( sep_line | attrs_modrdn )* . attrs_modrdn (* View: change_record changerecord = "changetype:" FILL (changeadd/delete/modify/moddn) *) let change_record = ( change_add | change_delete | change_modify | change_modrdn) (* View: change_control "control:" FILL ldap-oid 0*1(1*SPACE ("true" / "false")) 0*1(value-spec) *) let change_control = let attr_criticality = [ Util.del_ws_spc . label "criticality" . store /true|false/ ] in let attr_ctrlvalue = [ label "value" . (attr_safe_string | attr_base64_string | attr_url_string ) ] in [ key "control" . sep_colon . store ldapoid_re . attr_criticality? . attr_ctrlvalue? . eol ] (* View: ldif_change_record ldif-change-record = dn-spec SEP *control changerecord *) let ldif_change_record = [ seq "record" . attr_dn . ( ( sep_line | change_control )* . change_control )? . sep_line* . change_record ] (* View: ldif_changes ldif-changes = version-spec 1*(1*SEP ldif-change-record) *) let ldif_changes = [ label "@changes" . ( sep_record . attr_version )? . ( sep_record . ldif_change_record )+ . sep_record ] (************************************************************************ * Group: LENS ************************************************************************) (* View: lns *) let lns = sep_record | ldif_content | ldif_changes let filter = incl "/etc/openldap/schema/*.ldif" let xfm = transform lns filter lenses/dist/gshadow.aug 0000644 00000004300 15231153062 0011125 0 ustar 00 (* Module: Gshadow Parses /etc/gshadow Author: Lorenzo M. Catucci <catucci@ccd.uniroma2.it> Original Author: Free Ekanayaka <free@64studio.com> About: Reference - man 5 gshadow About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Each line in the gshadow files represents the additional shadow-defined attributes for the corresponding group, as defined in the group file. *) module Gshadow = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let comment = Util.comment let empty = Util.empty let colon = Sep.colon let comma = Sep.comma let sto_to_spc = store Rx.space_in let word = Rx.word let password = /[A-Za-z0-9_.!*-]*/ let integer = Rx.integer (************************************************************************ * Group: ENTRIES *************************************************************************) (* View: member *) let member = [ label "member" . store word ] (* View: member_list the member list is a comma separated list of users allowed to chgrp to the group without being prompted for the group's password *) let member_list = Build.opt_list member comma (* View: admin *) let admin = [ label "admin" . store word ] (* View: admin_list the admin_list is a comma separated list of users allowed to change the group's password and the member_list *) let admin_list = Build.opt_list admin comma (* View: params *) let params = [ label "password" . store password . colon ] . admin_list? . colon . member_list? let entry = Build.key_value_line word colon params (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = incl "/etc/gshadow" . Util.stdexcl let xfm = transform lns filter lenses/dist/securetty.aug 0000644 00000000702 15231153062 0011522 0 ustar 00 (* Parses entries in /etc/securetty Author: Simon Josi <josi@yokto.net> *) module Securetty = autoload xfm let word = /[^ \t\n#]+/ let eol = Util.eol let empty = Util.empty let comment = Util.comment let comment_or_eol = Util.comment_or_eol let record = [ seq "securetty" . store word . comment_or_eol ] let lns = ( empty | comment | record )* let filter = (incl "/etc/securetty") let xfm = transform lns filter lenses/dist/koji.aug 0000644 00000001602 15231153062 0010427 0 ustar 00 (* Module: Koji Parses koji config files Author: Pat Riehecky <riehecky@fnal.gov> About: Reference This lens tries to keep as close as possible to koji config syntax 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/koji.conf /etc/kojid/kojid.conf /etc/koji-hub/hub.conf /etc/kojira/kojira.conf /etc/kojiweb/web.conf /etc/koji-shadow/koji-shadow.conf See <filter>. *) module Koji = autoload xfm let lns = IniFile.lns_loose_multiline let filter = incl "/etc/koji.conf" . incl "/etc/kojid/kojid.conf" . incl "/etc/koji-hub/hub.conf" . incl "/etc/kojira/kojira.conf" . incl "/etc/kojiweb/web.conf" . incl "/etc/koji-shadow/koji-shadow.conf" let xfm = transform lns filter lenses/dist/xinetd.aug 0000644 00000010030 15231153062 0010761 0 ustar 00 (* * Module: Xinetd * Parses xinetd configuration files * * The structure of the lens and allowed attributes are ripped directly * from xinetd's parser in xinetd/parse.c in xinetd's source checkout * The downside of being so precise here is that if attributes are added * they need to be added here, too. Writing a catchall entry, and getting * to typecheck correctly would be a huge pain. * * A really enterprising soul could tighten this down even further by * restricting the acceptable values for each attribute. * * Author: David Lutterkort *) module Xinetd = autoload xfm let opt_spc = Util.del_opt_ws " " let spc_equal = opt_spc . Sep.equal let op = ([ label "add" . opt_spc . Util.del_str "+=" ] |[ label "del" . opt_spc . Util.del_str "-=" ] | spc_equal) let value = store Rx.no_spaces let indent = del Rx.opt_space "\t" let attr_one (n:regexp) = Build.key_value n Sep.space_equal value let attr_lst (n:regexp) (op_eq: lens) = let value_entry = [ label "value" . value ] in Build.key_value n op_eq (opt_spc . Build.opt_list value_entry Sep.space)? let attr_lst_eq (n:regexp) = attr_lst n spc_equal let attr_lst_op (n:regexp) = attr_lst n op (* Variable: service_attr * Note: * It is much faster to combine, for example, all the attr_one * attributes into one regexp and pass that to a lens instead of * using lens union (attr_one "a" | attr_one "b"|..) because the latter * causes the type checker to work _very_ hard. *) let service_attr = attr_one (/socket_type|protocol|wait|user|group|server|instances/i |/rpc_version|rpc_number|id|port|nice|banner|bind|interface/i |/per_source|groups|banner_success|banner_fail|disable|max_load/i |/rlimit_as|rlimit_cpu|rlimit_data|rlimit_rss|rlimit_stack|v6only/i |/deny_time|umask|mdns|libwrap/i) (* redirect and cps aren't really lists, they take exactly two values *) |attr_lst_eq (/server_args|log_type|access_times|type|flags|redirect|cps/i) |attr_lst_op (/log_on_success|log_on_failure|only_from|no_access|env|passenv/i) let default_attr = attr_one (/instances|banner|bind|interface|per_source|groups/i |/banner_success|banner_fail|max_load|v6only|umask|mdns/i) |attr_lst_eq /cps/i (* really only two values, not a whole list *) |attr_lst_op (/log_type|log_on_success|log_on_failure|disabled/i |/no_access|only_from|passenv|enabled/i) (* View: body * Note: * We would really like to say "the body can contain any of a list * of a list of attributes, each of them at most once"; but that * would require that we build a lens that matches the permutation * of all attributes; with around 40 individual attributes, that's * not computationally feasible, even if we didn't have to worry * about how to write that down. The resulting regular expressions * would simply be prohibitively large. *) let body (attr:lens) = Build.block_newlines_spc (indent . attr . Util.eol) Util.comment (* View: includes * Note: * It would be nice if we could use the directories given in include and * includedir directives to parse additional files instead of hardcoding * all the places where xinetd config files can be found; but that is * currently not possible, and implementing that has a good amount of * hairy corner cases to consider. *) let includes = Build.key_value_line /include(dir)?/ Sep.space (store Rx.no_spaces) let service = let sto_re = /[^# \t\n\/]+/ in Build.key_value_line "service" Sep.space (store sto_re . body service_attr) let defaults = [ key "defaults" . body default_attr . Util.eol ] let lns = ( Util.empty | Util.comment | includes | defaults | service )* let filter = incl "/etc/xinetd.d/*" . incl "/etc/xinetd.conf" . Util.stdexcl let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/squid.aug 0000644 00000037712 15231153062 0010633 0 ustar 00 (* Squid module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: the self-documented default squid.conf file *) module Squid = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let spc = Util.del_ws_spc let indent = Util.indent let word = /[A-Za-z0-9!_.-]+(\[[0-9]+\])?/ let sto_to_spc = store /[^# \t\n]+/ let sto_to_eol = store /([^# \t\n][^#\n]*[^# \t\n])|[^# \t\n]/ let comment = Util.comment let empty = Util.empty let comment_or_eol = Util.comment_or_eol let value (kw:string) = [ spc . label kw . sto_to_spc ] let value_space_in (kw:string) = [ spc . label kw . sto_to_eol ] let parameters = [ label "parameters" . counter "parameters" . [ spc . seq "parameters" . sto_to_spc ]+ ] (************************************************************************ * SPACEVARS SETTINGS *************************************************************************) let entry_re = "accept_filter" | "access_log" | "acl_uses_indirect_client" | "adaptation_access" | "adaptation_service_set" | "allow_underscore" | "always_direct" | "announce_file" | "announce_host" | "announce_period" | "announce_port" | "append_domain" | "as_whois_server" | "authenticate_cache_garbage_interval" | "authenticate_ip_shortcircuit_access" | "authenticate_ip_shortcircuit_ttl" | "authenticate_ip_ttl" | "authenticate_ttl" | "background_ping_rate" | "balance_on_multiple_ip" | "broken_posts" | "buffered_logs" | "cache" | "cache_dir" | "cache_dns_program" | "cache_effective_group" | "cache_effective_user" | "cache_log" | "cache_mem" | "cache_mgr" | "cachemgr_passwd" | "cache_peer" | "cache_peer_access" | "cache_peer_domain" | "cache_replacement_policy" | "cache_store_log" | "cache_swap_high" | "cache_swap_low" | "cache_swap_state" | "cache_vary" | "check_hostnames" | "chroot" | "client_db" | "client_lifetime" | "client_netmask" | "client_persistent_connections" | "clientside_tos" | "collapsed_forwarding" | "connect_timeout" | "coredump_dir" | "dead_peer_timeout" | "debug_options" | "delay_access" | "delay_class" | "delay_initial_bucket_level" | "delay_parameters" | "delay_pools" | "delay_pool_uses_indirect_client" | "deny_info" | "detect_broken_pconn" | "digest_bits_per_entry" | "digest_generation" | "digest_rebuild_chunk_percentage" | "digest_rebuild_period" | "digest_rewrite_period" | "digest_swapout_chunk_size" | "diskd_program" | "dns_children" | "dns_defnames" | "dns_nameservers" | "dns_retransmit_interval" | "dns_testnames" | "dns_timeout" | "dns_v4_fallback" | "ecap_enable" | "ecap_service" | "email_err_data" | "emulate_httpd_log" | "err_html_text" | "error_default_language" | "error_directory" | "error_log_languages" | "error_map" | "err_page_stylesheet" | "esi_parser" | "external_acl_type" | "external_refresh_check" | "follow_x_forwarded_for" | "forwarded_for" | "forward_log" | "forward_timeout" | "fqdncache_size" | "ftp_epsv_all" | "ftp_list_width" | "ftp_passive" | "ftp_sanitycheck" | "ftp_telnet_protocol" | "ftp_user" | "global_internal_static" | "half_closed_clients" | "header_access" | "header_replace" | "hierarchy_stoplist" | "high_memory_warning" | "high_page_fault_warning" | "high_response_time_warning" | "hostname_aliases" | "hosts_file" | "htcp_access" | "htcp_clr_access" | "htcp_port" | "http_accel_surrogate_remote" | "http_access2" | "httpd_accel_no_pmtu_disc" | "httpd_accel_surrogate_id" | "httpd_suppress_version_string" | "http_port" | "http_reply_access" | "https_port" | "icap_access" | "icap_class" | "icap_client_username_encode" | "icap_client_username_header" | "icap_connect_timeout" | "icap_default_options_ttl" | "icap_enable" | "icap_io_timeout" | "icap_persistent_connections" | "icap_preview_enable" | "icap_preview_size" | "icap_send_client_ip" | "icap_send_client_username" | "icap_service" | "icap_service_failure_limit" | "icap_service_revival_delay" | "icon_directory" | "icp_access" | "icp_hit_stale" | "icp_port" | "icp_query_timeout" | "ident_lookup_access" | "ident_timeout" | "ie_refresh" | "ignore_expect_100" | "ignore_ims_on_miss" | "ignore_unknown_nameservers" | "incoming_dns_average" | "incoming_http_average" | "incoming_icp_average" | "incoming_rate" | "ipcache_high" | "ipcache_low" | "ipcache_size" | "loadable_modules" | "location_rewrite_access" | "location_rewrite_children" | "location_rewrite_concurrency" | "location_rewrite_program" | "log_access" | "logfile_daemon" | "logfile_rotate" | "logformat" | "log_fqdn" | "log_icp_queries" | "log_ip_on_direct" | "log_mime_hdrs" | "log_uses_indirect_client" | "mail_from" | "mail_program" | "max_filedescriptors" | "maximum_icp_query_timeout" | "maximum_object_size" | "maximum_object_size_in_memory" | "maximum_single_addr_tries" | "max_open_disk_fds" | "max_stale" | "mcast_groups" | "mcast_icp_query_timeout" | "mcast_miss_addr" | "mcast_miss_encode_key" | "mcast_miss_port" | "mcast_miss_ttl" | "memory_pools" | "memory_pools_limit" | "memory_replacement_policy" | "mime_table" | "min_dns_poll_cnt" | "min_http_poll_cnt" | "min_icp_poll_cnt" | "minimum_direct_hops" | "minimum_direct_rtt" | "minimum_expiry_time" | "minimum_icp_query_timeout" | "minimum_object_size" | "miss_access" | "negative_dns_ttl" | "negative_ttl" | "neighbor_type_domain" | "netdb_filename" | "netdb_high" | "netdb_low" | "netdb_ping_period" | "never_direct" | "no_cache" | "nonhierarchical_direct" | "offline_mode" | "pconn_timeout" | "peer_connect_timeout" | "persistent_connection_after_error" | "persistent_request_timeout" | "pid_filename" | "pinger_enable" | "pinger_program" | "pipeline_prefetch" | "positive_dns_ttl" | "prefer_direct" | "qos_flows" | "query_icmp" | "quick_abort_max" | "quick_abort_min" | "quick_abort_pct" | "range_offset_limit" | "read_ahead_gap" | "read_timeout" | "redirector_bypass" | "referer_log" | "refresh_all_ims" | "refresh_stale_hit" | "relaxed_header_parser" | "reload_into_ims" | "reply_body_max_size" | "reply_header_access" | "reply_header_max_size" | "request_body_max_size" | "request_entities" | "request_header_access" | "request_header_max_size" | "request_timeout" | "retry_on_error" | "server_http11" | "server_persistent_connections" | "short_icon_urls" | "shutdown_lifetime" | "sleep_after_fork" | "snmp_access" | "snmp_incoming_address" | "snmp_outgoing_address" | "snmp_port" | "ssl_bump" | "ssl_engine" | "sslpassword_program" | "sslproxy_cafile" | "sslproxy_capath" | "sslproxy_cert_error" | "sslproxy_cipher" | "sslproxy_client_certificate" | "sslproxy_client_key" | "sslproxy_flags" | "sslproxy_options" | "sslproxy_version" | "ssl_unclean_shutdown" | "store_avg_object_size" | "store_dir_select_algorithm" | "store_objects_per_bucket" | "storeurl_access" | "storeurl_rewrite_children" | "storeurl_rewrite_concurrency" | "storeurl_rewrite_program" | "strip_query_terms" | "tcp_outgoing_address" | "tcp_outgoing_tos" | "tcp_recv_bufsize" | "test_reachability" | "udp_incoming_address" | "udp_outgoing_address" | "umask" | "unique_hostname" | "unlinkd_program" | "update_headers" | "uri_whitespace" | "url_rewrite_access" | "url_rewrite_bypass" | "url_rewrite_children" | "url_rewrite_concurrency" | "url_rewrite_host_header" | "url_rewrite_program" | "useragent_log" | "vary_ignore_expire" | "via" | "visible_hostname" | "wccp2_address" | "wccp2_assignment_method" | "wccp2_forwarding_method" | "wccp2_rebuild_wait" | "wccp2_return_method" | "wccp2_router" | "wccp2_service" | "wccp2_service_info" | "wccp2_weight" | "wccp_address" | "wccp_router" | "wccp_version" | "windows_ipaddrchangemonitor" | "zero_buffers" | "zph_local" | "zph_mode" | "zph_option" | "zph_parent" | "zph_sibling" let entry = indent . (Build.key_ws_value entry_re) (************************************************************************ * AUTH *************************************************************************) let auth_re = "auth_param" let auth = indent . [ key "auth_param" . value "scheme" . value "parameter" . (value_space_in "setting") ? . comment_or_eol ] (************************************************************************ * ACL *************************************************************************) let acl_re = "acl" let acl = indent . [ key acl_re . spc . [ key word . value "type" . value "setting" . parameters? . comment_or_eol ] ] (************************************************************************ * HTTP ACCESS *************************************************************************) let http_access_re = "http_access" | "upgrade_http0.9" | "broken_vary_encoding" let http_access = indent . [ key http_access_re . spc . [ key /allow|deny/ . spc . sto_to_spc . parameters? ] . comment_or_eol ] (************************************************************************ * REFRESH PATTERN *************************************************************************) let refresh_pattern_option_re = "override-expire" | "override-lastmod" | "reload-into-ims" | "ignore-reload" | "ignore-no-cache" | "ignore-no-store" | "ignore-must-revalidate" | "ignore-private" | "ignore-auth" | "refresh-ims" | "store-stale" let refresh_pattern = indent . [ key "refresh_pattern" . spc . [ label "case_insensitive" . Util.del_str "-i" . spc ]? . store /[^ \t\n]+/ . spc . [ label "min" . store Rx.integer ] . spc . [ label "percent" . store Rx.integer . Util.del_str "%" ] . spc . [ label "max" . store Rx.integer ] . (spc . Build.opt_list [ label "option" . store refresh_pattern_option_re ] spc)? . comment_or_eol ] (************************************************************************ * EXTENSION METHODS *************************************************************************) let extension_methods = indent . [ key "extension_methods" . spc . Build.opt_list [ seq "extension_method" . store Rx.word ] spc . comment_or_eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry|auth|acl|http_access|refresh_pattern|extension_methods)* let filter = incl "/etc/squid/squid.conf" . incl "/etc/squid3/squid.conf" let xfm = transform lns filter lenses/dist/anacron.aug 0000644 00000004761 15231153062 0011125 0 ustar 00 (* Module: Anacron Parses /etc/anacrontab Author: Raphael Pinson <raphink@gmail.com> 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 <filter>. About: Examples The <Test_Anacron> 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 <period_name>. 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 <entry> *************************************************************************) let delay = [ label "delay" . store Rx.integer ] (************************************************************************ * View: job_identifier * The job_identifier for an <entry> *************************************************************************) 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 lenses/dist/pgbouncer.aug 0000644 00000002666 15231153062 0011472 0 ustar 00 (* Module: Pgbouncer Parses Pgbouncer ini configuration files. Author: Andrew Colin Kissa <andrew@topdog.za.net> Baruwa Enterprise Edition http://www.baruwa.com About: License This file is licensed under the LGPL v2+. About: Configuration files This lens applies to /etc/pgbouncer.ini See <filter>. About: TODO Create a tree for the database options *) module Pgbouncer = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES ************************************************************************) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = IniFile.sep "=" "=" let eol = Util.eol let entry_re = ( /[A-Za-z][:#A-Za-z0-9._-]+|\*/) (************************************************************************ * Group: ENTRY *************************************************************************) let non_db_line = [ key entry_re . sep . IniFile.sto_to_eol? . eol ] let entry = non_db_line|comment let title = IniFile.title IniFile.record_re let record = IniFile.record title entry (****************************************************************** * Group: LENS AND FILTER ******************************************************************) let lns = IniFile.lns record comment (* Variable: filter *) let filter = incl "/etc/pgbouncer.ini" let xfm = transform lns filter lenses/dist/sip_conf.aug 0000644 00000003163 15231153062 0011277 0 ustar 00 (* Module: Sip_Conf Parses /etc/asterisk/sip.conf Author: Rob Tucker <rtucker@mozilla.com> About: Reference Lens parses the sip.conf with support for template structure 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/asterisk/sip.conf. See <filter>. *) module Sip_Conf = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = IniFile.sep IniFile.sep_re IniFile.sep_default let empty = IniFile.empty let eol = IniFile.eol let comment_or_eol = comment | eol let entry = IniFile.indented_entry IniFile.entry_re sep comment let text_re = Rx.word let tmpl = let is_tmpl = [ label "@is_template" . Util.del_str "!" ] in let use_tmpl = [ label "@use_template" . store Rx.word ] in let comma = Util.delim "," in Util.del_str "(" . Sep.opt_space . Build.opt_list (is_tmpl|use_tmpl) comma . Sep.opt_space . Util.del_str ")" let title_comment_re = /[ \t]*[#;].*$/ let title_comment = [ label "#title_comment" . store title_comment_re ] let title = label "title" . Util.del_str "[" . store text_re . Util.del_str "]" . tmpl? . title_comment? . eol let record = IniFile.record title entry let lns = IniFile.lns record comment let filter = incl "/etc/asterisk/sip.conf" let xfm = transform lns filter lenses/dist/openshift_http.aug 0000644 00000002034 15231153062 0012531 0 ustar 00 (* Module: OpenShift_Http Parses HTTPD related files specific to openshift Author: Brian Redbeard <redbeard@dead-city.org> 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/var/www/openshift About: Examples The <Test_OpenShift_Http> file contains various examples and tests. *) module OpenShift_Http = autoload xfm (* Variable: filter *) let filter = incl "/var/www/openshift/console/httpd/httpd.conf" . incl "/var/www/openshift/console/httpd/conf.d/*.conf" . incl "/var/www/openshift/broker/httpd/conf.d/*.conf" . incl "/var/www/openshift/broker/httpd/httpd.conf" . incl "/var/www/openshift/console/httpd/console.conf" . incl "/var/www/openshift/broker/httpd/broker.conf" . Util.stdexcl (* View: lns *) let lns = Httpd.lns let xfm = transform lns filter (* vim: set ts=4 expandtab sw=4: *) lenses/dist/up2date.aug 0000644 00000004330 15231153062 0011040 0 ustar 00 (* Module: Up2date Parses /etc/sysconfig/rhn/up2date Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 up2date` where possible. About: License This file is licenced under the LGPLv2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files This lens applies to /etc/sysconfig/rhn/up2date. See <filter>. About: Examples The <Test_Up2date> file contains various examples and tests. *) module Up2date = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Variable: key_re *) let key_re = /[^=# \t\n]+/ (* Variable: value_re *) let value_re = /[^ \t\n;][^\n;]*[^ \t\n;]|[^ \t\n;]/ (* View: sep_semi *) let sep_semi = Sep.semicolon (************************************************************************ * Group: ENTRIES *************************************************************************) (* View: single_entry key=foo *) let single_entry = [ label "value" . store value_re ] (* View: multi_empty key=; *) let multi_empty = sep_semi (* View: multi_value One value in a list setting *) let multi_value = [ seq "multi" . store value_re ] (* View: multi_single key=foo; (parsed as a list) *) let multi_single = multi_value . sep_semi (* View: multi_values key=foo;bar key=foo;bar; *) let multi_values = multi_value . ( sep_semi . multi_value )+ . del /;?/ ";" (* View: multi_entry List settings go under a 'values' node *) let multi_entry = [ label "values" . counter "multi" . ( multi_single | multi_values | multi_empty ) ] (* View: entry *) let entry = [ seq "entry" . store key_re . Sep.equal . ( multi_entry | single_entry )? . Util.eol ] (************************************************************************ * Group: LENS *************************************************************************) (* View: lns *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = incl "/etc/sysconfig/rhn/up2date" let xfm = transform lns filter lenses/dist/mdadm_conf.aug 0000644 00000024057 15231153062 0011573 0 ustar 00 (****************************************************************************** Mdadm_conf module for Augeas Author: Matthew Booth <mbooth@redhat.com> Copyright (C): 2011 Red Hat Inc. Reference: mdadm(5) config.c and policy.c from mdadm-3.2.2 License: This file is licensed under the LGPL v2+. This is a lens for /etc/mdadm.conf. It aims to parse every valid configuration file as of version 3.2.2, and many invalid ones too. This last point is a feature, not a bug! madm will generate warnings for invalid configuration which do not prevent correct operation of the tool. Wherever possible, we try to allow for this behaviour. Keywords in mdadm.conf are matched with a case-insensitive prefix match of at least 3 characters. Keys in key/value pairs are also matched case-insensitively, but require a full match. The exception is POLICY and PART-POLICY, where keys are matched case-sensitively. N.B. We can't use case-insensitive regular expressions in most places due to bug #147. *******************************************************************************) module Mdadm_conf = autoload xfm (****************************************************************************** * PRIMITIVES ******************************************************************************) let eol = Util.comment_or_eol let comment = Util.comment let empty = Util.empty let value = /[^ \t\n#]+/ let value_no_eq = /[^ \t\n#=]+/ let value_no_eq_sl = /[^ \t\n#=\/]+/ let continuation = /\n[ \t]+/ let space = /[ \t]+/ let value_sep = ( del ( continuation | space . continuation? ) " " | comment . del space " " ) (* We parse specific keys rather than having a catch-all owing to the varying case of the syntax. This means the user can rely on 'array/uuid' rather than additionally testing for 'array/UUID'. It would be good to have an additional catchall, but I haven't been able to make that work. *) let keyvalue (r:regexp) (lc:string) (uc:string) = [ del ( r . /=/ ) ( uc . "=" ) . label lc . store value ] let simplevalue (r:regexp) (lc:string) (uc:string) = [ del r uc . label lc . ( value_sep . [ label "value" . store value ] )* . eol ] (****************************************************************************** * DEVICES ******************************************************************************) let dev_re = /dev(i(ce?)?)?/i let dev_containers_re = /containers/i let dev_partitions_re = /partitions/i let dev_containers = [ del dev_containers_re "containers" . label "containers" ] let dev_partitions = [ del dev_partitions_re "partitions" . label "partitions" ] let dev_device = [ label "name". store ( value - (dev_containers_re | dev_partitions_re)) ] (* Strictly there must be at least 1 device, but we err on the side of parsing *) let dev_devices = ( value_sep . ( dev_containers | dev_partitions | dev_device ) )* let device = [ del dev_re "DEVICE" . label "device" . dev_devices . eol ] (****************************************************************************** * ARRAY ******************************************************************************) let array_re = /arr(ay?)?/i let arr_auto_re = /auto/i let arr_bitmap_re = /bitmap/i let arr_container_re = /container/i let arr_devices_re = /devices/i let arr_disks_re = /disks/i (* Undocumented *) let arr_level_re = /level/i let arr_member_re = /member/i let arr_metadata_re = /metadata/i let arr_name_re = /name/i let arr_num_devices_re = /num-devices/i let arr_spare_group_re = /spare-group/i let arr_spares_re = /spares/i let arr_super_minor_re = /super-minor/i let arr_uuid_re = /uuid/i let arr_devicename = [ store value_no_eq . label "devicename" ] let arr_auto = keyvalue arr_auto_re "auto" "AUTO" let arr_bitmap = keyvalue arr_bitmap_re "bitmap" "BITMAP" let arr_container = keyvalue arr_container_re "container" "CONTAINER" let arr_devices = keyvalue arr_devices_re "devices" "DEVICES" let arr_disks = keyvalue arr_disks_re "disks" "DISKS" let arr_level = keyvalue arr_level_re "level" "LEVEL" let arr_member = keyvalue arr_member_re "member" "MEMBER" let arr_metadata = keyvalue arr_metadata_re "metadata" "METADATA" let arr_name = keyvalue arr_name_re "name" "NAME" let arr_num_devices = keyvalue arr_num_devices_re "num-devices" "NUM-DEVICES" let arr_spare_group = keyvalue arr_spare_group_re "spare-group" "SPARE-GROUP" let arr_spares = keyvalue arr_spares_re "spares" "SPARES" let arr_super_minor = keyvalue arr_super_minor_re "super-minor" "SUPER-MINOR" let arr_uuid = keyvalue arr_uuid_re "uuid" "UUID" let arr_options = ( value_sep . ( arr_devicename | arr_auto | arr_bitmap | arr_container | arr_devices | arr_disks | arr_level | arr_member | arr_metadata | arr_name | arr_num_devices | arr_spare_group | arr_spares | arr_super_minor | arr_uuid ) )* let array = [ del array_re "ARRAY" . label "array" . arr_options . eol ] (****************************************************************************** * MAILADDR ******************************************************************************) let mailaddr_re = /mai(l(a(d(dr?)?)?)?)?/i (* We intentially allow multiple mailaddr values here, even though this is invalid and would produce a warning. This is better than not parsing the file. *) let mailaddr = simplevalue mailaddr_re "mailaddr" "MAILADDR" (****************************************************************************** * MAILFROM ******************************************************************************) (* N.B. MAILFROM can only be abbreviated to 5 characters *) let mailfrom_re = /mailf(r(om?)?)?/i let mailfrom = [ del mailfrom_re "MAILFROM" . label "mailfrom" . ( value_sep . [ label "value" . store value ] )* . eol ] (****************************************************************************** * PROGRAM ******************************************************************************) let program_re = /pro(g(r(am?)?)?)?/i let program = simplevalue program_re "program" "PROGRAM" (****************************************************************************** * CREATE ******************************************************************************) let create_re = /cre(a(te?)?)?/i let cre_auto_re = /auto/i let cre_owner_re = /owner/i let cre_group_re = /group/i let cre_mode_re = /mode/i let cre_metadata_re = /metadata/i let cre_symlinks_re = /symlinks/i let cre_auto = keyvalue cre_auto_re "auto" "AUTO" let cre_group = keyvalue cre_group_re "group" "GROUP" let cre_metadata = keyvalue cre_metadata_re "metadata" "METADATA" let cre_mode = keyvalue cre_mode_re "mode" "MODE" let cre_owner = keyvalue cre_owner_re "owner" "OWNER" let cre_symlinks = keyvalue cre_symlinks_re "symlinks" "SYMLINKS" let cre_options = ( value_sep . ( arr_auto | cre_owner | cre_group | cre_mode | cre_metadata | cre_symlinks) )* let create = [ del create_re "CREATE" . label "create" . cre_options . eol ] (****************************************************************************** * HOMEHOST ******************************************************************************) let homehost_re = /hom(e(h(o(st?)?)?)?)?/i let homehost = simplevalue homehost_re "homehost" "HOMEHOST" (****************************************************************************** * AUTO ******************************************************************************) let auto_re = /auto?/i let aut_plus = [ key "+" . store value ] let aut_minus = [ key "-" . store value ] let aut_homehost = [ del /homehost/i "homehost" . label "homehost" ] let aut_list = ( value_sep . ( aut_plus | aut_minus | aut_homehost ) )* let auto = [ del auto_re "AUTO" . label "auto" . aut_list . eol ] (****************************************************************************** * POLICY and PART-POLICY ******************************************************************************) (* PART-POLICY is undocumented. A cursory inspection of the parsing code suggests it's parsed the same way as POLICY, but treated slightly differently thereafter. *) let policy_re = /pol(i(cy?)?)?/i let part_policy_re = /par(t(-(p(o(l(i(cy?)?)?)?)?)?)?)?/i (* Unlike everything else, policy keys are matched case sensitive. This means we don't have to mess around with explicit option matching, as the match string is fixed for a working configuration. *) let pol_option (act:string) = [ del ( act . "=" ) ( act . "=" ) . label act . store value ] let pol_options = ( value_sep . [ key value_no_eq_sl . del "=" "=" . store value ] )* let policy = [ del policy_re "POLICY" . label "policy" . pol_options . eol ] let part_policy = [ del part_policy_re "PART-POLICY" . label "part-policy" . pol_options . eol ] (****************************************************************************** * LENS ******************************************************************************) let lns = (comment | empty | device | array | mailaddr | mailfrom | program | create | homehost | auto | policy | part_policy )* let filter = incl "/etc/mdadm.conf" . incl "/etc/mdadm/mdadm.conf" let xfm = transform lns filter lenses/dist/postfix_main.aug 0000644 00000002734 15231153062 0012202 0 ustar 00 (* Postfix_Main module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: *) module Postfix_Main = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let indent = del /[ \t]*(\n[ \t]+)?/ " " let comment = Util.comment let empty = Util.empty let eq = del /[ \t]*=/ " =" let word = /[A-Za-z0-9_.-]+/ (* The value of a parameter, after the '=' sign. Postfix allows that * lines are continued by starting continuation lines with spaces. * The definition needs to make sure we don't add indented comment lines * into values *) let value = let chr = /[^# \t\n]/ in let any = /.*/ in let line = (chr . any* . chr | chr) in let lines = line . (/[ \t]*\n[ \t]+/ . line)* in store lines (************************************************************************ * ENTRIES *************************************************************************) let entry = [ key word . eq . (indent . value)? . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = incl "/etc/postfix/main.cf" let xfm = transform lns filter lenses/dist/properties.aug 0000644 00000004401 15231153062 0011667 0 ustar 00 (* Augeas module for editing Java properties files Author: Craig Dunn <craig@craigdunn.org> Limitations: - doesn't support \ alone on a line - values are not unescaped - multi-line properties are broken down by line, and can't be replaced with a single line See format info: http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html#load(java.io.Reader) *) module Properties = (* Define some basic primitives *) let empty = Util.empty let eol = Util.eol let hard_eol = del "\n" "\n" let sepch = del /([ \t]*(=|:)|[ \t])/ "=" let sepspc = del /[ \t]/ " " let sepch_ns = del /[ \t]*(=|:)/ "=" let sepch_opt = del /[ \t]*(=|:)?[ \t]*/ "=" let value_to_eol_ws = store /(:|=)[^\n]*[^ \t\n\\]/ let value_to_bs_ws = store /(:|=)[^\n]*[^\\\n]/ let value_to_eol = store /([^ \t\n:=][^\n]*[^ \t\n\\]|[^ \t\n\\:=])/ let value_to_bs = store /([^ \t\n:=][^\n]*[^\\\n]|[^ \t\n\\:=])/ let indent = Util.indent let backslash = del /[\\][ \t]*\n/ "\\\n" let opt_backslash = del /([\\][ \t]*\n)?/ "" let entry = /([^ \t\n:=\/!#\\]|[\\]:|[\\]=|[\\][\t ]|[\\][^\/\n])+/ let multi_line_entry = [ indent . value_to_bs? . backslash ] . [ indent . value_to_bs . backslash ] * . [ indent . value_to_eol . eol ] . value " < multi > " let multi_line_entry_ws = opt_backslash . [ indent . value_to_bs_ws . backslash ] + . [ indent . value_to_eol . eol ] . value " < multi_ws > " (* define comments and properties*) let bang_comment = [ label "!comment" . del /[ \t]*![ \t]*/ "! " . store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ . eol ] let comment = ( Util.comment | bang_comment ) let property = [ indent . key entry . sepch . ( multi_line_entry | indent . value_to_eol . eol ) ] let property_ws = [ indent . key entry . sepch_ns . ( multi_line_entry_ws | indent . value_to_eol_ws . eol ) ] let empty_property = [ indent . key entry . sepch_opt . hard_eol ] let empty_key = [ sepch_ns . ( multi_line_entry | indent . value_to_eol . eol ) ] (* setup our lens and filter*) let lns = ( empty | comment | property_ws | property | empty_property | empty_key ) * lenses/dist/multipath.aug 0000644 00000006432 15231153062 0011510 0 ustar 00 (* Process /etc/multipath.conf *) (* The lens is based on the multipath.conf(5) man page *) module Multipath = autoload xfm let comment = Util.comment let empty = Util.empty let dels = Util.del_str let eol = Util.eol let ws = del /[ \t]+/ " " let indent = del /[ \t]*/ "" (* We require that braces are always followed by a newline *) let obr = del /\{([ \t]*)\n/ "{\n" let cbr = del /[ \t]*}[ \t]*\n/ "}\n" let ikey (k:regexp) = indent . key k let section (n:regexp) (b:lens) = [ ikey n . ws . obr . (b|empty|comment)* . cbr ] let kv (k:regexp) (v:regexp) = [ ikey k . ws . store v . eol ] (* FIXME: it would be much more concise to write *) (* [ key k . ws . (bare | quoted) ] *) (* but the typechecker trips over that *) let qstr (k:regexp) = let delq = del /['"]/ "\"" in let bare = del /["']?/ "" . store /[^"' \t\n]+/ . del /["']?/ "" in let quoted = delq . store /.*[ \t].*/ . delq in [ ikey k . ws . bare . eol ] |[ ikey k . ws . quoted . eol ] let wwid = kv "wwid" (Rx.word|"*") (* Settings that can be changed in various places *) let common_setting = kv "path_grouping_policy" /failover|multibus|group_by_(serial|prio|node_name)/ |qstr /(getuid|prio)_callout/ |qstr /path_(selector|checker)|features/ |kv "failback" (Rx.integer | /immediate|manual/) |kv "rr_weight" /priorities|uniform/ |kv "no_path_retry" (Rx.integer | /fail|queue/) |kv /rr_min_io(_rq)?/ Rx.integer let default_setting = kv "polling_interval" Rx.integer |kv "udev_dir" Rx.fspath |qstr "selector" |kv "user_friendly_names" /yes|no/ |kv "dev_loss_tmo" Rx.integer |kv "fast_io_fail_tmo" Rx.integer |kv "verbosity" /[0-6]/ |kv "reassign_maps" /yes|no/ (* These are not in the manpage but in the example multipath.conf *) |kv "prio" Rx.word |kv "max_fds" Rx.integer (* SUSE extensions *) |kv "async_timeout" Rx.integer |kv "max_polling_interval" Rx.integer |kv "pg_timeout" Rx.word |kv "bindings_file" Rx.fspath |kv "multipath_dir" Rx.fspath |kv "alias_prefix" Rx.word |kv "queue_without_daemon" /yes|no/ |kv "h_on_last_deleassign_maps" /yes|no/ |qstr "prio_args" (* SUSE extensions SP3 *) |qstr "uid_attribute" |kv "wwids_file" Rx.fspath |kv "log_checker_err" Rx.word |kv "retain_attached_hw_handler" /yes|no/ |kv "detect_prio" /yes|no/ |kv "flush_on_last_del" /yes|no/ (* A device subsection *) let device = let setting = qstr /vendor|product|product_blacklist|hardware_handler/ |common_setting |default_setting in section "device" setting (* The defaults section *) let defaults = let setting = common_setting |default_setting in section "defaults" setting (* The blacklist and blacklist_exceptions sections *) let blacklist = let setting = wwid |qstr "devnode" |device in section /blacklist(_exceptions)?/ setting (* A multipath subsection *) let multipath = let setting = wwid |qstr "alias" |common_setting in section "multipath" setting (* The multipaths section *) let multipaths = section "multipaths" multipath (* The devices section *) let devices = section "devices" device let lns = (comment|empty|defaults|blacklist|devices|multipaths)* let xfm = transform lns (incl "/etc/multipath.conf") lenses/dist/postfix_transport.aug 0000644 00000002664 15231153062 0013314 0 ustar 00 (* Module: Postfix_Transport Parses /etc/postfix/transport Author: Raphael Pinson <raphael.pinson@camptocamp.com> About: Reference This lens tries to keep as close as possible to `man 5 transport` 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/postfix/transport. See <filter>. About: Examples The <Test_Postfix_Transport> file contains various examples and tests. *) module Postfix_Transport = autoload xfm (* View: space_or_eol *) let space_or_eol = del /([ \t]*\n)?[ \t]+/ " " (* View: colon *) let colon = Sep.colon (* View: nexthop *) let nexthop = let host_re = "[" . Rx.word . "]" | /[A-Za-z]([^\n]*[^ \t\n])?/ in [ label "nexthop" . (store host_re)? ] (* View: transport *) let transport = [ label "transport" . (store Rx.word)? ] . colon . nexthop (* View: nexthop_smtp *) let nexthop_smtp = let host_re = "[" . Rx.word . "]" | Rx.word in [ label "host" . store host_re ] . colon . [ label "port" . store Rx.integer ] (* View: record *) let record = [ label "pattern" . store /[A-Za-z0-9@\*.-]+/ . space_or_eol . (transport | nexthop_smtp) . Util.eol ] (* View: lns *) let lns = (Util.empty | Util.comment | record)* (* Variable: filter *) let filter = incl "/etc/postfix/transport" let xfm = transform lns filter lenses/dist/jmxpassword.aug 0000644 00000002537 15231153062 0012064 0 ustar 00 (* Module: JMXPassword JMXPassword for Augeas Author: Brian Redbeard <redbeard@dead-city.org> About: Reference This lens ensures that files included in JMXPassword 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.password > set /files/etc/activemq/jmx.password/user[last()]/username redbeard > set /files/etc/activemq/jmx.password/user[last()]/password testing ... * 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: * pass_entry: /etc/activemq/jmx.password See <filter>. *) module JMXPassword = autoload xfm (* View: pass_entry *) let pass_entry = [ label "user" . [ label "username" . store Rx.word ] . Sep.space . [ label "password" . store Rx.no_spaces ] . Util.eol ] (* View: lns *) let lns = ( Util.comment | Util.empty | pass_entry )* (* Variable: filter *) let filter = incl "/etc/activemq/jmx.password" let xfm = transform lns filter lenses/dist/aptsources.aug 0000644 00000003020 15231153062 0011657 0 ustar 00 (* Module: Aptsources Parsing /etc/apt/sources.list *) module Aptsources = autoload xfm (************************************************************************ * Group: Utility variables/functions ************************************************************************) (* View: sep_ws *) let sep_ws = del /[ \t]+/ " " (* View: eol *) let eol = Util.del_str "\n" (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* View: word *) let word = /[^# \n\t]+/ (************************************************************************ * Group: Keywords ************************************************************************) (* View: record *) let record = [ Util.indent . seq "source" . [ label "type" . store word ] . sep_ws . [ label "uri" . store word ] . sep_ws . [ label "distribution" . store word ] . [ label "component" . sep_ws . store word ]* . del /[ \t]*(#.*)?/ "" . eol ] (************************************************************************ * Group: Lens ************************************************************************) (* View: lns *) let lns = ( comment | empty | record ) * (* View: filter *) let filter = (incl "/etc/apt/sources.list") . (incl "/etc/apt/sources.list.d/*") . Util.stdexcl let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/memcached.aug 0000644 00000002370 15231153062 0011404 0 ustar 00 (* Module: Memcached Parses Memcached's configuration files Author: Marc Fournier <marc.fournier@camptocamp.com> About: Reference This lens is based on Memcached's default memcached.conf file. About: Usage Example (start code) augtool> get /files/etc/memcached.conf/u /files/etc/memcached.conf/u = nobody augtool> set /files/etc/memcached.conf/m 128 augtool> save Saved 1 file(s) (end code) The <Test_Memcached> file also contains various examples. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Memcached = autoload xfm let comment = Util.comment let comment_eol = Util.comment_generic /[#][ \t]*/ "# " let option = /[a-zA-Z]/ let val = /[^# \n\t]+/ let empty = Util.empty let eol = Util.del_str "\n" let entry = [ Util.del_str "-" . key option . ( Util.del_ws_spc . (store val) )? . del /[ \t]*/ "" . (eol|comment_eol) ] let logfile = Build.key_value_line_comment "logfile" Sep.space (store val) comment let lns = ( entry | logfile | comment | empty )* let filter = incl "/etc/memcached.conf" . incl "/etc/memcachedb.conf" let xfm = transform lns filter lenses/dist/webmin.aug 0000644 00000002351 15231153062 0010756 0 ustar 00 (* Webmin module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: *) module Webmin = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let comment = Util.comment let empty = Util.empty let sep_eq = del /=/ "=" let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ let word = /[A-Za-z0-9_.-]+/ (************************************************************************ * ENTRIES *************************************************************************) let entry = [ key word . sep_eq . sto_to_eol? . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let wm_incl (n:string) = (incl ("/etc/webmin/" . n)) let filter = wm_incl "miniserv.conf" . wm_incl "ldap-useradmin/config" let xfm = transform lns filter lenses/dist/odbc.aug 0000644 00000002652 15231153062 0010410 0 ustar 00 (* ODBC lens for Augeas Author: Marc Fournier <marc.fournier@camptocamp.com> odbc.ini and odbcinst.ini are standard INI files. *) module Odbc = autoload xfm (************************************************************************ * INI File settings * odbc.ini only supports "# as commentary and "=" as separator ************************************************************************) let comment = IniFile.comment "#" "#" let sep = IniFile.sep "=" "=" (************************************************************************ * ENTRY * odbc.ini uses standard INI File entries ************************************************************************) let entry = IniFile.indented_entry IniFile.entry_re sep comment (************************************************************************ * RECORD * odbc.ini uses standard INI File records ************************************************************************) let title = IniFile.indented_title IniFile.record_re let record = IniFile.record title entry (************************************************************************ * LENS & FILTER ************************************************************************) let lns = IniFile.lns record comment let filter = incl "/etc/odbc.ini" . incl "/etc/odbcinst.ini" let xfm = transform lns filter lenses/dist/iptables.aug 0000644 00000005217 15231153062 0011304 0 ustar 00 module Iptables = autoload xfm (* Module: Iptables Parse the iptables file format as produced by iptables-save. The resulting tree is fairly simple; in particular a rule is simply a long list of options/switches and their values (if any) This lens should be considered experimental *) let comment = Util.comment let empty = Util.empty let eol = Util.eol let spc = Util.del_ws_spc let dels = Util.del_str let chain_name = store /[A-Za-z0-9_-]+/ let chain = let policy = [ label "policy" . store /ACCEPT|DROP|REJECT|-/ ] in let counters_eol = del /[ \t]*(\[[0-9:]+\])?[ \t]*\n/ "\n" in [ label "chain" . dels ":" . chain_name . spc . policy . counters_eol ] let param (long:string) (short:string) = [ label long . spc . del (/--/ . long | /-/ . short) ("-" . short) . spc . store /(![ \t]*)?[^ \t\n!-][^ \t\n]*/ ] (* A negatable parameter, which can either be FTW ! --param arg or --param ! arg *) let neg_param (long:string) (short:string) = [ label long . [ spc . dels "!" . label "not" ]? . spc . del (/--/ . long | /-/ . short) ("-" . short) . spc . store /(![ \t]*)?[^ \t\n!-][^ \t\n]*/ ] let tcp_flags = let flags = /SYN|ACK|FIN|RST|URG|PSH|ALL|NONE/ in let flag_list (name:string) = Build.opt_list [label name . store flags] (dels ",") in [ label "tcp-flags" . spc . dels "--tcp-flags" . spc . flag_list "mask" . spc . flag_list "set" ] (* misses --set-counters *) let ipt_match = let any_key = /[a-zA-Z-][a-zA-Z0-9-]+/ - /protocol|source|destination|jump|goto|in-interface|out-interface|fragment|match|tcp-flags/ in let any_val = /([^" \t\n!-][^ \t\n]*)|"([^"\\\n]|\\\\.)*"/ in let any_param = [ [ spc . dels "!" . label "not" ]? . spc . dels "--" . key any_key . (spc . store any_val)? ] in (neg_param "protocol" "p" |neg_param "source" "s" |neg_param "destination" "d" |param "jump" "j" |param "goto" "g" |neg_param "in-interface" "i" |neg_param "out-interface" "o" |neg_param "fragment" "f" |param "match" "m" |tcp_flags |any_param)* let chain_action (n:string) (o:string) = [ label n . del (/--/ . n | o) o . spc . chain_name . ipt_match . eol ] let table_rule = chain_action "append" "-A" | chain_action "insert" "-I" | empty let table = [ del /\*/ "*" . label "table" . store /[a-z]+/ . eol . (chain|comment|table_rule)* . dels "COMMIT" . eol ] let lns = (comment|empty|table)* let xfm = transform lns (incl "/etc/sysconfig/iptables" . incl "/etc/sysconfig/iptables.save" . incl "/etc/iptables-save") lenses/dist/limits.aug 0000644 00000004021 15231153062 0010772 0 ustar 00 (* Limits module for Augeas Author: Free Ekanayaka <free@64studio.com> 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 lenses/dist/hostname.aug 0000644 00000000646 15231153062 0011320 0 ustar 00 (* Module: Hostname Parses /etc/hostname and /etc/mailname Author: Raphael Pinson <raphink@gmail.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. *) module Hostname = autoload xfm (* View: lns *) let lns = [ label "hostname" . store Rx.word . Util.eol ] (* View: filter *) let filter = incl "/etc/hostname" . incl "/etc/mailname" let xfm = transform lns filter lenses/dist/ntp.aug 0000644 00000011571 15231153062 0010302 0 ustar 00 (* NTP module for Augeas *) (* Author: Raphael Pinson <raphink@gmail.com> *) (* *) (* Status: basic settings supported *) module Ntp = autoload xfm (* Define useful shortcuts *) let eol = del /[ \t]*/ "" . [ label "#comment" . store /#.*/]? . Util.del_str "\n" let sep_spc = Util.del_ws_spc let word = /[^,# \n\t]+/ let num = /[0-9]+/ (* define comments and empty lines *) let comment = [ label "#comment" . del /#[ \t]*/ "#" . store /([^ \t\n][^\n]*)?/ . del "\n" "\n" ] let empty = [ del /[ \t]*\n/ "\n" ] let kv (k:regexp) (v:regexp) = [ key k . sep_spc. store v . eol ] (* Define generic record *) let record (kw:regexp) (value:lens) = [ key kw . sep_spc . store word . value . eol ] (* Define a command record; see confopt.html#cfg in the ntp docs *) let command_record = let opt = [ sep_spc . key /minpoll|maxpoll|ttl|version|key/ . sep_spc . store word ] | [ sep_spc . key (/autokey|burst|iburst|noselect|preempt/ | /prefer|true|dynamic/) ] in let cmd = /server|peer|broadcast|manycastclient/ | /multicastclient|manycastserver/ in record cmd opt* let broadcastclient = [ key "broadcastclient" . [ sep_spc . key "novolley" ]? . eol ] (* Define a fudge record *) let fudge_opt_re = "refid" | "stratum" let fudge_opt = [ sep_spc . key fudge_opt_re . sep_spc . store word ] let fudge_record = record "fudge" fudge_opt? (* Define simple settings, see miscopt.html in ntp docs *) let flags = let flags_re = /auth|bclient|calibrate|kernel|monitor|ntp|pps|stats/ in let flag = [ label "flag" . store flags_re ] in [ key /enable|disable/ . (sep_spc . flag)* . eol ] let simple_setting (k:regexp) = kv k word (* Still incomplete, misses logconfig, phone, setvar, tos, trap, ttl *) let simple_settings = kv "broadcastdelay" Rx.decimal | flags | simple_setting /driftfile|leapfile|logfile|includefile/ | simple_setting "statsdir" (* Misc commands, see miscopt.html in ntp docs *) (* Define restrict *) let restrict_record = let action = [ label "action" . sep_spc . store word ] in [ key "restrict" . sep_spc . [ label "ipv6" . Util.del_str "-6" . sep_spc ]? . store (word - "-6") . action* . eol ] (* Define statistics *) let statistics_flag (kw:string) = [ sep_spc . key kw ] let statistics_opts = statistics_flag "loopstats" | statistics_flag "peerstats" | statistics_flag "clockstats" | statistics_flag "rawstats" let statistics_record = [ key "statistics" . statistics_opts* . eol ] (* Define filegen *) let filegen = del /filegen[ \t]+/ "filegen " . store word let filegen_opt (kw:string) = [ sep_spc . key kw . sep_spc . store word ] (* let filegen_flag (kw:string) = [ label kw . sep_spc . store word ] *) let filegen_select (kw:string) (select:regexp) = [ label kw . sep_spc . store select ] let filegen_opts = filegen_opt "file" | filegen_opt "type" | filegen_select "enable" /(en|dis)able/ | filegen_select "link" /(no)?link/ let filegen_record = [ label "filegen" . filegen . filegen_opts* . eol ] (* Authentication commands, see authopt.html#cmd; incomplete *) let auth_command = [ key /controlkey|keys|keysdir|requestkey|authenticate/ . sep_spc . store word . eol ] | [ key /autokey|revoke/ . [sep_spc . store word]? . eol ] | [ key /trustedkey/ . [ sep_spc . label "key" . store word ]+ . eol ] (* tinker [step step | panic panic | dispersion dispersion | stepout stepout | minpoll minpoll | allan allan | huffpuff huffpuff] *) let tinker = let arg_names = /step|panic|dispersion|stepout|minpoll|allan|huffpuff/ in let arg = [ key arg_names . sep_spc . store Rx.decimal ] in [ key "tinker" . (sep_spc . arg)* . eol ] (* tos [beacon beacon | ceiling ceiling | cohort {0 | 1} | floor floor | maxclock maxclock | maxdist maxdist | minclock minclock | mindist mindist | minsane minsane | orphan stratum | orphanwait delay] *) let tos = let arg_names = /beacon|ceiling|cohort|floor|maxclock|maxdist| minclock|mindist|minsane|orphan|orphanwait/ in let arg = [ key arg_names . sep_spc . store Rx.decimal ] in [ key "tos" . (sep_spc . arg)* . eol ] (* Define lens *) let lns = ( comment | empty | command_record | fudge_record | restrict_record | simple_settings | statistics_record | filegen_record | broadcastclient | auth_command | tinker | tos)* let filter = (incl "/etc/ntp.conf") let xfm = transform lns filter lenses/dist/vsftpd.aug 0000644 00000005242 15231153062 0011005 0 ustar 00 (* Parse vsftpd.conf *) module Vsftpd = autoload xfm (* The code in parseconf.c does not seem to allow for trailing whitespace *) (* in the config file *) let eol = Util.del_str "\n" let empty = Util.empty let comment = Util.comment let bool_option_re = /anonymous_enable|local_enable|pasv_enable|port_enable|chroot_local_user|write_enable|anon_upload_enable|anon_mkdir_write_enable|anon_other_write_enable|chown_uploads|connect_from_port_20|xferlog_enable|dirmessage_enable|anon_world_readable_only|async_abor_enable|ascii_upload_enable|ascii_download_enable|one_process_model|xferlog_std_format|pasv_promiscuous|deny_email_enable|chroot_list_enable|setproctitle_enable|text_userdb_names|ls_recurse_enable|log_ftp_protocol|guest_enable|userlist_enable|userlist_deny|use_localtime|check_shell|hide_ids|listen|port_promiscuous|passwd_chroot_enable|no_anon_password|tcp_wrappers|use_sendfile|force_dot_files|listen_ipv6|dual_log_enable|syslog_enable|background|virtual_use_local_privs|session_support|download_enable|dirlist_enable|chmod_enable|secure_email_list_enable|run_as_launching_user|no_log_lock|ssl_enable|allow_anon_ssl|force_local_logins_ssl|force_local_data_ssl|ssl_sslv2|ssl_sslv3|ssl_tlsv1|tilde_user_enable|force_anon_logins_ssl|force_anon_data_ssl|mdtm_write|lock_upload_files|pasv_addr_resolve|debug_ssl|require_cert|validate_cert|require_ssl_reuse/ let uint_option_re = /accept_timeout|connect_timeout|local_umask|anon_umask|ftp_data_port|idle_session_timeout|data_connection_timeout|pasv_min_port|pasv_max_port|anon_max_rate|local_max_rate|listen_port|max_clients|file_open_mode|max_per_ip|trans_chunk_size|delay_failed_login|delay_successful_login|max_login_fails|chown_upload_mode/ let str_option_re = /secure_chroot_dir|ftp_username|chown_username|xferlog_file|vsftpd_log_file|message_file|nopriv_user|ftpd_banner|banned_email_file|chroot_list_file|pam_service_name|guest_username|userlist_file|anon_root|local_root|banner_file|pasv_address|listen_address|user_config_dir|listen_address6|cmds_allowed|hide_file|deny_file|user_sub_token|email_password_file|rsa_cert_file|dsa_cert_file|ssl_ciphers|rsa_private_key_file|dsa_private_key_file|ca_certs_file/ let bool_value_re = /[yY][eE][sS]|[tT][rR][uU][eE]|1|[nN][oO]|[fF][aA][lL][sS][eE]|0/ let option (k:regexp) (v:regexp) = [ key k . Util.del_str "=" . store v . eol ] let bool_option = option bool_option_re bool_value_re let str_option = option str_option_re /[^\n]+/ let uint_option = option uint_option_re /[0-9]+/ let lns = (bool_option|str_option|uint_option|comment|empty)* let filter = (incl "/etc/vsftpd.conf") . (incl "/etc/vsftpd/vsftpd.conf") let xfm = transform lns filter lenses/dist/sep.aug 0000644 00000002432 15231153062 0010264 0 ustar 00 (* Module: Sep Generic separators to build lenses Author: Raphael Pinson <raphink@gmail.com> About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Sep = (* Variable: colon *) let colon = Util.del_str ":" (* Variable: semicolon *) let semicolon = Util.del_str ";" (* Variable: comma *) let comma = Util.del_str "," (* Variable: equal *) let equal = Util.del_str "=" (* Variable: space_equal *) let space_equal = Util.delim "=" (* Variable: space Deletes a <Rx.space> and default to a single space *) let space = del Rx.space " " (* Variable: tab Deletes a <Rx.space> and default to a tab *) let tab = del Rx.space "\t" (* Variable: opt_space Deletes a <Rx.opt_space> and default to an empty string *) let opt_space = del Rx.opt_space "" (* Variable: opt_tab Deletes a <Rx.opt_space> and default to a tab *) let opt_tab = del Rx.opt_space "\t" (* Variable: cl_or_space Deletes a <Rx.cl_or_space> and default to a single space *) let cl_or_space = del Rx.cl_or_space " " (* Variable: cl_or_opt_space Deletes a <Rx.cl_or_opt_space> and default to a single space *) let cl_or_opt_space = del Rx.cl_or_opt_space " " (* Variable: lbracket *) let lbracket = Util.del_str "(" (* Variable: rbracket *) let rbracket = Util.del_str ")" lenses/dist/dnsmasq.aug 0000644 00000002653 15231153062 0011150 0 ustar 00 (* Dnsmasq module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: man dnsmasq (8) "Format is one option per line, legal options are the same as the long options legal on the command line. See "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details." *) module Dnsmasq = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let spc = Util.del_ws_spc let comment = Util.comment let empty = Util.empty let sep_eq = del /=/ "=" let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ (************************************************************************ * ENTRIES *************************************************************************) let entry_re = /[A-Za-z0-9._-]+/ let entry = [ key entry_re . (sep_eq . sto_to_eol)? . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry) * let filter = incl "/etc/dnsmasq.conf" . incl "/etc/dnsmasq.d/*" . excl ".*" . Util.stdexcl let xfm = transform lns filter lenses/dist/chrony.aug 0000644 00000020107 15231153062 0010776 0 ustar 00 (* Module: Chrony Parses the chrony config file Author: Pat Riehecky <riehecky@fnal.gov> About: Reference This lens tries to keep as close as possible to chrony config syntax See http://chrony.tuxfamily.org/manual.html#Configuration-file About: Limitations Does not (currently) support - include - manual - refclock - tempcomp 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/chrony.conf See <filter>. *) module Chrony = autoload xfm (************************************************************************ * Group: Import provided expressions ************************************************************************) (* View: empty *) let empty = Util.empty (* View: eol *) let eol = Util.eol (* View: space *) let space = Sep.space (* Variable: email_addr *) let email_addr = Rx.email_addr (* Variable: word *) let word = Rx.word (* Variable: integer *) let integer = Rx.relinteger (* Variable: decimal *) let decimal = Rx.reldecimal (* Variable: ip *) let ip = Rx.ip (************************************************************************ * Group: Create required expressions ************************************************************************) (* Variable: number *) let number = integer | decimal (* Variable: address_re *) let address_re = Rx.ip | Rx.hostname (* View: comment from 4.2.1 of the upstream doc Chrony comments start with: ! ; # or % and must be on their own line *) let comment = Util.comment_generic /[ \t]*[!;#%][ \t]*/ "# " (* Variable: no_space No spaces or comment characters *) let no_space = /[^ \t\r\n!;#%]+/ (* Variable: cmd_options Server/Peer options with values *) let cmd_options = "key" | /maxdelay((dev)?ratio)?/ | /(min|max)poll/ | "polltarget" | "port" | "presend" (* Variable: cmd_flags Server/Peer options without values *) let cmd_flags = "auto_offline"|"iburst"|"noselect"|"offline"|"prefer" (* Variable: server_peer Server/Peer key names *) let server_peer = "server"|"peer" (* Variable: flags Options without values *) let flags = "dumponexit" | "generatecommandkey" | "lock_all" | "noclientlog" | "rtconutc" | "rtcsync" (* Variable: log_flags log has a specific options list *) let log_flags = /measurements|statistics|tracking|rtc|refclocks|tempcomp/ (* Variable: simple_keys Options with single values *) let simple_keys = "acquisitionport" | "allow" | "bindaddress" | "bindcmdaddress" | "cmdallow" | "cmddeny" | "combinelimit" | "commandkey" | "cmdport" | "corrtimeratio" | "deny" | "driftfile" | "dumpdir" | "keyfile" | "leapsectz" | "linux_hz" | "linux_freq_scale" | "logbanner" | "logchange" | "logdir" | "maxclockerror" | "maxsamples" | "maxupdateskew" | "minsamples" | "clientloglimit" | "pidfile" | "port" | "reselectdist" | "rtcdevice" | "rtcfile" | "sched_priority" | "stratumweight" | "user" (************************************************************************ * Group: Make some sub-lenses for use in later lenses ************************************************************************) (* View: host_flags *) let host_flags = [ space . key cmd_flags ] (* View: host_options *) let host_options = [ space . key cmd_options . space . store integer ] (* View: log_flag_list *) let log_flag_list = [ space . key log_flags ] (* View: store_address *) let store_address = [ label "address" . store address_re ] (************************************************************************ * Group: Lenses for parsing out sections ************************************************************************) (* View: all_flags match all flags using Build.flag_line *) let all_flags = Build.flag_line flags (* View: kv options with only one arg can be directly mapped to key = value *) let kv = Build.key_value_line_comment simple_keys space (store no_space) comment (* Property: Options with multiple values Each of these gets their own parsing block - server|peer <address> <options> - log <options> - broadcast <interval> <address> <optional port> - fallbackdrift <min> <max> - initstepslew <threshold> <addr> <optional extra addrs> - local stratum <int> - mailonchange <emailaddress> <threshold> - makestep <threshold> <limit> - maxchange <threshold> <delay> <limit> *) (* View: host_list Find all ntp servers/peers and their flags/options *) let host_list = [ Util.indent . key server_peer . space . store address_re . ( host_flags | host_options )* . eol ] (* View: log_list log has a specific options list *) let log_list = [ Util.indent . key "log" . log_flag_list+ . eol ] (* View: bcast broadcast has specific syntax *) let bcast = [ Util.indent . key "broadcast" . space . [ label "interval" . store integer ] . space . store_address . ( space . [ label "port" . store integer] | eol) ] (* View: fdrift fallbackdrift has specific syntax *) let fdrift = [ Util.indent . key "fallbackdrift" . space . [ label "min" . store integer ] . space . [ label "max" . store integer ] . eol ] (* View: istepslew initstepslew has specific syntax *) let istepslew = [ Util.indent . key "initstepslew" . space . [ label "threshold" . store number ] . ( space . store_address )+ . eol ] (* View: local local has specific syntax *) let local = [ Util.indent . key "local" . space . [ key "stratum" . space . store integer ] . eol ] (* View: email mailonchange has specific syntax *) let email = [ Util.indent . key "mailonchange" . space . [ label "emailaddress" . store email_addr ] . space . [ label "threshold" . store number ] . eol ] (* View: makestep makestep has specific syntax *) let makestep = [ Util.indent . key "makestep" . space . [ label "threshold" . store number ] . space . [ label "limit" . store integer ] . eol ] (* View: maxchange maxchange has specific syntax *) let maxchange = [ Util.indent . key "maxchange" . space . [ label "threshold" . store number ] . space . [ label "delay" . store integer ] . space . [ label "limit" . store integer ] . eol ] (************************************************************************ * Group: Final lense summary ************************************************************************) (* View: settings * All supported chrony settings *) let settings = host_list | log_list | bcast | fdrift | istepslew | local | email | makestep | maxchange | kv | all_flags (* * View: lns * The crony lens *) let lns = ( empty | comment | settings )* (* View: filter * The files parsed by default *) let filter = incl "/etc/chrony.conf" let xfm = transform lns filter lenses/dist/rhsm.aug 0000644 00000002152 15231153062 0010445 0 ustar 00 (* Module: Rhsm Parses subscription-manager config files Author: Dominic Cleal <dcleal@redhat.com> About: Reference This lens tries to keep as close as possible to rhsm.conf(5) and Python's SafeConfigParser. All settings must be in sections without indentation. Semicolons and hashes are permitted for comments. 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/rhsm/rhsm.conf See <filter>. *) module Rhsm = autoload xfm (* Semicolons and hashes are permitted for comments *) let comment = IniFile.comment IniFile.comment_re "#" (* Equals and colons are permitted for separators *) let sep = IniFile.sep IniFile.sep_re IniFile.sep_default (* All settings must be in sections without indentation *) let entry = IniFile.entry_multiline IniFile.entry_re sep comment let title = IniFile.title IniFile.record_re let record = IniFile.record title entry let lns = IniFile.lns record comment let filter = incl "/etc/rhsm/rhsm.conf" let xfm = transform lns filter lenses/dist/stunnel.aug 0000644 00000004324 15231153062 0011167 0 ustar 00 (* Stunnel configuration file module for Augeas *) module Stunnel = autoload xfm let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = IniFile.sep "=" "=" let setting = "chroot" | "compression" | "debug" | "EGD" | "engine" | "engineCtrl" | "fips" | "foreground" | "output" | "pid" | "RNDbytes" | "RNDfile" | "RNDoverwrite" | "service" | "setgid" | "setuid" | "socket" | "syslog" | "taskbar" | "accept" | "CApath" | "CAfile" | "cert" | "ciphers" | "client" | "connect" | "CRLpath" | "CRLfile" | "curve" | "delay" | "engineNum" | "exec" | "execargs" | "failover" | "ident" | "key" | "local" | "OCSP" | "OCSPflag" | "options" | "protocol" | "protocolAuthentication" | "protocolHost" | "protocolPassword" | "protocolUsername" | "pty" | "retry" | "session" | "sessiond" | "sni" | "sslVersion" | "stack" | "TIMEOUTbusy" | "TIMEOUTclose" | "TIMEOUTconnect" | "TIMEOUTidle" | "transparent" | "verify" let entry = IniFile.indented_entry setting sep comment let empty = IniFile.empty let title = IniFile.indented_title ( IniFile.record_re - ".anon" ) let record = IniFile.record title entry let rc_anon = [ label ".anon" . ( entry | empty )+ ] let lns = rc_anon? . record* let filter = (incl "/etc/stunnel/stunnel.conf") let xfm = transform lns filter lenses/dist/apt_update_manager.aug 0000644 00000002157 15231153062 0013321 0 ustar 00 (* Module: Apt_Update_Manager Parses files in /etc/update-manager Author: Raphael Pinson <raphael.pinson@camptocamp.com> 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 files in /etc/update-manager. See <filter>. About: Examples The <Test_Apt_Update_Manager> file contains various examples and tests. *) module Apt_Update_Manager = autoload xfm (* View: comment *) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default (* View: sep *) let sep = IniFile.sep IniFile.sep_re IniFile.sep_default (* View: title *) let title = IniFile.title Rx.word (* View: entry *) let entry = IniFile.entry Rx.word sep comment (* View: record *) let record = IniFile.record title entry (* View: lns *) let lns = IniFile.lns record comment (* Variable: filter *) let filter = incl "/etc/update-manager/meta-release" . incl "/etc/update-manager/release-upgrades" . incl "/etc/update-manager/release-upgrades.d/*" . Util.stdexcl let xfm = transform lns filter lenses/dist/dhclient.aug 0000644 00000015071 15231153062 0011272 0 ustar 00 (* Intefraces module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: man dhclient.conf The only difference with the reference syntax is that this lens assumes that statements end with a new line, while the reference syntax allows new statements to be started right after the trailing ";" of the previous statement. This should not be a problem in real-life configuration files as statements get usually splitted across several lines, rather than merged in a single one. *) module Dhclient = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let comment = Util.comment let comment_or_eol = Util.comment_or_eol let empty = Util.empty (* Define separators *) let sep_spc = del /[ \t\n]+/ " " let sep_scl = del /[ \t]*;/ ";" let sep_obr = del /[ \t\n]*\{\n]*/ " {\n" let sep_cbr = del /[ \t\n]*\}/ " }" let sep_com = del /[ \t\n]*,[ \t\n]*/ "," let sep_slh = del "\/" "/" let sep_col = del ":" ":" let sep_eq = del /[ \t]*=[ \t]*/ "=" (* Define basic types *) let word = /[A-Za-z0-9_.-]+(\[[0-9]+\])?/ (* Define fields *) (* TODO: there could be a " " in the middle of a value ... *) let sto_to_spc = store /[^\\#,;{}" \t\n]+|"[^\\#"\n]+"/ let sto_to_spc_noeval = store /[^=\\#,;{}" \t\n]|[^=\\#,;{}" \t\n][^\\#,;{}" \t\n]*|"[^\\#"\n]+"/ let sto_to_scl = store /[^ \t\n][^;\n]+[^ \t]|[^ \t;\n]+/ let rfc_code = [ key "code" . sep_spc . store word ] . sep_eq . [ label "value" . sto_to_scl ] let eval = [ label "#eval" . Sep.equal . sep_spc . sto_to_scl ] let sto_number = store /[0-9][0-9]*/ (************************************************************************ * SIMPLE STATEMENTS *************************************************************************) let stmt_simple_re = "timeout" | "retry" | "select-timeout" | "reboot" | "backoff-cutoff" | "initial-interval" | "do-forward-updates" | "reject" let stmt_simple = [ key stmt_simple_re . sep_spc . sto_to_spc . sep_scl . comment_or_eol ] (************************************************************************ * ARRAY STATEMENTS *************************************************************************) (* TODO: the array could also be empty, like in the request statement *) let stmt_array_re = "media" | "request" | "require" let stmt_array = [ key stmt_array_re . sep_spc . counter "stmt_array" . [ seq "stmt_array" . sto_to_spc ] . [ sep_com . seq "stmt_array" . sto_to_spc ]* . sep_scl . comment_or_eol ] (************************************************************************ * HASH STATEMENTS *************************************************************************) let stmt_hash_re = "send" | "option" let stmt_hash = [ key stmt_hash_re . sep_spc . [ key word . sep_spc . (sto_to_spc_noeval|rfc_code|eval) ] . sep_scl . comment_or_eol ] let stmt_opt_mod_re = "append" | "prepend" | "default" | "supersede" let stmt_opt_mod = [ key stmt_opt_mod_re . sep_spc . stmt_hash ] (************************************************************************ * BLOCK STATEMENTS *************************************************************************) let stmt_block_re = "interface" | "lease" | "alias" let stmt_block_opt_re = "interface" | "script" | "bootp" | "fixed-address" | "filename" | "server-name" | "medium" | "vendor option space" (* TODO: some options could take no argument like bootp *) let stmt_block_opt = [ key stmt_block_opt_re . sep_spc . sto_to_spc . sep_scl . comment_or_eol ] let stmt_block_date_re = "renew" | "rebind" | "expire" let stmt_block_date = [ key stmt_block_date_re . [ sep_spc . label "weekday" . sto_number ] . [ sep_spc . label "year" . sto_number ] . [ sep_slh . label "month" . sto_number ] . [ sep_slh . label "day" . sto_number ] . [ sep_spc . label "hour" . sto_number ] . [ sep_col . label "minute" . sto_number ] . [ sep_col . label "second" . sto_number ] . sep_scl . comment_or_eol ] let stmt_block_arg = sep_spc . sto_to_spc let stmt_block_entry = sep_spc . ( stmt_array | stmt_hash | stmt_opt_mod | stmt_block_opt | stmt_block_date ) let stmt_block = [ key stmt_block_re . stmt_block_arg? . sep_obr . stmt_block_entry+ . sep_cbr . comment_or_eol ] (************************************************************************ * LENS & FILTER *************************************************************************) let statement = (stmt_simple|stmt_opt_mod|stmt_array|stmt_hash|stmt_block) let lns = ( empty | comment | statement )* let filter = incl "/etc/dhcp3/dhclient.conf" . incl "/etc/dhcp/dhclient.conf" . incl "/etc/dhclient.conf" let xfm = transform lns filter lenses/dist/schroot.aug 0000644 00000003450 15231153062 0011157 0 ustar 00 (* Module: Schroot Parses /etc/schroot/schroot.conf Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 schroot.conf` 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/schroot/schroot.conf. See <filter>. *) module Schroot = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: comment An <IniFile.comment> entry *) let comment = IniFile.comment "#" "#" (* View: sep An <IniFile.sep> entry *) let sep = IniFile.sep "=" "=" (************************************************************************ * Group: ENTRIES *************************************************************************) (* View: description Descriptions are special entries, which can have an optional lang parameter *) let description = let lang = [ Util.del_str "[" . label "lang" . store IniFile.entry_re . Util.del_str "]" ] in IniFile.entry_generic_nocomment (key "description" . lang?) sep "#" comment (* View: entry An <IniFile.entry>, or <description> *) let entry = IniFile.entry (IniFile.entry_re - "description") sep comment | description (* View: title An <IniFile.title> *) let title = IniFile.title IniFile.record_re (* View: record An <IniFile.record> *) let record = IniFile.record title entry (* View: lns An <IniFile.lns> *) let lns = IniFile.lns record comment (* View: filter *) let filter = (incl "/etc/schroot/schroot.conf") let xfm = transform lns filter lenses/dist/fstab.aug 0000644 00000002355 15231153062 0010600 0 ustar 00 (* 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: *) lenses/dist/clamav.aug 0000644 00000003042 15231153062 0010736 0 ustar 00 (* Module: ClamAV Parses ClamAV clamd and freshclam configuration files. Author: Andrew Colin Kissa <andrew@topdog.za.net> Baruwa Enterprise Edition http://www.baruwa.com About: License This file is licensed under the LGPL v2+. About: Configuration files This lens applies to /etc/clamd.conf, /etc/freshclam.conf and files in /etc/clamd.d. See <filter>. *) module Clamav = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES ************************************************************************) let word = /[A-Za-z][A-Za-z0-9]+/ let comment = Util.comment let some_value = Sep.space . store Rx.space_in (************************************************************************ * Group: Entry ************************************************************************) let example_entry = [ key "Example" . Util.eol ] let clamd_entry = [ key word . some_value . Util.eol ] (****************************************************************** * Group: LENS AND FILTER ******************************************************************) (************************************************************************ * View: Lns ************************************************************************) let lns = (Util.empty | example_entry | clamd_entry | comment )* (* Variable: filter *) let filter = (incl "/etc/clamd.conf") . (incl "/etc/freshclam.conf") . (incl "/etc/clamd.d/*.conf") let xfm = transform lns filter lenses/dist/syslog.aug 0000644 00000016405 15231153062 0011022 0 ustar 00 (* Module: Syslog parses /etc/syslog.conf Author: Mathieu Arnold <mat@FreeBSD.org> About: Reference This lens tries to keep as close as possible to `man 5 resolv.conf` where possible. An online source being : http://www.freebsd.org/cgi/man.cgi?query=syslog.conf&sektion=5 About: Licence This file is licensed under the BSD License. About: Lens Usage To be documented About: Configuration files This lens applies to /etc/syslog.conf. See <filter>. *) module Syslog = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Comments and empty lines *) (* Variable: empty *) let empty = Util.empty (* Variable: eol *) let eol = Util.eol (* Variable: sep_tab *) let sep_tab = del /([ \t]+|[ \t]*\\\\\n[ \t]*)/ "\t" (* Variable: sep_tab_opt *) let sep_tab_opt = del /([ \t]*|[ \t]*\\\\\n[ \t]*)/ "" (* View: comment Map comments into "#comment" nodes Can't use Util.comment as #+ and #! have a special meaning. However, '# !' and '# +' have no special meaning so they should be allowed. *) let comment_gen (space:regexp) (sto:regexp) = [ label "#comment" . del ("#" . space) "# " . store sto . eol ] let comment = let comment_withsign = comment_gen Rx.space /([!+-].*[^ \t\n]|[!+-])/ in let comment_nosign = comment_gen Rx.opt_space /([^ \t\n+!-].*[^ \t\n]|[^ \t\n+!-])/ in comment_withsign | comment_nosign (* Group: single characters macro *) (* Variable: comma Deletes a comma and default to it *) let comma = sep_tab_opt . Util.del_str "," . sep_tab_opt (* Variable: colon Deletes a colon and default to it *) let colon = sep_tab_opt . Util.del_str ":" . sep_tab_opt (* Variable: semicolon Deletes a semicolon and default to it *) let semicolon = sep_tab_opt . Util.del_str ";" . sep_tab_opt (* Variable: at Deletes a at and default to it *) let at = Util.del_str "@" (* Variable: dot Deletes a dot and default to it *) let dot = Util.del_str "." (* Variable: pipe Deletes a pipe and default to it *) let pipe = Util.del_str "|" (* Variable: plus Deletes a plus and default to it *) let plus = Util.del_str "+" (* Variable: bang Deletes a bang and default to it *) let bang = Util.del_str "!" (* Variable: opt_hash deletes an optional # sign *) let opt_hash = del /#?/ "" (* Variable: opt_plus deletes an optional + sign *) let opt_plus = del /\+?/ "" (* Group: various macros *) (* Variable: word our version can't start with [_.-] because it would mess up the grammar *) let word = /[A-Za-z0-9][A-Za-z0-9_.-]*/ (* Variable: comparison a comparison is an optional ! with optionaly some of [<=>] *) let comparison = /(!|[<=>]+|![<=>]+)/ (* Variable: protocol @ means UDP (removed, no protocol node is used for compatibility with 1.1.0) @@ means TCP *) let protocol = /@@/ (* Variable: token alphanum or "*" *) let token = /([A-Za-z0-9]+|\*)/ (* Variable: file_r a file begins with a / and get almost anything else after *) let file_r = /\/[^ \t\n;]+/ (* Variable: loghost_r Matches a hostname, that is labels speparated by dots, labels can't start or end with a "-". maybe a bit too complicated for what it's worth *) let loghost_r = /[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*/ | "[" . Rx.ipv6 . "]" (* Group: Function *) (* View: label_opt_list Uses Build.opt_list to generate a list of labels Parameters: l:string - the label name r:lens - the lens going after the label s:lens - the separator lens passed to Build.opt_list *) let label_opt_list (l:string) (r:lens) (s:lens) = Build.opt_list [ label l . r ] s (* View: label_opt_list_or Either label_opt_list matches something or it emits a single label with the "or" string. Parameters: l:string - the label name r:lens - the lens going after the label s:lens - the separator lens passed to Build.opt_list or:string - the string used if the label_opt_list does not match anything *) let label_opt_list_or (l:string) (r:lens) (s:lens) (or:string) = ( label_opt_list l r s | [ label l . store or ] ) (************************************************************************ * Group: LENSE DEFINITION *************************************************************************) (* Group: selector *) (* View: facilities a list of facilities, separated by commas *) let facilities = label_opt_list "facility" (store token) comma (* View: selector a selector is a list of facilities, an optional comparison and a level *) let selector = facilities . dot . [ label "comparison" . store comparison]? . [ label "level" . store token ] (* View: selectors a list of selectors, separated by semicolons *) let selectors = label_opt_list "selector" selector semicolon (* Group: action *) (* View: file a file may start with a "-" meaning it does not gets sync'ed everytime *) let file = [ Build.xchgs "-" "no_sync" ]? . [ label "file" . store file_r ] (* View: loghost a loghost is an @ sign followed by the hostname and a possible port *) let loghost = ([label "protocol" . store protocol] | at) . [ label "hostname" . store loghost_r ] . (colon . [ label "port" . store /[0-9]+/ ] )? (* View: users a list of users or a "*" *) let users = label_opt_list_or "user" (store word) comma "*" (* View: logprogram a log program begins with a pipe *) let logprogram = pipe . [ label "program" . store /[^ \t\n][^\n]+[^ \t\n]/ ] (* View: action an action is either a file, a host, users, or a program *) let action = (file | loghost | users | logprogram) (* Group: Entry *) (* View: entry an entry contains selectors and an action *) let entry = [ label "entry" . selectors . sep_tab . [ label "action" . action ] . eol ] (* View: entries entries are either comments/empty lines or entries *) let entries = (empty | comment | entry)* (* Group: Program matching *) (* View: programs a list of programs *) let programs = label_opt_list_or "program" (store word) comma "*" (* View: program a program begins with an optional hash, a bang, and an optional + or - *) let program = [ label "program" . opt_hash . bang . ( opt_plus | [ Build.xchgs "-" "reverse" ] ) . programs . eol . entries ] (* Group: Hostname maching *) (* View: hostnames a list of hostnames *) let hostnames = label_opt_list_or "hostname" (store Rx.word) comma "*" (* View: hostname a program begins with an optional hash, and a + or - *) let hostname = [ label "hostname" . opt_hash . ( plus | [ Build.xchgs "-" "reverse" ] ) . hostnames . eol . entries ] (* Group: Top of the tree *) (* View: lns generic entries then programs or hostnames matching blocs *) let lns = entries . ( program | hostname )* (* Variable: filter all you need is /etc/syslog.conf *) let filter = incl "/etc/syslog.conf" let xfm = transform lns filter lenses/dist/ethers.aug 0000644 00000001227 15231153062 0010770 0 ustar 00 (* Parsing /etc/ethers *) module Ethers = autoload xfm let sep_tab = Util.del_ws_tab let eol = del /[ \t]*\n/ "\n" let indent = del /[ \t]*/ "" let comment = Util.comment let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ] let word = /[^# \n\t]+/ let address = let hex = /[0-9a-fA-F][0-9a-fA-F]?/ in hex . ":" . hex . ":" . hex . ":" . hex . ":" . hex . ":" . hex let record = [ seq "ether" . indent . [ label "mac" . store address ] . sep_tab . [ label "ip" . store word ] . eol ] let lns = ( empty | comment | record ) * let xfm = transform lns (incl "/etc/ethers") lenses/dist/puppetfileserver.aug 0000644 00000006166 15231153062 0013111 0 ustar 00 (* -*- coding: utf-8 -*- Module: PuppetFileserver Parses /etc/puppet/fileserver.conf used by puppetmasterd daemon. Author: Frédéric Lespez <frederic.lespez@free.fr> About: Reference This lens tries to keep as close as possible to puppet documentation for this file: http://docs.puppetlabs.com/guides/file_serving.html About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage Sample usage of this lens in augtool * Create a new mount point > ins test_mount after /files/etc/puppet/fileserver.conf/*[last()] > defvar test_mount /files/etc/puppet/fileserver.conf/test_mount > set $test_mount/path /etc/puppet/files > set $test_mount/allow *.example.com > ins allow after $test_mount/*[last()] > set $test_mount/allow[last()] server.domain.com > set $test_mount/deny dangerous.server.com * List the definition of a mount point > print /files/etc/puppet/fileserver.conf/files * Remove a mount point > rm /files/etc/puppet/fileserver.conf/test_mount About: Configuration files This lens applies to /etc/puppet/fileserver.conf. See <filter>. *) module PuppetFileserver = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: INI File settings *) (* Variable: eol *) let eol = IniFile.eol (* Variable: sep Only treat one space as the sep, extras are stripped by IniFile *) let sep = Util.del_str " " (* Variable: comment Only supports "#" as commentary *) let comment = IniFile.comment "#" "#" (* Variable: entry_re Regexp for possible <entry> keyword (path, allow, deny) *) let entry_re = /path|allow|deny/ (************************************************************************ * Group: ENTRY *************************************************************************) (* View: entry - It might be indented with an arbitrary amount of whitespace - It does not have any separator between keywords and their values - It can only have keywords with the following values (path, allow, deny) *) let entry = IniFile.indented_entry entry_re sep comment (************************************************************************ * Group: RECORD *************************************************************************) (* Group: Title definition *) (* View: title Uses standard INI File title *) let title = IniFile.indented_title IniFile.record_re (* View: title Uses standard INI File record *) let record = IniFile.record title entry (************************************************************************ * Group: LENS *************************************************************************) (* View: lns Uses standard INI File lens *) let lns = IniFile.lns record comment (* Variable: filter *) let filter = (incl "/etc/puppet/fileserver.conf" .incl "/usr/local/etc/puppet/fileserver.conf" .incl "/etc/puppetlabs/puppet/fileserver.conf") let xfm = transform lns filter lenses/dist/wine.aug 0000644 00000003656 15231153062 0010450 0 ustar 00 (* 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* lenses/dist/cgrules.aug 0000644 00000004600 15231153062 0011140 0 ustar 00 (* Module: cgrules Parses /etc/cgrules.conf Author: Raphael Pinson <raphink@gmail.com> Ivana Hutarova Varekova <varekova@redhat.com> 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: About: Configuration files This lens applies to /etc/cgconfig.conf. See <filter>. *) module Cgrules = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Separators *) (* Variable: ws *) let ws = del /[ \t]+/ " " (* Group: Comments and empty lines *) (* Variable: eol *) let eol = Util.eol (* Variable: comment *) let comment = Util.comment (* Variable: empty *) let empty = Util.empty (* Group: Generic primitive definitions *) (* Variable: name *) let name = /[^@%# \t\n][^ \t\n]*/ (* Variable: ctrl_key *) let ctrl_key = /[^ \t\n\/]+/ (* Variable: ctrl_value *) let ctrl_value = /[^ \t\n]+/ (************************************************************************ * Group: CONTROLLER *************************************************************************) (* Variable: controller *) let controller = ws . [ key ctrl_key . ws . store ctrl_value ] let more_controller = Util.del_str "%" . controller . eol (************************************************************************ * Group: RECORDS *************************************************************************) let generic_record (lbl:string) (lns:lens) = [ label lbl . lns . controller . eol . more_controller* ] (* Variable: user_record *) let user_record = generic_record "user" (store name) (* Variable: group_record *) let group_record = generic_record "group" (Util.del_str "@" . store name) (************************************************************************ * Group: LENS & FILTER *************************************************************************) (* View: lns The main lens, any amount of * <empty> lines * <comment> * <user_record> * <group_record> *) let lns = ( empty | comment | user_record | group_record )* let xfm = transform lns (incl "/etc/cgrules.conf") lenses/dist/util.aug 0000644 00000010776 15231153062 0010464 0 ustar 00 (* Module: Util Generic module providing useful primitives Author: David Lutterkort About: License This file is licensed under the LGPLv2+, like the rest of Augeas. *) module Util = (* Variable: del_str Delete a string and default to it Parameters: s:string - the string to delete and default to *) let del_str (s:string) = del s s (* Variable: del_ws Delete mandatory whitespace *) let del_ws = del /[ \t]+/ (* Variable: del_ws_spc Delete mandatory whitespace, default to single space *) let del_ws_spc = del_ws " " (* Variable: del_ws_tab Delete mandatory whitespace, default to single tab *) let del_ws_tab = del_ws "\t" (* Variable: del_opt_ws Delete optional whitespace *) let del_opt_ws = del /[ \t]*/ (* Variable: eol Delete end of line, including optional trailing whitespace *) let eol = del /[ \t]*\n/ "\n" (* Variable: doseol Delete end of line with optional carriage return, including optional trailing whitespace *) let doseol = del /[ \t]*\r?\n/ "\n" (* Variable: indent Delete indentation, including leading whitespace *) let indent = del /[ \t]*/ "" (* Group: Comment This is a general definition of comment It allows indentation for comments, removes the leading and trailing spaces of comments and stores them in nodes, except for empty comments which are ignored together with empty lines *) (* View: comment_generic_seteol Map comments and set default comment sign *) let comment_generic_seteol (r:regexp) (d:string) (eol:lens) = [ label "#comment" . del r d . store /([^ \t\r\n].*[^ \t\r\n]|[^ \t\r\n])/ . eol ] (* View: comment_generic Map comments and set default comment sign *) let comment_generic (r:regexp) (d:string) = comment_generic_seteol r d doseol (* View: comment Map comments into "#comment" nodes *) let comment = comment_generic /[ \t]*#[ \t]*/ "# " (* View: comment_noindent Map comments into "#comment" nodes, without indentation *) let comment_noindent = comment_generic /#[ \t]*/ "# " (* View: comment_eol Map eol comments into "#comment" nodes Add a space before # for end of line comments *) let comment_eol = comment_generic /[ \t]*#[ \t]*/ " # " (* View: comment_or_eol A <comment_eol> or <eol>, with an optional empty comment *) let comment_or_eol = comment_eol | (del /[ \t]*(#[ \t]*)?\n/ "\n") (* View: comment_multiline A C-style multiline comment *) let comment_multiline = let mline_re = (/[^ \t\r\n].*[^ \t\r\n]|[^ \t\r\n]/ - /.*\*\/.*/) in let mline = [ seq "mline" . del /[ \t\r\n]*/ "\n" . store mline_re ] in [ label "#mcomment" . del /[ \t]*\/\*/ "/*" . counter "mline" . mline . (eol . mline)* . del /[ \t\r\n]*\*\/[ \t]*\r?\n/ "\n*/\n" ] (* View: comment_c_style A comment line, C-style *) let comment_c_style = comment_generic /[ \t]*\/\/[ \t]*/ "// " (* View: empty_generic A generic definition of <empty> Map empty lines, including empty comments *) let empty_generic (r:regexp) = [ del r "" . del_str "\n" ] (* Variable: empty_generic_re *) let empty_generic_re = /[ \t]*#?[ \t]*/ (* View: empty Map empty lines, including empty comments *) let empty = empty_generic empty_generic_re (* View: empty_c_style Map empty lines, including C-style empty comment *) let empty_c_style = empty_generic /[ \t]*((\/\/)|(\/\*[ \t]*\*\/))?[ \t]*/ (* View: empty_generic_dos A generic definition of <empty> with dos newlines Map empty lines, including empty comments *) let empty_generic_dos (r:regexp) = [ del r "" . del /\r?\n/ "\n" ] (* View: empty_dos *) let empty_dos = empty_generic_dos /[ \t]*#?[ \t]*/ (* View: Split *) (* Split (SEP . ELT)* into an array-like tree where each match for ELT *) (* appears in a separate subtree. The labels for the subtrees are *) (* consecutive numbers, starting at 0 *) let split (elt:lens) (sep:lens) = let sym = gensym "split" in counter sym . ( [ seq sym . sep . elt ] ) * (* View: delim *) let delim (op:string) = del (/[ \t]*/ . op . /[ \t]*/) (" " . op . " ") (* Group: Exclusions Variable: stdexcl Exclusion for files that are commonly not wanted/needed *) let stdexcl = (excl "*~") . (excl "*.rpmnew") . (excl "*.rpmsave") . (excl "*.dpkg-old") . (excl "*.dpkg-new") . (excl "*.dpkg-bak") . (excl "*.dpkg-dist") . (excl "*.augsave") . (excl "*.augnew") . (excl "*.bak") . (excl "*.old") . (excl "#*#") lenses/dist/inifile.aug 0000644 00000036763 15231153062 0011132 0 ustar 00 (* Module: IniFile Generic module to create INI files lenses Author: Raphael Pinson <raphink@gmail.com> About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: TODO Things to add in the future - Support double quotes in value About: Lens usage This lens is made to provide generic primitives to construct INI File lenses. See <Puppet>, <PHP>, <MySQL> or <Dput> for examples of real life lenses using it. About: Examples The <Test_IniFile> file contains various examples and tests. *) module IniFile = (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Internal primitives *) (* Variable: eol End of line, inherited from <Util.eol> *) let eol = Util.doseol (* Group: Separators *) (* Variable: sep Generic separator Parameters: pat:regexp - the pattern to delete default:string - the default string to use *) let sep (pat:regexp) (default:string) = Sep.opt_space . del pat default (* Variable: sep_noindent Generic separator, no indentation Parameters: pat:regexp - the pattern to delete default:string - the default string to use *) let sep_noindent (pat:regexp) (default:string) = del pat default (* Variable: sep_re The default regexp for a separator *) let sep_re = /[=:]/ (* Variable: sep_default The default separator value *) let sep_default = "=" (* Group: Stores *) (* Variable: sto_to_eol Store until end of line *) let sto_to_eol = Sep.opt_space . store Rx.space_in (* Variable: to_comment_re Regex until comment *) let to_comment_re = /[^";# \t\n][^";#\n]*[^";# \t\n]|[^";# \t\n]/ (* Variable: sto_to_comment Store until comment *) let sto_to_comment = Sep.opt_space . store to_comment_re (* Variable: sto_multiline Store multiline values *) let sto_multiline = Sep.opt_space . store (to_comment_re . (/[ \t]*\n/ . Rx.space . to_comment_re)*) (* Variable: sto_multiline_nocomment Store multiline values without an end-of-line comment *) let sto_multiline_nocomment = Sep.opt_space . store (Rx.space_in . (/[ \t]*\n/ . Rx.space . Rx.space_in)*) (* Group: Define comment and defaults *) (* View: comment_noindent Map comments into "#comment" nodes, no indentation allowed Parameters: pat:regexp - pattern to delete before commented data default:string - default pattern before commented data Sample Usage: (start code) let comment = IniFile.comment_noindent "#" "#" let comment = IniFile.comment_noindent IniFile.comment_re IniFile.comment_default (end code) *) let comment_noindent (pat:regexp) (default:string) = Util.comment_generic_seteol (pat . Rx.opt_space) default eol (* View: comment Map comments into "#comment" nodes Parameters: pat:regexp - pattern to delete before commented data default:string - default pattern before commented data Sample Usage: (start code) let comment = IniFile.comment "#" "#" let comment = IniFile.comment IniFile.comment_re IniFile.comment_default (end code) *) let comment (pat:regexp) (default:string) = Util.comment_generic_seteol (Rx.opt_space . pat . Rx.opt_space) default eol (* Variable: comment_re Default regexp for <comment> pattern *) let comment_re = /[;#]/ (* Variable: comment_default Default value for <comment> pattern *) let comment_default = ";" (* View: empty_generic Empty line, including empty comments Parameters: indent:regexp - the indentation regexp comment_re:regexp - the comment separator regexp *) let empty_generic (indent:regexp) (comment_re:regexp) = Util.empty_generic_dos (indent . comment_re? . Rx.opt_space) (* View: empty Empty line *) let empty = empty_generic Rx.opt_space comment_re (* View: empty_noindent Empty line, without indentation *) let empty_noindent = empty_generic "" comment_re (************************************************************************ * Group: ENTRY *************************************************************************) (* Group: entry includes comments *) (* View: entry_generic_nocomment A very generic INI File entry, not including comments It allows to set the key lens (to set indentation or subnodes linked to the key) as well as the comment separator regexp, used to tune the store regexps. Parameters: kw:lens - lens to match the key, including optional indentation sep:lens - lens to use as key/value separator comment_re:regexp - comment separator regexp comment:lens - lens to use as comment Sample Usage: > let entry = IniFile.entry_generic (key "setting") sep IniFile.comment_re comment *) let entry_generic_nocomment (kw:lens) (sep:lens) (comment_re:regexp) (comment:lens) = let bare_re_noquot = (/[^" \t\r\n]/ - comment_re) in let bare_re = (/[^\r\n]/ - comment_re)+ in let no_quot = /[^"\r\n]*/ in let bare = Quote.do_dquote_opt_nil (store (bare_re_noquot . (bare_re* . bare_re_noquot)?)) in let quoted = Quote.do_dquote (store (no_quot . comment_re+ . no_quot)) in [ kw . sep . (Sep.opt_space . bare)? . (comment|eol) ] | [ kw . sep . Sep.opt_space . quoted . (comment|eol) ] (* View: entry_generic A very generic INI File entry It allows to set the key lens (to set indentation or subnodes linked to the key) as well as the comment separator regexp, used to tune the store regexps. Parameters: kw:lens - lens to match the key, including optional indentation sep:lens - lens to use as key/value separator comment_re:regexp - comment separator regexp comment:lens - lens to use as comment Sample Usage: > let entry = IniFile.entry_generic (key "setting") sep IniFile.comment_re comment *) let entry_generic (kw:lens) (sep:lens) (comment_re:regexp) (comment:lens) = entry_generic_nocomment kw sep comment_re comment | comment (* View: entry Generic INI File entry Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator comment:lens - lens to use as comment Sample Usage: > let entry = IniFile.entry setting sep comment *) let entry (kw:regexp) (sep:lens) (comment:lens) = entry_generic (key kw) sep comment_re comment (* View: indented_entry Generic INI File entry that might be indented with an arbitrary amount of whitespace Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator comment:lens - lens to use as comment Sample Usage: > let entry = IniFile.indented_entry setting sep comment *) let indented_entry (kw:regexp) (sep:lens) (comment:lens) = entry_generic (Util.indent . key kw) sep comment_re comment (* View: entry_multiline_generic A very generic multiline INI File entry It allows to set the key lens (to set indentation or subnodes linked to the key) as well as the comment separator regexp, used to tune the store regexps. Parameters: kw:lens - lens to match the key, including optional indentation sep:lens - lens to use as key/value separator comment_re:regexp - comment separator regexp comment:lens - lens to use as comment eol:lens - lens for end of line Sample Usage: > let entry = IniFile.entry_generic (key "setting") sep IniFile.comment_re comment comment_or_eol *) let entry_multiline_generic (kw:lens) (sep:lens) (comment_re:regexp) (comment:lens) (eol:lens) = let newline = /\r?\n[ \t]+/ in let bare = let word_re_noquot = (/[^" \t\r\n]/ - comment_re)+ in let word_re = (/[^\r\n]/ - comment_re)+ in let base_re = (word_re_noquot . (word_re* . word_re_noquot)?) in let sto_re = base_re . (newline . base_re)* | (newline . base_re)+ in Quote.do_dquote_opt_nil (store sto_re) in let quoted = let no_quot = /[^"\r\n]*/ in let base_re = (no_quot . comment_re+ . no_quot) in let sto_re = base_re . (newline . base_re)* | (newline . base_re)+ in Quote.do_dquote (store sto_re) in [ kw . sep . (Sep.opt_space . bare)? . eol ] | [ kw . sep . Sep.opt_space . quoted . eol ] | comment (* View: entry_multiline Generic multiline INI File entry Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator comment:lens - lens to use as comment *) let entry_multiline (kw:regexp) (sep:lens) (comment:lens) = entry_multiline_generic (key kw) sep comment_re comment (comment|eol) (* View: entry_multiline_nocomment Generic multiline INI File entry without an end-of-line comment Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator comment:lens - lens to use as comment *) let entry_multiline_nocomment (kw:regexp) (sep:lens) (comment:lens) = entry_multiline_generic (key kw) sep comment_re comment eol (* View: entry_list Generic INI File list entry Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator sto:regexp - store regexp for the values list_sep:lens - lens to use as list separator comment:lens - lens to use as comment *) let entry_list (kw:regexp) (sep:lens) (sto:regexp) (list_sep:lens) (comment:lens) = let list = counter "elem" . Build.opt_list [ seq "elem" . store sto ] list_sep in Build.key_value_line_comment kw sep (Sep.opt_space . list) comment (* View: entry_list_nocomment Generic INI File list entry without an end-of-line comment Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator sto:regexp - store regexp for the values list_sep:lens - lens to use as list separator *) let entry_list_nocomment (kw:regexp) (sep:lens) (sto:regexp) (list_sep:lens) = let list = counter "elem" . Build.opt_list [ seq "elem" . store sto ] list_sep in Build.key_value_line kw sep (Sep.opt_space . list) (* Variable: entry_re Default regexp for <entry> keyword *) let entry_re = ( /[A-Za-z][A-Za-z0-9._-]*/ ) (************************************************************************ * Group: RECORD *************************************************************************) (* Group: Title definition *) (* View: title Title for <record>. This maps the title of a record as a node in the abstract tree. Parameters: kw:regexp - keyword regexp for the label Sample Usage: > let title = IniFile.title IniFile.record_re *) let title (kw:regexp) = Util.del_str "[" . key kw . Util.del_str "]". eol (* View: indented_title Title for <record>. This maps the title of a record as a node in the abstract tree. The title may be indented with arbitrary amounts of whitespace Parameters: kw:regexp - keyword regexp for the label Sample Usage: > let title = IniFile.title IniFile.record_re *) let indented_title (kw:regexp) = Util.indent . title kw (* View: title_label Title for <record>. This maps the title of a record as a value in the abstract tree. Parameters: name:string - name for the title label kw:regexp - keyword regexp for the label Sample Usage: > let title = IniFile.title_label "target" IniFile.record_label_re *) let title_label (name:string) (kw:regexp) = label name . Util.del_str "[" . store kw . Util.del_str "]". eol (* View: indented_title_label Title for <record>. This maps the title of a record as a value in the abstract tree. The title may be indented with arbitrary amounts of whitespace Parameters: name:string - name for the title label kw:regexp - keyword regexp for the label Sample Usage: > let title = IniFile.title_label "target" IniFile.record_label_re *) let indented_title_label (name:string) (kw:regexp) = Util.indent . title_label name kw (* Variable: record_re Default regexp for <title> keyword pattern *) let record_re = ( /[^]\r\n\/]+/ - /#comment/ ) (* Variable: record_label_re Default regexp for <title_label> keyword pattern *) let record_label_re = /[^]\r\n]+/ (* Group: Record definition *) (* View: record_noempty INI File Record with no empty lines allowed. Parameters: title:lens - lens to use for title. Use either <title> or <title_label>. entry:lens - lens to use for entries in the record. See <entry>. *) let record_noempty (title:lens) (entry:lens) = [ title . entry* ] (* View: record Generic INI File record Parameters: title:lens - lens to use for title. Use either <title> or <title_label>. entry:lens - lens to use for entries in the record. See <entry>. Sample Usage: > let record = IniFile.record title entry *) let record (title:lens) (entry:lens) = record_noempty title ( entry | empty ) (************************************************************************ * Group: GENERIC LENSES *************************************************************************) (* Group: Lens definition View: lns_noempty Generic INI File lens with no empty lines Parameters: record:lens - record lens to use. See <record_noempty>. comment:lens - comment lens to use. See <comment>. Sample Usage: > let lns = IniFile.lns_noempty record comment *) let lns_noempty (record:lens) (comment:lens) = comment* . record* (* View: lns Generic INI File lens Parameters: record:lens - record lens to use. See <record>. comment:lens - comment lens to use. See <comment>. Sample Usage: > let lns = IniFile.lns record comment *) let lns (record:lens) (comment:lens) = lns_noempty record (comment|empty) (************************************************************************ * Group: READY-TO-USE LENSES *************************************************************************) let record_anon (entry:lens) = [ label "section" . value ".anon" . ( entry | empty )+ ] (* View: lns_loose A loose, ready-to-use lens, featuring: - sections as values (to allow '/' in names) - support empty lines and comments - support for [#;] as comment, defaulting to ";" - .anon sections - don't allow multiline values - allow indented titles - allow indented entries *) let lns_loose = let l_comment = comment comment_re comment_default in let l_sep = sep sep_re sep_default in let l_entry = indented_entry entry_re l_sep l_comment in let l_title = indented_title_label "section" (record_label_re - ".anon") in let l_record = record l_title l_entry in (record_anon l_entry)? . l_record* (* View: lns_loose_multiline A loose, ready-to-use lens, featuring: - sections as values (to allow '/' in names) - support empty lines and comments - support for [#;] as comment, defaulting to ";" - .anon sections - allow multiline values *) let lns_loose_multiline = let l_comment = comment comment_re comment_default in let l_sep = sep sep_re sep_default in let l_entry = entry_multiline entry_re l_sep l_comment in let l_title = title_label "section" (record_label_re - ".anon") in let l_record = record l_title l_entry in (record_anon l_entry)? . l_record* lenses/dist/thttpd.aug 0000644 00000002501 15231153062 0011001 0 ustar 00 (* Module: Thttpd Parses Thttpd's configuration files Author: Marc Fournier <marc.fournier@camptocamp.com> About: Reference This lens is based on Thttpd's default thttpd.conf file. About: Usage Example (start code) augtool> get /files/etc/thttpd/thttpd.conf/port /files/etc/thttpd/thttpd.conf/port = 80 augtool> set /files/etc/thttpd/thttpd.conf/port 8080 augtool> save Saved 1 file(s) (end code) The <Test_Thttpd> file also contains various examples. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Thttpd = autoload xfm let comment = Util.comment let comment_eol = Util.comment_generic /[ \t]*[#][ \t]*/ " # " let empty = Util.empty let eol = Util.del_str "\n" let bol = Util.del_opt_ws "" let kvkey = /(port|dir|data_dir|user|cgipat|throttles|host|logfile|pidfile|charset|p3p|max_age)/ let flag = /(no){0,1}(chroot|symlinks|vhost|globalpasswd)/ let val = /[^\n# \t]*/ let kventry = key kvkey . Util.del_str "=" . store val let flagentry = key flag let kvline = [ bol . kventry . (eol|comment_eol) ] let flagline = [ bol . flagentry . (eol|comment_eol) ] let lns = (kvline|flagline|comment|empty)* let filter = incl "/etc/thttpd/thttpd.conf" let xfm = transform lns filter lenses/dist/shells.aug 0000644 00000001351 15231153062 0010766 0 ustar 00 (* Module: Shells Parses /etc/shells Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 shells` 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/shells. See <filter>. *) module Shells = autoload xfm let empty = Util.empty let comment = Util.comment let comment_or_eol = Util.comment_or_eol let shell = [ seq "shell" . store /[^# \t\n]+/ . comment_or_eol ] (* View: lns The shells lens *) let lns = ( empty | comment | shell )* (* Variable: filter *) let filter = incl "/etc/shells" let xfm = transform lns filter lenses/dist/vfstab.aug 0000644 00000003334 15231153062 0010764 0 ustar 00 (* Module: Vfstab Parses Solaris vfstab config file, based on Fstab lens Author: Dominic Cleal <dcleal@redhat.com> About: Reference See vfstab(4) About: License This file is licenced under the LGPLv2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files This lens applies to /etc/vfstab. About: Examples The <Test_Vfstab> file contains various examples and tests. *) module Vfstab = 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]+/ let int = Rx.integer let bool = "yes" | "no" (* An option label can't contain comma, comment, equals, or space *) let optlabel = /[^,#= \n\t]+/ - "-" let spec = /[^-,# \n\t][^ \n\t]*/ let optional = Util.del_str "-" 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" . [ label "spec" . store spec ] . sep_tab . ( [ label "fsck" . store spec ] | optional ). sep_tab . [ label "file" . store file ] . sep_tab . comma_sep_list "vfstype" . sep_tab . ( [ label "passno" . store int ] | optional ) . sep_spc . [ label "atboot" . store bool ] . sep_tab . ( comma_sep_list "opt" | optional ) . eol ] let lns = ( empty | comment | record ) * let filter = incl "/etc/vfstab" let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/xymon.aug 0000644 00000004264 15231153062 0010654 0 ustar 00 (* 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_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_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_only)* . (page | subparent)* let filter = incl "/etc/xymon/hosts.cfg" . incl "/etc/xymon/pages.cfg" let xfm = transform lns filter lenses/dist/anaconda.aug 0000644 00000001407 15231153062 0011242 0 ustar 00 (* Module: Anaconda Parses Anaconda's user interaction configuration files. Author: Pino Toscano <ptoscano@redhat.com> About: Reference https://anaconda-installer.readthedocs.io/en/latest/user-interaction-config-file-spec.html About: Configuration file This lens applies to /etc/sysconfig/anaconda. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Anaconda = autoload xfm let comment = IniFile.comment "#" "#" let sep = IniFile.sep "=" "=" let entry = IniFile.entry IniFile.entry_re sep comment let title = IniFile.title IniFile.record_re let record = IniFile.record title entry let lns = IniFile.lns record comment let filter = incl "/etc/sysconfig/anaconda" let xfm = transform lns filter lenses/dist/cachefilesd.aug 0000644 00000004003 15231153062 0011723 0 ustar 00 (* Module: Cachefilesd Parses /etc/cachefilesd.conf Author: Pat Riehecky <riehecky@fnal.gov> About: Reference This lens tries to keep as close as possible to `man 5 cachefilesd.conf` where possible. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage See <lns>. About: Configuration files This lens applies to /etc/cachefilesd.conf. About: Examples The <Test_Cachefilesd> file contains various examples and tests. *) module Cachefilesd = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Comments and empty lines *) (* View: eol *) let eol = Util.eol (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* Group: separators *) (* View: space * Separation between key and value *) let space = Util.del_ws_spc (* View: colon * Separation between selinux attributes *) let colon = Sep.colon (* Group: entries *) (* View: entry_key * The key for an entry in the config file *) let entry_key = Rx.word (* View: entry_value * The value for an entry may contain all sorts of things *) let entry_value = /[A-Za-z0-9_.-:%]+/ (* View: nocull * The nocull key has different syntax than the rest *) let nocull = /nocull/i (* Group: config *) (* View: cacheconfig * This is a simple "key value" setup *) let cacheconfig = [ key (entry_key - nocull) . space . store entry_value . eol ] (* View: nocull * This is a either present, and therefore active or missing and * not active *) let nocull_entry = [ key nocull . eol ] (* View: lns *) let lns = (empty | comment | cacheconfig | nocull_entry)* let xfm = transform lns (incl "/etc/cachefilesd.conf") (* Local Variables: *) (* mode: caml *) (* End: *) lenses/dist/vmware_config.aug 0000644 00000001276 15231153062 0012330 0 ustar 00 (* Module: VWware_Config Parses /etc/vmware/config Author: Raphael Pinson <raphael.pinson@camptocamp.com> 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/vmware/config. See <filter>. About: Examples The <Test_VMware_Config> file contains various examples and tests. *) module VMware_Config = autoload xfm (* View: entry *) let entry = Build.key_value_line Rx.word Sep.space_equal Quote.double_opt (* View: lns *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = incl "/etc/vmware/config" let xfm = transform lns filter lenses/dist/bootconf.aug 0000644 00000007230 15231153062 0011307 0 ustar 00 (* Module: BootConf Parses (Open)BSD-stype /etc/boot.conf Author: Jasper Lievisse Adriaanse <jasper@jasper.la> About: Reference This lens is used to parse the second-stage bootstrap configuration file, /etc/boot.conf as found on OpenBSD. The format is largely MI, with MD parts included: http://www.openbsd.org/cgi-bin/man.cgi?query=boot.conf&arch=i386 About: Usage Example To be documented About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Configuration files This lens applies to /etc/boot.conf. See <filter>. *) module BootConf = autoload xfm (************************************************************************ * Utility variables/functions ************************************************************************) (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* View: eol *) let eol = Util.eol (* View: fspath *) let fspath = Rx.fspath (* View: space *) let space = Sep.space (* View: word *) let word = Rx.word (************************************************************************ * View: key_opt_value_line * A subnode with a keyword, an optional part consisting of a separator * and a storing lens, and an end of line * * Parameters: * kw:regexp - the pattern to match as key * sto:lens - the storing lens ************************************************************************) let key_opt_value_line (kw:regexp) (sto:lens) = [ key kw . (space . sto)? . eol ] (************************************************************************ * Commands ************************************************************************) (* View: single_command single command such as 'help' or 'time' *) let single_command = let line_re = /help|time|reboot/ in [ Util.indent . key line_re . eol ] (* View: ls ls [directory] *) let ls = Build.key_value_line "ls" space (store fspath) let set_cmd = "addr" | "debug" | "device" | "howto" | "image" | "timeout" | "tty" (* View: set set [varname [value]] *) let set = Build.key_value "set" space (key_opt_value_line set_cmd (store Rx.space_in)) (* View: stty stty [device [speed]] *) let stty = let device = [ label "device" . store fspath ] in let speed = [ label "speed" . store Rx.integer ] in key_opt_value_line "stty" (device . (space . speed)?) (* View: echo echo [args] *) let echo = Build.key_value_line "echo" space (store word) (* View: boot boot [image [-acds]] XXX: the last arguments are not always needed, so make them optional *) let boot = let image = [ label "image" . store fspath ] in let arg = [ label "arg" . store word ] in Build.key_value_line "boot" space (image . space . arg) (* View: machine machine [command] *) let machine = let machine_entry = Build.key_value ("comaddr"|"memory") space (store word) | Build.flag ("diskinfo"|"regs") in Build.key_value_line "machine" space (Build.opt_list machine_entry space) (************************************************************************ * Lens ************************************************************************) (* View: command *) let command = boot | echo | ls | machine | set | stty (* View: lns *) let lns = ( empty | comment | command | single_command )* (* Variable: filter *) let filter = (incl "/etc/boot.conf") let xfm = transform lns filter lenses/dist/desktop.aug 0000644 00000002616 15231153062 0011152 0 ustar 00 (* Module: Desktop Desktop module for Augeas (.desktop files) Author: Raphael Pinson <raphink@gmail.com> About: Lens Usage This lens is made to provide a lens for .desktop files for augeas Reference: Freedesktop.org http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html About: License This file is licenced under the LGPL v2+, like the rest of Augeas. *) module Desktop = (* We don't load this lens by default Since a lot of desktop files contain unicode characters which we can't parse *) (* autoload xfm *) (* Comments can be only of # type *) let comment = IniFile.comment "#" "#" (* TITLE * These represents sections of a desktop file * Example : [DesktopEntry] *) let title = IniFile.title IniFile.record_re let sep = IniFile.sep "=" "=" let setting = /[A-Za-z0-9_.-]+([][@A-Za-z0-9_.-]+)?/ (* Variable: sto_to_comment Store until comment *) let sto_to_comment = Sep.opt_space . store /[^# \t\r\n][^#\r\n]*[^# \t\r\n]|[^# \t\r\n]/ (* Entries can have comments at their end and so they are modified to represent as such *) let entry = [ key setting . sep . sto_to_comment? . (comment|IniFile.eol) ] | comment let record = IniFile.record title entry let lns = IniFile.lns record comment let filter = ( incl "/usr/share/applications/*.desktop" . incl "/usr/share/applications/screensavers/*.desktop" ) let xfm = transform lns filter lenses/dist/xymon_alerting.aug 0000644 00000014163 15231153062 0012540 0 ustar 00 (* Module: Xymon_Alerting Parses xymon alerting files Author: Francois Maillard <fmaillard@gmail.com> 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 <filter>. About: Examples The <Test_Xymon_Alerting> 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 <kw_word> entry with optional filters *) let kw_word_filters_opt (kw:string) = [ key kw . equal . store_word . filters_opt ] (* View: flag_filters_opt A <flag> 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 lenses/dist/fuse.aug 0000644 00000001547 15231153062 0010445 0 ustar 00 (* Module: Fuse Parses /etc/fuse.conf Author: Raphael Pinson <raphink@gmail.com> About: Reference 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/fuse.conf. See <filter>. About: Examples The <Test_Fuse> file contains various examples and tests. *) module Fuse = autoload xfm (* Variable: equal *) let equal = del /[ \t]*=[ \t]*/ " = " (* View: mount_max *) let mount_max = Build.key_value_line "mount_max" equal (store Rx.integer) (* View: user_allow_other *) let user_allow_other = Build.flag_line "user_allow_other" (* View: lns The fuse.conf lens *) let lns = ( Util.empty | Util.comment | mount_max | user_allow_other )* (* Variable: filter *) let filter = incl "/etc/fuse.conf" let xfm = transform lns filter lenses/dist/nsswitch.aug 0000644 00000004431 15231153062 0011340 0 ustar 00 (* Module: Nsswitch Parses /etc/nsswitch.conf Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man nsswitch.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/nsswitch.conf. See <filter>. *) module Nsswitch = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* View: sep_colon The separator for database entries *) let sep_colon = del /:[ \t]*/ ": " (* View: database_kw The database specification like `passwd', `shadow', or `hosts' *) let database_kw = Rx.word (* View: service The service specification like `files', `db', or `nis' *) let service = [ label "service" . store Rx.word ] (* View: reaction The reaction on lookup result like `[NOTFOUND=return]' TODO: Use case-insensitive regexps when ticket #147 is fixed. *) let reaction = let status_kw = /[Ss][Uu][Cc][Cc][Ee][Ss][Ss]/ | /[Nn][Oo][Tt][Ff][Oo][Uu][Nn][Dd]/ | /[Uu][Nn][Aa][Vv][Aa][Ii][Ll]/ | /[Tt][Rr][Yy][Aa][Gg][Aa][Ii][Nn]/ in let action_kw = /[Rr][Ee][Tt][Uu][Rr][Nn]/ | /[Cc][Oo][Nn][Tt][Ii][Nn][Uu][Ee]/ in let negate = [ Util.del_str "!" . label "negate" ] in let reaction_entry = [ label "status" . negate? . store status_kw . Util.del_str "=" . [ label "action" . store action_kw ] ] in Util.del_str "[" . [ label "reaction" . (Build.opt_list reaction_entry Sep.space) ] . Util.del_str "]" (* View: database *) let database = [ label "database" . store database_kw . sep_colon . (Build.opt_list (service|reaction) Sep.space) . Util.eol ] (* View: lns *) let lns = ( empty | comment | database )* (* Variable: filter *) let filter = (incl "/etc/nsswitch.conf") let xfm = transform lns filter lenses/dist/cpanel.aug 0000644 00000001470 15231153062 0010740 0 ustar 00 (* Module: CPanel Parses cpanel.config Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens parses cpanel.config files 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 cpanel.config files. See <filter>. About: Examples The <Test_CPanel> file contains various examples and tests. *) module CPanel = autoload xfm (* View: kv A key-value pair, supporting flags and empty values *) let kv = [ key /[A-Za-z0-9:_.-]+/ . (Sep.equal . store (Rx.space_in?))? . Util.eol ] (* View: lns The <CPanel> lens *) let lns = (Util.comment | Util.empty | kv)* (* View: filter *) let filter = incl "/var/cpanel/cpanel.config" let xfm = transform lns filter lenses/dist/networkmanager.aug 0000644 00000003777 15231153062 0012536 0 ustar 00 (* Module: NetworkManager Parses /etc/NetworkManager/system-connections/* files which are GLib key-value setting files. Author: Raphael Pinson <raphael.pinson@camptocamp.com> 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/NetworkManager/system-connections/*. See <filter>. About: Examples The <Test_NetworkManager> file contains various examples and tests. *) module NetworkManager = autoload xfm (************************************************************************ * INI File settings * * GLib only supports "# as commentary and "=" as separator *************************************************************************) let comment = IniFile.comment "#" "#" let sep = Sep.equal let eol = Util.eol (************************************************************************ * ENTRY * GLib entries can contain semicolons, entry names can contain spaces and * brackets *************************************************************************) (* Variable: entry_re *) let entry_re = /[A-Za-z][A-Za-z0-9:._\(\) \t-]+/ (* Lens: entry *) let entry = [ key entry_re . sep . Quote.double_opt? . eol ] | comment (************************************************************************ * RECORD * GLib uses standard INI File records *************************************************************************) let title = IniFile.indented_title IniFile.record_re let record = IniFile.record title entry (************************************************************************ * LENS & FILTER * GLib uses standard INI File records *************************************************************************) let lns = IniFile.lns record comment (* Variable: filter *) let filter = incl "/etc/NetworkManager/system-connections/*" let xfm = transform lns filter lenses/dist/mongodbserver.aug 0000644 00000002261 15231153062 0012351 0 ustar 00 (* Module: MongoDBServer Parses /etc/mongodb.conf Author: Brian Redbeard <redbeard@dead-city.org> About: Reference For information on configuration options available to mongod reference one of the following resources: * The Mongo DB Manual - <http://docs.mongodb.org/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 <filter>. About: Examples The <Test_MongoDBServer> 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 lenses/dist/known_hosts.aug 0000644 00000002435 15231153062 0012054 0 ustar 00 (* Module: Known_Hosts Parses SSH known_hosts files Author: Raphaël Pinson <raphink@gmail.com> About: Reference This lens ensures that conf files included in ActiveMQ /FuseMQ are properly handled by Augeas. 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: * Get a key by name from ssh_known_hosts > print /files/etc/ssh_known_hosts/*[.="foo.example.com"] ... * Change a host's key > set /files/etc/ssh_known_hosts/*[.="foo.example.com"]/key "newkey" About: Configuration files This lens applies to SSH known_hosts files. See <filter>. *) module Known_Hosts = autoload xfm (* View: entry A known_hosts entry *) let entry = let alias = [ label "alias" . store Rx.neg1 ] in [ Util.indent . seq "entry" . store Rx.neg1 . (Sep.comma . Build.opt_list alias Sep.comma)? . Sep.space . [ label "type" . store Rx.no_spaces ] . Sep.space . [ label "key" . store Rx.no_spaces ] . Util.eol ] (* View: lns The known_hosts lens *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = incl "/etc/ssh/ssh_known_hosts" . incl (Sys.getenv("HOME") . "/.ssh/known_hosts") let xfm = transform lns filter lenses/dist/inetd.aug 0000644 00000014335 15231153062 0010605 0 ustar 00 (* inetd.conf lens definition for Augeas Auther: Matt Palmer <mpalmer@hezmatt.org> Copyright (C) 2009 Matt Palmer, All Rights Reserved This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. This lens parses /etc/inetd.conf. The current format is based on the syntax documented in the inetd manpage shipped with Debian's openbsd-inetd package version 0.20080125-2. Apologies if your inetd.conf doesn't follow the same format. Each top-level entry will have a key being that of the service name (the first column in the service definition, which is the name or number of the port that the service should listen on). The attributes for the service all sit under that. In regular Augeas style, the order of the attributes matter, and attempts to set things in a different order will fail miserably. The defined attribute names (and the order in which they must appear) are as follows (with mandatory parameters indicated by [*]): address -- a sequence of IP addresses or hostnames on which this service should listen. socket[*] -- The type of the socket that will be created (either stream or dgram, although the lens doesn't constrain the possibilities here) protocol[*] -- The socket protocol. I believe that the usual possibilities are "tcp", "udp", or "unix", but no restriction is made on what you can actually put here. sndbuf -- Specify a non-default size for the send buffer of the connection. rcvbuf -- Specify a non-default size for the receive buffer of the connection. wait[*] -- Whether to wait for new connections ("wait"), or just terminate immediately ("nowait"). max -- The maximum number of times that a service can be invoked in one minute. user[*] -- The user to run the service as. group -- A group to set the running service to, rather than the primary group of the previously specified user. command[*] -- What program to run. arguments -- A sequence of arguments to pass to the command. In addition to this straightforward tree, inetd has the ability to set "default" listen addresses; this is a little used feature which nonetheless comes in handy sometimes. The key for entries of this type is "address" , and the subtree should be a sequence of addresses. "*" can always be used to return the default behaviour of listening on INADDR_ANY. *) module Inetd = autoload xfm (*************************** * PRIMITIVES ***************************) (* Store whitespace *) let wsp = del /[ \t]+/ " " let sep = del /[ \t]+/ " " let owsp(t:string) = del /[ \t]*/ t (* It's the end of the line as we know it... doo, doo, dooooo *) let eol = Util.eol (* In the beginning, the earth was without form, and void *) let empty = Util.empty let comment = Util.comment let del_str = Util.del_str let address = [ seq "addrseq" . store /([a-zA-Z0-9.-]+|\[[A-Za-z0-9:?*%]+\]|\*)/ ] let address_list = ( counter "addrseq" . (address . del_str ",")* . address ) let argument = [ seq "argseq" . store /[^ \t\n]+/ ] let argument_list = ( counter "argseq" . [ label "arguments" . (argument . wsp)* . argument ] ) (*************************** * ELEMENTS ***************************) let service (l:string) = ( label l . [label "address" . address_list . del_str ":" ]? . store /[^ \t\n\/:#]+/ ) let socket = [ label "socket" . store /[^ \t\n#]+/ ] let protocol = ( [ label "protocol" . store /[^ \t\n,#]+/ ] . [ del_str "," . key /sndbuf/ . del_str "=" . store /[^ \t\n,]+/ ]? . [ del_str "," . key /rcvbuf/ . del_str "=" . store /[^ \t\n,]+/ ]? ) let wait = ( [ label "wait" . store /(wait|nowait)/ ] . [ del_str "." . label "max" . store /[0-9]+/ ]? ) let usergroup = ( [ label "user" . store /[^ \t\n:.]+/ ] . [ del /[:.]/ ":" . label "group" . store /[^ \t\n:.]+/ ]? ) let command = ( [ label "command" . store /[^ \t\n]+/ ] . (wsp . argument_list)? ) (*************************** * SERVICE LINES ***************************) let service_line = [ service "service" . sep . socket . sep . protocol . sep . wait . sep . usergroup . sep . command . eol ] (*************************** * RPC LINES ***************************) let rpc_service = service "rpc_service" . Util.del_str "/" . [ label "version" . store Rx.integer ] let rpc_endpoint = [ label "endpoint-type" . store Rx.word ] let rpc_protocol = Util.del_str "rpc/" . (Build.opt_list [label "protocol" . store /[^ \t\n,#]+/ ] Sep.comma) let rpc_line = [ rpc_service . sep . rpc_endpoint . sep . rpc_protocol . sep . wait . sep . usergroup . sep . command . eol ] (*************************** * DEFAULT LISTEN ADDRESSES ***************************) let default_listen_address = [ label "address" . address_list . del_str ":" . eol ] (*********************** * LENS / FILTER ***********************) let lns = (comment|empty|service_line|rpc_line|default_listen_address)* let filter = incl "/etc/inetd.conf" let xfm = transform lns filter lenses/dist/sysconfig_route.aug 0000644 00000005067 15231153062 0012726 0 ustar 00 (* 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 <Test_Sysconfig_Route> 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 lenses/dist/aptcacherngsecurity.aug 0000644 00000001326 15231153062 0013545 0 ustar 00 (* Module: AptCacherNGSecurity Lens for config files like the one found in /etc/apt-cacher-ng/security.conf About: License Copyright 2013 Erik B. Andersen; this file is licenced under the LGPL v2+. *) module AptCacherNGSecurity = autoload xfm (* Define a Username/PW pair *) let authpair = [ key /[^ \t:\/]*/ . del /:/ ":" . store /[^: \t\n]*/ ] (* Define a record. So far as I can tell, the only auth level supported is Admin *) let record = [ key "AdminAuth". del /[ \t]*:[ \t]*/ ": ". authpair . Util.del_str "\n"] (* Define the basic lens *) let lns = ( record | Util.empty | Util.comment )* let filter = incl "/etc/apt-cacher-ng/security.conf" . Util.stdexcl let xfm = transform lns filter lenses/dist/grub.aug 0000644 00000025775 15231153062 0010453 0 ustar 00 (* Module: Grub Parses grub configuration Author: David Lutterkort <lutter@redhat.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented *) module Grub = autoload xfm (* This only covers the most basic grub directives. Needs to be *) (* expanded to cover more (and more esoteric) directives *) (* It is good enough to handle the grub.conf on my Fedora 8 box *) (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: value_to_eol *) let value_to_eol = store /[^= \t\n][^\n]*[^= \t\n]|[^= \t\n]/ (* View: eol *) let eol = Util.eol (* View: spc *) let spc = Util.del_ws_spc (* View: opt_ws *) let opt_ws = Util.del_opt_ws "" (* View: dels *) let dels (s:string) = Util.del_str s (* View: eq *) let eq = dels "=" (* View: switch *) let switch (n:regexp) = dels "--" . key n (* View: switch_arg *) let switch_arg (n:regexp) = switch n . eq . store Rx.no_spaces (* View: value_sep *) let value_sep (dflt:string) = del /[ \t]*[ \t=][ \t]*/ dflt (* View: comment_re *) let comment_re = /([^ \t\n].*[^ \t\n]|[^ \t\n])/ - /# ## (Start|End) Default Options ##/ (* View: comment *) let comment = [ Util.indent . label "#comment" . del /#[ \t]*/ "# " . store comment_re . eol ] (* View: empty *) let empty = Util.empty (************************************************************************ * Group: USEFUL FUNCTIONS *************************************************************************) (* View: command *) let command (kw:regexp) (indent:string) = Util.del_opt_ws indent . key kw (* View: kw_arg *) let kw_arg (kw:regexp) (indent:string) (dflt_sep:string) = [ command kw indent . value_sep dflt_sep . value_to_eol . eol ] (* View: kw_boot_arg *) let kw_boot_arg (kw:regexp) = kw_arg kw "\t" " " (* View: kw_menu_arg *) let kw_menu_arg (kw:regexp) = kw_arg kw "" " " (* View: password_arg *) let password_arg = [ command "password" "" . (spc . [ switch "md5" ])? . (spc . [ switch "encrypted" ])? . spc . store (/[^ \t\n]+/ - /--[^ \t\n]+/) . (spc . [ label "file" . store /[^ \t\n]+/ ])? . eol ] (* View: kw_pres *) let kw_pres (kw:string) = [ opt_ws . key kw . eol ] (* View: error * Parse a line that looks almost like a valid setting, but isn't, * into an '#error' node. Any line that starts with letters, but not * anything matching kw, is considered an error line. * * Parameters: * kw:regexp - the valid keywords that are _not_ considered an * error *) let error (kw:regexp) = let not_kw = /[a-zA-Z]+/ - kw in [ label "#error" . Util.del_opt_ws "\t" . store (not_kw . /([^a-zA-Z\n].*[^ \t\n])?/) . eol ] (************************************************************************ * Group: BOOT ENTRIES *************************************************************************) (* View: device * This is a shell-only directive in upstream grub; the grub versions * in at least Fedora/RHEL use this to find devices for UEFI boot *) let device = [ command "device" "" . Sep.space . store /\([A-Za-z0-9_.-]+\)/ . spc . [ label "file" . value_to_eol ] . Util.eol ] (* View: color *) let color = (* Should we nail it down to exactly the color names that *) (* grub supports ? *) let color_name = store /[A-Za-z-]+/ in let color_spec = [ label "foreground" . color_name] . dels "/" . [ label "background" . color_name ] in [ opt_ws . key "color" . spc . [ label "normal" . color_spec ] . (spc . [ label "highlight" . color_spec ])? . eol ] (* View: serial *) let serial = [ command "serial" "" . [ spc . switch_arg /unit|port|speed|word|parity|stop|device/ ]* . eol ] (* View: terminal *) let terminal = [ command "terminal" "" . ([ spc . switch /dumb|no-echo|no-edit|silent/ ] |[ spc . switch_arg /timeout|lines/ ])* . [ spc . key /console|serial|hercules/ ]* . eol ] (* View: setkey *) let setkey = [ command "setkey" "" . ( spc . [ label "to" . store Rx.no_spaces ] . spc . [ label "from" . store Rx.no_spaces ] )? . eol ] (* View: menu_entry *) let menu_entry = kw_menu_arg "default" | kw_menu_arg "fallback" | kw_pres "hiddenmenu" | kw_menu_arg "timeout" | kw_menu_arg "splashimage" | kw_menu_arg "gfxmenu" | kw_menu_arg "foreground" | kw_menu_arg "background" | kw_menu_arg "verbose" | kw_menu_arg "boot" (* only for CLI, ignored in conf *) | serial | terminal | password_arg | color | device | setkey (* View: menu_error * Accept lines not matching menu_entry and stuff them into * '#error' nodes *) let menu_error = let kw = /default|fallback|hiddenmenu|timeout|splashimage|gfxmenu/ |/foreground|background|verbose|boot|password|title/ |/serial|setkey|terminal|color|device/ in error kw (* View: menu_setting * a valid menu setting or a line that looks like one but is an #error *) let menu_setting = menu_entry | menu_error (* View: title *) let title = del /title[ \t=]+/ "title " . value_to_eol . eol (* View: multiboot_arg * Permits a second form for Solaris multiboot kernels that * take a path (with a slash) as their first arg, e.g. * /boot/multiboot kernel/unix another=arg *) let multiboot_arg = [ label "@path" . store (Rx.word . "/" . Rx.no_spaces) ] (* View: kernel_args Parse the file name and args on a kernel or module line. *) let kernel_args = let arg = /[A-Za-z0-9_.$\+-]+/ - /type|no-mem-option/ in store /(\([a-z0-9,]+\))?\/[^ \t\n]*/ . (spc . multiboot_arg)? . (spc . [ key arg . (eq. store /([^ \t\n])*/)?])* . eol (* View: module_line Solaris extension adds module$ and kernel$ for variable interpolation *) let module_line = [ command /module\$?/ "\t" . spc . kernel_args ] (* View: map_line *) let map_line = [ command "map" "\t" . spc . [ label "from" . store /[()A-za-z0-9]+/ ] . spc . [ label "to" . store /[()A-za-z0-9]+/ ] . eol ] (* View: kernel *) let kernel = [ command /kernel\$?/ "\t" . (spc . ([switch "type" . eq . store /[a-z]+/] |[switch "no-mem-option"]))* . spc . kernel_args ] (* View: chainloader *) let chainloader = [ command "chainloader" "\t" . [ spc . switch "force" ]? . spc . store Rx.no_spaces . eol ] (* View: savedefault *) let savedefault = [ command "savedefault" "\t" . (spc . store Rx.integer)? . eol ] (* View: configfile *) let configfile = [ command "configfile" "\t" . spc . store Rx.no_spaces . eol ] (* View: boot_entry <boot> entries *) let boot_entry = let boot_arg_re = "root" | "initrd" | "rootnoverify" | "uuid" | "findroot" | "bootfs" (* Solaris extensions *) in kw_boot_arg boot_arg_re | kernel | chainloader | kw_pres "quiet" (* Seems to be a Ubuntu extension *) | savedefault | configfile | module_line | map_line | kw_pres "lock" | kw_pres "makeactive" | password_arg (* View: boot_error * Accept lines not matching boot_entry and stuff them into * '#error' nodes *) let boot_error = let kw = /lock|uuid|password|root|initrd|rootnoverify|findroot|bootfs/ |/configfile|chainloader|title|boot|quiet|kernel|module/ |/makeactive|savedefault|map/ in error kw (* View: boot_setting * a valid boot setting or a line that looks like one but is an #error *) let boot_setting = boot_entry | boot_error (* View: boot *) let boot = let line = ((boot_setting|comment)* . boot_setting)? in [ label "title" . title . line ] (************************************************************************ * Group: DEBIAN-SPECIFIC SECTIONS *************************************************************************) (* View: debian_header Header for a <debian>-specific section *) let debian_header = "## ## Start Default Options ##\n" (* View: debian_footer Footer for a <debian>-specific section *) let debian_footer = "## ## End Default Options ##\n" (* View: debian_comment_re *) let debian_comment_re = /([^ \t\n].*[^ \t\n]|[^ \t\n])/ - "## End Default Options ##" (* View: debian_comment A comment entry inside a <debian>-specific section *) let debian_comment = [ Util.indent . label "#comment" . del /##[ \t]*/ "## " . store debian_comment_re . eol ] (* View: debian_setting_re *) let debian_setting_re = "kopt" | "groot" | "alternative" | "lockalternative" | "defoptions" | "lockold" | "xenhopt" | "xenkopt" | "altoptions" | "howmany" | "memtest86" | "updatedefaultentry" | "savedefault" | "indomU" (* View: debian_entry *) let debian_entry = [ Util.del_str "#" . Util.indent . key debian_setting_re . del /[ \t]*=/ "=" . value_to_eol? . eol ] (* View: debian A debian-specific section, made of <debian_entry> lines *) let debian = [ label "debian" . del debian_header debian_header . (debian_comment|empty|debian_entry)* . del debian_footer debian_footer ] (************************************************************************ * Group: LENS AND FILTER *************************************************************************) (* View: lns *) let lns = (comment | empty | menu_setting | debian)* . (boot . (comment | empty | boot)*)? (* View: filter *) let filter = incl "/boot/grub/grub.conf" . incl "/boot/grub/menu.lst" . incl "/etc/grub.conf" let xfm = transform lns filter lenses/dist/solaris_system.aug 0000644 00000006234 15231153062 0012561 0 ustar 00 (* Module: Solaris_System Parses /etc/system on Solaris Author: Dominic Cleal <dcleal@redhat.com> About: Reference This lens tries to keep as close as possible to `man 4 system` 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/system on Solaris. See <filter>. *) module Solaris_System = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES ************************************************************************) (* View: comment *) let comment = Util.comment_generic /[ \t]*\*[ \t]*/ "* " (* View: empty Map empty lines, including empty asterisk comments *) let empty = [ del /[ \t]*\*?[ \t]*\n/ "\n" ] (* View: sep_colon The separator for key/value entries *) let sep_colon = del /:[ \t]*/ ": " (* View: sep_moddir The separator of directories in a moddir search path *) let sep_moddir = del /[: ]+/ " " (* View: modpath Individual moddir search path entry *) let modpath = [ seq "modpath" . store /[^ :\t\n]+/ ] (* Variable: set_operator Valid set operators: equals, bitwise AND and OR *) let set_operators = /[=&|]/ (* View: set_value Sets an integer value or char pointer *) let set_value = [ label "value" . store Rx.no_spaces ] (************************************************************************ * Group: COMMANDS ************************************************************************) (* View: cmd_kv Function for simple key/value setting commands such as rootfs *) let cmd_kv (cmd:string) (value:regexp) = Build.key_value_line cmd sep_colon (store value) (* View: cmd_moddir The moddir command for specifying module search paths *) let cmd_moddir = Build.key_value_line "moddir" sep_colon (Build.opt_list modpath sep_moddir) (* View: set_var Loads the variable name from a set command, no module *) let set_var = [ label "variable" . store Rx.word ] (* View: set_var Loads the module and variable names from a set command *) let set_varmod = [ label "module" . store Rx.word ] . Util.del_str ":" . set_var (* View: set_sep_spc *) let set_sep_spc = Util.del_opt_ws " " (* View: cmd_set The set command for individual kernel/module parameters *) let cmd_set = [ key "set" . Util.del_ws_spc . ( set_var | set_varmod ) . set_sep_spc . [ label "operator" . store set_operators ] . set_sep_spc . set_value . Util.eol ] (************************************************************************ * Group: LENS ************************************************************************) (* View: lns *) let lns = ( empty | comment | cmd_moddir | cmd_kv "rootdev" Rx.fspath | cmd_kv "rootfs" Rx.word | cmd_kv "exclude" Rx.fspath | cmd_kv "include" Rx.fspath | cmd_kv "forceload" Rx.fspath | cmd_set )* (* Variable: filter *) let filter = (incl "/etc/system") let xfm = transform lns filter lenses/dist/dovecot.aug 0000644 00000006553 15231153062 0011150 0 ustar 00 (* Module: Dovecot Parses dovecot configuration files. Author: Serge Smetana <serge.smetana@gmail.com> 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 <filter>. About: Examples The <Test_Dovecot> 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 "!" (* View: block_args Map block arguments after block name and before "{" *) let block_args = Sep.space . store /([A-Za-z0-9\/\\_-]+|\"[A-Za-z0-9 ]*\")/ (****************************************************************** * 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 ] let mailbox = [ indent . key /mailbox/ . block_args? . 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 . block_args? . 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") . Util.stdexcl let xfm = transform lns filter lenses/dist/xorg.aug 0000644 00000024171 15231153062 0010460 0 ustar 00 (* Module: Xorg Parses /etc/X11/xorg.conf Authors: Raphael Pinson <raphink@gmail.com> Matthew Booth <mbooth@redhat.com> About: Reference This lens tries to keep as close as possible to `man xorg.conf` where possible. The definitions from `man xorg.conf` are put as commentaries for reference throughout the file. More information can be found in the manual. About: License This file is licensed under the LGPLv2+, like the rest of Augeas. About: Lens Usage Sample usage of this lens in augtool * Get the identifier of the devices with a "Clone" option: > match "/files/etc/X11/xorg.conf/Device[Option = 'Clone']/Identifier" About: Configuration files This lens applies to /etc/X11/xorg.conf. See <filter>. *) module Xorg = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Generic primitives *) (* Variable: eol *) let eol = Util.eol (* Variable: to_eol * Match everything from here to eol, cropping whitespace at both ends *) let to_eol = /[^ \t\n](.*[^ \t\n])?/ (* Variable: indent *) let indent = Util.indent (* Variable: comment *) let comment = Util.comment (* Variable: empty *) let empty = Util.empty (* Group: Separators *) (* Variable: sep_spc *) let sep_spc = Util.del_ws_spc (* Variable: sep_dquote *) let sep_dquote = Util.del_str "\"" (* Group: Fields and values *) (* Variable: entries_re * This is a list of all patterns which have specific handlers, and should * therefore not be matched by the generic handler *) let entries_re = /([oO]ption|[sS]creen|[iI]nput[dD]evice|[dD]river|[sS]ub[sS]ection|[dD]isplay|[iI]dentifier|[vV]ideo[rR]am|[dD]efault[dD]epth|[dD]evice)/ (* Variable: generic_entry_re *) let generic_entry_re = /[^# \t\n\/]+/ - entries_re (* Variable: quoted_string_val *) let quoted_string_val = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\"" (* " relax, emacs *) (* Variable: int *) let int = /[0-9]+/ (************************************************************************ * Group: ENTRIES AND OPTIONS *************************************************************************) (* View: entry_int * This matches an entry which takes a single integer for an argument *) let entry_int (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . store int . eol ] (* View: entry_rgb * This matches an entry which takes 3 integers as arguments representing red, * green and blue components *) let entry_rgb (canon:string) (re:regexp) = [ indent . del re canon . label canon . [ label "red" . sep_spc . store int ] . [ label "green" . sep_spc . store int ] . [ label "blue" . sep_spc . store int ] . eol ] (* View: entry_xy * This matches an entry which takes 2 integers as arguments representing X and * Y coordinates *) let entry_xy (canon:string) (re:regexp) = [ indent . del re canon . label canon . [ label "x" . sep_spc . store int ] . [ label "y" . sep_spc . store int ] . eol ] (* View: entry_str * This matches an entry which takes a single quoted string *) let entry_str (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . quoted_string_val . eol ] (* View: entry_generic * An entry without a specific handler. Store everything after the keyword, * cropping whitespace at both ends. *) let entry_generic = [ indent . key generic_entry_re . sep_spc . store to_eol . eol ] (* View: option *) let option = [ indent . del /[oO]ption/ "Option" . label "Option" . sep_spc . quoted_string_val . [ label "value" . sep_spc . quoted_string_val ]* . eol ] (* View: screen * The Screen entry of ServerLayout *) let screen = [ indent . del /[sS]creen/ "Screen" . label "Screen" . [ sep_spc . label "num" . store int ]? . ( sep_spc . quoted_string_val . [ sep_spc . label "position" . store to_eol ]? )? . eol ] (* View: input_device *) let input_device = [ indent . del /[iI]nput[dD]evice/ "InputDevice" . label "InputDevice" . sep_spc . quoted_string_val . [ label "option" . sep_spc . quoted_string_val ]* . eol ] (* View: driver *) let driver = entry_str "Driver" /[dD]river/ (* View: identifier *) let identifier = entry_str "Identifier" /[iI]dentifier/ (* View: videoram *) let videoram = entry_int "VideoRam" /[vV]ideo[rR]am/ (* View: default_depth *) let default_depth = entry_int "DefaultDepth" /[dD]efault[dD]epth/ (* View: device *) let device = entry_str "Device" /[dD]evice/ (************************************************************************ * Group: DISPLAY SUBSECTION *************************************************************************) (* View: display_modes *) let display_modes = [ indent . del /[mM]odes/ "Modes" . label "Modes" . [ label "mode" . sep_spc . quoted_string_val ]+ . eol ] (************************************************************************* * View: display_entry * Known values for entries in the Display subsection * * Definition: * > Depth depth * > FbBpp bpp * > Weight red-weight green-weight blue-weight * > Virtual xdim ydim * > ViewPort x0 y0 * > Modes "mode-name" ... * > Visual "visual-name" * > Black red green blue * > White red green blue * > Options *) let display_entry = entry_int "Depth" /[dD]epth/ | entry_int "FbBpp" /[fF]b[bB]pp/ | entry_rgb "Weight" /[wW]eight/ | entry_xy "Virtual" /[vV]irtual/ | entry_xy "ViewPort" /[vV]iew[pP]ort/ | display_modes | entry_str "Visual" /[vV]isual/ | entry_rgb "Black" /[bB]lack/ | entry_rgb "White" /[wW]hite/ | entry_str "Options" /[oO]ptions/ | empty | comment (* View: display *) let display = [ indent . del "SubSection" "SubSection" . sep_spc . sep_dquote . key "Display" . sep_dquote . eol . display_entry* . indent . del "EndSubSection" "EndSubSection" . eol ] (************************************************************************ * Group: EXTMOD SUBSECTION *************************************************************************) let extmod_entry = entry_str "Option" /[oO]ption/ | empty | comment let extmod = [ indent . del "SubSection" "SubSection" . sep_spc . sep_dquote . key "extmod" . sep_dquote . eol . extmod_entry* . indent . del "EndSubSection" "EndSubSection" . eol ] (************************************************************************ * Group: SECTIONS *************************************************************************) (************************************************************************ * Variable: section_re * Known values for Section names * * Definition: * > The section names are: * > * > Files File pathnames * > ServerFlags Server flags * > Module Dynamic module loading * > Extensions Extension Enabling * > InputDevice Input device description * > InputClass Input Class description * > Device Graphics device description * > VideoAdaptor Xv video adaptor description * > Monitor Monitor description * > Modes Video modes descriptions * > Screen Screen configuration * > ServerLayout Overall layout * > DRI DRI-specific configuration * > Vendor Vendor-specific configuration *************************************************************************) let section_re = /(Extensions|Files|ServerFlags|Module|InputDevice|InputClass|Device|VideoAdaptor|Monitor|Modes|Screen|ServerLayout|DRI|Vendor)/ (************************************************************************ * Variable: secton_re_obsolete * The following obsolete section names are still recognised for * compatibility purposes. In new config files, the InputDevice * section should be used instead. * * Definition: * > Keyboard Keyboard configuration * > Pointer Pointer/mouse configuration *************************************************************************) let section_re_obsolete = /(Keyboard|Pointer)/ (* View: section_entry *) let section_entry = option | screen | display | extmod | input_device | driver | identifier | videoram | default_depth | device | entry_generic | empty | comment (************************************************************************ * View: section * A section in xorg.conf * * Definition: * > Section "SectionName" * > SectionEntry * > ... * > EndSection *************************************************************************) let section = [ indent . del "Section" "Section" . sep_spc . sep_dquote . key (section_re|section_re_obsolete) . sep_dquote . eol . section_entry* . indent . del "EndSection" "EndSection" . eol ] (* * View: lns * The xorg.conf lens *) let lns = ( empty | comment | section )* (* Variable: filter *) let filter = incl "/etc/X11/xorg.conf" . incl "/etc/X11/xorg.conf.d/*.conf" . Util.stdexcl let xfm = transform lns filter lenses/dist/rsyslog.aug 0000644 00000004016 15231153062 0011177 0 ustar 00 (* Module: Rsyslog Parses /etc/rsyslog.conf Author: Raphael Pinson <raphael.pinsons@camptocamp.com> About: Reference This lens tries to keep as close as possible to `man 5 rsyslog.conf` 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/rsyslog.conf. See <filter>. About: Examples The <Test_Rsyslog> file contains various examples and tests. *) module Rsyslog = autoload xfm let macro_rx = /[^,# \n\t][^#\n]*[^,# \n\t]|[^,# \n\t]/ let macro = [ key /$[A-Za-z0-9]+/ . Sep.space . store macro_rx . Util.comment_or_eol ] (* View: users Map :omusrmsg: and a list of users, or a single * *) let omusrmsg = Util.del_str ":omusrmsg:" . Syslog.label_opt_list_or "omusrmsg" (store Syslog.word) Syslog.comma "*" (* View: file_tmpl File action with a specified template *) let file_tmpl = Syslog.file . [ label "template" . Util.del_str ";" . store Rx.word ] let action = Syslog.action | omusrmsg | file_tmpl (* View: entry An entry contains selectors and an action *) let entry = [ label "entry" . Syslog.selectors . Syslog.sep_tab . [ label "action" . action ] . Util.eol ] (* View: prop_filter Parses property-based filters, which start with ":" and the property name *) let prop_filter = let sep = Sep.comma . Util.del_ws_spc in let prop_name = [ Util.del_str ":" . label "property" . store Rx.word ] in let prop_oper = [ label "operation" . store /[A-Za-z!-]+/ ] in let prop_val = [ label "value" . Quote.do_dquote (store /[^\n"]*/) ] in let prop_act = [ label "action" . action ] in [ label "filter" . prop_name . sep . prop_oper . sep . prop_val . Sep.space . prop_act . Util.eol ] let entries = ( Syslog.empty | Syslog.comment | entry | macro | prop_filter )* let lns = entries . ( Syslog.program | Syslog.hostname )* let filter = incl "/etc/rsyslog.conf" let xfm = transform lns filter lenses/dist/interfaces.aug 0000644 00000010515 15231153062 0011621 0 ustar 00 (* Intefraces module for Augeas Author: Free Ekanayaka <free@64studio.com> 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 reseverved words and multi-value options*) let stanza_word = /(source|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 ] (************************************************************************ * 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 a iface or mapping block *) let stanza_single = (auto|allow|source) . (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 lenses/dist/protocols.aug 0000644 00000002070 15231153062 0011517 0 ustar 00 (* Module: Protocols Parses /etc/protocols Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 protocols` 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/protocols. See <filter>. About: Examples The <Test_Protocols> file contains various examples and tests. *) module Protocols = autoload xfm let protoname = /[^# \t\n]+/ (* View: entry *) let entry = let protocol = [ label "protocol" . store protoname ] in let number = [ label "number" . store Rx.integer ] in let alias = [ label "alias" . store protoname ] in [ seq "protocol" . protocol . Sep.space . number . (Sep.space . Build.opt_list alias Sep.space)? . Util.comment_or_eol ] (* View: lns The protocols lens *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = incl "/etc/protocols" let xfm = transform lns filter lenses/dist/postfix_sasl_smtpd.aug 0000644 00000001174 15231153062 0013424 0 ustar 00 module Postfix_sasl_smtpd = autoload xfm let eol = Util.eol let colon = del /:[ \t]*/ ": " let value_to_eol = store Rx.space_in let simple_entry (kw:string) = [ key kw . colon . value_to_eol . eol ] let entries = simple_entry "pwcheck_method" | simple_entry "auxprop_plugin" | simple_entry "saslauthd_path" | simple_entry "mech_list" | simple_entry "sql_engine" | simple_entry "log_level" | simple_entry "auto_transition" let lns = entries+ let filter = incl "/etc/postfix/sasl/smtpd.conf" let xfm = transform lns filter lenses/dist/sudoers.aug 0000644 00000047345 15231153062 0011175 0 ustar 00 (* Module: Sudoers Parses /etc/sudoers Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man sudoers` where possible. For example, recursive definitions such as > Cmnd_Spec_List ::= Cmnd_Spec | > Cmnd_Spec ',' Cmnd_Spec_List are replaced by > let cmnd_spec_list = cmnd_spec . ( sep_com . cmnd_spec )* since Augeas cannot deal with recursive definitions. The definitions from `man sudoers` are put as commentaries for reference throughout the file. More information can be found in the manual. About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Lens Usage Sample usage of this lens in augtool * Set first Defaults to apply to the "LOCALNET" network alias > set /files/etc/sudoers/Defaults[1]/type "@LOCALNET" * List all user specifications applying explicitely to the "admin" Unix group > match /files/etc/sudoers/spec/user "%admin" * Remove the full 3rd user specification > rm /files/etc/sudoers/spec[3] About: Configuration files This lens applies to /etc/sudoers. See <filter>. *) module Sudoers = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Generic primitives *) (* Variable: eol *) let eol = Util.eol (* Variable: indent *) let indent = Util.indent (* Group: Separators *) (* Variable: sep_spc *) let sep_spc = Sep.space (* Variable: sep_cont *) let sep_cont = Sep.cl_or_space (* Variable: sep_cont_opt *) let sep_cont_opt = Sep.cl_or_opt_space (* Variable: sep_cont_opt_build *) let sep_cont_opt_build (sep:string) = del (Rx.cl_or_opt_space . sep . Rx.cl_or_opt_space) (" " . sep . " ") (* Variable: sep_com *) let sep_com = sep_cont_opt_build "," (* Variable: sep_eq *) let sep_eq = sep_cont_opt_build "=" (* Variable: sep_col *) let sep_col = sep_cont_opt_build ":" (* Variable: sep_dquote *) let sep_dquote = Util.del_str "\"" (* Group: Stores *) (* Variable: sto_to_com_cmnd sto_to_com_cmnd does not begin or end with a space *) let sto_to_com_cmnd = let alias = Rx.word - /(NO)?(PASSWD|EXEC|SETENV)/ in let non_alias = /(!?[\/a-z]([^,:#()\n\\]|\\\\[=:,\\])*[^,=:#() \t\n\\])|[^,=:#() \t\n\\]/ in store (alias | non_alias) (* Variable: sto_to_com There could be a \ in the middle of a command *) let sto_to_com = store /([^,=:#() \t\n\\][^,=:#()\n]*[^,=:#() \t\n\\])|[^,=:#() \t\n\\]/ (* Variable: sto_to_com_host *) let sto_to_com_host = store /[^,=:#() \t\n\\]+/ (* Variable: sto_to_com_user Escaped spaces and NIS domains and allowed*) let sto_to_com_user = let nis_re = /([A-Z]([-A-Z0-9]|(\\\\[ \t]))*+\\\\\\\\)/ in let user_re = /[%+@a-z]([-A-Za-z0-9._+]|(\\\\[ \t]))*/ in let alias_re = /[A-Z_]+/ in store ((nis_re? . user_re) | alias_re) (* Variable: to_com_chars *) let to_com_chars = /[^",=#() \t\n\\]+/ (* " relax emacs *) (* Variable: to_com_dquot *) let to_com_dquot = /"[^",=#()\n\\]+"/ (* " relax emacs *) (* Variable: sto_to_com_dquot *) let sto_to_com_dquot = store (to_com_chars|to_com_dquot) (* Variable: sto_to_com_col *) let sto_to_com_col = store to_com_chars (* Variable: sto_to_eq *) let sto_to_eq = store /[^,=:#() \t\n\\]+/ (* Variable: sto_to_spc *) let sto_to_spc = store /[^", \t\n\\]+|"[^", \t\n\\]+"/ (* Variable: sto_to_spc_no_dquote *) let sto_to_spc_no_dquote = store /[^",# \t\n\\]+/ (* " relax emacs *) (* Variable: sto_integer *) let sto_integer = store /[0-9]+/ (* Group: Comments and empty lines *) (* View: comment Map comments in "#comment" nodes *) let comment = let sto_to_eol = store (/([^ \t\n].*[^ \t\n]|[^ \t\n])/ - /include(dir)?.*/) in [ label "#comment" . del /[ \t]*#[ \t]*/ "# " . sto_to_eol . eol ] (* View: comment_eol Requires a space before the # *) let comment_eol = Util.comment_generic /[ \t]+#[ \t]*/ " # " (* View: comment_or_eol A <comment_eol> or <eol> *) let comment_or_eol = comment_eol | (del /([ \t]+#\n|[ \t]*\n)/ "\n") (* View: empty Map empty lines *) let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ] (* View: includedir *) let includedir = [ key /#include(dir)?/ . Sep.space . store Rx.fspath . eol ] (************************************************************************ * Group: ALIASES *************************************************************************) (************************************************************************ * View: alias_field * Generic alias field to gather all Alias definitions * * Definition: * > User_Alias ::= NAME '=' User_List * > Runas_Alias ::= NAME '=' Runas_List * > Host_Alias ::= NAME '=' Host_List * > Cmnd_Alias ::= NAME '=' Cmnd_List * * Parameters: * kw:string - the label string * sto:lens - the store lens *************************************************************************) let alias_field (kw:string) (sto:lens) = [ label kw . sto ] (* View: alias_list List of <alias_fields>, separated by commas *) let alias_list (kw:string) (sto:lens) = Build.opt_list (alias_field kw sto) sep_com (************************************************************************ * View: alias_name * Name of an <alias_entry_single> * * Definition: * > NAME ::= [A-Z]([A-Z][0-9]_)* *************************************************************************) let alias_name = [ label "name" . store /[A-Z][A-Z0-9_]*/ ] (************************************************************************ * View: alias_entry_single * Single <alias_entry>, named using <alias_name> and listing <alias_list> * * Definition: * > Alias_Type NAME = item1, item2, ... * * Parameters: * field:string - the field name, passed to <alias_list> * sto:lens - the store lens, passed to <alias_list> *************************************************************************) let alias_entry_single (field:string) (sto:lens) = [ label "alias" . alias_name . sep_eq . alias_list field sto ] (************************************************************************ * View: alias_entry * Alias entry, a list of comma-separated <alias_entry_single> fields * * Definition: * > Alias_Type NAME = item1, item2, item3 : NAME = item4, item5 * * Parameters: * kw:string - the alias keyword string * field:string - the field name, passed to <alias_entry_single> * sto:lens - the store lens, passed to <alias_entry_single> *************************************************************************) let alias_entry (kw:string) (field:string) (sto:lens) = [ indent . key kw . sep_cont . alias_entry_single field sto . ( sep_col . alias_entry_single field sto )* . comment_or_eol ] (* TODO: go further in user definitions *) (* View: user_alias User_Alias, see <alias_field> *) let user_alias = alias_entry "User_Alias" "user" sto_to_com (* View: runas_alias Run_Alias, see <alias_field> *) let runas_alias = alias_entry "Runas_Alias" "runas_user" sto_to_com (* View: host_alias Host_Alias, see <alias_field> *) let host_alias = alias_entry "Host_Alias" "host" sto_to_com (* View: cmnd_alias Cmnd_Alias, see <alias_field> *) let cmnd_alias = alias_entry "Cmnd_Alias" "command" sto_to_com_cmnd (************************************************************************ * View: alias * Every kind of Alias entry, * see <user_alias>, <runas_alias>, <host_alias> and <cmnd_alias> * * Definition: * > Alias ::= 'User_Alias' User_Alias (':' User_Alias)* | * > 'Runas_Alias' Runas_Alias (':' Runas_Alias)* | * > 'Host_Alias' Host_Alias (':' Host_Alias)* | * > 'Cmnd_Alias' Cmnd_Alias (':' Cmnd_Alias)* *************************************************************************) let alias = user_alias | runas_alias | host_alias | cmnd_alias (************************************************************************ * Group: DEFAULTS *************************************************************************) (************************************************************************ * View: default_type * Type definition for <defaults> * * Definition: * > Default_Type ::= 'Defaults' | * > 'Defaults' '@' Host_List | * > 'Defaults' ':' User_List | * > 'Defaults' '!' Cmnd_List | * > 'Defaults' '>' Runas_List *************************************************************************) let default_type = let value = store /[@:!>][^ \t\n\\]+/ in [ label "type" . value ] (************************************************************************ * View: del_negate * Delete an even number of '!' signs *************************************************************************) let del_negate = del /(!!)*/ "" (************************************************************************ * View: negate_node * Negation of boolean values for <defaults>. Accept one optional '!' * and produce a 'negate' node if there is one. *************************************************************************) let negate_node = [ del "!" "!" . label "negate" ] let negate_or_value (key:lens) (value:lens) = [ del_negate . (negate_node . key | key . value) ] (************************************************************************ * View: parameter_flag * A flag parameter for <defaults> * * Flags are implicitly boolean and can be turned off via the '!' operator. * Some integer, string and list parameters may also be used in a boolean * context to disable them. *************************************************************************) let parameter_flag_kw = "always_set_home" | "authenticate" | "env_editor" | "env_reset" | "fqdn" | "ignore_dot" | "ignore_local_sudoers" | "insults" | "log_host" | "log_year" | "long_otp_prompt" | "mail_always" | "mail_badpass" | "mail_no_host" | "mail_no_perms" | "mail_no_user" | "noexec" | "path_info" | "passprompt_override" | "preserve_groups" | "requiretty" | "root_sudo" | "rootpw" | "runaspw" | "set_home" | "set_logname" | "setenv" | "shell_noargs" | "stay_setuid" | "targetpw" | "tty_tickets" | "visiblepw" | "closefrom_override" | "closefrom_override" | "compress_io" | "fast_glob" | "log_input" | "log_output" | "pwfeedback" | "umask_override" | "use_pty" | "match_group_by_gid" | "always_query_group_plugin" let parameter_flag = [ del_negate . negate_node? . key parameter_flag_kw ] (************************************************************************ * View: parameter_integer * An integer parameter for <defaults> *************************************************************************) let parameter_integer_nobool_kw = "passwd_tries" let parameter_integer_nobool = [ key parameter_integer_nobool_kw . sep_eq . del /"?/ "" . sto_integer . del /"?/ "" ] let parameter_integer_bool_kw = "loglinelen" | "passwd_timeout" | "timestamp_timeout" | "umask" let parameter_integer_bool = negate_or_value (key parameter_integer_bool_kw) (sep_eq . del /"?/ "" . sto_integer . del /"?/ "") let parameter_integer = parameter_integer_nobool | parameter_integer_bool (************************************************************************ * View: parameter_string * A string parameter for <defaults> * * An odd number of '!' operators negate the value of the item; * an even number just cancel each other out. *************************************************************************) let parameter_string_nobool_kw = "badpass_message" | "editor" | "mailsub" | "noexec_file" | "passprompt" | "runas_default" | "syslog_badpri" | "syslog_goodpri" | "timestampdir" | "timestampowner" | "secure_path" let parameter_string_nobool = [ key parameter_string_nobool_kw . sep_eq . sto_to_com_dquot ] let parameter_string_bool_kw = "exempt_group" | "lecture" | "lecture_file" | "listpw" | "logfile" | "mailerflags" | "mailerpath" | "mailto" | "mailfrom" | "syslog" | "verifypw" let parameter_string_bool = negate_or_value (key parameter_string_bool_kw) (sep_eq . sto_to_com_dquot) let parameter_string = parameter_string_nobool | parameter_string_bool (************************************************************************ * View: parameter_lists * A single list parameter for <defaults> * * All lists can be used in a boolean context * The argument may be a double-quoted, space-separated list or a single * value without double-quotes. * The list can be replaced, added to, deleted from, or disabled * by using the =, +=, -=, and ! operators respectively. * An odd number of '!' operators negate the value of the item; * an even number just cancel each other out. *************************************************************************) let parameter_lists_kw = "env_check" | "env_delete" | "env_keep" let parameter_lists_value = [ label "var" . sto_to_spc_no_dquote ] let parameter_lists_value_dquote = [ label "var" . del /"?/ "" . sto_to_spc_no_dquote . del /"?/ "" ] let parameter_lists_values = parameter_lists_value_dquote | ( sep_dquote . parameter_lists_value . ( sep_cont . parameter_lists_value )+ . sep_dquote ) let parameter_lists_sep = sep_cont_opt . ( [ del "+" "+" . label "append" ] | [ del "-" "-" . label "remove" ] )? . del "=" "=" . sep_cont_opt let parameter_lists = negate_or_value (key parameter_lists_kw) (parameter_lists_sep . parameter_lists_values) (************************************************************************ * View: parameter * A single parameter for <defaults> * * Definition: * > Parameter ::= Parameter '=' Value | * > Parameter '+=' Value | * > Parameter '-=' Value | * > '!'* Parameter * * Parameters may be flags, integer values, strings, or lists. * *************************************************************************) let parameter = parameter_flag | parameter_integer | parameter_string | parameter_lists (************************************************************************ * View: parameter_list * A list of comma-separated <parameters> for <defaults> * * Definition: * > Parameter_List ::= Parameter | * > Parameter ',' Parameter_List *************************************************************************) let parameter_list = parameter . ( sep_com . parameter )* (************************************************************************ * View: defaults * A Defaults entry * * Definition: * > Default_Entry ::= Default_Type Parameter_List *************************************************************************) let defaults = [ indent . key "Defaults" . default_type? . sep_cont . parameter_list . comment_or_eol ] (************************************************************************ * Group: USER SPECIFICATION *************************************************************************) (************************************************************************ * View: runas_spec * A runas specification for <spec>, using <alias_list> for listing * users and/or groups used to run a command * * Definition: * > Runas_Spec ::= '(' Runas_List ')' | * > '(:' Runas_List ')' | * > '(' Runas_List ':' Runas_List ')' *************************************************************************) let runas_spec_user = alias_list "runas_user" sto_to_com let runas_spec_group = Util.del_str ":" . indent . alias_list "runas_group" sto_to_com let runas_spec_usergroup = runas_spec_user . indent . runas_spec_group let runas_spec = Util.del_str "(" . (runas_spec_user | runas_spec_group | runas_spec_usergroup ) . Util.del_str ")" . sep_cont_opt (************************************************************************ * View: tag_spec * Tag specification for <spec> * * Definition: * > Tag_Spec ::= ('NOPASSWD:' | 'PASSWD:' | 'NOEXEC:' | 'EXEC:' | * > 'SETENV:' | 'NOSETENV:') *************************************************************************) let tag_spec = [ label "tag" . store /(NO)?(PASSWD|EXEC|SETENV)/ . sep_col ] (************************************************************************ * View: cmnd_spec * Command specification for <spec>, * with optional <runas_spec> and any amount of <tag_specs> * * Definition: * > Cmnd_Spec ::= Runas_Spec? Tag_Spec* Cmnd *************************************************************************) let cmnd_spec = [ label "command" . runas_spec? . tag_spec* . sto_to_com_cmnd ] (************************************************************************ * View: cmnd_spec_list * A list of comma-separated <cmnd_specs> * * Definition: * > Cmnd_Spec_List ::= Cmnd_Spec | * > Cmnd_Spec ',' Cmnd_Spec_List *************************************************************************) let cmnd_spec_list = Build.opt_list cmnd_spec sep_com (************************************************************************ * View: spec_list * Group of hosts with <cmnd_spec_list> *************************************************************************) let spec_list = [ label "host_group" . alias_list "host" sto_to_com_host . sep_eq . cmnd_spec_list ] (************************************************************************ * View: spec * A user specification, listing colon-separated <spec_lists> * * Definition: * > User_Spec ::= User_List Host_List '=' Cmnd_Spec_List \ * > (':' Host_List '=' Cmnd_Spec_List)* *************************************************************************) let spec = [ label "spec" . indent . alias_list "user" sto_to_com_user . sep_cont . Build.opt_list spec_list sep_col . comment_or_eol ] (************************************************************************ * Group: LENS & FILTER *************************************************************************) (* View: lns The sudoers lens, any amount of * <empty> lines * <comments> * <includedirs> * <aliases> * <defaults> * <specs> *) let lns = ( empty | comment | includedir | alias | defaults | spec )* (* View: filter *) let filter = (incl "/etc/sudoers") . (incl "/usr/local/etc/sudoers") . (incl "/etc/sudoers.d/*") . (incl "/usr/local/etc/sudoers.d/*") . (incl "/opt/csw/etc/sudoers") . (incl "/etc/opt/csw/sudoers") . Util.stdexcl let xfm = transform lns filter lenses/dist/authorized_keys.aug 0000644 00000003533 15231153062 0012711 0 ustar 00 (* Module: Authorized_Keys Parses SSH authorized_keys Author: Raphael Pinson <raphael.pinson@camptocamp.com> 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 <filter>. About: Examples The <Test_Authorized_Keys> 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 <option>s *) let key_options = [ label "options" . Build.opt_list option Sep.comma ] (* View: key_type *) let key_type = let key_type_re = /ecdsa-sha2-nistp[0-9]+/ | /ssh-[a-z0-9]+/ in [ label "type" . store key_type_re ] (* View: key_comment *) let key_comment = [ label "comment" . store Rx.space_in ] (* View: authorized_key *) let authorized_key = [ label "key" . (key_options . Sep.space)? . key_type . Sep.space . store Rx.no_spaces . (Sep.space . key_comment)? . Util.eol ] (* View: lns The authorized_keys lens *) let lns = ( Util.empty | Util.comment | authorized_key)* (* Variable: filter *) let filter = incl (Sys.getenv("HOME") . "/.ssh/authorized_keys") let xfm = transform lns filter lenses/dist/darkice.aug 0000644 00000001405 15231153062 0011076 0 ustar 00 (* Darkice module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: man 5 darkice.cfg *) module Darkice = autoload xfm (************************************************************************ * INI File settings *************************************************************************) let comment = IniFile.comment IniFile.comment_re IniFile.comment_default let sep = IniFile.sep IniFile.sep_re IniFile.sep_default let entry_re = ( /[A-Za-z0-9][A-Za-z0-9._-]*/ ) let entry = IniFile.entry entry_re sep comment let title = IniFile.title_label "target" IniFile.record_label_re let record = IniFile.record title entry let lns = IniFile.lns record comment let filter = (incl "/etc/darkice.cfg") let xfm = transform lns filter lenses/dist/mailscanner_rules.aug 0000644 00000005537 15231153062 0013214 0 ustar 00 (* Module: Mailscanner_rules Parses MailScanner rules files. Author: Andrew Colin Kissa <andrew@topdog.za.net> Baruwa Enterprise Edition http://www.baruwa.com About: License This file is licensed under the LGPL v2+. About: Configuration files This lens applies to MailScanner rules files The format is described below: # NOTE: Fields are separated by TAB characters --- Important! # # Syntax is allow/deny/deny+delete/rename/rename to replacement-text/email-addresses, # then regular expression, # then log text, # then user report text. # The "email-addresses" can be a space or comma-separated list of email # addresses. If the rule hits, the message will be sent to these address(es) # instead of the original recipients. # If a rule is a "rename" rule, then the attachment filename will be renamed # according to the "Default Rename Pattern" setting in MailScanner.conf. # If a rule is a "rename" rule and the "to replacement-text" is supplied, then # the text matched by the regular expression in the 2nd field of the line # will be replaced with the "replacement-text" string. # For example, the rule # rename to .ppt \.pps$ Renamed .pps to .ppt Renamed .pps to .ppt # will find all filenames ending in ".pps" and rename them so they end in # ".ppt" instead. *) module Mailscanner_Rules = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = del /\n/ "\n" let ws = del /[\t]+/ "\t" let comment = Util.comment let empty = Util.empty let action = /allow|deny|deny\+delete|rename|rename[ ]+to[ ]+[^# \t\n]+|([A-Za-z0-9_+.-]+@[A-Za-z0-9_.-]+[, ]?)+/ let non_space = /[^# \t\n]+/ let non_tab = /[^\t\n]+/ let field (l:string) (r:regexp) = [ label l . store r ] (************************************************************************ * ENTRIES *************************************************************************) let entry = [ seq "rule" . field "action" action . ws . field "regex" non_tab . ws . field "log-text" non_tab . ws . field "user-report" non_tab . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry)* let filter = (incl "/etc/MailScanner/filename.rules.conf") . (incl "/etc/MailScanner/filetype.rules.conf") . (incl "/etc/MailScanner/archives.filename.rules.conf") . (incl "/etc/MailScanner/archives.filetype.rules.conf") let xfm = transform lns filter lenses/dist/aptconf.aug 0000644 00000007620 15231153062 0011133 0 ustar 00 (* Module: AptConf Parses /etc/apt/apt.conf and /etc/apt/apt.conf.d/* Author: Raphael Pinson <raphink@gmail.com> About: Reference This lens tries to keep as close as possible to `man 5 apt.conf` 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/apt/apt.conf and /etc/apt/apt.conf.d/*. See <filter>. *) module AptConf = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: eol And <Util.eol> end of line *) let eol = Util.eol (* View: empty A C-style empty line *) let empty = Util.empty_c_style (* View: indent An indentation *) let indent = Util.indent (* View: comment_simple A one-line comment, C-style *) let comment_simple = Util.comment_c_style (* View: comment_multi A multiline comment, C-style *) let comment_multi = Util.comment_multiline (* View: comment A comment, either <comment_simple> or <comment_multi> *) let comment = comment_simple | comment_multi (************************************************************************ * Group: ENTRIES *************************************************************************) (* View: name_re Regex for entry names *) let name_re = /[A-Za-z][A-Za-z-]*/ (* View: name_re_colons Regex for entry names with colons *) let name_re_colons = /[A-Za-z][A-Za-z:-]*/ (* View: entry An apt.conf entry, recursive WARNING: This lens exploits a put ambiguity since apt.conf allows for both APT { Clean-Installed { "true" } } and APT::Clean-Installed "true"; but we're chosing to map them the same way The recursive lens doesn't seem to care and defaults to the first item in the union. This is why the APT { Clean-Installed { "true"; } } form is listed first, since it supports all subnodes (which Dpkg::Conf) doesn't. Exchanging these two expressions in the union makes tests fails since the tree cannot be mapped back. This situation results in existing configuration being modified when the associated tree is modified. For example, changing the value of APT::Clean-Installed "true"; to "false" results in APT { Clean-Installed "false"; } (see unit tests) *) let rec entry_noeol = let value = Util.del_str "\"" . store /[^"\n]+/ . del /";?/ "\";" in let opt_eol = del /[ \t\n]*/ "\n" in let long_eol = del /[ \t]*\n+/ "\n" in let list_elem = [ opt_eol . label "@elem" . value ] in let eol_comment = del /([ \t\n]*\n)?/ "" . comment in [ key name_re . Sep.space . value ] | [ key name_re . del /[ \t\n]*\{/ " {" . ( (opt_eol . entry_noeol) | list_elem | eol_comment )* . del /[ \t\n]*\};?/ "\n};" ] | [ key name_re . Util.del_str "::" . entry_noeol ] let entry = indent . entry_noeol . eol (* View: include A file inclusion /!\ The manpage is not clear on the syntax *) let include = [ indent . key "#include" . Sep.space . store Rx.fspath . eol ] (* View: clear A list of variables to clear /!\ The manpage is not clear on the syntax *) let clear = let name = [ label "name" . store name_re_colons ] in [ indent . key "#clear" . Sep.space . Build.opt_list name Sep.space . eol ] (************************************************************************ * Group: LENS AND FILTER *************************************************************************) (* View: lns The apt.conf lens *) let lns = (empty|comment|entry|include|clear)* (* View: filter *) let filter = incl "/etc/apt/apt.conf" . incl "/etc/apt/apt.conf.d/*" . Util.stdexcl let xfm = transform lns filter lenses/dist/simplelines.aug 0000644 00000002137 15231153062 0012023 0 ustar 00 (* Module: Simplelines Parses simple lines conffiles Author: Raphael Pinson <raphink@gmail.com> About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files See <filter>. About: Examples The <Test_Simplelines> file contains various examples and tests. *) module Simplelines = autoload xfm (* View: line A simple, uncommented, line *) let line = let line_re = /[^# \t\n].*[^ \t\n]|[^# \t\n]/ in [ seq "line" . Util.indent . store line_re . Util.eol ] (* View: lns The simplelines lens *) let lns = (Util.empty | Util.comment | line)* (* Variable: filter *) let filter = incl "/etc/at.allow" . incl "/etc/at.deny" . incl "/etc/cron.allow" . incl "/etc/cron.deny" . incl "/etc/cron.d/at.allow" . incl "/etc/cron.d/at.deny" . incl "/etc/cron.d/cron.allow" . incl "/etc/cron.d/cron.deny" . incl "/etc/default/grub_installdevice" . incl "/etc/pam.d/allow.pamlist" let xfm = transform lns filter lenses/dist/kdump.aug 0000644 00000005641 15231153062 0010622 0 ustar 00 (* Module: Kdump Parses /etc/kdump.conf Author: Roman Rakus <rrakus@redhat.com> About: References manual page kdump.conf(5) About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Configuration files This lens applies to /etc/kdump.conf. See <filter>. *) module Kdump = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) let empty = Util.empty let comment = Util.comment let value_to_eol = store /[^ \t\n#][^\n#]*[^ \t\n#]|[^ \t\n#]/ let int_to_eol = store Rx.integer let delimiter = Util.del_ws_spc let eol = Util.eol let value_to_spc = store Rx.neg1 let key_to_space = key /[A-Za-z0-9_.\$-]+/ let eq = Sep.equal (************************************************************************ * Group: ENTRY TYPES *************************************************************************) let list (kw:string) = counter kw . Build.key_value_line_comment kw delimiter (Build.opt_list [ seq kw . value_to_spc ] delimiter) comment let mdl_key_value = [ delimiter . key_to_space . ( eq . value_to_spc)? ] let mdl_options = [ key_to_space . mdl_key_value+ ] let mod_options = [ key "options" . delimiter . mdl_options . (comment|eol) ] (************************************************************************ * Group: ENTRIES *************************************************************************) (* Got from mount(8) *) let fs_types = "adfs" | "affs" | "autofs" | "cifs" | "coda" | "coherent" | "cramfs" | "debugfs" | "devpts" | "efs" | "ext" | "ext2" | "ext3" | "ext4" | "hfs" | "hfsplus" | "hpfs" | "iso9660" | "jfs" | "minix" | "msdos" | "ncpfs" | "nfs" | "nfs4" | "ntfs" | "proc" | "qnx4" | "ramfs" | "reiserfs" | "romfs" | "squashfs" | "smbfs" | "sysv" | "tmpfs" | "ubifs" | "udf" | "ufs" | "umsdos" | "usbfs" | "vfat" | "xenix" | "xfs" | "xiafs" let simple_kws = "raw" | "net" | "path" | "core_collector" | "kdump_post" | "kdump_pre" | "default" | "ssh" | "sshkey" | "dracut_args" | "fence_kdump_args" let int_kws = "force_rebuild" | "override_resettable" | "debug_mem_level" | "link_delay" | "disk_timeout" let option = Build.key_value_line_comment ( simple_kws | fs_types ) delimiter value_to_eol comment | Build.key_value_line_comment int_kws delimiter int_to_eol comment | list "extra_bins" | list "extra_modules" | list "blacklist" | list "fence_kdump_nodes" | mod_options (* View: lns The options lens *) let lns = ( empty | comment | option )* let filter = incl "/etc/kdump.conf" let xfm = transform lns filter lenses/dist/slapd.aug 0000644 00000012157 15231153062 0010605 0 ustar 00 (* Slapd module for Augeas Author: Free Ekanayaka <free@64studio.com> Reference: man slapd.conf(5), man slapd.access (5) *) module Slapd = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let spc = Util.del_ws_spc let sep = del /[ \t\n]+/ " " let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ let sto_to_spc = store /[^\\# \t\n]+/ let sto_to_by = store (/[^\\# \t\n]+/ - "by") let comment = Util.comment let empty = Util.empty (************************************************************************ * ACCESS TO *************************************************************************) let access_re = "access to" let who = [ spc . label "who" . sto_to_spc ] let what = [ spc . label "what" . sto_to_spc ] (* TODO: parse the control field, see man slapd.access (5) *) let control = [ spc . label "control" . sto_to_by ] let by = [ sep . key "by". who . what. control? ] let access = [ key access_re . spc. sto_to_spc . by+ . eol ] (************************************************************************ * GLOBAL *************************************************************************) (* TODO: parse special field separately, see man slapd.conf (5) *) let global_re = "allow" | "argsfile" | "attributeoptions" | "attributetype" | "authz-policy" | "ldap" | "dn" | "concurrency" | "cron_max_pending" | "conn_max_pending_auth" | "defaultsearchbase" | "disallow" | "ditcontentrule" | "gentlehup" | "idletimeout" | "include" | "index_substr_if_minlen" | "index_substr_if_maxlen" | "index_substr_any_len" | "index_substr_any_step" | "localSSF" | "loglevel" | "moduleload" | "modulepath" | "objectclass" | "objectidentifier" | "password-hash" | "password-crypt-salt-format" | "pidfile" | "referral" | "replica-argsfile" | "replica-pidfile" | "replicationinterval" | "require" | "reverse-lookup" | "rootDSE" | "sasl-host " | "sasl-realm" | "sasl-secprops" | "schemadn" | "security" | "sizelimit" | "sockbuf_max_incoming " | "sockbuf_max_incoming_auth" | "threads" | "timelimit time" | "tool-threads" | "TLSCipherSuite" | "TLSCACertificateFile" | "TLSCACertificatePath" | "TLSCertificateFile" | "TLSCertificateKeyFile" | "TLSDHParamFile" | "TLSRandFile" | "TLSVerifyClient" | "TLSCRLCheck" | "backend" let global = Build.key_ws_value global_re (************************************************************************ * DATABASE *************************************************************************) (* TODO: support all types of database backend *) let database_hdb = "cachesize" | "cachefree" | "checkpoint" | "dbconfig" | "dbnosync" | "directory" | "dirtyread" | "idlcachesize" | "index" | "linearindex" | "lockdetect" | "mode" | "searchstack" | "shm_key" let database_re = "suffix" | "lastmod" | "limits" | "maxderefdepth" | "overlay" | "readonly" | "replica uri" | "replogfile" | "restrict" | "rootdn" | "rootpw" | "suffix" | "subordinate" | "syncrepl rid" | "updatedn" | "updateref" | database_hdb let database = [ key "database" . spc . sto_to_eol . eol . (comment|empty|Build.key_ws_value database_re|access)* ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|global|access)* . (database)* let filter = incl "/etc/ldap/slapd.conf" . incl "/etc/openldap/slapd.conf" let xfm = transform lns filter lenses/dist/shadow.aug 0000644 00000004544 15231153062 0010770 0 ustar 00 (* Module: Shadow Parses /etc/shadow Author: Lorenzo M. Catucci <catucci@ccd.uniroma2.it> Original Author: Free Ekanayaka <free@64studio.com> About: Reference - man 5 shadow - man 3 getspnam About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Each line in the shadow files represents the additional shadow-defined attributes for the corresponding user, as defined in the passwd file. *) module Shadow = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let comment = Util.comment let empty = Util.empty let dels = Util.del_str let colon = Sep.colon let word = Rx.word let integer = Rx.integer let sto_to_col = Passwd.sto_to_col let sto_to_eol = Passwd.sto_to_eol (************************************************************************ * Group: ENTRIES *************************************************************************) (* Common for entry and nisdefault *) let common = [ label "lastchange_date" . store integer? . colon ] . [ label "minage_days" . store integer? . colon ] . [ label "maxage_days" . store integer? . colon ] . [ label "warn_days" . store integer? . colon ] . [ label "inactive_days" . store integer? . colon ] . [ label "expire_date" . store integer? . colon ] . [ label "flag" . store integer? ] (* View: entry *) let entry = [ key word . colon . [ label "password" . sto_to_col? . colon ] . common . eol ] let nisdefault = let overrides = colon . [ label "password" . store word? . colon ] . common in [ dels "+" . label "@nisdefault" . overrides? . eol ] (************************************************************************ * LENS *************************************************************************) let lns = (comment|empty|entry|nisdefault) * let filter = incl "/etc/shadow" . Util.stdexcl let xfm = transform lns filter lenses/dist/login_defs.aug 0000644 00000001147 15231153062 0011610 0 ustar 00 (* Module: Login_defs Lense for login.defs Author: Erinn Looney-Triggs About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: Configuration files This lens applies to /etc/login.defs. See <filter>. *) module Login_defs = autoload xfm (* View: record A login.defs record *) let record = let value = store /[^ \t\n]+([ \t]+[^ \t\n]+)*/ in [ key Rx.word . Sep.space . value . Util.eol ] (* View: lns The login.defs lens *) let lns = (record | Util.comment | Util.empty) * (* View: filter *) let filter = incl "/etc/login.defs" let xfm = transform lns filter lenses/dist/channels.aug 0000644 00000007531 15231153062 0011275 0 ustar 00 (* Module: Channels Parses channels.conf files Author: Raphael Pinson <raphink@gmail.com> About: Reference See http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf 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 channels.conf files. About: Examples The <Test_Channels> file contains various examples and tests. *) module Channels = (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: eol *) let eol = Util.eol (* View: comment *) let comment = Util.comment_generic /;[ \t]*/ "; " (* View: equal *) let equal = Sep.equal (* View: colon *) let colon = Sep.colon (* View: comma *) let comma = Sep.comma (* View: semicol *) let semicol = Util.del_str ";" (* View: plus *) let plus = Util.del_str "+" (* View: arroba *) let arroba = Util.del_str "@" (* View: no_colon *) let no_colon = /[^: \t\n][^:\n]*[^: \t\n]|[^:\n]/ (* View: no_semicolon *) let no_semicolon = /[^;\n]+/ (************************************************************************ * Group: FUNCTIONS *************************************************************************) (* View: field A generic field *) let field (name:string) (sto:regexp) = [ label name . store sto ] (* View: field_no_colon A <field> storing <no_colon> *) let field_no_colon (name:string) = field name no_colon (* View: field_int A <field> storing <Rx.integer> *) let field_int (name:string) = field name Rx.integer (* View: field_word A <field> storing <Rx.word> *) let field_word (name:string) = field name Rx.word (************************************************************************ * Group: ENTRIES *************************************************************************) (* View: vpid *) let vpid = let codec = [ equal . label "codec" . store Rx.integer ] in let vpid_entry (lbl:string) = [ label lbl . store Rx.integer . codec? ] in vpid_entry "vpid" . ( plus . vpid_entry "vpid_pcr" )? (* View: langs *) let langs = let lang = [ label "lang" . store Rx.word ] in Build.opt_list lang plus (* View: apid *) let apid = let codec = [ arroba . label "codec" . store Rx.integer ] in let options = equal . ( (langs . codec?) | codec ) in let apid_entry (lbl:string) = [ label lbl . store Rx.integer . options? ] in Build.opt_list (apid_entry "apid") comma . ( semicol . Build.opt_list (apid_entry "apid_dolby") comma )? (* View: tpid *) let tpid = let tpid_bylang = [ label "tpid_bylang" . store Rx.integer . (equal . langs)? ] in field_int "tpid" . ( semicol . Build.opt_list tpid_bylang comma )? (* View: caid *) let caid = let caid_entry = [ label "caid" . store Rx.word ] in Build.opt_list caid_entry comma (* View: entry *) let entry = [ label "entry" . store no_semicolon . (semicol . field_no_colon "provider")? . colon . field_int "frequency" . colon . field_word "parameter" . colon . field_word "signal_source" . colon . field_int "symbol_rate" . colon . vpid . colon . apid . colon . tpid . colon . caid . colon . field_int "sid" . colon . field_int "nid" . colon . field_int "tid" . colon . field_int "rid" . eol ] (* View: entry_or_comment *) let entry_or_comment = entry | comment (* View: group *) let group = [ Util.del_str ":" . label "group" . store no_colon . eol . entry_or_comment* ] (* View: lns *) let lns = entry_or_comment* . group* lenses/dist/openvpn.aug 0000644 00000014641 15231153062 0011167 0 ustar 00 (* OpenVPN module for Augeas Author: Raphael Pinson <raphink@gmail.com> Reference: http://openvpn.net/index.php/documentation/howto.html *) module OpenVPN = autoload xfm (************************************************************************ * USEFUL PRIMITIVES *************************************************************************) let eol = Util.eol let indent = Util.indent (* Define separators *) let sep = Util.del_ws_spc (* Define value regexps *) let ip_re = Rx.ipv4 let num_re = Rx.integer let fn_re = /[^#; \t\n][^#;\n]*[^#; \t\n]|[^#; \t\n]/ let an_re = /[a-z][a-z0-9_-]*/ (* Define store aliases *) let ip = store ip_re let num = store num_re let filename = store fn_re let sto_to_dquote = store /[^"\n]+/ (* " Emacs, relax *) (* define comments and empty lines *) let comment = Util.comment_generic /[ \t]*[;#][ \t]*/ "# " let comment_or_eol = eol | Util.comment_generic /[ \t]*[;#][ \t]*/ " # " let empty = Util.empty (************************************************************************ * SINGLE VALUES * * - local => IP * - port => num * - proto => tcp|udp * - dev => (tun|tap)\d* * - dev-node => MyTap * - ca => filename * - cert => filename * - key => filename * - dh => filename * - ifconfig-pool-persist => filename * - learn-address => filename * - cipher => [A-Z0-9-]+ * - max-clients => num * - user => alphanum * - group => alphanum * - status => filename * - log => filename * - log-append => filename * - client-config-dir => filename * - verb => num * - mute => num * - fragment => num * - mssfix => num * - ns-cert-type => "server" * - resolv-retry => "infinite" * - script-security => [0-3] (execve|system)? *************************************************************************) let single_ip = "local" let single_num = "port" | "max-clients" | "verb" | "mute" | "fragment" | "mssfix" let single_fn = "ca" | "cert" | "key" | "dh" | "ifconfig-pool-persist" | "learn-address" | "status" | "log" | "log-append" | "client-config-dir" let single_an = "user" | "group" let single_entry (kw:regexp) (re:regexp) = [ key kw . sep . store re . comment_or_eol ] let single = single_entry single_num num_re | single_entry single_fn fn_re | single_entry single_an an_re | single_entry "local" ip_re | single_entry "proto" /(tcp|udp)/ | single_entry "dev" /(tun|tap)[0-9]*/ | single_entry "dev-node" "MyTap" | single_entry "cipher" /[A-Z][A-Z0-9-]*/ | single_entry "ns-cert-type" "server" | single_entry "resolv-retry" "infinite" | single_entry "script-security" /[0-3]( execve| system)?/ (************************************************************************ * FLAGS * * - client-to-client * - duplicate-cn * - comp-lzo * - persist-key * - persist-tun * - client * - remote-random * - nobind * - mute-replay-warnings * - http-proxy-retry * - daemon * *************************************************************************) let flag_words = "client-to-client" | "duplicate-cn" | "comp-lzo" | "persist-key" | "persist-tun" | "client" | "remote-random" | "nobind" | "mute-replay-warnings" | "http-proxy-retry" | "daemon" let flag_entry (kw:regexp) = [ key kw . comment_or_eol ] let flag = flag_entry flag_words (************************************************************************ * OTHER FIELDS * * - server => IP IP * - server-bridge => IP IP IP IP * - route => IP IP * - push => "string" * - keepalive => num num * - tls-auth => filename [01] * - remote => hostname/IP num * - management => IP num filename * *************************************************************************) let server = [ key "server" . sep . [ label "address" . ip ] . sep . [ label "netmask" . ip ] . comment_or_eol ] let server_bridge = [ key "server-bridge" . sep . [ label "address" . ip ] . sep . [ label "netmask" . ip ] . sep . [ label "start" . ip ] . sep . [ label "end" . ip ] . comment_or_eol ] let route = [ key "route" . sep . [ label "address" . ip ] . sep . [ label "netmask" . ip ] . comment_or_eol ] let push = [ key "push" . sep . Quote.do_dquote sto_to_dquote . comment_or_eol ] let keepalive = [ key "keepalive" . sep . [ label "ping" . num ] . sep . [ label "timeout" . num ] . comment_or_eol ] let tls_auth = [ key "tls-auth" . sep . [ label "key" . filename ] . sep . [ label "is_client" . store /[01]/ ] . comment_or_eol ] let remote = [ key "remote" . sep . [ label "server" . filename ] . sep . [ label "port" . num ] . comment_or_eol ] let http_proxy = [ key "http-proxy" . ( sep . [ label "server" . store /[A-Za-z0-9._-]+/ ] . ( sep . [ label "port" . num ] )? )? . comment_or_eol ] let management = [ key "management" . sep . [ label "server" . ip ] . sep . [ label "port" . num ] . sep . [ label "pwfile" . filename ] . comment_or_eol ] let other = server | server_bridge | route | push | keepalive | tls_auth | remote | http_proxy | management (************************************************************************ * LENS & FILTER *************************************************************************) let lns = ( comment | empty | single | flag | other )* let filter = (incl "/etc/openvpn/client.conf") . (incl "/etc/openvpn/server.conf") let xfm = transform lns filter lenses/dist/lokkit.aug 0000644 00000004250 15231153062 0010772 0 ustar 00 module Lokkit = autoload xfm (* Module: Lokkit Parse the config file for lokkit from system-config-firewall *) let comment = Util.comment let empty = Util.empty let eol = Util.eol let spc = Util.del_ws_spc let dels = Util.del_str let eq = del /[ \t=]+/ "=" let token = store /[a-zA-Z0-9][a-zA-Z0-9-]*/ let long_opt (n:regexp) = [ dels "--" . key n . eq . token . eol ] let flag (n:regexp) = [ dels "--" . key n . eol ] let option (l:string) (s:string) = del ("--" . l | "-" . s) ("--" . l) . label l . eq let opt (l:string) (s:string) = [ option l s . token . eol ] (* trust directive -t <interface>, --trust=<interface> *) let trust = [ option "trust" "t" . store Rx.device_name . eol ] (* port directive -p <port>[-<port>]:<protocol>, --port=<port>[-<port>]:<protocol> *) let port = let portnum = store /[0-9]+/ in [ option "port" "p" . [ label "start" . portnum ] . (dels "-" . [ label "end" . portnum])? . dels ":" . [ label "protocol" . token ] . eol ] (* custom_rules directive --custom-rules=[<type>:][<table>:]<filename> *) let custom_rules = let types = store /ipv4|ipv6/ in let tables = store /mangle|nat|filter/ in let filename = store /[^ \t\n:=][^ \t\n:]*/ in [ dels "--custom-rules" . label "custom-rules" . eq . [ label "type" . types . dels ":" ]? . [ label "table" . tables . dels ":"]? . filename . eol ] (* forward_port directive --forward-port=if=<interface>:port=<port>:proto=<protocol>[:toport=<destination port>][:toaddr=<destination address>] *) let forward_port = let elem (n:string) (v:lens) = [ key n . eq . v ] in let ipaddr = store /[0-9.]+/ in let colon = dels ":" in [ dels "--forward-port" . label "forward-port" . eq . elem "if" token . colon . elem "port" token . colon . elem "proto" token . (colon . elem "toport" token)? . (colon . elem "toaddr" ipaddr)? . eol ] let entry = long_opt /selinux|selinuxtype|addmodule|removemodule|block-icmp/ |flag /enabled|disabled/ |opt "service" "s" |port |trust |opt "masq" "m" |custom_rules |forward_port let lns = (comment|empty|entry)* let xfm = transform lns (incl "/etc/sysconfig/system-config-firewall") lenses/libreport.aug 0000644 00000002575 15231153062 0010544 0 ustar 00 module Libreport = autoload xfm (* Define useful primitives *) let val_sep = del /[ \t]*=[ \t]*/ " = " let val = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ let eol = del /\n/ "\n" let whitespace_eol = del /[ \t]*\n/ "\n" let ident = /[a-zA-Z][a-zA-Z_]+/ (* Define comment *) let commented_line = [ label "#comment" . del /#[ \t]*/ "# " . val . eol ] let empty_comment = [ label "#comment" . value "" . del /#[ \t]*/ "# " . eol ] let comment = commented_line | empty_comment (* Define empty *) let empty = [ del /[ \t]*\n/ "\n" ] (* Define option *) let option_val = [ del /[ \t]*/ "" . key ident . val_sep . val . whitespace_eol ] let option_no_val = [ value "" . del /[ \t]*/ "" . key ident . val_sep . eol ] let option = option_val | option_no_val (* Define lens *) let lns = ( comment | empty | option )* let filter = (incl "/etc/libreport/plugins/*") . (incl "/etc/libreport/events/*") . (incl (Sys.getenv("HOME") . "/.config/abrt/settings/*")) . (incl (Sys.getenv("XDG_CACHE_HOME") . "/abrt/events/*")) . (incl (Sys.getenv("HOME") . "/.cache/abrt/events/*")) . (excl "/etc/libreport/plugins/bugzilla_format*") . Util.stdexcl let xfm = transform lns filter
| ver. 1.4 |
Github
|
.
| PHP 8.2.32 | Generation time: 0.11 |
proxy
|
phpinfo
|
Settings