Index - Augeas Documentation

Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z

S |
| save_entry, Redis
| savedefault, Grub
| schedule, Cron
| Schroot
| Scope entry, Nslcd
| screen, Xorg
| script, Xymon_Alerting
| search, Resolv
| section, Xorg
| section_entry, Xorg
| section_re, Xorg
| SECTIONS, Xorg
| secton_re_obsolete, Xorg
| selector, Syslog
| selectors, Syslog
| Semanage
| semicol, Channels
| semicolon Sep Syslog
| sensor, Ntpd
| sentinel_entry, Redis
| sep Global Approx Apt_Update_Manager Avahi IniFile Mke2fs Netmasks Oz Postgresql Schroot Subversion Systemd Trapperkeeper
| Sep
| sep_ace, Test_IniFile
| sep_acf, Test_IniFile
| sep_ade, Test_IniFile
| sep_adf, Test_IniFile
| sep_base64, Ldif
| sep_bce, Test_IniFile
| sep_bcf, Test_IniFile
| sep_bde, Test_IniFile
| sep_bdf, Test_IniFile
| sep_col, Sudoers
| sep_colon Ldif Nsswitch Solaris_System
| sep_com, Sudoers
| sep_cont, Sudoers
| sep_cont_opt, Sudoers
| sep_cont_opt_build, Sudoers
| sep_default, IniFile
| sep_dquote Sudoers Xorg
| sep_eq Cron Sudoers
| sep_line, Ldif
| sep_moddir, Solaris_System
| sep_modspec, Ldif
| sep_noindent, IniFile
| sep_opt_spc, Tmpfiles
| sep_re, IniFile
| sep_record, Ldif
| sep_semi, Up2date
| sep_space, Modprobe
| sep_spc Cron Keepalived Sudoers Tmpfiles Xorg
| sep_tab Crypttab Syslog
| sep_tab_opt, Syslog
| sep_url, Ldif
| sep_with_spc, Trapperkeeper
| sep_ws, Aptsources
| separators AFS_cellalias Aliases Cachefilesd
| Separators cgrules Cron Crypttab Erlang IniFile Services Sudoers Xorg
| serial, Grub
| server Nginx Ntpd
| servers, Ntpd
| service Nsswitch Xymon_Alerting
| service_attr, Xinetd
| Services
| set, BootConf
| set_operator, Solaris_System
| set_sep_spc, Solaris_System
| set_value, Solaris_System
| set_var, Solaris_System
| setkey, Grub
| setting, Puppet_Auth
| settings, Chrony
| Shadow
| shell MasterPasswd Passwd
| shell_command, Hosts_Access
| shell_command_rx, Hosts_Access
| Shells
| shellvar Anacron Cron
| Shellvars
| short, Test_Tmpfiles
| short_age, Test_Tmpfiles
| short_age_tree, Test_Tmpfiles
| short_gid, Test_Tmpfiles
| short_gid_tree, Test_Tmpfiles
| short_mode, Test_Tmpfiles
| short_mode_tree, Test_Tmpfiles
| short_tree, Test_Tmpfiles
| short_uid, Test_Tmpfiles
| short_uid_tree, Test_Tmpfiles
| simple Nginx Test_Collectd Test_Tmpfiles Trapperkeeper
| simple values, Test_Erlang
| simple_config, Test_FAI_DiskConfig
| simple_entry, Nslcd
| simple_entry_quoted_value, Nslcd
| simple_keys, Chrony
| simple_tree, Test_Tmpfiles
| Simplelines
| Simplevars
| single Quote Test_Quote
| single characters macro, Syslog
| single_command, BootConf
| single_entry, Up2date
| single_opt Quote Test_Quote
| single_opt_re, Quote
| Sip_Conf
| size, FAI_DiskConfig
| size_kw, FAI_DiskConfig
| slash_char_sysctl, Test_Sysctl
| SmbUsers
| smoothtime, Chrony
| smtp_check, Test_Keepalived
| smtp_check_field, Keepalived
| smtp_host_check_field, Keepalived
| softdep, Modprobe
| Solaris_System
| sortlist, Resolv
| Sos
| space AFS_cellalias BootConf Cachefilesd Chrony Erlang FAI_DiskConfig Ntpd Rx Sep
| space_equal, Sep
| space_in, Rx
| space_list_re, Subversion
| space_or_eol Postfix_Passwordmap Postfix_Transport Postfix_Virtual
| space_or_eol_re, Postfix_Virtual
| Spaces, Rx
| Spacing Functions, Erlang
| spare_missing, FAI_DiskConfig
| spc Grub Nslcd
| spec Sudoers Test_sudoers.Sudoers
| spec_chars_sysctl, Test_Sysctl
| spec_list, Sudoers
| SPECIAL OPTIONS, Resolv
| Split, Util
| Splunk
| squote, Quote
| squote_opt, Quote
| squote_opt_nil Quote Test_Quote
| squote_spaces Quote Test_Quote
| Ssh
| Sshd
| ssl_options Rabbitmq Test_Rabbitmq.Rabbitmq
| sssd.aug
| standard_entry, Redis
| Star
| static_ipaddress_field, Keepalived
| static_routes, Keepalived
| static_routes_field, Keepalived
| std_re, Subversion
| stdexcl, Util
| sto_bool, Host_Conf
| sto_bool_warn, Host_Conf
| sto_email_addr, Keepalived
| sto_integer, Sudoers
| sto_ipv6, Keepalived
| sto_line, Modules
| sto_multiline, IniFile
| sto_multiline_nocomment, IniFile
| sto_no_colons, Modprobe
| sto_no_spaces, Modprobe
| sto_num, Keepalived
| sto_to_colon, Hosts_Access
| sto_to_com, Sudoers
| sto_to_com_cmnd, Sudoers
| sto_to_com_col, Sudoers
| sto_to_com_dquot, Sudoers
| sto_to_com_host, Sudoers
| sto_to_com_user, Sudoers
| sto_to_comment Desktop IniFile
| sto_to_eol IniFile Keepalived Modprobe
| sto_to_eq, Sudoers
| sto_to_spc, Sudoers
| sto_to_spc_no_dquote, Sudoers
| sto_value, Systemd
| sto_value_single, Systemd
| sto_word, Keepalived
| stop, Xymon_Alerting
| Store types, Erlang
| store_address, Chrony
| store_word, Xymon_Alerting
| Stores IniFile Sudoers
| stratum_re, Ntpd
| Strongswan
| stty, BootConf
| subnet, Sysconfig_Route
| SUBNODE CONSTRUCTIONS Build Test_Build
| Subversion
| Sudoers
| switch, Grub
| switch_arg, Grub
| Sysconfig_Route
| Sysctl
| Syslog
| Systemd

