From 7044fa14642d1b14c24daebe1f582bf409c1961e Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Mon, 27 Jul 2009 19:04:22 +0200 Subject: augeas: added debian + cleanup --- files/logrotate.aug | 113 ---------------------------------------------------- files/php.aug | 52 ------------------------ files/vsftpd.aug | 31 -------------- files/yum.aug | 54 ------------------------- 4 files changed, 250 deletions(-) delete mode 100644 files/logrotate.aug delete mode 100644 files/php.aug delete mode 100644 files/vsftpd.aug delete mode 100644 files/yum.aug (limited to 'files') diff --git a/files/logrotate.aug b/files/logrotate.aug deleted file mode 100644 index 6663cde..0000000 --- a/files/logrotate.aug +++ /dev/null @@ -1,113 +0,0 @@ -(* 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 = Util.del_ws_spc - let sep_val = del /[ \t]*=[ \t]*|[ \t]+/ " " - let eol = Util.del_str "\n" - let num = /[0-9]+/ - let word = /[^,#= \n\t{}]+/ - let size = num . /[kMG]?/ - - (* define comments and empty lines *) - let comment (indent:string) = [ label "#comment" . del /[ \t]*/ indent . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . eol ] - let empty = [ del /[ \t]*\n/ "\n" ] - - - (* Useful functions *) - - let list_item = [ sep_spc . key /[^\/+,# \n\t{}]+/ ] - let select_to_eol (kw:string) (select:regexp) (indent:string) = [ del /[ \t]*/ indent . label kw . store select . eol ] - let value_to_eol (kw:string) (value:regexp) (indent:string ) = [ del /[ \t]*/ indent . key kw . sep_val . store value . eol ] - let flag_to_eol (kw:string) (indent:string) = [ del /[ \t]*/ indent . key kw . eol ] - let list_to_eol (kw:string) (indent:string) = [ del /[ \t]*/ indent . key kw . list_item+ . eol ] - - - (* Defaults *) - - let create (indent:string ) = [ del /[ \t]*/ indent . key "create" . - ( sep_spc . [ label "mode" . store num ] . sep_spc . - [ label "owner" . store word ] . sep_spc . - [ label "group" . store word ])? - . eol ] - - let tabooext (indent:string) = [ del /[ \t]*/ indent . key "tabooext" . ( sep_spc . store /\+/ )? . list_item+ . eol ] - - let attrs (indent:string) = select_to_eol "schedule" /(daily|weekly|monthly|yearly)/ indent - | value_to_eol "rotate" num indent - | create indent - | flag_to_eol "nocreate" indent - | value_to_eol "include" word indent - | select_to_eol "missingok" /(no)?missingok/ indent - | select_to_eol "compress" /(no)?compress/ indent - | select_to_eol "delaycompress" /(no)?delaycompress/ indent - | select_to_eol "ifempty" /(not)?ifempty/ indent - | select_to_eol "sharedscripts" /(no)?sharedscripts/ indent - | value_to_eol "size" size indent - | tabooext indent - | value_to_eol "olddir" word indent - | flag_to_eol "noolddir" indent - | value_to_eol "mail" word indent - | flag_to_eol "mailfirst" indent - | flag_to_eol "maillast" indent - | flag_to_eol "nomail" indent - | value_to_eol "errors" word indent - | value_to_eol "extension" word indent - | select_to_eol "dateext" /(no)?dateext/ indent - | value_to_eol "compresscmd" word indent - | value_to_eol "uncompresscmd" word indent - | value_to_eol "compressext" word indent - | list_to_eol "compressoptions" indent - | select_to_eol "copy" /(no)?copy/ indent - | select_to_eol "copytruncate" /(no)?copytruncate/ indent - | value_to_eol "maxage" num indent - | value_to_eol "minsize" size indent - | select_to_eol "shred" /(no)?shred/ indent - | value_to_eol "shredcycles" num indent - | value_to_eol "start" num indent - - (* Define hooks *) - - - let hook_lines = - let line_re = /.*/ - /[ \t]*endscript[ \t]*/ in - store ( line_re . ("\n" . line_re)* )? . del "\n" "\n" - - let hooks = - let hook_names = /(pre|post)rotate|(first|last)action/ in - [ del /[ \t]*/ "\t" . key hook_names . eol . - hook_lines . - del /[ \t]*endscript\n/ "\tendscript\n" ] - - (* Define rule *) - - let body = del /\{[ \t]*\n/ "{\n" - . ( comment "\t" | attrs "\t" | hooks | empty )* - . del /[ \t]*\}[ \t]*\n/ "}\n" - - let rule = - [ label "rule" . - [ label "file" . store word ] . - [ del /[ \t]+/ " " . label "file" . store word ]* . - del /[ \t\n]*/ " " . body ] - - let lns = ( comment "" | empty | attrs "" | rule )* - - let filter = incl "/etc/logrotate.d/*" - . incl "/etc/logrotate.conf" - . Util.stdexcl - - let xfm = transform lns filter - diff --git a/files/php.aug b/files/php.aug deleted file mode 100644 index 5d44363..0000000 --- a/files/php.aug +++ /dev/null @@ -1,52 +0,0 @@ -(* PHP module for Augeas *) -(* Author: Raphael Pinson *) -(* *) - -module PHP = - autoload xfm - -(************************************************************************ - * INI File settings - *************************************************************************) - -let comment = IniFile.comment IniFile.comment_re IniFile.comment_default -let sep = IniFile.sep IniFile.sep_re IniFile.sep_default -let empty = IniFile.empty - - -(************************************************************************ - * ENTRY - * - * We have to remove the keyword "section" from possible entry keywords - * otherwise it would lead to an ambiguity with the "section" label - * since PHP allows entries outside of sections. - *************************************************************************) -let entry = IniFile.entry IniFile.entry_re sep comment - - -(************************************************************************ - * TITLE - * - * We use IniFile.title_label because there can be entries - * outside of sections whose labels would conflict with section names - *************************************************************************) -let title = IniFile.title ( IniFile.record_re - ".anon" ) -let record = IniFile.record title entry - -let record_anon = [ label ".anon" . ( entry | empty )+ ] - - -(************************************************************************ - * LENS & FILTER - * There can be entries before any section - * IniFile.entry includes comment management, so we just pass entry to lns - *************************************************************************) -let lns = record_anon? . record* - -let filter = (incl "/etc/php*/*/*.ini") - . (incl "/etc/php.ini") - . (incl "/etc/php.d/*.ini") - . Util.stdexcl - -let xfm = transform lns filter - diff --git a/files/vsftpd.aug b/files/vsftpd.aug deleted file mode 100644 index f95bdd0..0000000 --- a/files/vsftpd.aug +++ /dev/null @@ -1,31 +0,0 @@ -(* Parse vsftpd.conf *) -module Vsftpd = - autoload xfm - -(* The code in parseconf.c does not seem to allow for trailing whitespace *) -(* in the config file *) -let eol = Util.del_str "\n" -let empty = Util.empty -let comment = Util.comment - -let bool_option_re = /anonymous_enable|local_enable|pasv_enable|port_enable|chroot_local_user|write_enable|anon_upload_enable|anon_mkdir_write_enable|anon_other_write_enable|chown_uploads|connect_from_port_20|xferlog_enable|dirmessage_enable|anon_world_readable_only|async_abor_enable|ascii_upload_enable|ascii_download_enable|one_process_model|xferlog_std_format|pasv_promiscuous|deny_email_enable|chroot_list_enable|setproctitle_enable|text_userdb_names|ls_recurse_enable|log_ftp_protocol|guest_enable|userlist_enable|userlist_deny|use_localtime|check_shell|hide_ids|listen|port_promiscuous|passwd_chroot_enable|no_anon_password|tcp_wrappers|use_sendfile|force_dot_files|listen_ipv6|dual_log_enable|syslog_enable|background|virtual_use_local_privs|session_support|download_enable|dirlist_enable|chmod_enable|secure_email_list_enable|run_as_launching_user|no_log_lock|ssl_enable|allow_anon_ssl|force_local_logins_ssl|force_local_data_ssl|ssl_sslv2|ssl_sslv3|ssl_tlsv1|tilde_user_enable|force_anon_logins_ssl|force_anon_data_ssl|mdtm_write|lock_upload_files|pasv_addr_resolve|debug_ssl|require_cert|validate_cert/ - -let uint_option_re = /accept_timeout|connect_timeout|local_umask|anon_umask|ftp_data_port|idle_session_timeout|data_connection_timeout|pasv_min_port|pasv_max_port|anon_max_rate|local_max_rate|listen_port|max_clients|file_open_mode|max_per_ip|trans_chunk_size|delay_failed_login|delay_successful_login|max_login_fails|chown_upload_mode/ - -let str_option_re = /secure_chroot_dir|ftp_username|chown_username|xferlog_file|vsftpd_log_file|message_file|nopriv_user|ftpd_banner|banned_email_file|chroot_list_file|pam_service_name|guest_username|userlist_file|anon_root|local_root|banner_file|pasv_address|listen_address|user_config_dir|listen_address6|cmds_allowed|hide_file|deny_file|user_sub_token|email_password_file|rsa_cert_file|dsa_cert_file|ssl_ciphers|rsa_private_key_file|dsa_private_key_file|ca_certs_file/ - -let bool_value_re = /[yY][eE][sS]|[tT][rR][uU][eE]|1|[nN][oO]|[fF][aA][lL][sS][eE]|0/ - -let option (k:regexp) (v:regexp) = [ key k . Util.del_str "=" . store v . eol ] - -let bool_option = option bool_option_re bool_value_re - -let str_option = option str_option_re /[^\n]+/ - -let uint_option = option uint_option_re /[0-9]+/ - -let lns = (bool_option|str_option|uint_option|comment|empty)* - -let filter = (incl "/etc/vsftpd.conf") . (incl "/etc/vsftpd/vsftpd.conf") - -let xfm = transform lns filter diff --git a/files/yum.aug b/files/yum.aug deleted file mode 100644 index 7d32bc0..0000000 --- a/files/yum.aug +++ /dev/null @@ -1,54 +0,0 @@ -(* Parsing yum's config files *) -module Yum = - autoload xfm - - let eol = Util.del_str "\n" - - let key_re = /[^#;:= \t\n[\/]+/ - "baseurl" - - let eq = del /[ \t]*[:=][ \t]*/ "=" - let secname = /[^]\/]+/ - - let value = /[^ \t\n][^\n]*/ - - (* We really need to allow comments starting with REM and rem but that *) - (* leads to ambiguities with keys 'rem=' and 'REM=' The regular expression *) - (* to do that cleanly is somewhat annoying to craft by hand; we'd need to *) - (* define KEY_RE as /[A-Za-z0-9]+/ - "REM" - "rem" *) - let comment = [ del /([;#].*)?[ \t]*\n/ "\n" ] - - let list_sep = del /[ \t]*(,[ \t]*|\n[ \t]+)/ "\n\t" - let list_value = store /[^ \t\n,]+/ - - let kv_list(s:string) = - [ key s . eq . list_value ] . - [ list_sep . label s . list_value ]* . eol - - let kv = [ key key_re . eq . store value . eol ] - - let sechead = Util.del_str "[" . key secname . Util.del_str "]" - . del /[ \t]*[;#]?.*/ "" - . eol - - let entry = comment | kv - - (* A section is a section head, followed by any number of key value *) - (* entries, with comments and blank lines freely interspersed. The *) - (* continuation lines allowed for baseurl entries make this a little *) - (* more interesting: there can be at most one baseurl entry in each *) - (* section (more precisely, yum will only obey one of them, but we act *) - (* as if yum would actually barf) *) - let section = [ sechead . (entry* | entry* . (kv_list "baseurl") . entry*)] - - let lns = (comment) * . (section) * - - let filter = (incl "/etc/yum.conf") - . (incl "/etc/yum.repos.d/*") - . (incl "/etc/yum/pluginconf.d/*") - . Util.stdexcl - - let xfm = transform lns filter - -(* Local Variables: *) -(* mode: caml *) -(* End: *) -- cgit v1.2.3