ComplianceAsCode / content

Security automation content in SCAP, Bash, Ansible, and other formats
https://complianceascode.readthedocs.io/en/latest/
Other
2.18k stars 696 forks source link

Issues creating a new product #10355

Closed robrec closed 1 year ago

robrec commented 1 year ago

I wanted to create a new product and followed the instructions provided in the following link: https://complianceascode.readthedocs.io/en/latest/manual/developer/03_creating_content.html#creating-a-new-product

I noticed several things while doing so:

instructions point 1: After export CAPITAL_NAME="CUSTOM" there should be a cd products

instructions point 2: it should be as follows:

if (SSG_PRODUCT_CUSTOM6)
      add_subdirectory("products/custom6" "custom6")
endif()

instead of what is mentioned in the instructions:

if (SSG_PRODUCT_CUSTOM6)
      add_subdirectory("custom6")
endif()

When I have completed all the further steps and run ./build_product custom6, I receive the following error messages:

[xxx@localhost content]$ ./build_product custom6
-- SCAP Security Guide 0.1.67
-- (see /home/xxx/content/docs/manual/developer_guide.adoc for build instructions)
-- 
-- Found PythonInterp: /usr/bin/python3 (found version "3.6.8") 
-- Found PY_yaml: /usr/lib64/python3.6/site-packages/yaml  
-- Found PY_jinja2: /usr/lib/python3.6/site-packages/jinja2  
-- Found PY_pytest: /usr/lib/python3.6/site-packages/pytest.py  
-- Could NOT find PY_pytest_cov (missing: PY_PYTEST_COV) 
-- Could NOT find PY_json2html (missing: PY_JSON2HTML) 
-- Could NOT find PY_yamlpath (missing: PY_YAMLPATH) 
-- Could NOT find PY_mypy (missing: PY_MYPY) 
-- Found PY_openpyxl: /usr/lib/python3.6/site-packages/openpyxl  
-- Could NOT find PY_pandas (missing: PY_PANDAS) 
-- Could NOT find PY_sphinx (missing: PY_SPHINX) 
-- Could NOT find PY_sphinxcontrib.autojinja (missing: PY_SPHINXCONTRIB.AUTOJINJA) 
-- Could NOT find PY_sphinx_rtd_theme (missing: PY_SPHINX_RTD_THEME) 
-- Could NOT find PY_myst_parser (missing: PY_MYST_PARSER) 
-- CMake:
-- build type: Release
-- generator: Unix Makefiles
-- source directory: /home/xxx/content
-- build directory: /home/xxx/content/build
--  
-- Tools:
-- python: /usr/bin/python3 (version: 3.6.8)
-- python yaml module: /usr/lib64/python3.6/site-packages/yaml
-- python jinja2 module: /usr/lib/python3.6/site-packages/jinja2
-- oscap: /usr/bin/oscap (version: 1.3.6)
-- xsltproc: /usr/bin/xsltproc
-- xmllint: /usr/bin/xmllint
-- xmlwf: /usr/bin/xmlwf
-- sed: /usr/bin/sed
-- shellcheck (optional): /usr/bin/shellcheck
-- linkchecker (optional): LINKCHECKER_EXECUTABLE-NOTFOUND
-- grep (optional): /usr/bin/grep
-- python pytest module (optional): /usr/lib/python3.6/site-packages/pytest.py
-- ansible-playbook module (optional): /usr/bin/ansible-playbook
-- ansible-lint module (optional): ANSIBLE_LINT_EXECUTABLE-NOTFOUND
-- yamllint module (optional): /usr/bin/yamllint
-- yamlpath module (optional): 
-- python mypy module (optional): 
-- BATS framework (optional): /usr/bin/bats
-- python sphinx module (optional): 
-- python sphinxcontrib.autojinja module (optional): 
-- python sphinx_rtd_theme module (optional): 
-- python myst-parser module (optional): 
-- python openpyxl module (optional): /usr/lib/python3.6/site-packages/openpyxl
-- python pandas module (optional): 
--  
-- Build options:
-- SSG vendor string: ssgproject
-- Target OVAL version: 5.11
-- Build SCAP 1.2 source data streams: ON
-- OVAL schematron validation: ON
-- shellcheck bash fixes validation: ON
-- Separate SCAP files: ON
-- Ansible Playbooks: ON
-- Ansible Playbooks Per Rule: OFF
-- Bash scripts: ON
-- jinja2 cache: enabled
-- jinja2 cache dir: /home/xxx/content/build/jinja2_cache
-- STIG Delta Taloring files: ON
-- Build SCE Content: OFF
--  
-- Products:
-- Alibaba Cloud Linux 2: OFF
-- Alibaba Cloud Linux 3: OFF
-- Anolis OS 8: OFF
-- Chromium: OFF
-- Debian 10: OFF
-- Debian 11: OFF
-- Example: OFF
-- EKS: OFF
-- Fedora: OFF
-- Firefox: OFF
-- MacOS 1015: OFF
-- OCP4: OFF
-- RHCOS4: OFF
-- Oracle Linux 7: OFF
-- Oracle Linux 8: OFF
-- Oracle Linux 9: OFF
-- openSUSE: OFF
-- RHEL 7: OFF
-- RHEL 8: OFF
-- RHEL 9: OFF
-- RHV 4: OFF
-- SUSE 12: OFF
-- SUSE 15: OFF
-- Ubuntu 16.04: OFF
-- Ubuntu 18.04: OFF
-- Ubuntu 20.04: OFF
-- Ubuntu 22.04: OFF
-- Uos 20: OFF
-- Custom 6: ON
--  
-- Scanning for dependencies of custom6 fixes (bash, ansible, puppet, anaconda, ignition, kubernetes and blueprint)...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xxx/content/build
[  5%] Built target custom6 -tables
[  5%] [custom6 -content] generating sce/metadata.json
[  5%] Built target generate-internal-custom6 -sce-metadata.json
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xxx/content/build
[  5%] Built target custom6-tables
[  5%] custom6-content] generating sce/metadata.json
[  5%] Built target generate-internal-custom6-sce-metadata.json
[ 11%] custom6-content] compiling everything
Traceback (most recent call last):
  File "/home/xxx/content/build-scripts/compile_all.py", line 143, in <module>
    main()
  File "/home/xxx/content/build-scripts/compile_all.py", line 123, in main
    product_cpes.load_product_cpes(env_yaml)
  File "/home/xxx/content/ssg/build_cpe.py", line 44, in load_product_cpes
    for cpe_id, cpe in cpe_dict_repr.items():
AttributeError: 'str' object has no attribute 'items'
make[2]: *** [custom6/CMakeFiles/custom6-compile-all.dir/build.make:74: custom6/profiles] Error 1
make[1]: *** [CMakeFiles/Makefile2:867: custom6/CMakeFiles/custom6-compile-all.dir/all] Error 2
make: *** [Makefile:154: all] Error 2

Are there any other deviations from the documentation that I may have missed so far? Could it be related to my development environment, AlmaLinux8?

I would appreciate any help.

Best regards

ggbecker commented 1 year ago

The documentation most likely is outdated.

I suggest you taking a look at the most recent added product and get inspired by the changes in there.

https://github.com/ComplianceAsCode/content/pull/9770

But be aware that even that example could be outdated, and if you figure out any outdated documentation, feel free to propose it as a fix to it in: https://github.com/ComplianceAsCode/content/blob/master/docs/manual/developer/03_creating_content.md#creating-a-new-product

marcusburghardt commented 1 year ago

Guidance was provided. Follow-up issues could be created for any eventual and specific issue.