2016-06-09

Anarchy and diversity to survive complexity?

Anarchy is badly connoted. Makes us think about some kind of hippies.

But it is just another kind of organization. Of course there is a notion of disorder, but it is just that order and disorder are not where we are used to see them.

Wikipedia: "a state of disorder due to absence or non-recognition of authority or other controlling systems."

"Anarchy" came into my radar in the recent month from multiple ways:



I am not going to make a link to the "Nuit debout" in france, but you get the idea ...

Also it seems that organizations tend to be more and more complex, to the point where they collapse. See "The Collapse of Complex Societies" by Joseph Tainter. Same observation for companies "The Biology of Corporate Survival": corporations die because they lack the required disorder/agility to adapt to new situations. Being too "organized", too "under-control" is actually not a good thing perhaps?

2012-11-08

Bash Script debugging and SELinux


OpenVPN can launch a script client-connect each time a client connect to the VPN.
The script used to work when OpenVPN is launched directly, but not when launched via /etc/init.d/openvpn start ...

A good way to debug is to put this at the beginning of the file:
#!/bin/sh
"client-connect
exec > /tmp/debug.$$ 2>&1; set -x
...

Reading the /tmp/debug.pid will give a first hint: "Permission denied" when trying to launch "/bin/mail" in the script.

I put a ME=$(whoami) in the script but both (working and non-working) returned the same: nobody. So, it leaves only one suspect: SELinux. (I didn't though about SELinux because I didn't see it in the services. But it is there, in the Kernel.)

Quick info about SELinux:
  • sestatus to get information
  • setenforce Permissive will give only warning (it creates less problems than disabling it).
  • /usr/sbin/selinuxenabled && SEL="SELinux ON" to use in scripts.

To be really sure, I did the following:
# ls -Z /etc/init.d/openvpn gives: system_u:object_r:openvpn_initrc_exec_t:s0
# ls -Z myTest               gives: unconfined_u:object_r:openvpn_etc_t:s0

My test script runs "unconfined". If I copy the openvpn script into my folder while preserving the context cp -c ..., I change the content to be the same as my old working script and re-launch. It doesn't work anymore.
Conclusion: the file's context will confine openvpn so that the script it launches will fail to uses /bin/mail.


Solution 1 :
The "hard way" is to try to patch the policy to workaround your case:
$ grep client-connect /var/log/audit/audit.log | audit2allow -M openvpn_cc
This will create two files: a .pp to be run and a .te for your reading pleasure.
install the module: semodule -i openvpn_cc.pp

