augeas-1.15.0/0000755000175100017510000000000015257033010006602 5augeas-1.15.0/configure.ac0000644000175100017510000001074215257032642011026 AC_INIT(augeas, 1.15.0) AC_CONFIG_SRCDIR([src/augeas.c]) AC_CONFIG_AUX_DIR([build/ac-aux]) AM_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([-Wno-portability color-tests parallel-tests]) AM_SILENT_RULES([yes]) # make --enable-silent-rules the default. dnl Check for NaturalDocs AC_PATH_PROGS([ND_PROG], [naturaldocs NaturalDocs], missing) AM_CONDITIONAL([ND_ENABLED], [test "x$ND_PROG" != "xmissing"]) dnl NaturalDocs output format, defaults to HTML ND_FORMAT=HTML AC_ARG_WITH([naturaldocs-output], [AS_HELP_STRING([--with-naturaldocs-output=FORMAT], [format of NaturalDocs output (possible values: HTML/FramedHTML, default: HTML)])], [ if test "x$ND_PROG" = "xmissing"; then AC_MSG_ERROR([NaturalDocs was not found on your path; there's no point in setting the output format]) fi case $withval in HTML|FramedHTML) ND_FORMAT=$withval ;; *) AC_MSG_ERROR($withval is not a supported output format for NaturalDocs) ;; esac ]) AC_SUBST(ND_FORMAT) dnl Check for pdflatex PDFDOCS="" AC_ARG_WITH([pdfdocs], [AS_HELP_STRING([--with-pdfdocs], [whether to use pdflatex to build PDF docs])], [AC_PATH_PROG(PDFLATEX, pdflatex, no) if test "x$PDFLATEX" = "xno"; then AC_MSG_ERROR(You asked to use PDFLatex but it could not be found) else PDFDOCS="pdfdocs" fi ]) AC_SUBST(PDFLATEX) AC_SUBST(PDFDOCS) dnl Support for memory tests with failmalloc AC_ARG_WITH([failmalloc], [AS_HELP_STRING([--with-failmalloc=FAILMALLOC], [enable failmalloc test targets and use the failmalloc library FAILMALLOC])], [AC_SUBST([LIBFAILMALLOC], ["$with_failmalloc"])], [with_failmalloc=no]) AM_CONDITIONAL([WITH_FAILMALLOC], [test x$with_failmalloc != xno]) dnl --enable-debug=(yes|no) AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug=no/yes], [enable debugging output])],[],[enable_debug=yes]) AM_CONDITIONAL([ENABLE_DEBUG], test x"$enable_debug" = x"yes") if test x"$enable_debug" = x"yes"; then AC_DEFINE([ENABLE_DEBUG], [1], [whether debugging is enabled]) fi dnl Version info in libtool's notation AC_SUBST([LIBAUGEAS_VERSION_INFO], [25:0:25]) AC_SUBST([LIBFA_VERSION_INFO], [6:3:5]) AC_GNU_SOURCE AC_PROG_CC gl_EARLY AC_SYS_LARGEFILE dnl gl_INIT uses m4_foreach_w, yet that is not defined in autoconf-2.59. dnl In order to accommodate developers with such old tools, here's a dnl replacement definition. m4_ifndef([m4_foreach_w], [m4_define([m4_foreach_w], [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) AC_PROG_LIBTOOL AC_PROG_YACC AC_PROG_LEX AUGEAS_COMPILE_WARNINGS(maximum) ## Compiler flags to be used everywhere AUGEAS_CFLAGS=-std=gnu99 AC_SUBST(AUGEAS_CFLAGS) AUGEAS_CHECK_READLINE AC_CHECK_FUNCS([open_memstream uselocale]) AC_MSG_CHECKING([how to pass version script to the linker ($LD)]) VERSION_SCRIPT_FLAGS=none if $LD --help 2>&1 | grep "version-script" >/dev/null 2>/dev/null; then VERSION_SCRIPT_FLAGS=-Wl,--version-script= # Solaris needs gnu-version-script-compat to use version-script if test x"$host_os" = x"solaris2.11"; then VERSION_SCRIPT_FLAGS="-z gnu-version-script-compat,${VERSION_SCRIPT_FLAGS}" fi elif $LD --help 2>&1 | grep "M mapfile" >/dev/null 2>/dev/null; then VERSION_SCRIPT_FLAGS="-Wl,-M -Wl," fi AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS]) AC_SUBST(VERSION_SCRIPT_FLAGS) AM_CONDITIONAL([USE_VERSION_SCRIPT], [test "$VERSION_SCRIPT_FLAGS" != none]) gl_INIT dnl Should we run the gnulib tests? AC_MSG_CHECKING([if we should run the GNUlib tests]) AC_ARG_ENABLE([gnulib-tests], [AS_HELP_STRING([--disable-gnulib-tests], [disable running GNU Portability library tests @<:@default=yes@:>@])], [ENABLE_GNULIB_TESTS="$enableval"], [ENABLE_GNULIB_TESTS=yes]) AM_CONDITIONAL([ENABLE_GNULIB_TESTS],[test "x$ENABLE_GNULIB_TESTS" = "xyes"]) AC_MSG_RESULT([$ENABLE_GNULIB_TESTS]) dnl set PC_SELINUX for use by augeas.pc.in PC_SELINUX=$(echo $LIB_SELINUX | sed -e 's/-l/lib/') AC_SUBST([PC_SELINUX]) PKG_PROG_PKG_CONFIG PKG_CHECK_MODULES([LIBXML], [libxml-2.0]) AC_CHECK_FUNCS([strerror_r fsync]) AC_OUTPUT(Makefile \ gnulib/lib/Makefile \ gnulib/tests/Makefile \ src/Makefile \ man/Makefile \ tests/Makefile \ examples/Makefile \ doc/Makefile \ doc/naturaldocs/Makefile \ augeas.pc augeas.spec) # Bash completion ... PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], , bashcompdir="${sysconfdir}/bash_completion.d") AC_SUBST(bashcompdir) augeas-1.15.0/augeas.spec.in0000644000175100017510000002232615257032642011267 Name: augeas Version: @VERSION@ Release: 1%{?dist} Summary: A library for changing configuration files Group: System Environment/Libraries License: LGPLv2+ URL: http://augeas.net/ Source0: http://download.augeas.net/%{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: readline-devel libselinux-devel libxml2-devel Requires: %{name}-libs = %{version}-%{release} %description A library for programmatically editing configuration files. Augeas parses configuration files into a tree structure, which it exposes through its public API. Changes made through the API are written back to the initially read files. The transformation works very hard to preserve comments and formatting details. It is controlled by ``lens'' definitions that describe the file format and the transformation into a tree. %package devel Summary: Development files for %{name} Group: Development/Libraries Requires: %{name}-libs = %{version}-%{release} Requires: pkgconfig %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %package libs Summary: Libraries for %{name} Group: System Environment/Libraries %description libs The libraries for %{name}. Augeas is a library for programmatically editing configuration files. It parses configuration files into a tree structure, which it exposes through its public API. Changes made through the API are written back to the initially read files. %package static Summary: Static libraries for %{name} Group: Development/Libraries Requires: %{name}-devel = %{version}-%{release} %description static The %{name}-static package contains static libraries needed to produce static builds using %{name}. %prep %setup -q %build %configure \ %ifarch riscv64 --disable-gnulib-tests \ %endif --enable-static make %{?_smp_mflags} %check # Disable test-preserve.sh SELinux testing. This fails when run under mock due # to differing SELinux labelling. export SKIP_TEST_PRESERVE_SELINUX=1 make %{?_smp_mflags} check || { echo '===== tests/test-suite.log =====' cat tests/test-suite.log exit 1 } %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT INSTALL="%{__install} -p" find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' # The tests/ subdirectory contains lenses used only for testing, and # so it shouldn't be packaged. rm -r $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/dist/tests %clean rm -rf $RPM_BUILD_ROOT %post libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig %files %defattr(-,root,root,-) %{_bindir}/augtool %{_bindir}/augparse %{_bindir}/augmatch %{_bindir}/augprint %{_bindir}/fadot %doc %{_mandir}/man1/* %{_datadir}/vim/vimfiles/syntax/augeas.vim %{_datadir}/vim/vimfiles/ftdetect/augeas.vim %{bash_completions_dir}/* %files libs %defattr(-,root,root,-) # _datadir/augeas and _datadir/augeas/lenses are owned # by filesystem. %{_datadir}/augeas/lenses/dist %{_libdir}/*.so.* %doc AUTHORS COPYING NEWS %files devel %defattr(-,root,root,-) %doc %{_includedir}/* %{_libdir}/*.so %{_libdir}/pkgconfig/augeas.pc %files static %defattr(-,root,root,-) %{_libdir}/libaugeas.a %{_libdir}/libfa.a %changelog * Tue Sep 29 2026 David Lutterkort - 1.15.0 - Update to 1.15.0 * Wed Dec 7 2022 George Hansper - 1.14.0 - add augprint, fix bash-completion filenames * Sun Nov 20 2022 George Hansper - 1.14.0 - add bash completions * Fri Mar 17 2017 David Lutterkort - 1.8.0-1 - add static subpackage * Fri Feb 10 2017 Fedora Release Engineering - 1.7.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Thu Jan 12 2017 Igor Gnatenko - 1.7.0-3 - Rebuild for readline 7.x * Sat Nov 12 2016 Richard W.M. Jones - 1.7.0-2 - riscv64: Disable gnulib tests on riscv64 architecture. * Wed Nov 09 2016 Dominic Cleal - 1.7.0-1 - Update to 1.7.0 * Mon Aug 08 2016 Dominic Cleal - 1.6.0-1 - Update to 1.6.0 * Thu May 12 2016 Dominic Cleal - 1.5.0-1 - Update to 1.5.0 * Wed Feb 03 2016 Fedora Release Engineering - 1.4.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Wed Jun 17 2015 Fedora Release Engineering - 1.4.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Tue Jun 02 2015 Dominic Cleal - 1.4.0-1 - Update to 1.4.0 * Sat Nov 08 2014 Dominic Cleal - 1.3.0-1 - Update to 1.3.0; remove all patches * Fri Aug 15 2014 Fedora Release Engineering - 1.2.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild * Sat Jun 07 2014 Fedora Release Engineering - 1.2.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Mon Mar 31 2014 Dominic Cleal - 1.2.0-2 - Add patch for Krb5, parse braces in values (RHBZ#1079444) * Wed Feb 12 2014 Dominic Cleal - 1.2.0-1 - Update to 1.2.0, add check section - Update source URL to download.augeas.net (RHBZ#996032) * Sat Aug 03 2013 Fedora Release Engineering - 1.1.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Wed Jun 19 2013 David Lutterkort - 1.1.0-1 - Update to 1.1.0; remove all patches * Tue Jun 18 2013 Richard W.M. Jones - 1.0.0-4 - Fix /etc/sysconfig/network (RHBZ#904222). * Wed Jun 5 2013 Richard W.M. Jones - 1.0.0-3 - Don't package lenses in tests/ subdirectory. * Wed Feb 13 2013 Fedora Release Engineering - 1.0.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Fri Jan 4 2013 David Lutterkort - 1.0.0-1 - New version; remove all patches * Wed Jul 18 2012 Fedora Release Engineering - 0.10.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild * Tue Jan 10 2012 David Lutterkort - 0.10.0-3 - Add patches for bugs 247 and 248 (JSON lens) * Sat Dec 3 2011 Richard W.M. Jones - 0.10.0-2 - Add patch to resolve missing libxml2 requirement in augeas.pc. * Fri Dec 2 2011 David Lutterkort - 0.10.0-1 - New version * Mon Jul 25 2011 David Lutterkort - 0.9.0-1 - New version; removed patch pathx-whitespace-ea010d8 * Tue May 3 2011 David Lutterkort - 0.8.1-2 - Add patch pathx-whitespace-ea010d8.patch to fix BZ 700608 * Fri Apr 15 2011 David Lutterkort - 0.8.1-1 - New version * Wed Feb 23 2011 David Lutterkort - 0.8.0-1 - New version * Mon Feb 07 2011 Fedora Release Engineering - 0.7.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild * Mon Nov 22 2010 Matthew Booth - 0.7.4-1 - Update to version 0.7.4 * Thu Nov 18 2010 Richard W.M. Jones - 0.7.3-2 - Upstream patch proposed to fix GCC optimization bug (RHBZ#651992). * Fri Aug 6 2010 David Lutterkort - 0.7.3-1 - Remove upstream patches * Tue Jun 29 2010 David Lutterkort - 0.7.2-2 - Patches based on upstream fix for BZ 600141 * Tue Jun 22 2010 David Lutterkort - 0.7.2-1 - Fix ownership of /usr/share/augeas. BZ 569393 * Wed Apr 21 2010 David Lutterkort - 0.7.1-1 - New version * Thu Jan 14 2010 David Lutterkort - 0.7.0-1 - Remove patch vim-ftdetect-syntax.patch. It's upstream * Tue Dec 15 2009 David Lutterkort - 0.6.0-2 - Fix ftdetect file for vim * Mon Nov 30 2009 David Lutterkort - 0.6.0-1 - Install vim syntax files * Mon Sep 14 2009 David Lutterkort - 0.5.3-1 - Remove separate xorg.aug, included in upstream source * Tue Aug 25 2009 Matthew Booth - 0.5.2-3 - Include new xorg lens from upstream * Fri Jul 24 2009 Fedora Release Engineering - 0.5.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild * Mon Jul 13 2009 David Lutterkort - 0.5.2-1 - New version * Fri Jun 5 2009 David Lutterkort - 0.5.1-1 - Install fadot * Fri Mar 27 2009 David Lutterkort - 0.5.0-2 - fadot isn't being installed just yet * Tue Mar 24 2009 David Lutterkort - 0.5.0-1 - New program /usr/bin/fadot * Mon Mar 9 2009 David Lutterkort - 0.4.2-1 - New version * Fri Feb 27 2009 David Lutterkort - 0.4.1-1 - New version * Fri Feb 6 2009 David Lutterkort - 0.4.0-1 - New version * Mon Jan 26 2009 David Lutterkort - 0.3.6-1 - New version * Tue Dec 23 2008 David Lutterkort - 0.3.5-1 - New version * Mon Feb 25 2008 David Lutterkort - 0.0.4-1 - Initial specfile augeas-1.15.0/lenses/0000755000175100017510000000000015257033004010076 5augeas-1.15.0/lenses/logwatch.aug0000644000175100017510000000270115257032642012333 (* Logwatch module for Augeas Author: Francois Lebel 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 augeas-1.15.0/lenses/sep.aug0000644000175100017510000000243215257032642011313 (* Module: Sep Generic separators to build lenses Author: Raphael Pinson 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 and default to a single space *) let space = del Rx.space " " (* Variable: tab Deletes a and default to a tab *) let tab = del Rx.space "\t" (* Variable: opt_space Deletes a and default to an empty string *) let opt_space = del Rx.opt_space "" (* Variable: opt_tab Deletes a and default to a tab *) let opt_tab = del Rx.opt_space "\t" (* Variable: cl_or_space Deletes a and default to a single space *) let cl_or_space = del Rx.cl_or_space " " (* Variable: cl_or_opt_space Deletes a 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 ")" augeas-1.15.0/lenses/login_defs.aug0000644000175100017510000000114715257032642012637 (* 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 . *) 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 augeas-1.15.0/lenses/host_conf.aug0000644000175100017510000000362515257032642012513 (* Module: Host_Conf Parses /etc/host.conf Author: Raphael Pinson 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 . *) 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 . Sep.opt_space) 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 augeas-1.15.0/lenses/tuned.aug0000644000175100017510000000060315257032642011641 (* Module: Tuned Parses Tuned's configuration files Author: Pat Riehecky 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 augeas-1.15.0/lenses/squid.aug0000644000175100017510000003771215257032642011662 (* Squid module for Augeas Author: Free Ekanayaka 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 augeas-1.15.0/lenses/aptsources822.aug0000644000175100017510000000745315257032642013160 (* Module: Aptsources822 Augeas module for sources list (Deb822 style) for Apt package manager Authors: James Valleroy Sunil Mohan Adapa About: Reference 1. Deb822(5): https://manpages.debian.org/bullseye/dpkg-dev/deb822.5.en.html 2. sources.list(5): https://manpages.debian.org/bullseye/apt/sources.list.5.en.html About: License This file is licensed under the LGPLv2+, like the rest of Augeas. About: Configuration files This lens applies to files in /etc/apt/sources.list.d/ ending with the extension .sources. See . *) module Aptsources822 = autoload xfm (* Variable: single_value_field_name Names of known fields for which only a single value is allowed. *) let single_value_field_name = /(Enabled|PDiffs|By-Hash|Allow-Insecure|Allow-Weak|Allow-Downgrade-To-Insecure|Trusted|Check-Valid-Until|Valid-Until-Min|Valid-Until-Max|Check-Date|Date-Max-Future|InRelease-Path|Snapshot)/ (* Variable: multi_value_field_name Names of known fields for which multiple values are allowed and are assumed to contain multiple values These fields also allow the form FieldName-Add: extra_value FieldName-Remove: delete_this_value This is an explicit list of allowed field names *) let multi_value_field_name = /(URIs|Types|Components|Suites|Architectures|Include|Exclude|Languages|Targets|Signed-By)(-Add|-Remove)?/ (* Variable: field_value Value that a field can contain. Deb822 styles sources list files defines these fields to have multiple values separated by space, tab or a newline. *) let field_value = /[!-~]+/ (* Variable: text_value Value for the embedded public-key format for Signed-By Includes all text on the line except leading-spaces and trailing-spaces *) let text_value = /[!-~](.*[!-~])?/ (* Variable: empty_line Lens for an empty line separating two stanzas. It can't be a comment. Only tabs and spaces are allowed. *) let empty_line = Util.doseol (* Variable: name_value_separator Lens for separating a name and value. Field name is followed by a ':' and then optionally space. The file format also allow for a value to be on a new line when the new line starts with space or a tab. *) let name_value_separator = Sep.colon . del Rx.opt_space " " (* Variable: single_value_field Lens for a field (field name, separator and field value) with only a single value. *) let single_value_field = [ key single_value_field_name . name_value_separator . store field_value . Util.doseol ] (* Variable: multi_value_field Lens for a field (field name, separator and field value) with multiple values or can run over multiple lines, ie. SignedBy *) let multi_value_field = [ key multi_value_field_name . name_value_separator . ( ( counter "item" . [ seq "item". store field_value . del /[ \t]+/ " " ]* . [ seq "item". store field_value ] . Util.doseol ) | ( [ label "text" . del "\n" "\n" . counter "item" . [ del /^[ ]/ " " . seq "item" . store text_value . Util.doseol ]+ ] ) ) ] (* Variable: stanza Lens for a stanza that describes one or more sources for apt. *) (* An empty_line must seperate stanzas. A stanza may be completely empty, but must end on a newline (or end at the end-of-file) This results in the counter "source" being incremented with each empty line *) let stanza = [ seq "source" . (single_value_field | multi_value_field | Util.comment_noindent)* ] (* Variable: lns Lens for parsing the entire apt sources file in Deb822 format. *) let lns = ( stanza . empty_line )* . stanza (* Variable: filter All files in the sources.list.d directory are files describing sources. However, only those ending with .sources extension are in Deb822 format. *) let filter = incl "/etc/apt/sources.list.d/*.sources" let xfm = transform lns filter augeas-1.15.0/lenses/ldif.aug0000644000175100017510000001723115257032642011445 (* Module: Ldif Parses the LDAP Data Interchange Format (LDIF) Author: Dominic Cleal About: Reference This lens tries to keep as close as possible to 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 augeas-1.15.0/lenses/anaconda.aug0000644000175100017510000000140715257032642012271 (* Module: Anaconda Parses Anaconda's user interaction configuration files. Author: Pino Toscano 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 augeas-1.15.0/lenses/vmware_config.aug0000644000175100017510000000127615257032642013357 (* Module: VWware_Config Parses /etc/vmware/config Author: Raphael Pinson About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files This lens applies to /etc/vmware/config. See . About: Examples The 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 augeas-1.15.0/lenses/nsswitch.aug0000644000175100017510000000452215257032642012370 (* Module: Nsswitch Parses /etc/nsswitch.conf Author: Raphael Pinson 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 . *) 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]/ | /[Mm][Ee][Rr][Gg][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.comment_or_eol ] (* View: lns *) let lns = ( empty | comment | database )* (* Variable: filter *) let filter = (incl "/etc/nsswitch.conf") let xfm = transform lns filter augeas-1.15.0/lenses/star.aug0000644000175100017510000000165515257032642011503 (* Module: Star Parses star's configuration file Author: Cedric Bosdonnat About: Reference This lens is based on star(1) About: License This file is licensed under the LGPL v2+, like the rest of Augeas. *) module Star = autoload xfm let sto_to_tab = store Rx.no_spaces let size = Build.key_value_line "STAR_FIFOSIZE" Sep.space_equal ( store /[0-9x*.a-z]+/ ) let size_max = Build.key_value_line "STAR_FIFOSIZE_MAX" Sep.space_equal ( store /[0-9x*.a-z]+/ ) let archive = Build.key_value_line ( "archive". /[0-7]/ ) Sep.equal ( [ label "device" . sto_to_tab ] . Sep.tab . [ label "block" . sto_to_tab ] . Sep.tab . [ label "size" . sto_to_tab ] . ( Sep.tab . [ label "istape" . sto_to_tab ] )? ) let lns = ( size | size_max | archive | Util.comment | Util.empty )* let filter = incl "/etc/default/star" let xfm = transform lns filter augeas-1.15.0/lenses/cockpit.aug0000644000175100017510000000373415257032642012166 (* Module: Cockpit Cockpit module for Augeas Author: Pat Riehecky About: Configuration files cockpit.conf is a standard INI File. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. *) module Cockpit = 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]+/ " " 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 - ("Origins" | "Fatal") 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_two_opt (list_entry_elem "Origins") (list_entry_elem "Fatal") (***********************************************************************a * TITLE *************************************************************************) let title = IniFile.title IniFile.record_re let record = [ title . entries ] (************************************************************************ * LENS & FILTER *************************************************************************) let lns = (empty | comment)* . record* let filter = (incl "/etc/cockpit/cockpit.conf") let xfm = transform lns filter augeas-1.15.0/lenses/xymon_alerting.aug0000644000175100017510000001416315257032642013567 (* Module: Xymon_Alerting Parses xymon alerting files Author: Francois Maillard About: Reference This lens tries to keep as close as possible to `man 5 alerts.cfg` where possible. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Not supported File inclusion are not followed About: Configuration files This lens applies to /etc/xymon/alerts.d/*.cfg and /etc/xymon/alerts.cfg. See . About: Examples The file contains various examples and tests. *) module Xymon_Alerting = autoload xfm (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* View: store_word *) let store_word = store /[^ =\t\n#]+/ (* View: comparison The greater and lesser than operators *) let comparison = store /[<>]/ (* View: equal *) let equal = Sep.equal (* View: ws *) let ws = Sep.space (* View: eol *) let eol = Util.eol (* View: ws_or_eol *) let ws_or_eol = del /([ \t]+|[ \t]*\n[ \t]*)/ " " (* View: comment *) let comment = Util.comment (* View: empty *) let empty = Util.empty (* View: include *) let include = [ key "include" . ws . store_word . eol ] (************************************************************************ * Group: MACRO DEFINITION *************************************************************************) (* View: macrodefinition A string that starts with $ and that is assigned something *) let macrodefinition = [ key /\$[^ =\t\n#\/]+/ . Sep.space_equal . store Rx.space_in . eol ] (* View: flag A flag value *) let flag (kw:string) = Build.flag kw (* View: kw_word A key=value value *) let kw_word (kw:regexp) = Build.key_value kw equal store_word (************************************************************************ * Group: FILTERS *************************************************************************) (* View: page The (ex)?page filter definition *) let page = kw_word /(EX)?PAGE/ (* View: group The (ex)?group filter definition *) let group = kw_word /(EX)?GROUP/ (* View: host The (ex)?host filter definition *) let host = kw_word /(EX)?HOST/ (* View: service The (ex)?service filter definition *) let service = kw_word /(EX)?SERVICE/ (* View: color The color filter definition *) let color = kw_word "COLOR" (* View: time The time filter definition *) let time = kw_word "TIME" (* View: duration The duration filter definition *) let duration = [ key "DURATION" . [ label "operator" . comparison ] . [ label "value" . store_word ] ] (* View: recover The recover filter definition *) let recover = flag "RECOVER" (* View: notice The notice filter definition *) let notice = flag "NOTICE" (* View: rule_filter Filters are made out of any of the above filter definitions *) let rule_filter = page | group | host | service | color | time | duration | recover | notice (* View: filters One or more filters *) let filters = [ label "filters" . Build.opt_list rule_filter ws ] (* View: filters_opt Zero, one or more filters *) let filters_opt = [ label "filters" . (ws . Build.opt_list rule_filter ws)? ] (* View: kw_word_filters_opt A entry with optional filters *) let kw_word_filters_opt (kw:string) = [ key kw . equal . store_word . filters_opt ] (* View: flag_filters_opt A with optional filters *) let flag_filters_opt (kw:string) = [ key kw . filters_opt ] (************************************************************************ * Group: RECIPIENTS *************************************************************************) (* View: mail The mail recipient definition *) let mail = [ key "MAIL" . ws . store_word . filters_opt ] (* View: script The script recipient definition *) let script = [ key "SCRIPT" . ws . [ label "script" . store_word ] . ws . [ label "recipient" . store_word ] . filters_opt ] (* View: ignore The ignore recipient definition *) let ignore = flag_filters_opt "IGNORE" (* View: format The format recipient definition *) let format = kw_word_filters_opt "FORMAT" (* View: repeat The repeat recipient definition *) let repeat = kw_word_filters_opt "REPEAT" (* View: unmatched The unmatched recipient definition *) let unmatched = flag_filters_opt "UNMATCHED" (* View: stop The stop recipient definition *) let stop = flag_filters_opt "STOP" (* View: macro The macro recipient definition *) let macro = [ key /\$[^ =\t\n#\/]+/ . filters_opt ] (* View: recipient Recipients are made out of any of the above recipient definitions *) let recipient = mail | script | ignore | format | repeat | unmatched | stop | macro let recipients = [ label "recipients" . Build.opt_list recipient ws_or_eol ] (************************************************************************ * Group: RULES *************************************************************************) (* View: rule Rules are made of rule_filter and then recipients sperarated by a whitespace *) let rule = [ seq "rules" . filters . ws_or_eol . recipients . eol ] (* View: lns The Xymon_Alerting lens *) let lns = ( rule | macrodefinition | include | empty | comment )* (* Variable: filter *) let filter = incl "/etc/xymon/alerts.d/*.cfg" . incl "/etc/xymon/alerts.cfg" . Util.stdexcl let xfm = transform lns filter augeas-1.15.0/lenses/activemq_conf.aug0000644000175100017510000000274515257032642013351 (* Module: ActiveMQ_Conf ActiveMQ / FuseMQ conf module for Augeas Author: Brian Redbeard 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 . *) 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 augeas-1.15.0/lenses/thttpd.aug0000644000175100017510000000250115257032642012030 (* Module: Thttpd Parses Thttpd's configuration files Author: Marc Fournier 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 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 augeas-1.15.0/lenses/aptsources.aug0000644000175100017510000000411215257032642012711 (* Module: Aptsources Parsing /etc/apt/sources.list *) module Aptsources = autoload xfm (************************************************************************ * Group: Utility variables/functions ************************************************************************) (* View: sep_ws *) let sep_ws = Sep.space (* 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]+/ (* View: uri *) let uri = let protocol = /[a-z+]+:/ in let path = /\/[^] \t]*/ in let path_brack = /\[[^]]+\]\/?/ in protocol? . path | protocol . path_brack (************************************************************************ * Group: Keywords ************************************************************************) (* View: record *) let record = let option_key = /[^= \t\r\n]*[^-+= \t\r\n]/ in let option_sep = [ label "operation" . store /[+-]/]? . Sep.equal in let option_value = (store /[^] \t\r\n]+/) in let option = Build.key_value option_key option_sep option_value in let options = [ label "options" . Util.del_str "[" . Sep.opt_space . Build.opt_list option Sep.space . Sep.opt_space . Util.del_str "]" . sep_ws ] in [ Util.indent . seq "source" . [ label "type" . store word ] . sep_ws . options? . [ label "uri" . store uri ] . 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/*.list") . Util.stdexcl let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) augeas-1.15.0/lenses/carbon.aug0000644000175100017510000000304615257032642011772 (* Module: Carbon Parses Carbon's configuration files Author: Marc Fournier 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 . 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 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 augeas-1.15.0/lenses/xymon.aug0000644000175100017510000000441215257032642011676 (* Xymon configuration By Jason Kincl - 2012 *) module Xymon = autoload xfm let empty = Util.empty let eol = Util.eol let word = Rx.word let space = Rx.space let ip = Rx.ip let del_ws_spc = Util.del_ws_spc let value_to_eol = store /[^ \t][^\n]+/ let eol_no_spc = Util.del_str "\n" let comment = Util.comment_generic /[ \t]*[;#][ \t]*/ "# " let include = [ key /include|dispinclude|netinclude|directory/ . del_ws_spc . value_to_eol . eol_no_spc ] let title = [ key "title" . del_ws_spc . value_to_eol . eol_no_spc ] (* Define host *) let tag = del_ws_spc . [ label "tag" . store /[^ \n\t]+/ ] let host_ip = [ label "ip" . store ip ] let host_hostname = [ label "fqdn" . store word ] let host_colon = del /[ \t]*#/ " #" let host = [ label "host" . host_ip . del space " " . host_hostname . host_colon . tag* . eol ] (* Define group-compress and group-only *) let group_extra = del_ws_spc . value_to_eol . eol_no_spc . (comment | empty | host | title)* let group = [ key "group" . group_extra ] let group_compress = [ key "group-compress" . group_extra ] let group_sorted = [ key "group-sorted" . group_extra ] let group_only_col = [ label "col" . store Rx.word ] let group_only_cols = del_ws_spc . group_only_col . ( Util.del_str "|" . group_only_col )* let group_only = [ key "group-only" . group_only_cols . group_extra ] (* Have to use namespacing because page's title overlaps plain title tag *) let page_name = store word let page_title = [ label "pagetitle" . del_ws_spc . value_to_eol . eol_no_spc ] let page_extra = del_ws_spc . page_name . (page_title | eol_no_spc) . (comment | empty | title | include | host)* . (group | group_compress | group_sorted | group_only)* let page = [ key /page|subpage/ . page_extra ] let subparent_parent = [ label "parent" . store word ] let subparent = [ key "subparent" . del_ws_spc . subparent_parent . page_extra ] let ospage = [ key "ospage" . del_ws_spc . store word . del_ws_spc . [ label "ospagetitle" . value_to_eol . eol_no_spc ] ] let lns = (empty | comment | include | host | title | ospage )* . (group | group_compress | group_sorted | group_only)* . (page | subparent)* let filter = incl "/etc/xymon/hosts.cfg" . incl "/etc/xymon/pages.cfg" let xfm = transform lns filter augeas-1.15.0/lenses/pbuilder.aug0000644000175100017510000000117615257032642012336 (* Module: Pbuilder Parses /etc/pbuilderrc, /etc/pbuilder/pbuilderrc Author: Raphael Pinson 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 . *) 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 augeas-1.15.0/lenses/clamav.aug0000644000175100017510000000311415257032642011765 (* Module: ClamAV Parses ClamAV clamd and freshclam configuration files. Author: Andrew Colin Kissa 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 . *) 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") . (incl "/etc/clamav/*.conf") let xfm = transform lns filter augeas-1.15.0/lenses/dpkg.aug0000644000175100017510000000544315257032642011456 (* Module: Dpkg Parses /etc/dpkg/dpkg.cfg Author: Robin Lee Powell About: License This file, and the attendant test_dpgk.aug, are explicitly 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 likelihood 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") augeas-1.15.0/lenses/htpasswd.aug0000644000175100017510000000202315257032642012355 (* Module: Htpasswd Parses htpasswd and rsyncd.secrets files Author: Marc Fournier 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 augeas-1.15.0/lenses/mysql.aug0000644000175100017510000000371215257032642011673 (* MySQL module for Augeas *) (* Author: Tim Stoop *) (* Heavily based on php.aug by Raphael Pinson *) (* *) (* *) 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") . (incl "/etc/my.cnf.d/*.cnf") let xfm = transform lns filter augeas-1.15.0/lenses/mcollective.aug0000644000175100017510000000213015257032642013025 (* Module: MCollective Parses MCollective's configuration files Author: Marc Fournier 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 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 augeas-1.15.0/lenses/apt_update_manager.aug0000644000175100017510000000215715257032642014350 (* Module: Apt_Update_Manager Parses files in /etc/update-manager Author: Raphael Pinson About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files This lens applies to files in /etc/update-manager. See . About: Examples The 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 augeas-1.15.0/lenses/pgbouncer.aug0000644000175100017510000000266615257032642012521 (* Module: Pgbouncer Parses Pgbouncer ini configuration files. Author: Andrew Colin Kissa 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 . 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 augeas-1.15.0/lenses/gtkbookmarks.aug0000644000175100017510000000152715257032642013226 (* Module: GtkBookmarks Parses $HOME/.gtk-bookmarks Author: Raphael Pinson About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files This lens applies to $HOME/.gtk-bookmarks. See . About: Examples The 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")) augeas-1.15.0/lenses/masterpasswd.aug0000644000175100017510000001056415257032642013246 (* Module: MasterPasswd Parses /etc/master.passwd Author: Matt Dainty About: Reference - man 5 master.passwd Each line in the master.passwd file represents a single user record, whose colon-separated attributes correspond to the members of the passwd struct *) module MasterPasswd = 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 = Passwd.sto_to_eol let sto_to_col = Passwd.sto_to_col (* Store an empty string if nothing matches *) let sto_to_col_or_empty = Passwd.sto_to_col_or_empty (************************************************************************ * 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: class pw_class *) let class = [ label "class" . sto_to_col? . colon ] (* View: change pw_change *) let change_date = [ label "change_date" . store integer? . colon ] (* View: expire pw_expire *) let expire_date = [ label "expire_date" . 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 . class . change_date . expire_date . 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 "class" . sto_to_col ]? . colon . [ label "change_date" . store integer ]? . colon . [ label "expire_date" . 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 "class" . sto_to_col? . colon ] . [ label "change_date" . store integer? . colon ] . [ label "expire_date" . 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/master.passwd" let xfm = transform lns filter augeas-1.15.0/lenses/ntpd.aug0000644000175100017510000001137515257032642011477 (* Module: Ntpd Parses OpenNTPD's ntpd.conf Author: Jasper Lievisse Adriaanse 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 . *) 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 augeas-1.15.0/lenses/approx.aug0000644000175100017510000000240615257032642012036 (* Module: Approx Parses /etc/approx/approx.conf Author: David Lutterkort 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 . About: Configuration files This lens applies to /etc/approx/approx.conf. About: Examples The file contains various examples and tests. *) module Approx = autoload xfm (* Variable: eol An *) let eol = Util.eol (* Variable: indent An *) 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 *) 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 augeas-1.15.0/lenses/known_hosts.aug0000644000175100017510000000367315257032642013110 (* Module: Known_Hosts Parses SSH known_hosts files Author: Raphaël Pinson About: Reference This lens manages OpenSSH's known_hosts files. See `man 8 sshd` for reference. 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 . *) module Known_Hosts = autoload xfm (* View: marker The marker is optional, but if it is present then it must be one of “@cert-authority”, to indicate that the line contains a certification authority (CA) key, or “@revoked”, to indicate that the key contained on the line is revoked and must not ever be accepted. Only one marker should be used on a key line. *) let marker = [ key /@(revoked|cert-authority)/ . Sep.space ] (* View: type Bits, exponent, and modulus are taken directly from the RSA host key; they can be obtained, for example, from /etc/ssh/ssh_host_key.pub. The optional comment field continues to the end of the line, and is not used. *) let type = [ label "type" . store Rx.neg1 ] (* View: entry A known_hosts entry *) let entry = let alias = [ label "alias" . store Rx.neg1 ] in let key = [ label "key" . store Rx.neg1 ] in [ Util.indent . seq "entry" . marker? . store Rx.neg1 . (Sep.comma . Build.opt_list alias Sep.comma)? . Sep.space . type . Sep.space . key . Util.comment_or_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 augeas-1.15.0/lenses/slapd.aug0000644000175100017510000001231715257032642011632 (* Slapd module for Augeas Author: Free Ekanayaka 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 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)* let filter = incl "/etc/ldap/slapd.conf" . incl "/etc/openldap/slapd.conf" let xfm = transform lns filter augeas-1.15.0/lenses/lokkit.aug0000644000175100017510000000425015257032642012021 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 , --trust= *) let trust = [ option "trust" "t" . store Rx.device_name . eol ] (* port directive -p [-]:, --port=[-]: *) 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=[:][:] *) 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=:port=:proto=[:toport=][:toaddr=] *) 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") augeas-1.15.0/lenses/keepalived.aug0000644000175100017510000002535415257032642012645 (* Module: Keepalived Parses /etc/keepalived/keepalived.conf Author: Raphael Pinson 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 . About: Examples The 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 or *) 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_ipv6 *) let sto_ipv6 = store Rx.ipv6 (* 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 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 . *) 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"|"vrrp_mcast_group4" in let ipv6_re = "vrrp_mcast_group6" 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 | field ipv6_re sto_ipv6 (* 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 = let to_eol_re = /notify(_master|_backup|_fault|_stop|_deleted)?/ in let flag_re = "smtp_alert" in field to_eol_re sto_to_eol | flag flag_re | 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|repeat|refresh|refresh_repeat)/ in let to_eol_re = /notify(_master|_backup|_fault|_stop|_deleted)?/ | /(mcast|unicast)_src_ip/ in let flag_re = "smtp_alert" | "nopreempt" | "ha_suspend" | "debug" | "use_vmac" | "vmac_xmit_base" | "native_ipv6" | "dont_track_primary" | "preempt_delay" 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 ) | block "unicast_peer" static_ipaddress_field (* 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" | "fall" | "raise" 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 augeas-1.15.0/lenses/mailscanner_rules.aug0000644000175100017510000000553715257032642014243 (* Module: Mailscanner_rules Parses MailScanner rules files. Author: Andrew Colin Kissa 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 augeas-1.15.0/lenses/jettyrealm.aug0000644000175100017510000000302015257032642012676 (* Module: JettyRealm JettyRealm Properties for Augeas Author: Brian Redbeard About: Reference This lens ensures that properties files for JettyRealms are properly handled by Augeas. About: License This file is licensed under the LGPL License. About: Lens Usage Sample usage of this lens in augtool: * Create a new user > ins user after /files/etc/activemq/jetty-realm.properties/user > set /files/etc/activemq/jetty-realm.properties/user[last()]/username redbeard > set /files/etc/activemq/jetty-realm.properties/user[last()]/password testing > set /files/etc/activemq/jetty-realm.properties/user[last()]/realm admin ... * Delete the user named sample_user > rm /files/etc/activemq/jetty-realm.properties/user[*][username = "sample_user"] Saving your file: > save About: Configuration files This lens applies to jetty-realm.properties files. See . *) module JettyRealm = autoload xfm (* View: comma_sep *) let comma_sep = del /,[ \t]*/ ", " (* View: realm_entry *) let realm_entry = [ label "user" . [ label "username" . store Rx.word ] . del /[ \t]*:[ \t]*/ ": " . [ label "password" . store Rx.word ] . [ label "realm" . comma_sep . store Rx.word ]* . Util.eol ] (* View: lns *) let lns = ( Util.comment | Util.empty | realm_entry )* (* Variable: filter *) let filter = incl "/etc/activemq/jetty-realm.properties" let xfm = transform lns filter augeas-1.15.0/lenses/fonts.aug0000644000175100017510000000146315257032642011660 (* Module: Fonts Parses the /etc/fonts directory Author: Raphael Pinson 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 . About: Examples The 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 augeas-1.15.0/lenses/pamconf.aug0000644000175100017510000000235015257032642012146 (* Module: PamConf Parses /etc/pam.conf files Author: Dominic Cleal 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 . *) 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 ] . Sep.space . Pam.record ] let lns = ( empty | comment | include | record ) * let filter = incl "/etc/pam.conf" let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) augeas-1.15.0/lenses/ssh.aug0000644000175100017510000001061515257032642011323 (* Module: Ssh Parses ssh client configuration Author: Jiri Suchomel 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 spc_eq = del /[ \t]+|[ \t]*=[ \t]*/ " " 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 /[^ \t\r\n=][^ \t\r\n]*/ let value_to_comma = store /[^, \t\r\n=][^, \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_eq . Build.opt_list value comma . eol ] let spaces_entry (k:regexp) = let value = [ seq "spaces_entry" . value_to_spc ] in [ indent . key k . counter "spaces_entry" . spc_eq . Build.opt_list value spc . eol ] let fw_entry (k:regexp) = [ indent . key k . spc_eq . [ key /[^ \t\r\n\/=][^ \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 algorithms = commas_entry /(HostKey|Kex)Algorithms/i let pubkey_accepted_key_types = commas_entry /PubkeyAcceptedKeyTypes/i let global_knownhosts_file = spaces_entry /GlobalKnownHostsFile/i let rekey_limit = [ indent . key /RekeyLimit/i . spc_eq . [ label "amount" . value_to_spc ] . [ spc . label "duration" . value_to_spc ]? . eol ] let special_entry = send_env | proxy_command | remote_fw | local_fw | macs | ciphers | algorithms | pubkey_accepted_key_types | global_knownhosts_file | rekey_limit let key_re = /[A-Za-z0-9]+/ - /SendEnv|Host|Match|ProxyCommand|RemoteForward|LocalForward|MACs|Ciphers|(HostKey|Kex)Algorithms|PubkeyAcceptedKeyTypes|GlobalKnownHostsFile|RekeyLimit/i let other_entry = [ indent . key key_re . spc_eq . value_to_spc . eol ] let entry = comment | empty | special_entry | other_entry let host = [ key /Host/i . spc . value_to_eol . eol . entry* ] let condition_entry = let k = /[A-Za-z0-9]+/ in let no_spc = Quote.do_dquote_opt (store /[^"' \t\r\n=]+/) in let with_spc = Quote.do_quote (store /[^"'\t\r\n]* [^"'\t\r\n]*/) in [ spc . key k . spc . no_spc ] | [ spc . key k . spc . with_spc ] let match_cond = [ label "Condition" . condition_entry+ . eol ] let match_entry = entry let match = [ key /Match/i . match_cond . [ label "Settings" . match_entry+ ] ] (************************************************************************ * Group: LENS *************************************************************************) let lns = entry* . (host | match)* let xfm = transform lns (incl "/etc/ssh/ssh_config" . incl (Sys.getenv("HOME") . "/.ssh/config") . incl "/etc/ssh/ssh_config.d/*.conf") augeas-1.15.0/lenses/soma.aug0000644000175100017510000000221715257032642011464 (* Soma module for Augeas Author: Free Ekanayaka 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 augeas-1.15.0/lenses/up2date.aug0000644000175100017510000000433015257032642012067 (* Module: Up2date Parses /etc/sysconfig/rhn/up2date Author: Raphael Pinson 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 . About: Examples The 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 augeas-1.15.0/lenses/bootconf.aug0000644000175100017510000000723015257032642012336 (* Module: BootConf Parses (Open)BSD-stype /etc/boot.conf Author: Jasper Lievisse Adriaanse 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 . *) 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 augeas-1.15.0/lenses/strongswan.aug0000644000175100017510000000320715257032642012732 (* Module: Strongswan Lens for parsing strongSwan configuration files Authors: Kaarle Ritvanen About: Reference strongswan.conf(5), swanctl.conf(5) About: License This file is licensed under the LGPL v2+ *) module Strongswan = autoload xfm let ws = del /[\n\t ]*(#[\t ]*\n[\n\t ]*)*/ let rec conf = let keys = /[^\/.\{\}#\n\t ]+/ - /include/ in let lists = /(crl|oscp)_uris|(local|remote)_(addrs|ts)|vips|pools|(ca)?certs|pubkeys|groups|cert_policy|dns|nbns|dhcp|netmask|server|subnet|split_(in|ex)clude|interfaces_(ignore|use)|preferred/ in let proposals = /((ah|esp)_)?proposals/ in let name (pat:lens) (sep:string) = pat . Util.del_ws_spc . Util.del_str sep in let val = store /[^\n\t ].*/ . Util.del_str "\n" . ws "" in let sval = Util.del_ws_spc . val in let ival (pat:lens) (end:string) = Util.del_opt_ws " " . seq "item" . pat . Util.del_str end in let list (l:string) (k:regexp) (v:lens) = [ label l . name (store k) "=" . counter "item" . [ ival v "," ]* . [ ival v "\n" ] . ws "" ] in let alg = seq "alg" . store /[a-z0-9]+/ in ( [ Util.del_str "#" . label "#comment" . Util.del_opt_ws " " . val ] | [ key "include" . sval ] | [ name (key (keys - lists - proposals)) "=" . sval ] | list "#list" lists (store /[^\n\t ,][^\n,]*/) | list "#proposals" proposals (counter "alg" . [ alg ] . [ Util.del_str "-" . alg ]*) | [ name (key keys) "{" . ws "\n" . conf . Util.del_str "}" . ws "\n" ] )* let lns = ws "" . conf let xfm = transform lns ( incl "/etc/strongswan.d/*.conf" . incl "/etc/strongswan.d/**/*.conf" . incl "/etc/swanctl/conf.d/*.conf" . incl "/etc/swanctl/swanctl.conf" ) augeas-1.15.0/lenses/memcached.aug0000644000175100017510000000237015257032642012433 (* Module: Memcached Parses Memcached's configuration files Author: Marc Fournier 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 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 augeas-1.15.0/lenses/group.aug0000644000175100017510000000324715257032642011665 (* Group module for Augeas Author: Free Ekanayaka 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 = Passwd.sto_to_col 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 password? . 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 augeas-1.15.0/lenses/hosts.aug0000644000175100017510000000074515257032642011671 (* 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") augeas-1.15.0/lenses/subversion.aug0000644000175100017510000000540115257032642012722 (* Module: Subversion Parses subversion's INI files Authors: Marc Fournier Raphael Pinson About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Examples The 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 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 *) 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 augeas-1.15.0/lenses/odbc.aug0000644000175100017510000000265215257032642011437 (* ODBC lens for Augeas Author: Marc Fournier 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 augeas-1.15.0/lenses/grubenv.aug0000644000175100017510000000077415257032642012203 (* Parsing /boot/grub/grubenv *) module GrubEnv = autoload xfm let eol = Util.del_str "\n" let comment = Util.comment let eq = Util.del_str "=" let value = /[^\\\n]*(\\\\(\\\\|\n)[^\\\n]*)*/ let word = /[A-Za-z_][A-Za-z0-9_]*/ let record = [ seq "target" . [ label "name" . store word ] . eq . [ label "value" . store value ] . eol ] let lns = ( comment | record ) * let xfm = transform lns (incl "/boot/grub/grubenv" . incl "/boot/grub2/grubenv") augeas-1.15.0/lenses/logrotate.aug0000644000175100017510000001035515257032642012527 (* Logrotate module for Augeas *) (* Author: Raphael Pinson *) (* Patches from: *) (* Sean Millichamp *) (* *) (* 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 = Quote.do_quote_opt (store /\/[^"',#= \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" /(hourly|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 | flag_to_eol "dateyesterday" | 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" . 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 augeas-1.15.0/lenses/lvm.aug0000644000175100017510000000403715257032642011325 (* Module: LVM Parses LVM metadata. Author: Gabriel de Perthuis 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 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 augeas-1.15.0/lenses/mailscanner.aug0000644000175100017510000000324315257032642013021 (* Module: Mailscanner Parses MailScanner configuration files. Author: Andrew Colin Kissa 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 . *) 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 augeas-1.15.0/lenses/pagekite.aug0000644000175100017510000000514715257032642012323 (* Module: Pagekite Parses /etc/pagekite.d/ Author: Michael Pimmer 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 augeas-1.15.0/lenses/fai_diskconfig.aug0000644000175100017510000002243615257032642013471 (* Module: FAI_DiskConfig Parses disk_config files for FAI Author: Raphael Pinson 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 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 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 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 *) 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 *) 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 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 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 s and 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 *) augeas-1.15.0/lenses/xml.aug0000644000175100017510000001452115257032642011326 (* XML lens for Augeas Author: Francis Giraldeau 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 "" ] 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 = let literal (lbl:string) = [ sep_spc . label lbl . sto_dquote ] in decl_def /!ENTITY/ ( literal "#decl" | [ sep_spc . key /SYSTEM/ . literal "#systemliteral" ] | [ sep_spc . key /PUBLIC/ . literal "#pubidliteral" . literal "#systemliteral" ] ) 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 "" ] (************************************************************************ * Tags *************************************************************************) (* we consider entities as simple text *) let text_re = /[^<]+/ - /([^<]*\]\]>[^<]*)/ let text = [ label "#text" . store text_re ] let cdata = [ label "#CDATA" . dels "" . 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 "[\r?\n]?/ "/>\n" ] let pi_instruction = [ dels "/ "?>" ] (* 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 | Util.empty? let filter = (incl "/etc/xml/*.xml") . (incl "/etc/xml/catalog") let xfm = transform lns filter augeas-1.15.0/lenses/fail2ban.aug0000644000175100017510000000345315257032642012206 (* Fail2ban module for Augeas *) (* Author: Nicolas Gif *) (* Heavily based on DPUT module by Raphael Pinson *) (* *) (* *) module Fail2ban = 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 (************************************************************************ * "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 IniFile.entry_re 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 IniFile.record_re let record = IniFile.record title entry let lns = IniFile.lns record comment let filter = (incl "/etc/fail2ban/fail2ban.conf") . (incl "/etc/fail2ban/jail.conf") . (incl "/etc/fail2ban/jail.local") . (incl "/etc/fail2ban/fail2ban.d/*.conf") . (incl "/etc/fail2ban/jail.d/*.conf") let xfm = transform lns filter augeas-1.15.0/lenses/aptpreferences.aug0000644000175100017510000000344715257032642013541 (* Module: AptPreferences Apt/preferences module for Augeas Author: Raphael Pinson *) 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 augeas-1.15.0/lenses/sysctl.aug0000644000175100017510000000256415257032642012053 (* Module: Sysctl Parses /etc/sysctl.conf and /etc/sysctl.d/* Author: David Lutterkort 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 . About: Examples The 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: entry basically a Simplevars.entry but key has to allow some special chars as '*' *) let entry = let some_value = Sep.space_equal . store Simplevars.to_comment_re (* Rx.word extended by * and : *) in let word = /[*:\/A-Za-z0-9_.-]+/ (* Avoid ambiguity in tree by making a subtree here *) in let empty_value = [del /[ \t]*=/ "="] . store "" in [ Util.indent . key word . (some_value? | empty_value) . (Util.eol | Util.comment_eol) ] (* View: lns The sysctl lens *) let lns = (Util.empty | comment | entry)* let xfm = transform lns filter augeas-1.15.0/lenses/yum.aug0000644000175100017510000000430015257032642011332 (* 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") . (incl "/etc/dnf/dnf.conf") . (incl "/etc/dnf/automatic.conf") . (incl "/etc/dnf/plugins/*.conf") . Util.stdexcl let xfm = transform lns filter (* Local Variables: *) (* mode: caml *) (* End: *) augeas-1.15.0/lenses/mongodbserver.aug0000644000175100017510000000226115257032642013400 (* Module: MongoDBServer Parses /etc/mongodb.conf Author: Brian Redbeard About: Reference For information on configuration options available to mongod reference one of the following resources: * The Mongo DB Manual - * The current options available for your operating system via: > man mongos About: License This file is licenced under the LGPL v2+, conforming to the other components of Augeas. About: Lens Usage Sample usage of this lens in augtool: * Get your current setup > print /files/etc/mongodb.conf ... * Change MongoDB port > set /files/etc/mongodb.conf/port 27117 Saving your file: > save About: Configuration files This lens applies to /etc/mongodb.conf. See . About: Examples The file contains various examples and tests. *) module MongoDBServer = autoload xfm (* View: entry *) let entry = Build.key_value_line Rx.word Sep.space_equal (store Rx.space_in) (* View: lns *) let lns = (Util.empty | Util.comment | entry)* (* Variable: filter *) let filter = incl "/etc/mongodb.conf" let xfm = transform lns filter augeas-1.15.0/lenses/authorized_keys.aug0000644000175100017510000000353315257032642013740 (* Module: Authorized_Keys Parses SSH authorized_keys Author: Raphael Pinson About: Reference This lens tries to keep as close as possible to `man 5 authorized_keys` where possible. About: License This file is licenced under the LGPL v2+, like the rest of Augeas. About: Lens Usage To be documented About: Configuration files This lens applies to SSH authorized_keys. See . About: Examples The file contains various examples and tests. *) module Authorized_Keys = autoload xfm (* View: option A key option *) let option = let kv_re = "command" | "environment" | "from" | "permitopen" | "principals" | "tunnel" in let flag_re = "cert-authority" | "no-agent-forwarding" | "no-port-forwarding" | "no-pty" | "no-user-rc" | "no-X11-forwarding" in let option_value = Util.del_str "\"" . store /((\\\\")?[^\\\n"]*)+/ . Util.del_str "\"" in Build.key_value kv_re Sep.equal option_value | Build.flag flag_re (* View: key_options A list of key