Anyone?

Should I go for a module?

Thanks
-- M

On 29/06/12 22:29, Marco Marongiu wrote:
> Hi
> 
> I was writing a policy to do some fixups on my laptop when I'm on the
> VPN, but weird things were happening. After narrowing down the problem
> with a test policy, it seems that cfengine doesn't read the IPv4 address
> of the tun0 device. Maybe a bug?
> 
> If I list the ip addresses on the machine, I get:
>>
>> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
>>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>>     inet 127.0.0.1/8 scope host lo
>>     inet6 ::1/128 scope host 
>>        valid_lft forever preferred_lft forever
>> 2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN 
>> qlen 1000
>>     link/ether 00:27:13:65:69:4e brd ff:ff:ff:ff:ff:ff
>> 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 
>> 1000
>>     link/ether 00:26:c6:4c:35:b2 brd ff:ff:ff:ff:ff:ff
>>     inet 192.168.0.5/24 brd 192.168.0.255 scope global wlan0
>>     inet6 fe80::226:c6ff:fe4c:35b2/64 scope link 
>>        valid_lft forever preferred_lft forever
>> 7: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1400 qdisc pfifo_fast 
>> state UNKNOWN qlen 500
>>     link/[65534] 
>>     inet 10.20.18.160/32 scope global tun0
> 
> (used quoting to avoid line breaks)
> 
> 
> However, this policy:
> 
>> body common control
>> {
>>       inputs => {
>>                "cfengine_stdlib.cf",
>>              } ;
>>
>>       bundlesequence => {"test"} ;
>> }
>>
>> bundle agent test
>> {
>>   vars:
>>       "octets" slist => { "1", "2", "3" } ;
>>       "ifaces" slist => { @(sys.interfaces) } ;
>>       "ip[$(ifaces)]" string => "$(sys.ipv4[$(ifaces)])" ;
>>       
>>
>>   methods:
>>
>>   reports:
>>     inform_mode|verbose_mode::
>>       "Interface: $(ifaces) ($(ip[$(ifaces)]))" ;
>>       "Octets 1-$(octets): $(sys.ipv4_$(octets)[$(ifaces)])" ;
>> }
> 
> produces the following results:
> 
>> root@cooper:~# cf-agent -KI -f /var/cfengine/inputs/test-bundle.cf 
>> R: Interface: wlan0 (192.168.0.5)
>> R: Interface: tun0 ($(sys.ipv4[tun0]))
>> R: Octets 1-1: 192
>> R: Octets 1-1: $(sys.ipv4_1[tun0])
>> R: Octets 1-2: 192.168
>> R: Octets 1-2: $(sys.ipv4_2[tun0])
>> R: Octets 1-3: 192.168.0
>> R: Octets 1-3: $(sys.ipv4_3[tun0])
> 
> So, apparently, cfengine is able to tell that tun0 is up and configured
> and has an IP address, but is not able to tell the address. I understand
> from the reference guide that an interface doesn't show up in
> sys.interfaces if it's not up and configured with an IP address, so
> that's a bit weird that $(sys.ipv4[tun0]) and friends are undefined...
> 
> Ciao
> -- bronto
> 

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to