From 0c51bce5812e689a88214515f4d5ccfeda76350a Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sun, 25 Aug 2019 23:40:23 +0200 Subject: [PATCH] refactor(pillar): sync map.jinja with template-formula --- rkhunter/map.jinja | 23 ++++++++++++++--------- rkhunter/osarchmap.yaml | 35 +++++++++++++++++++++++++++++++++++ rkhunter/osfamilymap.yaml | 9 +++++++++ rkhunter/osfingermap.yaml | 18 ++++++++++-------- rkhunter/osmap.yaml | 15 ++++++++++----- 5 files changed, 78 insertions(+), 22 deletions(-) create mode 100644 rkhunter/osarchmap.yaml diff --git a/rkhunter/map.jinja b/rkhunter/map.jinja index 4888b8f..e37884f 100644 --- a/rkhunter/map.jinja +++ b/rkhunter/map.jinja @@ -5,6 +5,7 @@ {%- set tplroot = tpldir.split('/')[0] %} {#- Start imports as #} {%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %} +{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %} {%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %} {%- import_yaml tplroot ~ "/osmap.yaml" as osmap %} {%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %} @@ -16,23 +17,27 @@ default_settings, default=tplroot, merge=salt['grains.filter_by']( - osfamilymap, - grain='os_family', + osarchmap, + grain='osarch', merge=salt['grains.filter_by']( - osmap, - grain='os', + osfamilymap, + grain='os_family', merge=salt['grains.filter_by']( - osfingermap, - grain='osfinger', + osmap, + grain='os', merge=salt['grains.filter_by']( - _config, - default='lookup' + osfingermap, + grain='osfinger', + merge=salt['grains.filter_by']( + _config, + default='lookup' + ) ) ) ) ) ) - %} +%} {%- set config = salt['grains.filter_by']( {'defaults': defaults}, diff --git a/rkhunter/osarchmap.yaml b/rkhunter/osarchmap.yaml new file mode 100644 index 0000000..ab3bc1f --- /dev/null +++ b/rkhunter/osarchmap.yaml @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +# +# Setup variables using grains['osarch'] based logic. +# You just need to add the key:values for an `osarch` that differ +# from `defaults.yaml`. +# Only add an `osarch` which is/will be supported by the formula. +# +# If you do not need to provide defaults via the `osarch` grain, +# you will need to provide at least an empty dict in this file, e.g. +# osarch: {} +--- +amd64: + arch: amd64 + +x86_64: + arch: amd64 + +386: + arch: 386 + +arm64: + arch: arm64 + +armv6l: + arch: armv6l + +armv7l: + arch: armv7l + +ppc64le: + arch: ppc64le + +s390x: + arch: s390x diff --git a/rkhunter/osfamilymap.yaml b/rkhunter/osfamilymap.yaml index ffaa832..f490008 100644 --- a/rkhunter/osfamilymap.yaml +++ b/rkhunter/osfamilymap.yaml @@ -1,5 +1,14 @@ # -*- coding: utf-8 -*- # vim: ft=yaml +# +# Setup variables using grains['os_family'] based logic. +# You just need to add the key:values for an `os_family` that differ +# from `defaults.yaml` + `osarch.yaml`. +# Only add an `os_family` which is/will be supported by the formula. +# +# If you do not need to provide defaults via the `os_family` grain, +# you will need to provide at least an empty dict in this file, e.g. +# osfamilymap: {} --- Debian: default_file: /etc/default/rkhunter diff --git a/rkhunter/osfingermap.yaml b/rkhunter/osfingermap.yaml index ee18cf2..221bedf 100644 --- a/rkhunter/osfingermap.yaml +++ b/rkhunter/osfingermap.yaml @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- # vim: ft=yaml +# +# Setup variables using grains['osfinger'] based logic. +# You just need to add the key:values for an `osfinger` that differ +# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml` + `osmap.yaml`. +# Only add an `osfinger` which is/will be supported by the formula. +# +# If you do not need to provide defaults via the `os_finger` grain, +# you will need to provide at least an empty dict in this file, e.g. +# osfingermap: {} --- -Debian-8: {} -Debian-9: {} -Ubuntu-16.04: {} -Ubuntu-18.04: {} -Fedora-28: {} -Fedora-29: {} -CentOS-7: {} -openSUSE-4.23: {} +osfingermap: {} diff --git a/rkhunter/osmap.yaml b/rkhunter/osmap.yaml index c1cad1a..2ec94b4 100644 --- a/rkhunter/osmap.yaml +++ b/rkhunter/osmap.yaml @@ -1,8 +1,13 @@ # -*- coding: utf-8 -*- # vim: ft=yaml +# +# Setup variables using grains['os'] based logic. +# You just need to add the key:values for an `os` that differ +# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml`. +# Only add an `os` which is/will be supported by the formula. +# +# If you do not need to provide defaults via the `os` grain, +# you will need to provide at least an empty dict in this file, e.g. +# osmap: {} --- -Debian: {} -Ubuntu: {} -Fedora: {} -CentOS: {} -openSUSE: {} +osmap: {}