Troubleshooting: Cannot open TUN/TAP dev /dev/net/tun

If you are getting error ‘Cannot open TUN/TAP dev /dev/net/tun‘ while starting OpenVPN server, it means that you should load ‘tun’ module which features TUN/TAP device driver: OpenVPN 2.1.1 i386-redhat-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] built on Jan 26 2010 NOTE: the current –script-security setting may allow this configuration to call user-defined scripts LZO compression initialized…

Python: uploading file via HTTP with pyCurl and Requests

Here is a simple way to upload file in Python. You should have PyCurl installed. import pycurl from cStringIO import StringIO filename=’test_file’ c = pycurl.Curl() c.setopt(c.POST, 1) c.setopt(c.HTTPPOST, [(‘title’, ‘test’), ((‘file’, (c.FORM_FILE, filename)))]) c.setopt(c.VERBOSE, 1) bodyOutput = StringIO() headersOutput = StringIO() c.setopt(c.WRITEFUNCTION, bodyOutput.write) c.setopt(c.URL, “http://upload.example.com” ) c.setopt(c.HEADERFUNCTION, headersOutput.write) c.perform() print bodyOutput.getvalue() Upd. File upload with…

RPM: Bulding Python package for Redis

To build RPM package for Python library is really easy task if developer has kindly included setup.py file in it. Let’s build RPM for redis-py package by Andy Mccurdy. First of all we need archive with last version of redis-py. [root@develop ~]# wget https://github.com/downloads/andymccurdy/redis-py/redis-2.4.9.tar.gz Unpack it. [root@develop ~]# tar xzvf redis-2.4.9.tar.gz [root@develop ~]# cd redis-2.4.9/…

DRBD split-brain solution in primary/primary setup

Recently one of our customers DRBD cluster has detected split-brain: node2 kernel: block drbd1: Split-Brain detected, dropping connection! node2 kernel: block drbd1: helper command: /sbin/drbdadm split-brain minor-1 node2 kernel: block drbd1: helper command: /sbin/drbdadm split-brain minor-1 exit code 0 (0x0) This is  primary/primary cluster. And to fix this issue we had to perform manual procedures…