вторник, 9 октября 2012 г.

Put a specific validation.pem into chef-server

I want to put specific validation.pem into fresh chef-server installation. This will be useful if you have some predefined nodes, or kickstart files with specific validation.pem inside and want to boot fresh chef-server installation.

1. Generate public key from my-validation.pem

# openssl rsa -in my-validation.pem -pubout > key.pub

2. Goes to http://127.0.0.1:5984/_utils/database.html?chef/_design/clients/_view/all

Click on chef-validator, then double click on public_key value. And paste contents of key.pub. Do not forget to push "Save Document" in the top left corner.

3. Replace /etc/chef/validation.pem with your my-validation.pem

mv /etc/chef/validation.pem /etc/chef/validation-old.pem
mv my-validation.pem /etc/chef/validation.pem

Now you be able to register new nodes with your validation.pem

понедельник, 6 февраля 2012 г.

OpenVswitch GRE tunnel

For, example i have few virtual machines on my home server and several on my work server. I want that they lived in one distributed ethernet network.

OpenVswitch has implementation for GRE tunnels. In our case we will encapsulate all our ethernet traffic over IP.

My servers on Ubuntu 11.10.

Home server IP: 1.1.1.1
Work server IP: 2.2.2.2

On both servers install OVS (OpenVswitch). First install and automatically compile ovs module, then install main packages.

aptitude install openvswitch-datapath-dkms
aptitude install openvswitch openvswitch-brcompat
Then add brcompat_mod (replace for standart bridge utils) module.
modprobe brcompat_mod

ovs-brcompatd --pidfile --detach
Add ovs bridge and gre interface
ovs-vsctl add-br brs0
On work server:
ovs-vsctl add-port brs0 gre0 -- set interface gre0 type=gre options:remote_ip=1.1.1.1
On home server
ovs-vsctl add-port brs0 gre0 -- set interface gre0 type=gre options:remote_ip=2.2.2.2
Then you need to add tap interface of your VMs into the bridges
ovs-vsctl add-port brs0 vnet0
You don't need to add your uplink interface(eth0) to bridge. Now all VMs will live in single network. Note that GRE doesn't encrypt your traffic.