> let save_entry = [ indent . key save . save_val . eol ]

Entries identified by the “save” keyword can be found more than once.

> let savedefault = [ command "savedefault" "\t" . (spc . store Rx.integer)? . eol ]

> let schedule = [ label "schedule" . Util.del_str "@" . store schedule_re ]

Time in the format “@keyword”
Parses /etc/schroot/schroot.conf

> let screen = [ indent . del /[sS]creen/ "Screen" . label "Screen" . [ sep_spc . label "num" . store int ]? . ( sep_spc . quoted_non_empty_string_val . [ sep_spc . label "position" . store to_eol ]? )? . eol ]

The Screen entry of ServerLayout

> let script = [ key "SCRIPT" . ws . [ label "script" . store_word ] . ws . [ label "recipient" . store_word ] . filters_opt ]

The script recipient definition

> let search = Build.key_value_line_comment "search" Sep.space (Build.opt_list [label "domain" . store Rx.word] Sep.space) comment_eol

> 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 ]

A section in xorg.conf

> let section_entry = option | screen | display | extmod | input_device | driver | identifier | videoram | default_depth | device | entry_generic | empty | comment

> let section_re = /(Extensions|Files|ServerFlags|Module|InputDevice|InputClass|Device|VideoAdaptor|Monitor|Modes|Screen|ServerLayout|DRI|Vendor)/

