sap.sap_operations.proc_info (1.25.0) — module

Reads content from files in the /proc directory

| "added in version" 1.18.0 of sap.sap_operations"

Authors: Kirill Satarin (@kksat)

Install collection

Install with ansible-galaxy collection install sap.sap_operations:==1.25.0


Add to requirements.yml

  collections:
    - name: sap.sap_operations
      version: 1.25.0

Description

This module is designed to read the contents of files located within the /proc directory.

It prevents directory traversal attacks by ensuring that the requested path is within the /proc directory.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Read cpuinfo
  sap.sap_operations.proc_info:
    proc: "cpuinfo"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Try to read outside /proc
  sap.sap_operations.proc_info:
    proc: "/etc/passwd"

Inputs

    
proc:
    description:
    - The path to the file within the /proc directory to read.
    - This path might be relative to the /proc directory or absolute; absolute paths are
      adjusted accordingly.
    - To read /proc/cpuinfo from the root directory, one should set this parameter to
      "/proc/cpuinfo" or "cpuinfo"
    required: true
    type: path

Outputs

proc_path:
  description: The absolute path to the file that was read.
  returned: always
  type: str
rc:
  description: Return code from the 'cat' command.
  returned: always
  type: int
stderr:
  description: The standard error from the 'cat' command if it fails.
  returned: failure
  type: str
stdout:
  description: The content of the file read from /proc.
  returned: success
  type: str