Re: Xml_set_value fonction problem

thierry thunot <[email protected]> Mon, 3 Feb 2025 04:50:37 -0800 (PST)
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
------=_Part_280444_1266006551.1738587037839
Content-Type: multipart/alternative; 
	boundary="----=_Part_280445_1336746938.1738587037839"

------=_Part_280445_1336746938.1738587037839
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

=20
That's exactly it, the file is malformed
I will share it with the Wazuh developers

Thank's

Le vendredi 31 janvier 2025 =C3=A0 10:16:18 UTC+1, [email protected] =
a=20
=C3=A9crit :

> Hi there,
>
> What is the error message you get? Is it perhaps `parser error : Extra=20
> content at the end of the document`?
>
> The XLM that you reference does not look valid. Not because of duplicate=
=20
> tags. However, it breaks the following rule: "XML documents must contain=
=20
> one root element that is the parent of all other elements". See=20
> https://www.w3schools.com/xml/xml_syntax.asp.
>
> Hope this helps :)
>
> On Friday, January 31, 2025 at 8:18:28=E2=80=AFAM UTC+1 [email protected] =
wrote:
>
>> Hello everyone,
>> I am having difficulty editing an xml file.=20
>>
>> 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=
=20
>> very simple to use.=20
>>
>> The only problem is that the basic Wazuh configuration file has two=20
>> sections with the same tag. therefore, the xml_set_status function does =
not=20
>> work.=20
>>
>> ....
>> vars:
>> #                "adresse_wazuh_manager" string =3D> "10.54.1.40";
>>                 "fic_conf_wazuh"        string =3D>=20
>> "/var/ossec/etc/ossec.conf";
>> files:
>>         "${fic_conf_wazuh}"
>>                 perms      =3D> mog("550","root","root"),
>>                 edit_xml   =3D>=20
>> xml_set_value("10.54.1.40","/ossec_config/client/server/address"),
>>                 classes    =3D> results("bundle","relance_wazuh_agent"),
>>                 comment    =3D> "/?\ --------- Configuration wazuh agent=
";
>> ......
>>
>>
>>
>>
>> file to edit:=20
>>
>> !--
>>   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
>>
>

--=20
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 e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/help-cfengi=
ne/7e8c7cda-34dd-46f5-bcfb-a145ca56e28bn%40googlegroups.com.

------=_Part_280445_1336746938.1738587037839
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable


<div><div></div></div><div><div><div><div tabindex=3D"0" role=3D"text"><spa=
n style=3D"text-align: left;" dir=3D"ltr"><span lang=3D"en">That's exactly =
it, the file is malformed<br />
</span></span><div><div><div><div tabindex=3D"0" role=3D"text"><span style=
=3D"text-align: left;" dir=3D"ltr"><span lang=3D"en">I will share it with t=
he Wazuh developers</span></span></div></div></div></div>

</div><div tabindex=3D"0" role=3D"text"><br /></div><div tabindex=3D"0" rol=
e=3D"text">Thank's<br /></div></div></div></div><br /><div class=3D"gmail_q=
uote"><div dir=3D"auto" class=3D"gmail_attr">Le vendredi 31 janvier 2025 =
=C3=A0 10:16:18 UTC+1, [email protected] a =C3=A9crit=C2=A0:<br/></di=
v><blockquote class=3D"gmail_quote" style=3D"margin: 0 0 0 0.8ex; border-le=
ft: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi there,<div><br></d=
iv><div>What is the error message you get? Is it perhaps `parser error : Ex=
tra content at the end of the document`?<div><br></div><div>The XLM that yo=
u reference does not look valid. Not because of duplicate tags. However, it=
 breaks the following rule: &quot;XML documents must contain one root eleme=
nt that is the parent of all other elements&quot;. See=C2=A0<a href=3D"http=
s://www.w3schools.com/xml/xml_syntax.asp" target=3D"_blank" rel=3D"nofollow=
" data-saferedirecturl=3D"https://www.google.com/url?hl=3Dfr&amp;q=3Dhttps:=
//www.w3schools.com/xml/xml_syntax.asp&amp;source=3Dgmail&amp;ust=3D1738658=
810061000&amp;usg=3DAOvVaw2HLXur5dqzMDcGIpmVRygu">https://www.w3schools.com=
/xml/xml_syntax.asp</a>.</div><div><br></div><div>Hope this helps :)<br><br=
></div></div><div class=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_at=
tr">On Friday, January 31, 2025 at 8:18:28=E2=80=AFAM UTC+1 <a href data-em=
ail-masked rel=3D"nofollow">[email protected]</a> wrote:<br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 0.8ex;border-left:1px solid r=
gb(204,204,204);padding-left:1ex">
<span style=3D"text-align:left" dir=3D"ltr"><span lang=3D"en">Hello everyon=
e,<br>
I am having difficulty editing an xml file. <br><br>In particular that of t=
he 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 does no=
t work. <br><br>....<br></span></span><div><span style=3D"text-align: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 &quot;adresse_wazuh_manager&quot; string =3D&gt; &quot=
;10.54.1.40&quot;;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 &quot;fic_conf_wazuh&quot; =C2=A0 =C2=A0 =C2=A0 =C2=A0string =3D&gt; &q=
uot;/var/ossec/etc/ossec.conf&quot;;</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"text-align:left" dir=3D"ltr"><span lang=3D"en"></span></=
span></div><span style=3D"text-align:left" dir=3D"ltr"><span lang=3D"en">=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 &quot;${fic_conf_wazuh}&quot;<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&gt;=
 mog(&quot;550&quot;,&quot;root&quot;,&quot;root&quot;),<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 edit_xml =C2=A0 =3D&gt; xml_set_v=
