Skip to content

Adding user to multiple groups breaks config.xml schema #130

@luehm

Description

@luehm

Describe the bug
Attempting to add a user to two or more groups invalidates pfSense XML config schema. Results in unusable/broken web-GUI. Recover by manually editing /conf/config.xml.

Expected behavior
User should be successfully added to both groups.

Playbook
Please paste a minimal playbook to reproduce the issue:

- name: Create second group
  become: true
  pfsensible.core.pfsense_group:
    name: svc_admins
    state: present

- name: Create pfSense User
  become: true
  pfsensible.core.pfsense_user:
    name: learner
    groups:
      - admins
      - svc_admins

Output
Please paste the ansible output run with -vv:

{"changed": true, "commands": ["update user 'learner' set "], "stderr": "", "stderr_lines": [], "stdout": "\nFatal error: Uncaught Exception: XML error: GROUPS at line 55 cannot occur more than once\n in /etc/inc/xmlparse.inc:89\nStack trace:\n#0 [internal function]: startElement(Object(XMLParser), 'GROUPS', Array)\n#1 /etc/inc/xmlparse.inc(201): xml_parse(Object(XMLParser), '<?xml version='...', false)\n#2 /etc/inc/xmlparse.inc(162): parse_xml_config_raw('/conf/config.xm...', Array, 'false')\n#3 /etc/inc/config.lib.inc(136): parse_xml_config('/conf/config.xm...', Array)\n#4 /etc/inc/config.inc(137): parse_config()\n#5 /etc/inc/gwlb.inc(25): require_once('/etc/inc/config...')\n#6 /etc/inc/functions.inc(35): require_once('/etc/inc/gwlb.i...')\n#7 /usr/local/sbin/pfSsh.php(29): require_once('/etc/inc/functi...')\n#8 {main}\n  thrown in /etc/inc/xmlparse.inc on line 89\nPHP ERROR: Type: 1, File: /etc/inc/xmlparse.inc, Line: 89, Message: Uncaught Exception: XML error: GROUPS at line 55 cannot occur more than once\n in /etc/inc/xmlparse.inc:89\nStack trace:\n#0 [internal function]: startElement(Object(XMLParser), 'GROUPS', Array)\n#1 /etc/inc/xmlparse.inc(201): xml_parse(Object(XMLParser), '<?xml version='...', false)\n#2 /etc/inc/xmlparse.inc(162): parse_xml_config_raw('/conf/config.xm...', Array, 'false')\n#3 /etc/inc/config.lib.inc(136): parse_xml_config('/conf/config.xm...', Array)\n#4 /etc/inc/config.inc(137): parse_config()\n#5 /etc/inc/gwlb.inc(25): require_once('/etc/inc/config...')\n#6 /etc/inc/functions.inc(35): require_once('/etc/inc/gwlb.i...')\n#7 /usr/local/sbin/pfSsh.php(29): require_once('/etc/inc/functi...')\n#8 {main}\n  thrown\nFatal error: Uncaught TypeError: array_path_enabled(): Argument #1 ($arr) must be of type array, null given, called in /etc/inc/config.lib.inc on line 1250 and defined in /etc/inc/util.inc:3662\nStack trace:\n#0 /etc/inc/config.lib.inc(1250): array_path_enabled(NULL, 'notifications/s...', 'disable')\n#1 /etc/inc/notices.inc(379): config_path_enabled('notifications/s...', 'disable')\n#2 /etc/inc/notices.inc(662): notify_via_smtp('PHP ERROR: Type...')\n#3 /etc/inc/notices.inc(151): notify_all_remote('PHP ERROR: Type...')\n#4 /etc/inc/config.lib.inc(1154): file_notice('phperror', 'PHP ERROR: Type...', 'PHP errors')\n#5 [internal function]: pfSense_clear_globals()\n#6 {main}\n  thrown in /etc/inc/util.inc on line 3662\n", "stdout_lines": ["", "Fatal error: Uncaught Exception: XML error: GROUPS at line 55 cannot occur more than once", " in /etc/inc/xmlparse.inc:89", "Stack trace:", "#0 [internal function]: startElement(Object(XMLParser), 'GROUPS', Array)", "#1 /etc/inc/xmlparse.inc(201): xml_parse(Object(XMLParser), '<?xml version='...', false)", "#2 /etc/inc/xmlparse.inc(162): parse_xml_config_raw('/conf/config.xm...', Array, 'false')", "#3 /etc/inc/config.lib.inc(136): parse_xml_config('/conf/config.xm...', Array)", "#4 /etc/inc/config.inc(137): parse_config()", "#5 /etc/inc/gwlb.inc(25): require_once('/etc/inc/config...')", "#6 /etc/inc/functions.inc(35): require_once('/etc/inc/gwlb.i...')", "#7 /usr/local/sbin/pfSsh.php(29): require_once('/etc/inc/functi...')", "#8 {main}", "  thrown in /etc/inc/xmlparse.inc on line 89", "PHP ERROR: Type: 1, File: /etc/inc/xmlparse.inc, Line: 89, Message: Uncaught Exception: XML error: GROUPS at line 55 cannot occur more than once", " in /etc/inc/xmlparse.inc:89", "Stack trace:", "#0 [internal function]: startElement(Object(XMLParser), 'GROUPS', Array)", "#1 /etc/inc/xmlparse.inc(201): xml_parse(Object(XMLParser), '<?xml version='...', false)", "#2 /etc/inc/xmlparse.inc(162): parse_xml_config_raw('/conf/config.xm...', Array, 'false')", "#3 /etc/inc/config.lib.inc(136): parse_xml_config('/conf/config.xm...', Array)", "#4 /etc/inc/config.inc(137): parse_config()", "#5 /etc/inc/gwlb.inc(25): require_once('/etc/inc/config...')", "#6 /etc/inc/functions.inc(35): require_once('/etc/inc/gwlb.i...')", "#7 /usr/local/sbin/pfSsh.php(29): require_once('/etc/inc/functi...')", "#8 {main}", "  thrown", "Fatal error: Uncaught TypeError: array_path_enabled(): Argument #1 ($arr) must be of type array, null given, called in /etc/inc/config.lib.inc on line 1250 and defined in /etc/inc/util.inc:3662", "Stack trace:", "#0 /etc/inc/config.lib.inc(1250): array_path_enabled(NULL, 'notifications/s...', 'disable')", "#1 /etc/inc/notices.inc(379): config_path_enabled('notifications/s...', 'disable')", "#2 /etc/inc/notices.inc(662): notify_via_smtp('PHP ERROR: Type...')", "#3 /etc/inc/notices.inc(151): notify_all_remote('PHP ERROR: Type...')", "#4 /etc/inc/config.lib.inc(1154): file_notice('phperror', 'PHP ERROR: Type...', 'PHP errors')", "#5 [internal function]: pfSense_clear_globals()", "#6 {main}", "  thrown in /etc/inc/util.inc on line 3662"]}

Environment

  • What version of pfsensible.core? 0.6.1 (installed from ansible galaxy)
  • What version of ansible? core 2.14.3
  • What version of pfSense? 2.7.2

Additional context
<groups></groups> does not seem to be required - membership appears to be driven via the <member></member> tags within each <group> object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions