Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3765920
D3392.id8830.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D3392.id8830.diff
View Options
diff --git a/hotfixes/files/T1991-egrep.salt-3006.patch b/hotfixes/files/T1991-egrep.salt-3006.patch
new file mode 100644
--- /dev/null
+++ b/hotfixes/files/T1991-egrep.salt-3006.patch
@@ -0,0 +1,44 @@
+diff --git a/modules/csf.py b/modules/csf.py
+index 0f7a27c..5fd8b21 100644
+--- a/modules/csf.py
++++ b/modules/csf.py
+@@ -71,7 +71,7 @@ def exists(
+ ip, port, proto, direction, port_origin, ip_origin, comment
+ )
+ return _exists_with_port(method, rule)
+- exists = __salt__["cmd.run_all"](f"egrep ^'{ip} +' /etc/csf/csf.{method}")
++ exists = __salt__["cmd.run_all"](f"grep -E ^'{ip} +' /etc/csf/csf.{method}")
+ return not bool(exists["retcode"])
+
+
+diff --git a/modules/selinux.py b/modules/selinux.py
+index da7d0bc..0c4a0d1 100644
+--- a/modules/selinux.py
++++ b/modules/selinux.py
+@@ -490,7 +490,7 @@ def fcontext_get_policy(
+ "[[:alpha:] ]+" if filetype is None else filetype_id_to_string(filetype)
+ )
+ cmd = (
+- "semanage fcontext -l | egrep "
++ "semanage fcontext -l | grep -E "
+ + "'^{filespec}{spacer}{filetype}{spacer}{sel_user}:{sel_role}:{sel_type}:{sel_level}{ospacer}$'".format(
+ **cmd_kwargs
+ )
+@@ -616,7 +616,7 @@ def _fcontext_add_or_delete_policy(
+ if "add" == action:
+ # need to use --modify if context for name file exists, otherwise ValueError
+ filespec = re.escape(name)
+- cmd = f"semanage fcontext -l | egrep '{filespec}'"
++ cmd = f"semanage fcontext -l | grep -E '{filespec}'"
+ current_entry_text = __salt__["cmd.shell"](cmd, ignore_retcode=True)
+ if current_entry_text != "":
+ action = "modify"
+@@ -762,7 +762,7 @@ def port_get_policy(name, sel_type=None, protocol=None, port=None):
+ "port": port,
+ }
+ cmd = (
+- "semanage port -l | egrep "
++ "semanage port -l | grep -E "
+ + "'^{sel_type}{spacer}{protocol}{spacer}((.*)*)[ ]{port}($|,)'".format(
+ **cmd_kwargs
+ )
diff --git a/hotfixes/files/T1991-egrep.salt-3007.patch b/hotfixes/files/T1991-egrep.salt-3007.patch
new file mode 100644
--- /dev/null
+++ b/hotfixes/files/T1991-egrep.salt-3007.patch
@@ -0,0 +1,35 @@
+diff --git a/modules/csf.py b/modules/csf.py
+index 0f7a27c..5fd8b21 100644
+--- a/modules/csf.py
++++ b/modules/csf.py
+@@ -71,7 +71,7 @@ def exists(
+ ip, port, proto, direction, port_origin, ip_origin, comment
+ )
+ return _exists_with_port(method, rule)
+- exists = __salt__["cmd.run_all"](f"egrep ^'{ip} +' /etc/csf/csf.{method}")
++ exists = __salt__["cmd.run_all"](f"grep -E ^'{ip} +' /etc/csf/csf.{method}")
+ return not bool(exists["retcode"])
+
+
+diff --git a/modules/selinux.py b/modules/selinux.py
+index 8201d87..8364141 100644
+--- a/modules/selinux.py
++++ b/modules/selinux.py
+@@ -616,7 +616,7 @@ def _fcontext_add_or_delete_policy(
+ if "add" == action:
+ # need to use --modify if context for name file exists, otherwise ValueError
+ filespec = re.escape(name)
+- cmd = f"semanage fcontext -l | egrep '{filespec}'"
++ cmd = f"semanage fcontext -l | grep -E '{filespec}'"
+ current_entry_text = __salt__["cmd.shell"](cmd, ignore_retcode=True)
+ if current_entry_text != "":
+ action = "modify"
+@@ -762,7 +762,7 @@ def port_get_policy(name, sel_type=None, protocol=None, port=None):
+ "port": port,
+ }
+ cmd = (
+- "semanage port -l | egrep "
++ "semanage port -l | grep -E "
+ + "'^{sel_type}{spacer}{protocol}{spacer}((.*)*)[ ]{port}($|,)'".format(
+ **cmd_kwargs
+ )
diff --git a/hotfixes/init.sls b/hotfixes/init.sls
--- a/hotfixes/init.sls
+++ b/hotfixes/init.sls
@@ -7,6 +7,7 @@
# -------------------------------------------------------------
include:
+ - .salt
- .CVE-2017-6074
- .T1261-srv-data
- .T1345-drop-jails-from-ysul
diff --git a/hotfixes/salt.sls b/hotfixes/salt.sls
new file mode 100644
--- /dev/null
+++ b/hotfixes/salt.sls
@@ -0,0 +1,30 @@
+# -------------------------------------------------------------
+# Salt — Hotfixes to mitigate bugs and security issues
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# T1991 :: egrep -> grep -E
+#
+# GNU grep deprecated egrep separate utility.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% if grains['kernel'] == 'Linux' %}
+
+{% if salt["pkg.version_cmp"](grains["saltversion"], "3007") >= 0 %}
+T1991_egrep_patch:
+ file.patch:
+ - name: {{ grains.saltpath }}
+ - source: salt://hotfixes/files/T1991-egrep.salt-3007.patch
+ - strip: 1
+{% else %}
+T1991_egrep_patch:
+ file.patch:
+ - name: {{ grains.saltpath }}
+ - source: salt://hotfixes/files/T1991-egrep.salt-3006.patch
+ - strip: 1
+{% endif %}
+
+{% endif %}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 15:16 (17 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258296
Default Alt Text
D3392.id8830.diff (5 KB)
Attached To
Mode
D3392: Avoid egrep in Salt code base
Attached
Detach File
Event Timeline
Log In to Comment