It goes a little further, but still fails and if you look at the policy in the .te file, it is quite complicated.
(I didn't repeat the process audit2allow ... to get further, but I guess that ultimately it would have worked.)


Solution 2:
Create a policy to send mail:

$ vi openvpn_cc.te
policy_module(openvpn_cc, 1.0)
 
require {
        type openvpn_t;
};
 
mta_send_mail(openvpn_t)

Compile: make -f /usr/share/selinux/devel/Makefile openvpn_cc.pp
Install: semodule -i openvpn_cc.pp

Simple and it works.


References:

2012-10-18

VirtualBox, CentOS, Network and Template

I have been working with VirtualBox and CentOS recently, here are some notes about this experience.

I used VirtualBox 4.2 and CentOS 6.3, but most of this should work with other products too. I created the first headless, minimal CentOS via NetInstall.
I cover two points: create a template machine and configure the Network.

Configure the Network

We want Internet access and a LAN local to the host.
For background information read: Networking in VirtualBox by Fat Bloke on June 2012.

The easiest is to enable two Network Adapters: One will be "Host-only" and the second "Nat". In the "Preference" menu you can see the DHCP server range for the Host-only Network. So you may set fixed addresses outside this range.
Next: start the guest. There may be various results at first, depending on a lot of things. Some problem might be solved by rm -f /etc/udev/rules.d/70-persistent-net.rules and a reboot.

Anyway, configure the two interfaces (set your own IP and MAC addresses) :

/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO=none
IPADDR="192.168.56.12"
HWADDR="08:00:27:30:60:68"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="d22a3e0a-5e0d-4185-9aaa-7295e3547224"

/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1"
BOOTPROTO="dhcp"
HWADDR="08:00:27:02:A8:46"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"

I am not sure about the UUID and HWADDR usefulness. Be careful to first check that your configuration is not inverse eth0 ~ eth1. An ifconfig -a should give an indication.

Configure /etc/hosts to add the fixed IP: 192.168.56.12 web-serv1.my-domain.

Restart the Network: /etc/init.d/network restart. Quick test: ping $(hostname). You should have Internet access try with elinks google.com or yum update. You should also be able to access from your host via SSH. On Windows you may add the host name and IP to C:\WINDOWS\system32\drivers\etc\hosts.

Prepare the machine to be a template from which other will be cloned

When cloning don't forget to set new Mac address.

This script may ease the process. You need to adapt them!
# See: http://www.cyberciti.biz/tips/vmware-linux-lost-eth0-after-cloning-image.html
rm -f /etc/udev/rules.d/70-persistent-net.rules

# Remove MAC Address
ifcfg="/etc/sysconfig/network-scripts/ifcfg-eth0"
content=$( grep -v HWADDR $ifcfg )
echo "$content"> $ifcfg

# Remove SSH keys (they will be recreated at startup)
rm -f /etc/ssh/*_host_*
After cloning, don't forget to change the hostname and fixed IP.
This script may ease the process. You may need to adapt them!
ifcfg="/etc/sysconfig/network-scripts/ifcfg-eth0"

content=$( grep -v HWADDR $ifcfg )
if [ -z "$content" ] ; then
    echo "Problem $ifcfg maybe empty !?" ;  exit 1
fi

mac=$( ifconfig eth0 | grep eth0 | awk '{print $5}' )
if [ -z "$mac" ] ; then
    echo "Problem eth0 maybe down !?" ;  exit 1
fi

echo "$content" > $ifcfg
echo "HWADDR=\"$mac\"" >> $ifcfg

Next step ...

I should have use some Puppet or Chef automation, but since I already tried without success some time ago, I was not so keen to reiterate the experience.

I also wonder if NFS mounts would allow to keep a system up-to-date. The idea would be to have a common "kernel" base re-used by all the VM via NFS. The VM would have only user space variations. But I am not so sure if it would be reliable or even considered "good practice".

2012-08-27

Linux images for Virtualization

Some notes about Linux images for Virtualization.

To test some network tools or configuration, it can be useful to use multiple virtual linux machine. They can run with as little as 256Mo RAM and even less, 64Mo have been reported to work.

There are mainly two solutions:  https://www.virtualbox.org/ (free and opensource) and VMWare Player (free but less open). Also, there are free cloud services available (Amazon EC2 is free for one year for tiny configurations).

They each have "virtual appliances" ready to use (http://virtualboxes.org/ ; VMWare-Store ...) but there are no useful way to select one interesting. I took one from http://www.thoughtpolice.co.uk/vmware/.

Here I use Ubuntu 12.04 / VMWare Player 5,  

  • Set the f## french keyboard. Run: sudo dpkg-reconfigure console-setup or sudo dpkg-reconfigure keyboard-configuration, depending on the Ubuntu version.
  • Set the f## proxy with authentication.
    • If Gnome is installed:
      • gsettings set org.gnome.system.proxy.socks host 'fckng.proxy.enterprise.com'
      • gsettings set org.gnome.system.proxy.socks port 8080
      • gsettings set org.gnome.system.proxy mode 'manual'
      • gsettings set org.gnome.system.proxy.http authentication-user 'silly'
      • gsettings set org.gnome.system.proxy.http authentication-password 'dumb'
    • Otherwise (See this forum)
      • Generally: vi /etc/environment and add http_proxy="...", https_proxy="...", no_proxy="..." ...
      • For APT: sudo gedit /etc/apt/apt.conf.d/02proxy and add the line:  Acquire::http::Proxy “http://username:password@yourproxy:yourport″;
      • For wget: use .wgetrc ...
  • Update Linux: sudo apt-get update ; sudo apt-get upgrade ; sudo apt-get install linux;
  • Install the VMWare tools:    
    • There are some dependencies: sudo apt-get install build-essential linux linux-headers-$(uname -r)
    • In the VMWare window, there is a "Virtual Machine" menu to install a CDRom with the right tool version. Mount the CDrom and launch the installation
    • Re-run  vmware-config-tools.pl each time the kernel is upgraded.
    • Ref:  https://help.ubuntu.com/community/VMware/Tools

That it.

2012-07-11

From XML Firewall to API Server

It is very interesting to see the development of Vordel products. More precisely how they are marketing their products.

The "XML Firewall" was like a "Layer 7 Firewall", focusing on the application level.

Then it evolved to XML Gateway, SOA Gateway and now: here is how they define their "API Server": http://www.soatothecloud.com/2012/06/vordel-introduces-api-server.html.

As a side note, I can't resist a little quote against SOAP: http://www.soatothecloud.com/2012/07/what-scales-better-internet-or-esb.html

2012-07-05

TLS: Disabling legacy cipher suites

First: "A cipher suite is a named combination of authentication, encryption, and message authentication code (MAC) algorithms".

If you are using TLS (for HTTPS typicaly) you may want to remove some Cipher Suites.

You maybe a little bit less compatible, but also a bit more secure. Things will be better when TLS1.2 is implemented everywhere.

You can also claim to be FIPS 140 compliant: http://csrc.nist.gov/publications/nistpubs/800-52/SP800-52.pdf !

How to do it:

If someone knows how to do it on the IBM J9 via configuration, I am interested.

2012-03-18

Sacré Trail des Collines

Sacré Trail des Collines http://www.trailcollines.com/
Tullins
35km - 1500m D+

Almost no road. Very nice organisation. Nice gift from RaidLight too: http://www.raidlight.com/. But worse weather condition ever encountered.

The rain came much sooner than expected, along with hail, snow and some wind. It is not that high, less than 800m. I though that it was not really "mountain", so I decided to go light with only two cotton tee-shirt :-)  I didn't know I could shake like this: almost impossible to drink a cup of tea.

Lastly, I cannot exactly know my "performance", due to some bug, but around 4h30 supposedly. The nice thing is that they offered me the fee for the next year.

Festival de la Cooperative OASIS - 2026

 https://Cooperative-OASIS.org/ Abonnement la revue Passerelle Eco    Papier . Mais les annonces sont dispo:  Revue trimestrielle de l’ Ecov...