cfengine / design-center

CFEngine community-contributed content
http://cfengine.com/
Other
80 stars 68 forks source link

sudoers: fix parameter types #405

Closed tzz closed 10 years ago

tzz commented 10 years ago

Closes #404

@svenXY please test with this change if possible.

svenXY commented 10 years ago

seems better now, but not yet there:

cf-sketch> list -v params 

The following parameter sets are defined:

fnord: Sketch System::Sudoers
  [System::Sudoers][cmnd_alias]: { "C_reboot = /sbin/halt, /sbin/reboot" }
  [System::Sudoers][defaults]: { }
  [System::Sudoers][drop_dirs]: { }
  [System::Sudoers][file_path]: /etc/sudoers.d/10_svh
  [System::Sudoers][host_alias]: { "H_all = localhost, x12345, x54321" }
  [System::Sudoers][prefix]: __PREFIX__
  [System::Sudoers][runas_alias]: { "R_root = root" }
  [System::Sudoers][user_alias]: { "U_admins = svenh, root, fnord" }
  [System::Sudoers][user_specs]: { "U_admins H_all = (R_root) C_reboot" }
  [System::Sudoers][visudo_path]: /usr/sbin/visudo

cf-sketch> run

Runfile /var/cfengine/inputs/cf-sketch-runfile-standalone.cf successfully generated.
Now executing the runfile with: /usr/local/sbin/cf-agent  -f /var/cfengine/inputs/cf-sketch-runfile-standalone.cf

/var/cfengine/inputs/sketches/system/sudoers/main.cf:1:1: error: Broken variable syntax or bracket mismatch in string ($(arrays[user_specs)
/var/cfengine/inputs/sketches/system/sudoers/main.cf:1:1: error: Broken variable syntax or bracket mismatch in - outer ($(arrays[user_specs/)
/var/cfengine/inputs/sketches/system/sudoers/main.cf:1:1: error: Broken variable syntax or bracket mismatch in string ($(arrays[user_specs)
/var/cfengine/inputs/sketches/system/sudoers/main.cf:1:1: error: Broken variable syntax or bracket mismatch in string ($(arrays[user_specs)
[...]
svenXY commented 10 years ago
/var/cfengine/inputs/sketches/system/sudoers/main.cf:1:1: error: Broken variable syntax or bracket mismatch in string ($(arrays[cmnd_alias)
/var/cfengine/inputs/sketches/system/sudoers/main.cf:1:1: error: Broken variable syntax or bracket mismatch in - outer ($(arrays[cmnd_alias/)
/var/cfengine/inputs/sketches/system/sudoers/main.cf:1:1: error: Broken variable syntax or bracket mismatch in string ($(arrays[cmnd_alias)

as well

tzz commented 10 years ago

@svenXY sorry for the silence. Due to travel I haven't been able to get back to this, but will next week.

svenXY commented 10 years ago

No worries, but thanks for letting me know. Sven

tzz commented 10 years ago

Good news: this is fixed in 3.6 (master).

Could you try "cd tools/test; make sudoers2" in 3.5.2 with the latest DC? If the bug you observed is present in 3.5.2, I'll try to get it fixed in the upcoming 3.5.3.

Bad news: I found another bug while testing it in master, https://cfengine.com/dev/issues/3781 :anguished:

bheilman commented 10 years ago

Does this actually work? My revision of sudoers created breaking changing in the API

tzz commented 10 years ago

I couldn't test because of the bug I cited. Waiting for it to be fixed.