Skip to main content

Posts

Showing posts with the label linux

Building git 2.6 and enabling TLS 1.2 on CentOS 7

There are scenarios where TLS 1.2 is not just enabled, but the only one accepted. In these cases many clients fail to connect over HTTPS. I needed to be able to use 'git clone https://...' on CentOS 7, and since it was failing and I spent some time on a work around, I'm sharing it here. The system is a CentOS 7 host on DigitalOcean, with kernel Linux 3.10.0-123.8.1.el7.x86_64 git is 1.8.3 , the stock version nss is 3.19.1-5.el7_1 If I do something like curl  --tlsv1.2  https://freeswitch.org the connection is successful, but a command like GIT_CURL_VERBOSE=1 git clone  https://freeswitch.org/stash/ scm/fs/freeswitch.git was giving a connection error with this code: NSS error -12190 (SSL_ERROR_PROTOCOL_VERSION_ ALERT) (freeswitch.org only accepts TLSv1.2). Long story short, I read somewhere that git 2.6 had support for configuring TLSv1.2, and I downloaded the source code of git 2.6.0 from  https://www.kernel.org/ pub/software/...

Favourite alias of the week: 'dico'

diff provides one interesting option, ' -y ':        -y, --side-by-side               output in two columns If you combine it with ' --suppress-common-lines ':        --suppress-common-lines               do not output common lines you get a very nice to view diff in two columns, where only the different lines are displayed. My alias is: alias dico='diff -y --suppress-common-lines'

Basic Docker commands

Just a list of docker commands that I've found quite useful so far. List the containers available locally: docker ps -a Just the container IDs: docker ps -a -q Filter the running containers: docker ps -a -q | grep Up or simply: docker ps -q  Build an image: docker build -t <user>/<image name> . Run a container from an image, and execute bash shell: docker run -i -t <user>/<image name> /bin/bash Run a container from an image, in background, linking ports: docker run -d -p <host port>:<container port> <user>/<image name> (You can use -p multiple times, e.g. when the container exposes more than one port) Show logs of running container: docker logs <container id> Stop/start/restart container: docker stop/start/restart <container id> UPDATE - Stop running container with a single command: docker ps -a|grep Up|awk '{ print $1 }'|xargs docker stop  UPDATE - The reason why I'm ...

Docker on Ubuntu: when apt-get update fails

I've been spending some time with Docker , and since digitalocean provides Ubuntu images with Docker already configured, setting up a new droplet and a few containers with my apps has become a matter of minutes. One of the fist commands you want to run in your Dockerfile is certainly 'apt-get update'. I'm writing this with the hope to save the reader some precious time: if 'apt-get update' fails, you may want to ensure that docker's DNS configuration is complete (and servers are accessible). In my case this meant simply adding the Google DNS servers in /etc/default/docker : DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4" and restart docker with sudo service docker restart This StackOverflow question is related.

Configuration files: an important assumption debian takes

It took me more than expected (and in fact someone found it for me) to explain why a file installed by a debian package and not listed inside debian/conffiles was handled as a standard configuration file. The file is installed in a subdirectory of /etc/, so intuitively you may assume it must be considered as a configuration file, although this wasn't clearly stated in a document until I read this from Debian New Maintainer's Guide , chapter 5: Since debhelper V3, dh_installdeb(1) will automatically flag any files under the /etc directory as conffiles, so if your program only has conffiles there you do not need to specify them in this file. For most package types, the only place there is (and should be conffiles) is under /etc and so this file doesn't need to exist. The conclusion is that if you install a file in a subfolder of /etc/, you don't need to list it inside debian/conffiles.

curl for HTTPS (and Twitter)

curl is a powerful library available on different platforms - I use it on Linux debian . You can use it just to get http pages, or to post data and get a response from a server. HTTPS is available too. An example: curl -k --data @request.xml https://127.0.0.1/service posts the XML data contained by request.xml using a HTTPS connection (and ignoring invalid certificates, option ' -k ' - just for testing purposes). This is a more interesting usage: it's nice to get info from Twitter or even send messages ("update your status") with just a command line: Get status: curl http://twitter.com/users/show.xml?screen_name=giavac Send a message: curl -u user:password -d "status=describing how to use the Twitter API" http://twitter.com/statuses/update.xml To install curl on debian: apt-get install libcurl3 (install dependencies too, and I suggest to include libcurl3-gnutls-dev)