Known values for Section names
The following obsolete section names are still recognised for compatibility purposes.

> let selectors = label_opt_list "selector" selector semicolon

a list of selectors, separated by semicolons
Parses /etc/selinux/semanage.conf

> let semicol = Util.del_str ";"

> let semicolon = Util.del_str ";"

> let semicolon = sep_tab_opt . Util.del_str ";" . sep_tab_opt

Deletes a semicolon and default to it

> 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 ]

sensor device [correction microseconds] [weight weight-value] [refid string] [stratum stratum-value]

> let sentinel_entry = indent . [ key "sentinel" . del_ws_spc . (sentinel_global_entry | sentinel_cluster_setup | sentinel_cluster_instance_setup | sentinel_clustering) ] . eol

> let sep = Util.del_str " "

Only treat one space as the sep, extras are stripped by IniFile

> let sep = /[ \t]+/

> let sep = IniFile.sep IniFile.sep_re IniFile.sep_default

> let sep = IniFile.sep "=" "="

> let sep (pat:regexp) (default:string) = Sep.opt_space . del pat default

Generic separator

> let sep = IniFile.sep /=[ \t]*/ "="

> let sep = Util.del_ws_tab

The separator for network/mask entries

> let sep = IniFile.sep "=" "="

> let sep = del /([ \t]+)|([ \t]*=[ \t]*)/ " = "

Key and values are separated by either spaces or an equal sign

> let sep = IniFile.sep "=" "="

An IniFile.sep entry

> let sep = IniFile.sep IniFile.sep_default IniFile.sep_default

> let sep = IniFile.sep "=" "="

An IniFile.sep entry

> let sep = del /[ \t]*[:=]/ ":"

Generic separators to build lenses

> let sep_ace = IniFile.sep IniFile.sep_re IniFile.sep_default

> let sep_acf = IniFile.sep IniFile.sep_re IniFile.sep_default

> let sep_ade = IniFile.sep IniFile.sep_re IniFile.sep_default

> let sep_adf = IniFile.sep IniFile.sep_re IniFile.sep_default

> let sep_base64 = del /::[ \t]*/ ":: "

The separator for attributes and base64 encoded values

> let sep_bce = IniFile.sep "=" "="

> let sep_bcf = IniFile.sep "=" "="

> let sep_bde = IniFile.sep "=" "="

> let sep_bdf = IniFile.sep "=" "="

> let sep_col = sep_cont_opt_build ":"

> let sep_colon = del /:[ \t]*/ ": "

The separator for attributes and values

> let sep_colon = del /:[ \t]*/ ": "

The separator for database entries

> let sep_colon = del /:[ \t]*/ ": "

The separator for key/value entries

> let sep_com = sep_cont_opt_build ","

> let sep_cont = Sep.cl_or_space

> let sep_cont_opt = Sep.cl_or_opt_space

> let sep_cont_opt_build (sep:string) = del (Rx.cl_or_opt_space . sep . Rx.cl_or_opt_space) (" " . sep . " ")

> let sep_default = "="

The default separator value

> let sep_dquote = Util.del_str "\""

> let sep_dquote = Util.del_str "\""

> let sep_eq = Util.del_str "="

> let sep_eq = sep_cont_opt_build "="

> let sep_line = empty | comment

> let sep_moddir = del /[: ]+/ " "

The separator of directories in a moddir search path

> let sep_modspec = Util.del_str "-" . eol

Separator between modify operations

> let sep_noindent (pat:regexp) (default:string) = del pat default

Generic separator, no indentation

> let sep_opt_spc = Sep.opt_space

Optional space (for the beginning of the lines)

> let sep_re = /[=:]/

The default regexp for a separator

> let sep_record = ( sep_line | attr_include )*

