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: "XML documents must contain one root eleme= nt that is the parent of all other elements". 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&q=3Dhttps:= //www.w3schools.com/xml/xml_syntax.asp&source=3Dgmail&ust=3D1738658= 810061000&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 "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> &q= uot;/var/ossec/etc/ossec.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"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 "${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_v= alue("10.54.1.40","/ossec_config/client/server/address"= ),<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> "/?\ --------- Configuration wazuh agent";<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&q=3Dhttps://documenta= tion.wazuh.com&source=3Dgmail&ust=3D1738658810061000&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&q=3Dhttps://groups.google.com/forum/%23!forum/wazuh&so= urce=3Dgmail&ust=3D1738658810061000&usg=3DAOvVaw3Iucppm1iYNvuKqiY0l= OxU">https://groups.google.com/forum/#!forum/wazuh</a><br>--><br><br><= ;ossec_config><br>=C2=A0 <client><br>=C2=A0 =C2=A0 <server><= br>=C2=A0 =C2=A0 =C2=A0 <address>XXXXXX</address><br>=C2=A0 =C2= =A0 =C2=A0 <port>1514</port><br>=C2=A0 =C2=A0 =C2=A0 <protoc= ol>tcp</protocol><br>=C2=A0 =C2=A0 </server><br>=C2=A0 =C2= =A0 <config-profile>debian, debian12</config-profile><br>=C2=A0= =C2=A0 <notify_time>10</notify_time><br>=C2=A0 =C2=A0 <time= -reconnect>60</time-reconnect><br>=C2=A0 =C2=A0 <auto_restart&g= t;yes</auto_restart><br>=C2=A0 =C2=A0 <crypto_method>aes</cr= ypto_method><br>=C2=A0 </client><br>....<br>=C2=A0</ossec_confi= g><br><br><ossec_config><br>=C2=A0 <localfile><br>=C2=A0 =C2= =A0 <log_format>journald</log_format><br>=C2=A0 =C2=A0 <loca= tion>journald</location><br></span></span><div><span style=3D"text= -align:left" dir=3D"ltr"><span lang=3D"en">=C2=A0 </localfile></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"></ossec_config><br><br>Thank'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" 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--