Category Archives: Network Servers

Serving Python scripts with Apache mod_wsgi, part I

5.00 avg. rating (97% score) - 5 votes

I admit it, I’m a long-time PHP programmer. I got stuck with it for a long time with all my web-based stuff, simply because it is so easy to set up. Well, there is no set-up, it just works. You just add pages to your web server root and give a .php extension to them, and they get requests and give back responses. Nice and simple.

I still use PHP for quick and dirty things (like running shell commands through web interfaces – yes, really, really naughty…) For doing more complex work, I prefer Python. But I miss the PHP-like way of just adding pages or “web applications” with zero-setup. I will examine the possibilities in Python for this kind of behaviour in this article.

Please remember, there are many, some say even too many, Python web frameworks available already that handle all this stuff for you “automagically”. You are almost certainly better off with using one of them, if you want to get work done. But they all require some kind of setup work.

Then there’s the thing with all kinds of frameworks, that instead of you calling some library, the behaviour of which you understand, to do your work, a framework calls your code. That is all right when things work as expected. But whenever there are glitches, you need to start digging around the framework code to see exactly what’s wrong. And if it is a big framework, that could mean a lot of digging around. For that reason, if you’re a reasonably seasoned programmer, I think it might not be half bad an idea to create your own minimalistic framework, using existing, good quality libraries the behaviour of which you understand, and which you can easily poke in the Python shell if you think something’s not working like it should. Or just to see what’s available, and try out the available code.

Also, knowing how stuff works never hurts. This article is also about learning how the Apache http requests are dispatched to Python code through mod_wsgi. I insist on knowing how things work, so I’m doing it the hard way. Continue reading Serving Python scripts with Apache mod_wsgi, part I

OpenSSH public key authentication

0.00 avg. rating (0% score) - 0 votes

First, create a key-pair with ssh-keygen. This is a one-time operation.

It is good practice to enter a good password, but you may also leave the password empty. That will leave your private key vulnerable to local attacks, but if you need to login somewhere from a cron job, you probably need to do that.

Continue reading OpenSSH public key authentication

SSH tunneling your way through multiple gateways

0.00 avg. rating (0% score) - 0 votes

Ths SSH protocol supports tunneling arbitrary ports from your local host to a remote network that is only reachable through a remote gateway machine. The typical situation is that you have a, say, web server in a network which is only accessible from inside the network. If you have an ssh gateway machine within the network, you can get to the web server using tunneling. Continue reading SSH tunneling your way through multiple gateways

Sendmail relay configuration on AIX

4.00 avg. rating (80% score) - 2 votes

This document describes how to set up a Sendmail e-mail gateway or relay which will be able to process incoming mail and route it to different mail servers based on domain information. The routing table is based on the Sendmail mailertable feature instead of the usual MX record based routing. This will come handy when there is a need to route mail internally in a different way than externally.

Continue reading Sendmail relay configuration on AIX

Windows Server Time with NTP

0.00 avg. rating (0% score) - 0 votes

Here’s how to configure a Windows domain controller to act as an NTP client and server for your network. You may then sync all your hosts, Windows or other, to that server. To achieve this, configure one (or more) of your domain controllers to retrieve time from the atomic clocks of the Internet. Rest of you servers should follow suit and sync their time to this domain controller after a little while.

Continue reading Windows Server Time with NTP

Getting a Certificate for your Web Server

0.00 avg. rating (0% score) - 0 votes

To communicate securely using SSL (also known as TLS or Transport Layer Security), web servers need a key pair of public and private keys. This key pair can be generated and signed by yourself, but to prevent the web browser from asking “stupid” questions about the validity of a certificate, you must pay a company, called a Certificate authority, such as Verisign, Geotrust, or Thawte, for the added simplicity. That company will then verify that you are who you are (in theory, at least) and then sign your public key with their certificate. Their certificate is already bundled with most browsers and thus trusted by default, which also makes your newly signed certificate trusted as well.

Continue reading Getting a Certificate for your Web Server