Xml_set_value fonction problem
thierry thunot <[email protected]> Thu, 30 Jan 2025 23:18:27 -0800 (PST)
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_86014_1426427392.1738307907840
Content-Type: multipart/alternative;
boundary="----=_Part_86015_1014941744.1738307907840"
------=_Part_86015_1014941744.1738307907840
Content-Type: text/plain; charset="UTF-8"
Hello everyone,
I am having difficulty editing an xml file.
In particular that of the wazuh agent to be deployed automatically by cf.
I need to set a tag value. I use the xml_set_value function which seems
very simple to use.
The only problem is that the basic Wazuh configuration file has two
sections with the same tag. therefore, the xml_set_status function does not
work.
....
vars:
# "adresse_wazuh_manager" string => "10.54.1.40";
"fic_conf_wazuh" string =>
"/var/ossec/etc/ossec.conf";
files:
"${fic_conf_wazuh}"
perms => mog("550","root","root"),
edit_xml =>
xml_set_value("10.54.1.40","/ossec_config/client/server/address"),
classes => results("bundle","relance_wazuh_agent"),
comment => "/?\ --------- Configuration wazuh agent";
......
file to edit:
!--
Wazuh - Agent - Default configuration for debian 12
More info at: https://documentation.wazuh.com
Mailing list: https://groups.google.com/forum/#!forum/wazuh
-->
<ossec_config>
<client>
<server>
<address>XXXXXX</address>
<port>1514</port>
<protocol>tcp</protocol>
</server>
<config-profile>debian, debian12</config-profile>
<notify_time>10</notify_time>
<time-reconnect>60</time-reconnect>
<auto_restart>yes</auto_restart>
<crypto_method>aes</crypto_method>
</client>
....
</ossec_config>
<ossec_config>
<localfile>
<log_format>journald</log_format>
<location>journald</location>
</localfile>
......
</ossec_config>
Thank's for your help
--
You received this message because you are subscribed to the Google Groups "help-cfengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/help-cfengine/de6da3d6-7968-4204-b819-862a37302aebn%40googlegroups.com.
------=_Part_86015_1014941744.1738307907840
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<span style=3D"text-align: left;" dir=3D"ltr"><span lang=3D"en">Hello every=
one,<br />
I am having difficulty editing an xml file. <br /><br />In particular that =
of the wazuh agent to be deployed automatically by cf.<br />
I need to set a tag value.
I use the xml_set_value function which seems very simple to use.
<br /><br />The only problem is that the basic Wazuh configuration file has=
two sections with the same tag. therefore, the xml_set_status function doe=
s not work. <br /><br />....<br /></span></span><div><span style=3D"text-al=
ign: left;" dir=3D"ltr"><span lang=3D"en">vars:<br />#=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "adresse_wazuh_manager" string =3D> "=
10.54.1.40";<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "=
fic_conf_wazuh" =C2=A0 =C2=A0 =C2=A0 =C2=A0string =3D> "/var/ossec/etc/o=
ssec.conf";</span></span></div><div><span style=3D"text-align: left;" dir=
=3D"ltr"><span lang=3D"en">files:</span></span></div><div><span style=3D"te=
xt-align: left;" dir=3D"ltr"><span lang=3D"en"></span></span></div><span st=
yle=3D"text-align: left;" dir=3D"ltr"><span lang=3D"en">=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 "${fic_conf_wazuh}"<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 perms =C2=A0 =C2=A0 =C2=A0=3D> mog("550","root","root"=
),<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 edit_xml =
=C2=A0 =3D> xml_set_value("10.54.1.40","/ossec_config/client/server/addr=
ess"),<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 classes=
=C2=A0 =C2=A0=3D> results("bundle","relance_wazuh_agent"),<br />=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comment =C2=A0 =C2=A0=3D&g=
t; "/?\ --------- Configuration wazuh agent";<br />......<br /><br /><br />=
<br /><br />file to edit: <br /><br />!--<br />=C2=A0 Wazuh - Agent - Defau=
lt configuration for debian 12<br />=C2=A0 More info at: https://documentat=
ion.wazuh.com<br />=C2=A0 Mailing list: https://groups.google.com/forum/#!f=
orum/wazuh<br />--><br /><br /><ossec_config><br />=C2=A0 <clie=
nt><br />=C2=A0 =C2=A0 <server><br />=C2=A0 =C2=A0 =C2=A0 <addr=
ess>XXXXXX</address><br />=C2=A0 =C2=A0 =C2=A0 <port>1514<=
;/port><br />=C2=A0 =C2=A0 =C2=A0 <protocol>tcp</protocol><b=
r />=C2=A0 =C2=A0 </server><br />=C2=A0 =C2=A0 <config-profile>=
debian, debian12</config-profile><br />=C2=A0 =C2=A0 <notify_time&=
gt;10</notify_time><br />=C2=A0 =C2=A0 <time-reconnect>60</t=
ime-reconnect><br />=C2=A0 =C2=A0 <auto_restart>yes</auto_resta=
rt><br />=C2=A0 =C2=A0 <crypto_method>aes</crypto_method><br=
/>=C2=A0 </client><br />....<br />=C2=A0</ossec_config><br /><=
br /><ossec_config><br />=C2=A0 <localfile><br />=C2=A0 =C2=A0 =
<log_format>journald</log_format><br />=C2=A0 =C2=A0 <locati=
on>journald</location><br /></span></span><div><span style=3D"text=
-align: left;" dir=3D"ltr"><span lang=3D"en">=C2=A0 </localfile></spa=
n></span></div><div><span style=3D"text-align: left;" dir=3D"ltr"><span lan=
g=3D"en">......</span></span></div><div><span style=3D"text-align: left;" d=
ir=3D"ltr"><span lang=3D"en"></ossec_config><br /><br />Thank's for y=
our help<br /></span></span></div><div><span style=3D"text-align: left;" di=
r=3D"ltr"><span lang=3D"en"></span></span></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;help-cfengine" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">help-=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
help-cfengine/de6da3d6-7968-4204-b819-862a37302aebn%40googlegroups.com?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/help-=
cfengine/de6da3d6-7968-4204-b819-862a37302aebn%40googlegroups.com</a>.<br /=
>
------=_Part_86015_1014941744.1738307907840--
------=_Part_86014_1426427392.1738307907840--