FWIW, I see a possibly related bug in $(sys.interface). However, I still need to upgrade to the latest versions, so please submit a bugreport based on your version.
To answer your question, you can use getindices to find out all the interface names that are active (i.e., have an IP address). body common control { bundlesequence => { "hostname" }; } ######################################################## bundle agent hostname { vars: "ifc" slist => getindices("sys.ipv4"); reports: cfengine_3:: "ifc $(ifc) $(sys.ipv4[$(ifc)])"; } -Dan > --===============1368680543== > Content-Language: en > Content-Type: multipart/alternative; > boundary="_000_C7D103656DC3traianowelcomemtnbusinesscoza_" > > --_000_C7D103656DC3traianowelcomemtnbusinesscoza_ > Content-Type: text/plain; charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > Hi All > > I'm currently building PF (packet filter) rules file on freebsd using the = > example provided by "unit_copy_edit.cf". To identify the main network inter= > face of the system, I'm trying to use the "sys.interface" variable in order= > to replace a keyword in a pf.conf file (in this case "INTERFACE0"). Cfengi= > ne successfully writes out the config file but somehow finds something comp= > letely wrong to be the main interface of the system, instead of something l= > ike "bce0" which ifconfig returns as the main network interface. > > Running cf-agent in debug mode shows that cfengine correctly identifies the= > network interfaces of the system when discovering the system classes. So, = > my question is, what does "sys.interface" actually do, and is there a sys.x= > variable that will give me the first, second ... Nth network interface on = > my freebsd system? > > > Thanks in advance, > Traiano Welcome > ________________________________ > NOTE: This e-mail message and all attachments thereto contain confidential = > information intended for a specific addressee and purpose. If you are not t= > he addressee (a) you may not disclose, copy, distribute or take any action = > based on the contents hereof; (b) kindly inform the sender immediately and = > destroy all copies hereof. Any copying, publication or disclosure of this m= > essage, or part hereof, in any form whatsoever, without the sender's expres= > s written consent, is prohibited. No opinion expressed or implied by the se= > nder necessarily constitutes the opinion of MTN. This message does not cons= > titute a guarantee or proof of the facts mentioned herein. No Employee or i= > ntermediary is authorised to conclude a binding agreement on behalf of MTN = > Group Limited, or any of its subsidiary companies, by e-mail without the ex= > press written confirmation by a duly authorised representative of MTN Group= > Limited. > > --_000_C7D103656DC3traianowelcomemtnbusinesscoza_ > Content-Type: text/html; charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > <html> > <head> > <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-= > 1"> > <title>Cfengine3: Interface Naming when Building Firewall Rulesets from Tem= > plates</title> > </head> > <body> > <font face=3D"Calibri, Verdana, Helvetica, Arial"><span style=3D"font-size:= > 11pt">Hi All<br> > <br> > I’m currently building PF (packet filter) rules file on freebsd  = > ;using the example provided by “unit_copy_edit.cf”. To identify= > the main network interface of the system, I’m trying to use the R= > 20;sys.interface” variable in order to replace a keyword in a pf.conf > file (in this case “INTERFACE0”). Cfengine successfully writes= > out the config file but somehow finds something completely wrong to be the= > main interface of the system, instead of something like “bce0”= > which ifconfig returns as the main network interface.<br> > <br> > Running cf-agent in debug mode shows that cfengine correctly identifies the= > network interfaces of the system when discovering the system classes. So, = > my question is, what does “sys.interface” actually do, and is t= > here a sys.x variable that will give me the > first, second ... Nth network interface on my freebsd system?<br> > <br> > <br> > Thanks in advance,<br> > Traiano Welcome</span></font> <br> > <hr> > <font face=3D"Arial" color=3D"Gray" size=3D"1">NOTE: This e-mail message an= > d all attachments thereto contain confidential information intended for a s= > pecific addressee and purpose. If you are not the addressee (a) you may not= > disclose, copy, distribute or take any > action based on the contents hereof; (b) kindly inform the sender immediat= > ely and destroy all copies hereof. Any copying, publication or disclosure o= > f this message, or part hereof, in any form whatsoever, without the sender'= > s express written consent, is prohibited. > No opinion expressed or implied by the sender necessarily constitutes the = > opinion of MTN. This message does not constitute a guarantee or proof of th= > e facts mentioned herein. No Employee or intermediary is authorised to conc= > lude a binding agreement on behalf > of MTN Group Limited, or any of its subsidiary companies, by e-mail withou= > t the express written confirmation by a duly authorised representative of M= > TN Group Limited.<br> > </font> > </body> > </html> > > --_000_C7D103656DC3traianowelcomemtnbusinesscoza_-- > > --===============1368680543== > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@cfengine.org > https://cfengine.org/mailman/listinfo/help-cfengine > > --===============1368680543==-- _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine