commit
8bb991d2f4
@ -0,0 +1 @@
|
||||
afe7aee292e058141d8c19f6a82b5f8bae2d5163 SOURCES/augeas-1.12.0.tar.gz
|
@ -0,0 +1 @@
|
||||
SOURCES/augeas-1.12.0.tar.gz
|
@ -0,0 +1,59 @@
|
||||
From e666bf968071a9976bd44e1eb65645eb9d51b5cb Mon Sep 17 00:00:00 2001
|
||||
From: Pino Toscano <ptoscano@redhat.com>
|
||||
Date: Wed, 23 Oct 2019 11:35:57 +0200
|
||||
Subject: [PATCH 1/9] Grub: support '+' in kernel command line option names
|
||||
(#647)
|
||||
|
||||
This way it is possible to parse files that pass options with '+' in the
|
||||
name to the kernel.
|
||||
|
||||
(cherry picked from commit 2ba77589baee1bf2d43d3a49f8e6f3eb522e5bba)
|
||||
---
|
||||
lenses/grub.aug | 2 +-
|
||||
lenses/tests/test_grub.aug | 17 +++++++++++++++++
|
||||
2 files changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lenses/grub.aug b/lenses/grub.aug
|
||||
index 24ad39bc..82c1c37a 100644
|
||||
--- a/lenses/grub.aug
|
||||
+++ b/lenses/grub.aug
|
||||
@@ -196,7 +196,7 @@ module Grub =
|
||||
(* View: kernel_args
|
||||
Parse the file name and args on a kernel or module line. *)
|
||||
let kernel_args =
|
||||
- let arg = /[A-Za-z0-9_.$-]+/ - /type|no-mem-option/ in
|
||||
+ let arg = /[A-Za-z0-9_.$\+-]+/ - /type|no-mem-option/ in
|
||||
store /(\([a-z0-9,]+\))?\/[^ \t\n]*/ .
|
||||
(spc . multiboot_arg)? .
|
||||
(spc . [ key arg . (eq. store /([^ \t\n])*/)?])* . eol
|
||||
diff --git a/lenses/tests/test_grub.aug b/lenses/tests/test_grub.aug
|
||||
index 75657203..e50bdc4f 100644
|
||||
--- a/lenses/tests/test_grub.aug
|
||||
+++ b/lenses/tests/test_grub.aug
|
||||
@@ -258,6 +258,23 @@ password --encrypted ^9^32kwzzX./3WISQ0C /boot/grub/custom.lst
|
||||
{ "md5" }
|
||||
} }
|
||||
|
||||
+ (* Test kernel options with different special characters. *)
|
||||
+ test Grub.lns get "title Fedora (2.6.24.4-64.fc8)
|
||||
+ root (hd0,0)
|
||||
+ kernel /vmlinuz-2.6.24.4-64.fc8 ro root=/dev/vg00/lv00 with.dot=1 with-dash=1 with_underscore=1 with+plus=1
|
||||
+ initrd /initrd-2.6.24.4-64.fc8.img\n" =
|
||||
+ { "title" = "Fedora (2.6.24.4-64.fc8)"
|
||||
+ { "root" = "(hd0,0)" }
|
||||
+ { "kernel" = "/vmlinuz-2.6.24.4-64.fc8"
|
||||
+ { "ro" }
|
||||
+ { "root" = "/dev/vg00/lv00" }
|
||||
+ { "with.dot" = "1" }
|
||||
+ { "with-dash" = "1" }
|
||||
+ { "with_underscore" = "1" }
|
||||
+ { "with+plus" = "1" }
|
||||
+ }
|
||||
+ { "initrd" = "/initrd-2.6.24.4-64.fc8.img" } }
|
||||
+
|
||||
(* Test parsing of invalid entries via menu_error *)
|
||||
test Grub.lns get "default=0\ncrud=no\n" =
|
||||
{ "default" = "0" }
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,94 @@
|
||||
From eb2dc4ec0879290f42e35a7facc345ca1c70ba69 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rapha=C3=ABl=20Pinson?= <raphael.pinson@camptocamp.com>
|
||||
Date: Tue, 12 Nov 2019 13:33:26 +0100
|
||||
Subject: [PATCH 2/9] Rsyslog: support multiple actions in filters and
|
||||
selectors (#653)
|
||||
|
||||
(cherry picked from commit 5181105bae84dc7819a00886f068ad0bb4e6d05a)
|
||||
---
|
||||
lenses/rsyslog.aug | 11 ++++++++---
|
||||
lenses/tests/test_rsyslog.aug | 37 +++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 45 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lenses/rsyslog.aug b/lenses/rsyslog.aug
|
||||
index 7b9f7dc9..29ff9b10 100644
|
||||
--- a/lenses/rsyslog.aug
|
||||
+++ b/lenses/rsyslog.aug
|
||||
@@ -65,11 +65,17 @@ let hostname = [ label "hostname" .
|
||||
( Syslog.plus | [ Build.xchgs "-" "reverse" ] ) .
|
||||
Syslog.hostnames . Util.eol . Syslog.entries ]
|
||||
|
||||
+(* View: actions *)
|
||||
+let actions =
|
||||
+ let prop_act = [ label "action" . action ]
|
||||
+ in let act_sep = del /[ \t]*\n&[ \t]*/ "\n& "
|
||||
+ in Build.opt_list prop_act act_sep
|
||||
+
|
||||
(* View: entry
|
||||
An entry contains selectors and an action
|
||||
*)
|
||||
let entry = [ label "entry" . Syslog.selectors . Syslog.sep_tab .
|
||||
- [ label "action" . action ] . Util.eol ]
|
||||
+ actions . Util.eol ]
|
||||
|
||||
(* View: prop_filter
|
||||
Parses property-based filters, which start with ":" and the property name *)
|
||||
@@ -78,9 +84,8 @@ let prop_filter =
|
||||
in let prop_name = [ Util.del_str ":" . label "property" . store Rx.word ]
|
||||
in let prop_oper = [ label "operation" . store /[A-Za-z!-]+/ ]
|
||||
in let prop_val = [ label "value" . Quote.do_dquote (store /[^\n"]*/) ]
|
||||
- in let prop_act = [ label "action" . action ]
|
||||
in [ label "filter" . prop_name . sep . prop_oper . sep . prop_val .
|
||||
- Sep.space . prop_act . Util.eol ]
|
||||
+ Sep.space . actions . Util.eol ]
|
||||
|
||||
let entries = ( Syslog.empty | Util.comment | entry | macro | config_object | prop_filter )*
|
||||
|
||||
diff --git a/lenses/tests/test_rsyslog.aug b/lenses/tests/test_rsyslog.aug
|
||||
index 9011a2b3..e83613a2 100644
|
||||
--- a/lenses/tests/test_rsyslog.aug
|
||||
+++ b/lenses/tests/test_rsyslog.aug
|
||||
@@ -222,3 +222,40 @@ test Rsyslog.lns get "*.* ?DynamicFile\n" =
|
||||
{ "dynamic" = "DynamicFile" }
|
||||
}
|
||||
}
|
||||
+
|
||||
+(* Multiple actions in filters and selectors *)
|
||||
+test Rsyslog.lns get ":msg, startswith, \"iptables:\" -/var/log/iptables.log
|
||||
+& ~
|
||||
+# Save boot messages also to boot.log
|
||||
+local7.* /var/log/boot.log
|
||||
+local3.err /var/log/nfsen/nfsenlog
|
||||
+& /var/log/also.log
|
||||
+\n" =
|
||||
+ { "filter"
|
||||
+ { "property" = "msg" }
|
||||
+ { "operation" = "startswith" }
|
||||
+ { "value" = "iptables:" }
|
||||
+ { "action"
|
||||
+ { "no_sync" }
|
||||
+ { "file" = "/var/log/iptables.log" } }
|
||||
+ { "action"
|
||||
+ { "discard" } }
|
||||
+ }
|
||||
+ { "#comment" = "Save boot messages also to boot.log" }
|
||||
+ { "entry"
|
||||
+ { "selector"
|
||||
+ { "facility" = "local7" }
|
||||
+ { "level" = "*" } }
|
||||
+ { "action"
|
||||
+ { "file" = "/var/log/boot.log" } }
|
||||
+ }
|
||||
+ { "entry"
|
||||
+ { "selector"
|
||||
+ { "facility" = "local3" }
|
||||
+ { "level" = "err" } }
|
||||
+ { "action"
|
||||
+ { "file" = "/var/log/nfsen/nfsenlog" } }
|
||||
+ { "action"
|
||||
+ { "file" = "/var/log/also.log" } } }
|
||||
+ { }
|
||||
+
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 5218c2997b7b77752511ebc61ffa743fd2d8fcbf Mon Sep 17 00:00:00 2001
|
||||
From: Pino Toscano <ptoscano@redhat.com>
|
||||
Date: Fri, 17 May 2019 13:47:20 +0200
|
||||
Subject: [PATCH 3/9] * src/augrun.c (nexttoken): add more escape characters
|
||||
|
||||
Synchonize the list of "pass-through" characters with the set in the
|
||||
'name_follow' variable in pathx.c: as pathx_escape_name() escapes them,
|
||||
make sure that aug_srun() accepts them as arguments.
|
||||
---
|
||||
src/augrun.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/augrun.c b/src/augrun.c
|
||||
index 07f865a9..fd710c5f 100644
|
||||
--- a/src/augrun.c
|
||||
+++ b/src/augrun.c
|
||||
@@ -133,8 +133,16 @@ static char *nexttoken(struct command *cmd, char **line, bool path) {
|
||||
copy = true;
|
||||
if (*s == '\\') {
|
||||
switch (*(s+1)) {
|
||||
+ case ']':
|
||||
case '[':
|
||||
- case ']': /* pass both literally */
|
||||
+ case '|':
|
||||
+ case '/':
|
||||
+ case '=':
|
||||
+ case '(':
|
||||
+ case ')':
|
||||
+ case '!':
|
||||
+ case ',': /* pass them literally;
|
||||
+ * see 'name_follow' in pathx.c */
|
||||
nescaped = 2;
|
||||
break;
|
||||
case 't': /* insert tab */
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,42 @@
|
||||
From fc2b84a2ecd9a403cb602d2de26d6c1804a3ceac Mon Sep 17 00:00:00 2001
|
||||
From: Pino Toscano <ptoscano@redhat.com>
|
||||
Date: Fri, 17 May 2019 15:18:50 +0200
|
||||
Subject: [PATCH 4/9] * src/augtool.c: hopefully fix readline quoting issues
|
||||
|
||||
Configure the quoting (also using a detector) and word break characters,
|
||||
so it is possible to autocomplete paths with special characters (like
|
||||
spaces, which are already quoted by augeas).
|
||||
---
|
||||
src/augtool.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/src/augtool.c b/src/augtool.c
|
||||
index b42ef630..31a991eb 100644
|
||||
--- a/src/augtool.c
|
||||
+++ b/src/augtool.c
|
||||
@@ -267,10 +267,22 @@ static char *get_home_dir(uid_t uid) {
|
||||
return result;
|
||||
}
|
||||
|
||||
+/* Inspired from:
|
||||
+ * https://thoughtbot.com/blog/tab-completion-in-gnu-readline
|
||||
+ */
|
||||
+static int quote_detector(char *str, int index) {
|
||||
+ return index > 0
|
||||
+ && str[index - 1] == '\\'
|
||||
+ && quote_detector(str, index - 1) == 0;
|
||||
+}
|
||||
+
|
||||
static void readline_init(void) {
|
||||
rl_readline_name = "augtool";
|
||||
rl_attempted_completion_function = readline_completion;
|
||||
rl_completion_entry_function = readline_path_generator;
|
||||
+ rl_completer_quote_characters = "\"'";
|
||||
+ rl_completer_word_break_characters = (char *) " ";
|
||||
+ rl_char_is_quoted_p = "e_detector;
|
||||
|
||||
/* Set up persistent history */
|
||||
char *home_dir = get_home_dir(getuid());
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,133 @@
|
||||
From 1b4d6a9918b8bcbc06af4ce99a48cd66fed97196 Mon Sep 17 00:00:00 2001
|
||||
From: Pino Toscano <ptoscano@redhat.com>
|
||||
Date: Tue, 4 Feb 2020 17:54:22 +0100
|
||||
Subject: [PATCH 5/9] Krb5: improve [dbmodules] and includes (#630)
|
||||
|
||||
* Krb5: fix/revamp parsing of [dbmodules] subsection
|
||||
|
||||
The [dbmodules] subsection so far was parsed much like the [dbdefaults]
|
||||
one, and thus it did not handle realms.
|
||||
|
||||
Revamp it a bit to handle realms, and specify the only keyword not in
|
||||
realm subsections.
|
||||
|
||||
* Krb5: allow include/includedir directives everywhere
|
||||
|
||||
MIT Kerberos allows this, so do not restrict them only before any other
|
||||
section.
|
||||
---
|
||||
lenses/krb5.aug | 27 +++++++++++++++++++--------
|
||||
lenses/tests/test_krb5.aug | 36 +++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 54 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/lenses/krb5.aug b/lenses/krb5.aug
|
||||
index 46c22656..6b509c42 100644
|
||||
--- a/lenses/krb5.aug
|
||||
+++ b/lenses/krb5.aug
|
||||
@@ -21,10 +21,11 @@ let closebr = del /[ \t]*\}/ "}"
|
||||
and realms in the [appdefaults] section.
|
||||
*)
|
||||
|
||||
+let include_re = /include(dir)?/
|
||||
let realm_re = /[A-Z0-9][.a-zA-Z0-9-]*/
|
||||
let realm_anycase_re = /[A-Za-z0-9][.a-zA-Z0-9-]*/
|
||||
let app_re = /[a-z][a-zA-Z0-9_]*/
|
||||
-let name_re = /[.a-zA-Z0-9_-]+/
|
||||
+let name_re = /[.a-zA-Z0-9_-]+/ - include_re
|
||||
|
||||
let value_br = store /[^;# \t\r\n{}]+/
|
||||
let value = store /[^;# \t\r\n]+/
|
||||
@@ -130,10 +131,19 @@ let dbdefaults =
|
||||
simple_section "dbdefaults" keys
|
||||
|
||||
let dbmodules =
|
||||
- let keys = /db_library|ldap_kerberos_container_dn|ldap_kdc_dn/
|
||||
- |/ldap_kadmind_dn|ldap_service_password_file|ldap_servers/
|
||||
- |/ldap_conns_per_server/ in
|
||||
- simple_section "dbmodules" keys
|
||||
+ let subsec_key = /database_name|db_library|disable_last_success/
|
||||
+ |/disable_lockout|ldap_conns_per_server|ldap_(kdc|kadmind)_dn/
|
||||
+ |/ldap_(kdc|kadmind)_sasl_mech|ldap_(kdc|kadmind)_sasl_authcid/
|
||||
+ |/ldap_(kdc|kadmind)_sasl_authzid|ldap_(kdc|kadmind)_sasl_realm/
|
||||
+ |/ldap_kerberos_container_dn|ldap_servers/
|
||||
+ |/ldap_service_password_file|mapsize|max_readers|nosync/
|
||||
+ |/unlockiter/ in
|
||||
+ let subsec_option = subsec_entry subsec_key eq comment in
|
||||
+ let key = /db_module_dir/ in
|
||||
+ let option = entry key eq value comment in
|
||||
+ let realm = [ indent . label "realm" . store realm_re .
|
||||
+ eq_openbr . (subsec_option)* . closebr . eol ] in
|
||||
+ record "dbmodules" (option|realm)
|
||||
|
||||
(* This section is not documented in the krb5.conf manpage,
|
||||
but the Fermi example uses it. *)
|
||||
@@ -152,11 +162,12 @@ let kdc =
|
||||
let pam =
|
||||
simple_section "pam" name_re
|
||||
|
||||
-let includes = Build.key_value_line /include(dir)?/ Sep.space (store Rx.fspath)
|
||||
+let includes = Build.key_value_line include_re Sep.space (store Rx.fspath)
|
||||
+let include_lines = includes . (comment|empty)*
|
||||
|
||||
-let lns = (comment|empty|includes)* .
|
||||
+let lns = (comment|empty)* .
|
||||
(libdefaults|login|appdefaults|realms|domain_realm
|
||||
- |logging|capaths|dbdefaults|dbmodules|instance_mapping|kdc|pam)*
|
||||
+ |logging|capaths|dbdefaults|dbmodules|instance_mapping|kdc|pam|include_lines)*
|
||||
|
||||
let filter = (incl "/etc/krb5.conf.d/*.conf")
|
||||
. (incl "/etc/krb5.conf")
|
||||
diff --git a/lenses/tests/test_krb5.aug b/lenses/tests/test_krb5.aug
|
||||
index f746543b..10b87605 100644
|
||||
--- a/lenses/tests/test_krb5.aug
|
||||
+++ b/lenses/tests/test_krb5.aug
|
||||
@@ -1029,7 +1029,7 @@ default_ccache_name = KEYRING:persistent:%{uid}\n" =
|
||||
{ }
|
||||
{ "default_ccache_name" = "KEYRING:persistent:%{uid}" } }
|
||||
|
||||
-(* Include(dir) test *)
|
||||
+(* Include(dir) tests *)
|
||||
let include_test = "include /etc/krb5.other_conf.d/other.conf
|
||||
includedir /etc/krb5.conf.d/
|
||||
"
|
||||
@@ -1037,3 +1037,37 @@ includedir /etc/krb5.conf.d/
|
||||
test Krb5.lns get include_test =
|
||||
{ "include" = "/etc/krb5.other_conf.d/other.conf" }
|
||||
{ "includedir" = "/etc/krb5.conf.d/" }
|
||||
+
|
||||
+let include2_test = "[logging]
|
||||
+ default = FILE:/var/log/krb5libs.log
|
||||
+
|
||||
+include /etc/krb5.other_conf.d/other.conf
|
||||
+
|
||||
+includedir /etc/krb5.conf.d/
|
||||
+"
|
||||
+
|
||||
+test Krb5.lns get include2_test =
|
||||
+ { "logging"
|
||||
+ { "default"
|
||||
+ { "file" = "/var/log/krb5libs.log" } }
|
||||
+ { }
|
||||
+ }
|
||||
+ { "include" = "/etc/krb5.other_conf.d/other.conf" }
|
||||
+ { }
|
||||
+ { "includedir" = "/etc/krb5.conf.d/" }
|
||||
+
|
||||
+(* [dbmodules] test *)
|
||||
+let dbmodules_test = "[dbmodules]
|
||||
+ ATHENA.MIT.EDU = {
|
||||
+ disable_last_success = true
|
||||
+ }
|
||||
+ db_module_dir = /some/path
|
||||
+"
|
||||
+
|
||||
+test Krb5.lns get dbmodules_test =
|
||||
+ { "dbmodules"
|
||||
+ { "realm" = "ATHENA.MIT.EDU"
|
||||
+ { "disable_last_success" = "true" }
|
||||
+ }
|
||||
+ { "db_module_dir" = "/some/path" }
|
||||
+ }
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From eb7c72cfffa5360a65be270c5554abf36739e382 Mon Sep 17 00:00:00 2001
|
||||
From: Pino Toscano <ptoscano@redhat.com>
|
||||
Date: Tue, 4 Feb 2020 18:05:05 +0100
|
||||
Subject: [PATCH 6/9] Systemd: fix parsing of envvars with spaces (#659)
|
||||
|
||||
Allow spaces inside of values quoted with single or double quotes.
|
||||
|
||||
This amends commit f64d8bc7a7670f3af2549fdcefb64c2b5f22cd0d that added
|
||||
support for quoted values.
|
||||
---
|
||||
lenses/systemd.aug | 4 ++--
|
||||
lenses/tests/test_systemd.aug | 9 +++++++++
|
||||
2 files changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lenses/systemd.aug b/lenses/systemd.aug
|
||||
index b868e86f..77434367 100644
|
||||
--- a/lenses/systemd.aug
|
||||
+++ b/lenses/systemd.aug
|
||||
@@ -132,8 +132,8 @@ let entry_env =
|
||||
let envkv (env_val:lens) = key env_key . Util.del_str "=" . env_val
|
||||
(* bare has no spaces, and is optionally quoted *)
|
||||
in let bare = Quote.do_quote_opt (envkv (store /[^#'" \t\n]*[^#'" \t\n\\]/)?)
|
||||
- in let bare_dqval = envkv (store /"[^#" \t\n]*[^#" \t\n\\]"/)
|
||||
- in let bare_sqval = envkv (store /'[^#' \t\n]*[^#' \t\n\\]'/)
|
||||
+ in let bare_dqval = envkv (store /"[^#"\t\n]*[^#"\t\n\\]"/)
|
||||
+ in let bare_sqval = envkv (store /'[^#'\t\n]*[^#'\t\n\\]'/)
|
||||
(* quoted has at least one space, and must be quoted *)
|
||||
in let quoted = Quote.do_quote (envkv (store /[^#"'\n]*[ \t]+[^#"'\n]*/))
|
||||
in let envkv_quoted = [ bare ] | [ bare_dqval ] | [ bare_sqval ] | [ quoted ]
|
||||
diff --git a/lenses/tests/test_systemd.aug b/lenses/tests/test_systemd.aug
|
||||
index 3397456e..19c57075 100644
|
||||
--- a/lenses/tests/test_systemd.aug
|
||||
+++ b/lenses/tests/test_systemd.aug
|
||||
@@ -206,6 +206,8 @@ FOO=BAR
|
||||
Environment=\"LANG=foo bar\" FOO=BAR
|
||||
Environment=OPTIONS=\"-LS0-6d\"
|
||||
Environment=OPTIONS='-LS0-6d'
|
||||
+Environment=VAR=\"with some spaces\" VAR2='more spaces'
|
||||
+Environment=VAR='with some spaces'
|
||||
"
|
||||
(* Test: Systemd.lns *)
|
||||
test Systemd.lns get env =
|
||||
@@ -247,6 +249,13 @@ test Systemd.lns get env =
|
||||
{ "Environment"
|
||||
{ "OPTIONS" = "'-LS0-6d'" }
|
||||
}
|
||||
+ { "Environment"
|
||||
+ { "VAR" = "\"with some spaces\"" }
|
||||
+ { "VAR2" = "'more spaces'" }
|
||||
+ }
|
||||
+ { "Environment"
|
||||
+ { "VAR" = "'with some spaces'" }
|
||||
+ }
|
||||
}
|
||||
|
||||
(* Variable: unit *)
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,85 @@
|
||||
From efd61b77563489ca0fa21904cc1fecfc482afd06 Mon Sep 17 00:00:00 2001
|
||||
From: granquet <ranquet.guillaume@gmail.com>
|
||||
Date: Tue, 6 Oct 2020 23:03:18 +0200
|
||||
Subject: [PATCH 7/9] Ssh: add Match keyword support (#695)
|
||||
|
||||
Signed-off-by: Guillaume Ranquet <guillaume-externe.ranquet@edf.fr>
|
||||
---
|
||||
lenses/ssh.aug | 19 +++++++++++++++++--
|
||||
lenses/tests/test_ssh.aug | 12 ++++++++++++
|
||||
2 files changed, 29 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lenses/ssh.aug b/lenses/ssh.aug
|
||||
index 4e731581..c140c9a9 100644
|
||||
--- a/lenses/ssh.aug
|
||||
+++ b/lenses/ssh.aug
|
||||
@@ -92,7 +92,7 @@ module Ssh =
|
||||
| rekey_limit
|
||||
|
||||
let key_re = /[A-Za-z0-9]+/
|
||||
- - /SendEnv|Host|ProxyCommand|RemoteForward|LocalForward|MACs|Ciphers|(HostKey|Kex)Algorithms|PubkeyAcceptedKeyTypes|GlobalKnownHostsFile|RekeyLimit/i
|
||||
+ - /SendEnv|Host|Match|ProxyCommand|RemoteForward|LocalForward|MACs|Ciphers|(HostKey|Kex)Algorithms|PubkeyAcceptedKeyTypes|GlobalKnownHostsFile|RekeyLimit/i
|
||||
|
||||
|
||||
let other_entry = [ indent . key key_re
|
||||
@@ -105,11 +105,26 @@ module Ssh =
|
||||
let host = [ key /Host/i . spc . value_to_eol . eol . entry* ]
|
||||
|
||||
|
||||
+ let condition_entry =
|
||||
+ let value = store /[^ \t\r\n=]+/ in
|
||||
+ [ spc . key /[A-Za-z0-9]+/ . spc . value ]
|
||||
+
|
||||
+ 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*
|
||||
+ let lns = entry* . (host | match)*
|
||||
|
||||
let xfm = transform lns (incl "/etc/ssh/ssh_config" .
|
||||
incl (Sys.getenv("HOME") . "/.ssh/config") .
|
||||
diff --git a/lenses/tests/test_ssh.aug b/lenses/tests/test_ssh.aug
|
||||
index f5fca252..456624e4 100644
|
||||
--- a/lenses/tests/test_ssh.aug
|
||||
+++ b/lenses/tests/test_ssh.aug
|
||||
@@ -5,6 +5,9 @@ module Test_ssh =
|
||||
"# start
|
||||
IdentityFile /etc/ssh/identity.asc
|
||||
|
||||
+Match final all
|
||||
+ GSSAPIAuthentication yes
|
||||
+
|
||||
Host suse.cz
|
||||
ForwardAgent yes
|
||||
SendEnv LC_LANG
|
||||
@@ -30,6 +33,15 @@ PubkeyAcceptedKeyTypes ssh-ed25519-cert-v01@openssh.com,ssh-ed25519,ssh-rsa-cert
|
||||
{ "#comment" = "start" }
|
||||
{ "IdentityFile" = "/etc/ssh/identity.asc" }
|
||||
{ }
|
||||
+ { "Match"
|
||||
+ { "Condition"
|
||||
+ { "final" = "all" }
|
||||
+ }
|
||||
+ { "Settings"
|
||||
+ { "GSSAPIAuthentication" = "yes" }
|
||||
+ { }
|
||||
+ }
|
||||
+ }
|
||||
{ "Host" = "suse.cz"
|
||||
{ "ForwardAgent" = "yes" }
|
||||
{ "SendEnv"
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,251 @@
|
||||
From 59fb794a4c47b811998273323cd49cc91f9db7e2 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Wed, 12 Jan 2022 16:11:22 +0000
|
||||
Subject: [PATCH 8/9] Include mke2fs lens and test from upstream
|
||||
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1807010
|
||||
---
|
||||
lenses/mke2fs.aug | 108 ++++++++++++++++++++++++++---------
|
||||
lenses/tests/test_mke2fs.aug | 46 ++++++++++++++-
|
||||
2 files changed, 124 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/lenses/mke2fs.aug b/lenses/mke2fs.aug
|
||||
index dc895490..46a7136e 100644
|
||||
--- a/lenses/mke2fs.aug
|
||||
+++ b/lenses/mke2fs.aug
|
||||
@@ -34,6 +34,14 @@ let sep = IniFile.sep /=[ \t]*/ "="
|
||||
(* View: empty *)
|
||||
let empty = IniFile.empty
|
||||
|
||||
+(* View: boolean
|
||||
+ The configuration parser of e2fsprogs recognizes different values
|
||||
+ for booleans, so list all the recognized values *)
|
||||
+let boolean = ("y"|"yes"|"true"|"t"|"1"|"on"|"n"|"no"|"false"|"nil"|"0"|"off")
|
||||
+
|
||||
+(* View: fspath *)
|
||||
+let fspath = /[^ \t\n"]+/
|
||||
+
|
||||
|
||||
(************************************************************************
|
||||
* Group: RECORD TYPES
|
||||
@@ -47,27 +55,59 @@ let entry (kw:regexp) (lns:lens) = Build.key_value_line kw sep lns
|
||||
|
||||
(* View: list_sto
|
||||
A list of values with given lens *)
|
||||
-let list_sto (kw:regexp) (lns:lens) = counter "item" .
|
||||
- entry kw
|
||||
- (Build.opt_list
|
||||
- [lns]
|
||||
- Sep.comma)
|
||||
+let list_sto (kw:regexp) (lns:lens) =
|
||||
+ entry kw (Quote.do_dquote_opt_nil (Build.opt_list [lns] Sep.comma))
|
||||
|
||||
(* View: entry_sto
|
||||
Store a regexp as entry value *)
|
||||
-let entry_sto (kw:regexp) (val:regexp) = entry kw (store val)
|
||||
+let entry_sto (kw:regexp) (val:regexp) =
|
||||
+ entry kw (Quote.do_dquote_opt_nil (store val))
|
||||
+ | entry kw (Util.del_str "\"\"")
|
||||
|
||||
|
||||
(************************************************************************
|
||||
* Group: COMMON ENTRIES
|
||||
*************************************************************************)
|
||||
+
|
||||
+(* View: common_entries_list
|
||||
+ Entries with a list value *)
|
||||
+let common_entries_list = ("base_features"|"default_features"|"default_mntopts")
|
||||
+
|
||||
+(* View: common_entries_int
|
||||
+ Entries with an integer value *)
|
||||
+let common_entries_int = ("cluster_size"|"flex_bg_size"|"force_undo"
|
||||
+ |"inode_ratio"|"inode_size"|"num_backup_sb")
|
||||
+
|
||||
+(* View: common_entries_bool
|
||||
+ Entries with a boolean value *)
|
||||
+let common_entries_bool = ("auto_64-bit_support"|"discard"
|
||||
+ |"enable_periodic_fsck"|"lazy_itable_init"
|
||||
+ |"lazy_journal_init"|"packed_meta_blocks")
|
||||
+
|
||||
+(* View: common_entries_string
|
||||
+ Entries with a string value *)
|
||||
+let common_entries_string = ("encoding"|"journal_location")
|
||||
+
|
||||
+(* View: common_entries_double
|
||||
+ Entries with a double value *)
|
||||
+let common_entries_double = ("reserved_ratio")
|
||||
+
|
||||
(* View: common_entry
|
||||
Entries shared between <defaults> and <fs_types> sections *)
|
||||
-let common_entry = list_sto ("base_features"|"default_features")
|
||||
- (key Rx.word)
|
||||
+let common_entry = list_sto common_entries_list (key Rx.word)
|
||||
+ | entry_sto common_entries_int Rx.integer
|
||||
+ | entry_sto common_entries_bool boolean
|
||||
+ | entry_sto common_entries_string Rx.word
|
||||
+ | entry_sto common_entries_double Rx.decimal
|
||||
| entry_sto "blocksize" ("-"? . Rx.integer)
|
||||
| entry_sto "hash_alg" ("legacy"|"half_md4"|"tea")
|
||||
- | entry_sto ("inode_ratio"|"inode_size") Rx.integer
|
||||
+ | entry_sto "errors" ("continue"|"remount-ro"|"panic")
|
||||
+ | list_sto "features"
|
||||
+ ([del /\^/ "^" . label "disable"]?
|
||||
+ . key Rx.word)
|
||||
+ | list_sto "options"
|
||||
+ (key Rx.word . Util.del_str "="
|
||||
+ . store Rx.word)
|
||||
|
||||
(************************************************************************
|
||||
* Group: DEFAULTS SECTION
|
||||
@@ -75,11 +115,8 @@ let common_entry = list_sto ("base_features"|"default_features")
|
||||
|
||||
(* View: defaults_entry
|
||||
Possible entries under the <defaults> section *)
|
||||
-let defaults_entry = entry_sto "force_undo" ("true"|"false")
|
||||
- | entry_sto "fs_type" Rx.word
|
||||
- | entry_sto "undo_dir" Rx.fspath
|
||||
- | list_sto "default_mntopts" (key Rx.word)
|
||||
- | entry_sto "enable_periodic_fsck" Rx.integer
|
||||
+let defaults_entry = entry_sto "fs_type" Rx.word
|
||||
+ | entry_sto "undo_dir" fspath
|
||||
|
||||
(* View: defaults_title
|
||||
Title for the <defaults> section *)
|
||||
@@ -95,24 +132,12 @@ let defaults = IniFile.record defaults_title
|
||||
* Group: FS_TYPES SECTION
|
||||
*************************************************************************)
|
||||
|
||||
-(* View: fs_types_entry
|
||||
- Possible entries under a <fs_types_record> group *)
|
||||
-let fs_types_entry =list_sto "features"
|
||||
- ([del /\^/ "^" . label "disable"]?
|
||||
- . key Rx.word)
|
||||
- | list_sto "options"
|
||||
- (key Rx.word . Util.del_str "="
|
||||
- . store Rx.word)
|
||||
- | entry_sto "lazy_itable_init" ("true"|"false")
|
||||
- | entry_sto ("flex_bg_size"|"auto_64-bit_support")
|
||||
- Rx.integer
|
||||
-
|
||||
(* View: fs_types_record
|
||||
Fs group records under the <fs_types> section *)
|
||||
let fs_types_record = [ label "filesystem"
|
||||
. Util.indent . store Rx.word
|
||||
. del /[ \t]*=[ \t]*\{[ \t]*\n/ " = {\n"
|
||||
- . ((Util.indent . (fs_types_entry|common_entry)) | empty | comment)*
|
||||
+ . ((Util.indent . common_entry) | empty | comment)*
|
||||
. del /[ \t]*\}[ \t]*\n/ " }\n" ]
|
||||
|
||||
(* View: fs_types_title
|
||||
@@ -125,6 +150,33 @@ let fs_types = IniFile.record fs_types_title
|
||||
(fs_types_record | comment)
|
||||
|
||||
|
||||
+(************************************************************************
|
||||
+ * Group: OPTIONS SECTION
|
||||
+ *************************************************************************)
|
||||
+
|
||||
+(* View: options_entries_int
|
||||
+ Entries with an integer value *)
|
||||
+let options_entries_int = ("proceed_delay"|"sync_kludge")
|
||||
+
|
||||
+(* View: options_entries_bool
|
||||
+ Entries with a boolean value *)
|
||||
+let options_entries_bool = ("old_bitmaps")
|
||||
+
|
||||
+(* View: options_entry
|
||||
+ Possible entries under the <options> section *)
|
||||
+let options_entry = entry_sto options_entries_int Rx.integer
|
||||
+ | entry_sto options_entries_bool boolean
|
||||
+
|
||||
+(* View: defaults_title
|
||||
+ Title for the <options> section *)
|
||||
+let options_title = IniFile.title "options"
|
||||
+
|
||||
+(* View: options
|
||||
+ A options section *)
|
||||
+let options = IniFile.record options_title
|
||||
+ ((Util.indent . options_entry) | comment)
|
||||
+
|
||||
+
|
||||
(************************************************************************
|
||||
* Group: LENS AND FILTER
|
||||
*************************************************************************)
|
||||
@@ -132,7 +184,7 @@ let fs_types = IniFile.record fs_types_title
|
||||
(* View: lns
|
||||
The mke2fs lens
|
||||
*)
|
||||
-let lns = (empty|comment)* . (defaults|fs_types)*
|
||||
+let lns = (empty|comment)* . (defaults|fs_types|options)*
|
||||
|
||||
(* Variable: filter *)
|
||||
let filter = incl "/etc/mke2fs.conf"
|
||||
diff --git a/lenses/tests/test_mke2fs.aug b/lenses/tests/test_mke2fs.aug
|
||||
index f1ddbe9e..bcf2fe61 100644
|
||||
--- a/lenses/tests/test_mke2fs.aug
|
||||
+++ b/lenses/tests/test_mke2fs.aug
|
||||
@@ -33,6 +33,10 @@ module Test_mke2fs =
|
||||
inode_ratio = 1048576
|
||||
blocksize = -1
|
||||
}
|
||||
+
|
||||
+[options]
|
||||
+ proceed_delay = 1
|
||||
+ sync_kludge = 1
|
||||
"
|
||||
|
||||
test Mke2fs.lns get conf =
|
||||
@@ -74,10 +78,48 @@ module Test_mke2fs =
|
||||
{ "inode_ratio" = "4096" } }
|
||||
{ "filesystem" = "largefile"
|
||||
{ "inode_ratio" = "1048576" }
|
||||
- { "blocksize" = "-1" } } }
|
||||
+ { "blocksize" = "-1" } }
|
||||
+ {} }
|
||||
+ { "options"
|
||||
+ { "proceed_delay" = "1" }
|
||||
+ { "sync_kludge" = "1" } }
|
||||
|
||||
|
||||
-test Mke2fs.fs_types_entry
|
||||
+ let quoted_conf = "[defaults]
|
||||
+ base_features = \"sparse_super,filetype,resize_inode,dir_index,ext_attr\"
|
||||
+
|
||||
+[fs_types]
|
||||
+ ext4dev = {
|
||||
+ features = \"has_journal,^extent\"
|
||||
+ default_mntopts = \"user_xattr\"
|
||||
+ encoding = \"utf8\"
|
||||
+ encoding = \"\"
|
||||
+ }
|
||||
+"
|
||||
+
|
||||
+ test Mke2fs.lns get quoted_conf =
|
||||
+ { "defaults"
|
||||
+ { "base_features"
|
||||
+ { "sparse_super" }
|
||||
+ { "filetype" }
|
||||
+ { "resize_inode" }
|
||||
+ { "dir_index" }
|
||||
+ { "ext_attr" } }
|
||||
+ {} }
|
||||
+ { "fs_types"
|
||||
+ { "filesystem" = "ext4dev"
|
||||
+ { "features"
|
||||
+ { "has_journal" }
|
||||
+ { "extent"
|
||||
+ { "disable" } } }
|
||||
+ { "default_mntopts"
|
||||
+ { "user_xattr" } }
|
||||
+ { "encoding" = "utf8" }
|
||||
+ { "encoding" }
|
||||
+ } }
|
||||
+
|
||||
+
|
||||
+test Mke2fs.common_entry
|
||||
put "features = has_journal,^extent\n"
|
||||
after set "/features/has_journal/disable" "";
|
||||
rm "/features/extent/disable" = "features = ^has_journal,extent\n"
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,148 @@
|
||||
From f1480aa0c228107a22664e6302c6f2b388536ece Mon Sep 17 00:00:00 2001
|
||||
From: rwmjones <rjones@redhat.com>
|
||||
Date: Thu, 6 Oct 2022 12:15:56 +0100
|
||||
Subject: [PATCH 9/9] semanage: Fix parsing of ignoredirs (#758)
|
||||
|
||||
From /etc/selinux/semanage.conf from a RHEL 9.1 system, this line
|
||||
caused problems:
|
||||
|
||||
ignoredirs=/root;/bin;/boot;/dev;/etc [...]
|
||||
|
||||
Parse this as a list of modified Rx.fspath, generating a tree like:
|
||||
|
||||
/files/etc/selinux/semanage.conf/ignoredirs/1 = /root
|
||||
/files/etc/selinux/semanage.conf/ignoredirs/2 = /bin
|
||||
/files/etc/selinux/semanage.conf/ignoredirs/3 = /dev
|
||||
/files/etc/selinux/semanage.conf/ignoredirs/4 = /etc
|
||||
[...]
|
||||
|
||||
Also this adds the RHEL 9 file as another test case and adjusts the
|
||||
output of the existing test case.
|
||||
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2077120
|
||||
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
|
||||
|
||||
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
|
||||
(cherry picked from commit a3ba6e2d32b95507e2474a219e788ac3d54bc4a1)
|
||||
---
|
||||
lenses/semanage.aug | 7 +++-
|
||||
lenses/tests/test_semanage.aug | 4 +-
|
||||
tests/root/etc/selinux/semanage.conf | 60 ++++++++++++++++++++++++++++
|
||||
tests/xpath.tests | 1 +
|
||||
4 files changed, 70 insertions(+), 2 deletions(-)
|
||||
create mode 100644 tests/root/etc/selinux/semanage.conf
|
||||
|
||||
diff --git a/lenses/semanage.aug b/lenses/semanage.aug
|
||||
index 46f93b32..edd97131 100644
|
||||
--- a/lenses/semanage.aug
|
||||
+++ b/lenses/semanage.aug
|
||||
@@ -23,7 +23,12 @@ let sep = IniFile.sep "=" "="
|
||||
let empty = IniFile.empty
|
||||
let eol = IniFile.eol
|
||||
|
||||
-let entry = IniFile.entry IniFile.entry_re sep comment
|
||||
+let list_keys = "ignoredirs"
|
||||
+let scl = del ";" ";"
|
||||
+let fspath = /[^ \t\n;#]+/ (* Rx.fspath without ; or # *)
|
||||
+
|
||||
+let entry = IniFile.entry_list list_keys sep fspath scl comment
|
||||
+ | IniFile.entry (IniFile.entry_re - list_keys) sep comment
|
||||
| empty
|
||||
|
||||
let title = IniFile.title_label "@group" (IniFile.record_re - /^end$/)
|
||||
diff --git a/lenses/tests/test_semanage.aug b/lenses/tests/test_semanage.aug
|
||||
index a6ceaca0..f76b95f3 100644
|
||||
--- a/lenses/tests/test_semanage.aug
|
||||
+++ b/lenses/tests/test_semanage.aug
|
||||
@@ -68,7 +68,9 @@ test Semanage.lns get conf =
|
||||
{ "usepasswd" = "False" }
|
||||
{ "bzip-small" = "true" }
|
||||
{ "bzip-blocksize" = "5" }
|
||||
- { "ignoredirs" = "/root" }
|
||||
+ { "ignoredirs"
|
||||
+ { "1" = "/root" }
|
||||
+ }
|
||||
{ }
|
||||
{ "@group" = "sefcontext_compile"
|
||||
{ "path" = "/usr/sbin/sefcontext_compile" }
|
||||
diff --git a/tests/root/etc/selinux/semanage.conf b/tests/root/etc/selinux/semanage.conf
|
||||
new file mode 100644
|
||||
index 00000000..406f16f1
|
||||
--- /dev/null
|
||||
+++ b/tests/root/etc/selinux/semanage.conf
|
||||
@@ -0,0 +1,60 @@
|
||||
+# Authors: Jason Tang <jtang@tresys.com>
|
||||
+#
|
||||
+# Copyright (C) 2004-2005 Tresys Technology, LLC
|
||||
+#
|
||||
+# This library is free software; you can redistribute it and/or
|
||||
+# modify it under the terms of the GNU Lesser General Public
|
||||
+# License as published by the Free Software Foundation; either
|
||||
+# version 2.1 of the License, or (at your option) any later version.
|
||||
+#
|
||||
+# This library is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+# Lesser General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU Lesser General Public
|
||||
+# License along with this library; if not, write to the Free Software
|
||||
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
+#
|
||||
+# Specify how libsemanage will interact with a SELinux policy manager.
|
||||
+# The four options are:
|
||||
+#
|
||||
+# "source" - libsemanage manipulates a source SELinux policy
|
||||
+# "direct" - libsemanage will write directly to a module store.
|
||||
+# /foo/bar - Write by way of a policy management server, whose
|
||||
+# named socket is at /foo/bar. The path must begin
|
||||
+# with a '/'.
|
||||
+# foo.com:4242 - Establish a TCP connection to a remote policy
|
||||
+# management server at foo.com. If there is a colon
|
||||
+# then the remainder is interpreted as a port number;
|
||||
+# otherwise default to port 4242.
|
||||
+module-store = direct
|
||||
+
|
||||
+# When generating the final linked and expanded policy, by default
|
||||
+# semanage will set the policy version to POLICYDB_VERSION_MAX, as
|
||||
+# given in <sepol/policydb.h>. Change this setting if a different
|
||||
+# version is necessary.
|
||||
+#policy-version = 19
|
||||
+
|
||||
+# expand-check check neverallow rules when executing all semanage
|
||||
+# commands. There might be a penalty in execution time if this
|
||||
+# option is enabled.
|
||||
+expand-check=0
|
||||
+
|
||||
+# usepasswd check tells semanage to scan all pass word records for home directories
|
||||
+# and setup the labeling correctly. If this is turned off, SELinux will label only /home
|
||||
+# and home directories of users with SELinux login mappings defined, see
|
||||
+# semanage login -l for the list of such users.
|
||||
+# If you want to use a different home directory, you will need to use semanage fcontext command.
|
||||
+# For example, if you had home dirs in /althome directory you would have to execute
|
||||
+# semanage fcontext -a -e /home /althome
|
||||
+usepasswd=False
|
||||
+bzip-small=true
|
||||
+bzip-blocksize=5
|
||||
+ignoredirs=/root;/bin;/boot;/dev;/etc;/lib;/lib64;/proc;/run;/sbin;/sys;/tmp;/usr;/var
|
||||
+optimize-policy=true
|
||||
+
|
||||
+[sefcontext_compile]
|
||||
+path = /usr/sbin/sefcontext_compile
|
||||
+args = -r $@
|
||||
+[end]
|
||||
diff --git a/tests/xpath.tests b/tests/xpath.tests
|
||||
index a7db8d83..feab7584 100644
|
||||
--- a/tests/xpath.tests
|
||||
+++ b/tests/xpath.tests
|
||||
@@ -109,6 +109,7 @@ test descendant-or-self /files/descendant-or-self :: 4
|
||||
/files/etc/ssh/ssh_config/Host/SendEnv[1]/4 = LC_TIME
|
||||
/files/etc/ssh/ssh_config/Host/SendEnv[2]/4 = LC_TELEPHONE
|
||||
/files/etc/aliases/4
|
||||
+ /files/etc/selinux/semanage.conf/ignoredirs/4 = /dev
|
||||
/files/etc/fstab/4
|
||||
/files/etc/pam.d/login/4
|
||||
/files/etc/pam.d/newrole/4
|
||||
--
|
||||
2.31.1
|
||||
|
Loading…
Reference in new issue