Wed, 03 Dec 2014

Installing a StartSSL certificate with haproxy

haproxy since version 1.5 supports native SSL. It uses a combined PEM file for encrypting connections.

StartSSL is a popular provider of free SSL certificates (which I happen to use), but only provides separate ssl.crt and ssl.key files.

To install these with haproxy they need to be combined into a single PEM file. It is helpful to also present the intermediary certificates, which can be downloaded on the StartSSL website as well. Otherwise clients might not recognize the certificate as valid because they cannot verify the certificate chain.

To combine them into one, cat works just fine:

cat ssl.crt sub.class2.server.ca.pem ca.pem ssl.key > ssl.pem

Install it in haproxy by adding a bind option to the frontend block, e.g.

bind :443 ssl crt /etc/haproxy/ssl.pem bind :::443 ssl crt /etc/haproxy/ssl.pem

This is what I'm running on l4x.org.

posted at 01:00 | path: /unix | permanent link to this entry

Tue, 03 Jun 2014

Running Pyblosxom with gevent.wsgi

The gevent wsgi server is very easy to use from Python. I wrote a convenient wrapper which starts pyblosxom under gevent. This can be used to either serve your blog locally for testing or to serve the live system. The nice thing is that it doesn't require an extra apache or nginx server just to start serving it.

Full source code is located here.

The important piece:

from gevent import monkey; monkey.patch_all()
from gevent.pool import Pool
from gevent.pywsgi import WSGIServer
from Pyblosxom import pyblosxom

def start(host='127.0.0.1', port=8007, threads=8):
  pool = Pool(threads)
  application = pyblosxom.PyBlosxomWSGIApp()
  server = WSGIServer((host, port), application, spawn=pool)
  server.serve_forever()

posted at 23:00 | path: /python | permanent link to this entry

Sun, 16 Mar 2014

Attaching a new disk to a running VM

Just for my own memory (attaching 400G to vm named git0):

pool-define-as hdd --type dir --target /mnt/libvirt
pool-start hdd
pool-autostart hdd
vol-create-as hdd gitdisk 400G
attach-disk git0 /mnt/libvirt/gitdisk vdb --persistent --driver qemu --subdriver qcow2

The driver and subdriver options are essential. Otherwise the disk is attached as raw disk and the guest will only see several kilobytes (kb) of disk not the full 400G.

posted at 23:00 | path: /vm | permanent link to this entry