> let sep_semi = Sep.semicolon

> let sep_space = del /([ \t]|(\\\\\n))+/ " "

> let sep_spc = Util.del_ws_spc

> let sep_spc = Sep.space

> let sep_spc = Sep.space

> let sep_spc = Sep.space

Space

> let sep_spc = Util.del_ws_spc

> let sep_tab = Sep.tab

> let sep_tab = del /([ \t]+|[ \t]*\\\\\n[ \t]*)/ "\t"

> let sep_tab_opt = del /([ \t]*|[ \t]*\\\\\n[ \t]*)/ ""

The separator for attributes and URL-sourced values

> let sep_with_spc = sep . Sep.opt_space

> let sep_ws = Sep.space

> let serial = [ command "serial" "" . [ spc . switch_arg /unit|port|speed|word|parity|stop|device/ ]* . eol ]

> let server = let address = /[A-Za-z0-9_.:\/-]+/ in [ Util.indent . label "@server" . Util.del_str "server" . [ Sep.space . label "@address" . store address ] . [ Sep.space . key word . (Sep.equal . store word)? ]* . Sep.semicolon . (Util.eol|Util.comment_eol) ]

A simple server entry

> let server = let addr = [ label "address" . store address_re ] in key_opt_weight_rtable_line "server" addr

server address [weight weight-value] [rtable table-id]

> let servers = let addr = [ label "address" . store address_re ] in key_opt_weight_rtable_line "servers" addr

servers address [weight weight-value] [rtable table-id]

> let service = [ label "service" . store Rx.word ]