alue(&quot;10.54.1.40&quot;,&quot;/ossec_config/client/server/address&quot;=
),<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 classes =C2=
=A0 =C2=A0=3D&gt; results(&quot;bundle&quot;,&quot;relance_wazuh_agent&quot=
;),<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comment =C2=
=A0 =C2=A0=3D&gt; &quot;/?\ --------- Configuration wazuh agent&quot;;<br>.=
.....<br><br><br><br><br>file to edit: <br><br>!--<br>=C2=A0 Wazuh - Agent =
- Default configuration for debian 12<br>=C2=A0 More info at: <a href=3D"ht=
tps://documentation.wazuh.com" rel=3D"nofollow" target=3D"_blank" data-safe=
redirecturl=3D"https://www.google.com/url?hl=3Dfr&amp;q=3Dhttps://documenta=
tion.wazuh.com&amp;source=3Dgmail&amp;ust=3D1738658810061000&amp;usg=3DAOvV=
aw0nuig94q12iRIPOm2eWwrB">https://documentation.wazuh.com</a><br>=C2=A0 Mai=
ling list: <a href=3D"https://groups.google.com/forum/#!forum/wazuh" rel=3D=
"nofollow" target=3D"_blank" data-saferedirecturl=3D"https://www.google.com=
/url?hl=3Dfr&amp;q=3Dhttps://groups.google.com/forum/%23!forum/wazuh&amp;so=
urce=3Dgmail&amp;ust=3D1738658810061000&amp;usg=3DAOvVaw3Iucppm1iYNvuKqiY0l=
OxU">https://groups.google.com/forum/#!forum/wazuh</a><br>--&gt;<br><br>&lt=
;ossec_config&gt;<br>=C2=A0 &lt;client&gt;<br>=C2=A0 =C2=A0 &lt;server&gt;<=
br>=C2=A0 =C2=A0 =C2=A0 &lt;address&gt;XXXXXX&lt;/address&gt;<br>=C2=A0 =C2=
=A0 =C2=A0 &lt;port&gt;1514&lt;/port&gt;<br>=C2=A0 =C2=A0 =C2=A0 &lt;protoc=
ol&gt;tcp&lt;/protocol&gt;<br>=C2=A0 =C2=A0 &lt;/server&gt;<br>=C2=A0 =C2=
=A0 &lt;config-profile&gt;debian, debian12&lt;/config-profile&gt;<br>=C2=A0=
 =C2=A0 &lt;notify_time&gt;10&lt;/notify_time&gt;<br>=C2=A0 =C2=A0 &lt;time=
-reconnect&gt;60&lt;/time-reconnect&gt;<br>=C2=A0 =C2=A0 &lt;auto_restart&g=
t;yes&lt;/auto_restart&gt;<br>=C2=A0 =C2=A0 &lt;crypto_method&gt;aes&lt;/cr=
ypto_method&gt;<br>=C2=A0 &lt;/client&gt;<br>....<br>=C2=A0&lt;/ossec_confi=
g&gt;<br><br>&lt;ossec_config&gt;<br>=C2=A0 &lt;localfile&gt;<br>=C2=A0 =C2=
=A0 &lt;log_format&gt;journald&lt;/log_format&gt;<br>=C2=A0 =C2=A0 &lt;loca=
tion&gt;journald&lt;/location&gt;<br></span></span><div><span style=3D"text=
-align:left" dir=3D"ltr"><span lang=3D"en">=C2=A0 &lt;/localfile&gt;</span>=
</span></div><div><span style=3D"text-align:left" dir=3D"ltr"><span lang=3D=
"en">......</span></span></div><div><span style=3D"text-align:left" dir=3D"=
ltr"><span lang=3D"en">&lt;/ossec_config&gt;<br><br>Thank&#39;s for your he=
lp<br></span></span></div><div><span style=3D"text-align:left" dir=3D"ltr">=
<span lang=3D"en"></span></span></div>

</blockquote></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;help-cfengine&quot; 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/7e8c7cda-34dd-46f5-bcfb-a145ca56e28bn%40googlegroups.com?utm_=
medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/help-=
cfengine/7e8c7cda-34dd-46f5-bcfb-a145ca56e28bn%40googlegroups.com</a>.<br /=
>

------=_Part_280445_1336746938.1738587037839--

------=_Part_280444_1266006551.1738587037839--