The service specification like `files’, `db’, or `nis’

> let service = kw_word /(EX)?SERVICE/

The (ex)?service filter definition

> 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)

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”|..)
Parses /etc/services

> let set = Build.key_value "set" space (key_opt_value_line set_cmd (store Rx.space_in))

set [varname [value]]

> let set_operators = /[=&|]/

Valid set operators: equals, bitwise AND and OR

> let set_sep_spc = Util.del_opt_ws " "

> let set_value = [ label "value" . store Rx.no_spaces ]

Sets an integer value or char pointer

> let set_var = [ label "variable" . store Rx.word ]

Loads the variable name from a set command, no module

> let setkey = [ command "setkey" "" . ( spc . [ label "to" . store Rx.no_spaces ] . spc . [ label "from" . store Rx.no_spaces ] )? . eol ]

> 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

> let settings = host_list | allowdeny | log_list | bcast | fdrift | istepslew | local | email | makestep | maxchange | refclock | smoothtime | dir_list | hwtimestamp | ratelimit | tempcomp | kv | all_flags

All supported chrony settings
Parses /etc/shadow

> let shell = [ label "shell" . sto_to_eol? ]

pw_shell

> let shell = [ label "shell" . sto_to_eol? ]

pw_shell

> let shell_command = [ label "shell_command" . store shell_command_rx ]

> let shell_command_rx = /[^ \t\n:][^\n]*[^ \t\n]|[^ \t\n:\\\\]/ - ( option_kw . /.*/ )

Parses /etc/shells

> let shellvar = Cron.shellvar

A shell variable in crontab

> let shellvar = let key_re = /[A-Za-z1-9_-]+(\[[0-9]+\])?/ - "entry" in let sto_to_eol = store /[^\n]*[^ \t\n]/ in [ key key_re . sep_eq . sto_to_eol . eol ]

A shell variable in crontab
Generic lens for shell-script config files like the ones found in /etc/sysconfig

> let short = "A+ /tmp/foo\n"

Example with only type and path

> let short_age = "H /var/tmp/fooBarFOO - jj jj ~10d\n"

Example with only 6 fields

> let short_age_tree = { "1" { "type" = "H" } { "path" = "/var/tmp/fooBarFOO" } { "mode" = "-" } { "uid" = "jj" } { "gid" = "jj" } { "age" = "~10d" } }

Tree for short_age

> let short_gid = "z /tmp/bar/foo -\t- augd\n"

Example with only 5 fields

> let short_gid_tree = { "1" { "type" = "z" } { "path" = "/tmp/bar/foo" } { "mode" = "-" } { "uid" = "-" } { "gid" = "augd" } }

Tree for short_gid

> let short_mode = "c+! /tmp/foo ~0755\n"

Example with only 3 fields

> let short_mode_tree = { "1" { "type" = "c+!" } { "path" = "/tmp/foo" } { "mode" = "~0755" } }

Tree for short_mode

> let short_tree = { "1" { "type" = "A+" } { "path" = "/tmp/foo" } }

Tree for short

> let short_uid = "A+ /tmp/foo - 0\n"

Example with only 4 fields

> let short_uid_tree = { "1" { "type" = "A+" } { "path" = "/tmp/foo" } { "mode" = "-" } { "uid" = "0" } }

Tree for short_uid

> let simple = let kw = word - block_re_all in let mask = [ label "mask" . Util.del_str "/" . store Rx.integer ] in let sto = store /[^ \t\n;#]([^";#]|"[^"]*\")*/ in [ Util.indent . key kw . mask? . (Sep.space . sto)? . Sep.semicolon . (Util.eol|Util.comment_eol) ]

A simple entry

> let simple = "LoadPlugin contextswitch LoadPlugin cpu FQDNLookup \"true\" Include \"/var/lib/puppet/modules/collectd/plugins/*.conf\" "

> let simple = "d /run/user 0755 root mysql 10d -\n"

One line, simple example

> let simple_config = "# A comment disk_config disk2 raw-disk - 0 - - disk_config lvm vg my_pv sda2 vg test disk1.9 my_pv-_swap swap 2048 swap sw my_pv-_root / 2048 ext3 rw,errors=remount-ro disk_config raid raid1 /boot disk1.1,disk2.1,disk3.1,disk4.1,disk5.1,disk6.1 ext3 rw raid1 swap disk1.2,disk2.2,disk3.2,disk4.2,disk5.2,disk6.2 swap sw raid5 /srv/data disk1.11,disk2.11,disk3.11,disk4.11,disk5.11,disk6.11 ext3 ro createopts=\"-m 0\" raid0 - disk2.2,sdc1,sde1:spare:missing ext2 default disk_config tmpfs tmpfs /var/opt/hosting/tmp 500 defaults "

A simple configuration file

> let simple_entry (kw:string) = Build.key_ws_value kw

The simplest configuration option a key spc value.

> let simple_entry_quoted_value (kw:string) = Build.key_value_line kw spc (do_dquote (store /.*/))

Simple entry with quoted value

> let simple_keys = "acquisitionport" | "authselectmode" | "bindacqaddress" | "bindaddress" | "bindcmdaddress" | "bindacqdevice" | "bindcmddevice" | "binddevice" | "clientloglimit" | "clockprecision" | "combinelimit" | "commandkey" | "cmdport" | "corrtimeratio" | "driftfile" | "dscp" | "dumpdir" | "hwclockfile" | "include" | "keyfile" | "leapsecmode" | "leapsectz" | "linux_freq_scale" | "linux_hz" | "logbanner" | "logchange" | "logdir" | "maxclockerror" | "maxdistance" | "maxdrift" | "maxjitter" | "maxsamples" | "maxslewrate" | "maxntsconnections" | "maxupdateskew" | "minsamples" | "minsources" | "nocerttimecheck" | "ntsdumpdir" | "ntsntpserver" | "ntsport" | "ntsprocesses" | "ntsrefresh" | "ntsrotate" | "ntsservercert" | "ntsserverkey" | "ntstrustedcerts" | "ntpsigndsocket" | "pidfile" | "ptpport" | "port" | "reselectdist" | "rtcautotrim" | "rtcdevice" | "rtcfile" | "sched_priority" | "stratumweight" | "user"

Options with single values

> let simple_tree = { "1" { "type" = "d" } { "path" = "/run/user" } { "mode" = "0755" } { "uid" = "root" } { "gid" = "mysql" } { "age" = "10d" } { "argument" = "-" } }

Tree for simple
Parses simple lines conffiles
Parses simple key = value conffiles

> let single = let body = store /[^\n]*/ in do_squote body

A single-quoted value

> let single = [ label "single" . Quote.single ]

> let single_command = let line_re = /help|time|reboot/ in [ Util.indent . key line_re . eol ]

single command such as ‘help’ or ‘time’

> let single_entry = [ label "value" . store value_re ]

key=foo

> let single_opt = let body = store single_opt_re in do_squote_opt body

An optionally single-quoted value Single quotes are not allowed in value Value cannot begin or end with spaces

> let single_opt = [ label "single_opt" . Quote.single_opt ]

> let single_opt_re = /[^\n\t ']([^\n']*[^\n\t '])?/

The regexp to store when value is optionally single-quoted
Parses /etc/asterisk/sip.conf

> let size = [ label "size" . store size_kw . resize? ]

> let size_kw = /[0-9]+[kMGTP%]?(-([0-9]+[kMGTP%]?)?)?/ | /-[0-9]+[kMGTP%]?/

Regexps for size
Parses Samba username maps

> let smoothtime = [ Util.indent . key "smoothtime" . space . [ label "maxfreq" . store number ] . space . [ label "maxwander" . store number ] . ( space . [ key "leaponly" ] )? . eol ]

smoothtime has specific syntax

> let smtp_check = "virtual_server 192.168.1.11 22 { real_server 10.20.40.10 22 { SMTP_CHECK { host { connect_ip 10.20.40.11 connect_port 587 bindto 192.168.1.1 } connect_timeout 3 retry 5 delay_before_retry 10 helo_name \"Testing Augeas\" } } } " test Keepalived.lns get smtp_check = { "virtual_server" { "ip" = "192.168.1.11" } { "port" = "22" } { "real_server" { "ip" = "10.20.40.10" } { "port" = "22" } { "SMTP_CHECK" { "host" { "connect_ip" = "10.20.40.11" } { "connect_port" = "587" } { "bindto" = "192.168.1.1" } } { "connect_timeout" = "3" } { "retry" = "5" } { "delay_before_retry" = "10" } { "helo_name" = "\"Testing Augeas\"" } } } }

An example of an SMTP health checker

> 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

> 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

> 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 ]

Parses /etc/system on Solaris

> let sortlist = Build.key_value_line_comment "sortlist" Sep.space (Build.opt_list ipaddr Sep.space) comment_eol

Parses Anaconda’s user interaction configuration files.

> let space = Util.del_ws_spc

Separation between key and value

> let space = Sep.space

> let space = Util.del_ws_spc

Separation between key and value

> let space = Sep.space

> let space = del /[ \t\n]*/ ""

> let space = Sep.space

> let space = Sep.space

> let space = /[ \t]+/

A mandatory space or tab

> let space = del Rx.space " "

Deletes a Rx.space and default to a single space

> let space_equal = Util.delim "="

> let space_in = /[^ \r\t\n].*[^ \r\t\n]|[^ \t\n\r]/

A string which does not start or end with a space

> let space_list_re = "global-ignores" | "preserved-conflict-file-exts"

> let space_or_eol = del /([ \t]*\n)?[ \t]+/ " "

> let space_or_eol = del /([ \t]*\n)?[ \t]+/ " "

> let space_or_eol (sep:regexp) (default:string) = del (space_or_eol_re? . sep . space_or_eol_re?) default

> let space_or_eol_re = /([ \t]*\n)?[ \t]+/

> let spare_missing = tag /spare|missing/

> let spc = Util.del_ws_spc

> let spc = Util.del_ws_spc

> let spec = [ label "spec" . indent . alias_list "user" sto_to_com_user . sep_cont . Build.opt_list spec_list sep_col . comment_or_eol ]

A user specification, listing colon-separated spec_lists

> test Sudoers.spec get "APACHE_ADMIN ALL= ALL\n" = { "spec" { "user" = "APACHE_ADMIN" } { "host_group" { "host" = "ALL" } { "command" = "ALL" } } }

Spec users can be aliases

> let spec_chars_sysctl = "# Kernel sysctl configuration file # Controls IP packet forwarding net.ipv4.conf.*.rp_filter = 2 net.ipv4.conf.ib0:0.arp_filter = 1 "

> let spec_list = [ label "host_group" . alias_list "host" sto_to_com_host . sep_eq . cmnd_spec_list ]

Group of hosts with cmnd_spec_list
Parses /opt/splunk/etc/*, /opt/splunkforwarder/etc/system/local/*.conf and /opt/splunkforwarder/etc/apps/*/(default|local)/*.conf

> let squote = Util.del_str "'"

A single quote

> let squote_opt = del /'?/ "'"

An optional single quote, default to single

> let squote_opt_nil = del /'?/ ""

An optional single quote, default to nothing

> let squote_opt_nil = let body = store Quote.single_opt_re in [ label "squote_opt_nil" . Quote.do_squote_opt_nil body ]?

> let squote_spaces (lns:lens) =

Make single quotes mandatory if value contains spaces, and optional if value doesn’t contain spaces.
Parses ssh client configuration
Parses /etc/ssh/sshd_config

> let ssl_options = let versions_list = Erlang.opt_list (Erlang.make_value Erlang.quoted) in 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 | Erlang.value "versions" versions_list in Erlang.list "ssl_options" option

(Incomplete) list of SSL options

> test Rabbitmq.ssl_options get "{ssl_options, [ {cacertfile,\"/path/to/testca/cacert.pem\"}, {certfile,\"/path/to/server/cert.pem\"}, {keyfile,\"/path/to/server/key.pem\"}, {verify,verify_peer}, {versions, ['tlsv1.2', 'tlsv1.1', 'tlsv1']}, {fail_if_no_peer_cert,false}]}" = { "ssl_options" { "cacertfile" = "/path/to/testca/cacert.pem" } { "certfile" = "/path/to/server/cert.pem" } { "keyfile" = "/path/to/server/key.pem" } { "verify" = "verify_peer" } { "versions" { "value" = "tlsv1.2" } { "value" = "tlsv1.1" } { "value" = "tlsv1" } } { "fail_if_no_peer_cert" = "false" } }

> let standard_entry = let reserved_k = "save" | "rename-command" | "replicaof" | "slaveof" | "bind" | "client-output-buffer-limit" | "sentinel" in let entry_noempty = [ indent . key (k - reserved_k) . del_ws_spc . Quote.do_quote_opt_nil (store v) . eol ] in let entry_empty = [ indent . key (k - reserved_k) . del_ws_spc . dquote . store "" . dquote . eol ] in entry_noempty | entry_empty

A standard entry is a key-value pair, separated by blank space, with optional blank spaces at line beginning & end.
Parses star’s configuration file

> let static_ipaddress_field = [ indent . ipaddr . (sep_spc . ipdev)? . comment_or_eol ]

The whole string is fed to ip addr add.

> let static_routes = block "static_ipaddress" static_ipaddress_field | block "static_routes" static_routes_field

> 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 ]

src $SRC_IP to $DST_IP dev $SRC_DEVICE

> let std_re = /[^ \t\r\n\/=#]+/ - (comma_list_re | space_list_re)

> 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 "#*#")

Exclusion for files that are commonly not wanted/needed

> let sto_bool = store ("on"|"off")

Store a boolean value

> let sto_bool_warn = store ("on"|"off"|"warn"|"nowarn")

Store a boolean value

> let sto_email_addr = store Rx.email_addr

> let sto_integer = store /-?[0-9]+/

> let sto_ipv6 = store Rx.ipv6

> let sto_line = store /[^# \t\n].*[^ \t\n]|[^# \t\n]/

> let sto_multiline = Sep.opt_space . store (to_comment_re . (/[ \t]*\n/ . Rx.space . to_comment_re)*)

Store multiline values

> let sto_multiline_nocomment = Sep.opt_space . store (Rx.space_in . (/[ \t]*\n/ . Rx.space . Rx.space_in)*)

Store multiline values without an end-of-line comment

> let sto_no_colons = store /[^:# \t\n\\\\]+/

> let sto_no_spaces = store /[^# \t\n\\\\]+/

> let sto_num = store Rx.relinteger

> let sto_to_colon = store /[^ \t\n:=][^\n:]*((\\\\:|\\\\[ \t]*\n[ \t]+)[^\n:]*)*[^ \\\t\n:]|[^ \t\n:\\\\]/

Allows escaped colon sequences

> let sto_to_com = store /([^,=:#() \t\n\\][^,=:#()\n]*[^,=:#() \t\n\\])|[^,=:#() \t\n\\]/

There could be a \ in the middle of a command

> let sto_to_com_cmnd = del_negate . negate_node? . ( let alias = Rx.word - /(NO)?(PASSWD|EXEC|SETENV)/ in let non_alias = /[\/a-z]([^,:#()\n\\]|\\\\[=:,\\])*[^,=:#() \t\n\\]|[^,=:#() \t\n\\]/ in store (alias | non_alias))

sto_to_com_cmnd does not begin or end with a space

> let sto_to_com_col = store to_com_chars

> let sto_to_com_dquot = store (to_com_chars|to_com_dquot)

> let sto_to_com_host = store /[^,=:#() \t\n\\]+/

> 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])|\\\\\\\\[A-Za-z0-9])*/ - /@include(dir)?/ in let alias_re = /[A-Z_]+/ in store ((nis_re? . user_re) | alias_re)

Escaped spaces and NIS domains and allowed

> let sto_to_comment = Sep.opt_space . store /[^# \t\r\n][^#\r\n]*[^# \t\r\n]|[^# \t\r\n]/

Store until comment

> let sto_to_comment = Sep.opt_space . store to_comment_re

Store until comment

> let sto_to_eol = Sep.opt_space . store Rx.space_in

Store until end of line

> let sto_to_eol = store /[^#! \t\n][^#!\n]*[^#! \t\n]|[^#! \t\n]/

> let sto_to_eol = store /(([^# \t\n\\\\][^#\n\\\\]*[ \t]*\\\\[ \t]*\n[ \t]*)*([^# \t\n\\\\][^#\n\\\\]*[^# \t\n\\\\]|[^# \t\n\\\\])|[^# \t\n\\\\])/

> let sto_to_eq = store /[^,=:#() \t\n\\]+/

> let sto_to_spc = store /[^", \t\n\\]+|"[^", \t\n\\]+"/

> let sto_to_spc_no_dquote = store /[^",# \t\n\\]+/ (* " relax emacs *)

> let sto_value = store /[^# \t\n]*[^# \t\n\\]/

> let sto_value_single = Util.del_opt_ws "" . store (value_single_re . (/\\\\\n/ . value_single_re)*)

Support multiline values with a backslash

> let sto_word = store word

> let stop = flag_filters_opt "STOP"

The stop recipient definition

> let store_address = [ label "address" . store address_re ]

> let store_word = store /[^ =\t\n#]+/

> let stratum_re = /1[0-5]|[1-9]/

value between 1 and 15
Lens for parsing strongSwan configuration files

> 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)?)

stty [device [speed]]

> let subnet = Rx.ipv4 . "/" . cidr

Subnet specification
Parses subversion’s INI files
Parses /etc/sudoers

> let switch (n:regexp) = dels "--" . key n

> let switch_arg (n:regexp) = switch n . eq . store Rx.no_spaces

Parses /etc/sysconfig/network-scripts/route-${device}
Parses /etc/sysctl.conf and /etc/sysctl.d/*
parses /etc/syslog.conf
Parses systemd unit files.
Close