Choosing Your Linux Distribution

For enterprise servers, the choices are (basically) easy: Red Hat Enterprise Linux, SUSE Linux Enterprise, or Ubuntu Server – all very good environments with good support from their companies and supported by various hardware manufacturers. What about your desktop?

The choice is usually easy: most of us choose one of the common distributions – like Fedora, OpenSUSE, Ubuntu, Debian, or Linux Mint. What if you want to stretch a little – try something more avant-garde?

You must define your boundaries – what do you want to have or to accomplish? Here are some possibilities:

  • Do you want to build the software from source?
  • Do you want extensive packages already built?
  • Do you want to start from a minimal system and build up?
  • Do you want run on old or minimal hardware?
  • Do you want stable releases or a rolling release?
  • Do you want a full-featured desktop?
  • Do you want to run Linux?
  • Do you want to run Flash, MP3, DVDs, etc.?
  • Do you want to configure everything yourself?
  • Do you want to build everything yourself?
  • Do you want a special purpose distribution (e.g., penetration testing, multimedia, scientific, etc.)?

I find myself in the situation of trying to fix some hardware which requires installation of a new system – thus, I thought I would try something new. My criteria are:

  • Support for lots of packages
  • Everything mostly works on install
  • Window manager other than GNOME or KDE
  • Good security
  • Good support for Java, DVD, MP3, and Flash
  • Not mainstream
  • Actively supported and with active community

So far, the choices seem to be:

Almost all of these are based on Debian unstable or testing; Sabayon is based on Gentoo, and LFS is based on nothing at all…

I’ve always wanted to try a Linux that had the equivalent of FreeBSD’s ports tree…

A First Attempt with Arch Linux

Having heard great things about Arch Linux, I thought I would give it a try. I’ve enjoyed trying different Linux versions over the years, and have found some good environments.

Unfortunately, Arch Linux is not one of them – at least judging according to my initial installation.

The initial install gives you a text-based environment – no GUI here. This can be almost forgivable – but the installation had some hiccups. If you decide to install Arch Linux, don’t select anything other than the core resource: adding extras will only cause things to break. Stick with your CDROM installation media and forget the rest.

Then, after installation, there are a number of tasks to do. As long as you stick with the Beginner’s Guide, all should work just fine. The problems begin when you get into the extras. Most of these problems have solutions; however, one should not come across one problem after another.

Here are the problems I’ve experienced in just a few hours time after initial installation:

  • xdm spawning too many times; pausing for 5 minutes – this because xdm wasn’t installed but /etc/inittab was trying to start it.
  • package conflict with /etc/mtab
  • package conflict with /etc/profile.d/locale.sh
  • configuration of Window Maker overwrites ~/.xinitrc
  • configuring PAM to use ecryptfs didn’t work
  • encrypting home directory appears to have encrypted ~/Private and not ~
  • ecryptfs documentation is obsolete
  • running XDM loops back to login screen after successful login
  • running GDM fails
  • sudo wasn’t part of the main install
  • a new user wasn’t part of the main install
  • the documentation for adding a new user puts the user in the wheel group if you do it manually – but not if you do it with useradd
  • during installation, old install messages are not removed
  • perl is not part of the base install
  • X installs with a network listener active

The two biggest problems are the following:

  1. Bugs are just documented, not fixed.
  2. Nothing is configured!

When a package is installed, it should be ready to go – it should “just work.” Nothing “just works” on Arch. It is one thing to let us choose which packages we want and how we want; however, there should not be a day’s worth (or more!) of work to get things working. Every package seemed to have bugs and things that didn’t work right – and needed special instructions to configure it.

To do anything with Arch, it requires a huge effort to install a large number of packages – and to hand-configure most. It is a minimalist distribution that is built up to be what someone wants. However, I thought their choice of simplicity quotes was ironic:

Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away.

I say ironic because there is nothing that can be taken away from Arch Linux; packages must be added.

This is a big disappointment; I had such high hopes for Arch Linux. I thought it would be an simpler version of Gentoo or Slackware; not so.

    Using Browsers with OpenLDAP cn=config Tree

    The new OpenLDAP configuration is an LDAP tree like any other, and can be browsed as such. Using a graphical browser like Apache Directory Studio can simplify configuration (somewhat).

    When setting up a new LDAP connection, specify the user as the admin user for the configuration tree – like so:

    cn=admin,cn=config

    Also specify the tree root as:

    cn=config

    With the appropriate settings, you should then get a list of the configuration tree, where you can view and edit entries. It would behoove you to be very careful about changing things in this tree: if you change the wrong thing, your LDAP server could stop functioning properly.

    OpenLDAP with SSL in Ubuntu Lucid Lynx

    In researching configuration tasks for OpenLDAP, I found this article about using sudo with OpenLDAP. As I am going to implement SSL with OpenLDAP, problems with sudo and SSL could be fatal, so I decided to investigate further.

    It turns out that the problem is embedded in GnuTLS, a GPL-licensed OpenSSL replacement. GnuTLS was used by Debian because of a licensing conflict between OpenSSL and OpenLDAP. A backend library used by GnuTLS (libgcrypt11) causes problems based on the way it is initialized and the way it handles the dropping of privilege (that is, it gets rid of its “root” access). This shows up as suid applications failing when run against LDAP users; Ubuntu bugs 926350 (GnuTLS) and 423252 (sudo) are this exact problem.

    GnuTLS is replacing libgcrypt11 with the nettle backend as of 2.11.x, but Ubuntu Lucid Lynx continues to use GnuTLS with the original (flawed) backend. The “fix” espoused by some is to use nscd – but this is acknowledged to be a workaround.

    There is a GnuTLS version compiled not against libgcrypt11 but libnettle which should the problem. I did not test this PPA; if you wish to stick with OpenLDAP and GnuTLS this might be the way to go.

    However, there is also a version of OpenLDAP compiled against OpenSSL. Add the PPA to your APT configuration and then perform a system update (apt-get update && apt-get upgrade). This will upgrade your OpenLDAP and cause it to stop at least temporarily; thus, make sure you allow for some server downtime.

    This version of OpenLDAP works except for a few initial problems that must be overcome. When you first install, it may refuse to run.

    First, it seems to add an openldap user and group – and while this is good, it does not completely change appropriate files to give access to the openldap user. There are two locations that need to be fixed:

    • /var/lib/ldap (the location of the LDAP data store)
    • /etc/ssl (the location of the SSL certificates)

    Fixing the first is simple:

    chown -R openldap:openldap /var/lib/ldap

    The second is not as straight-forward; in my case, I added the user openldap to the group ssl-cert which has access into the /etc/ssl directory and subdirectories. Use the vigr command to make this happen: add openldap to the end of the ssl-cert group line (your group id might be different):

    ssl-cert:x:108:openldap

    Note that if the SSL certificates aren’t set up right, then running the new OpenLDAP will not work – even if LDAPS is not enabled at startup. (There is a fantastic message showing how to make sure your certificates match from OpenVPN.net.) You also need to make sure that the certificates are not expired; it is reported that OpenLDAP will also fail to start with expired certificates.

    As the final step, change the /etc/default/slapd file to start LDAPS:

    SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///"

    Eventually, the best thing to do is to remove LDAP support entirely (and use LDAPS completely):

    SLAPD_SERVICES="ldapi:/// ldaps:///"

    Tips and Tidbits About LDAP

    Setting up and understanding LDAP is not easy. In my opinion, nothing is obfuscated more and unnecessarily so than LDAP. There are a number of tips that can help you to understand LDAP.

    LDAP is not authentication. This was the number one problem I had when I started (a while back). The first time user might search for documents on setting up LDAP when in fact they are looking for documents on how to set up UNIX and Linux authentication using LDAP. An LDAP server at its most basic doesn’t understand UNIX uids, doesn’t understand GECOS fields, doesn’t understand UNIX gids, and doesn’t understand Linux shadow files. Support for all of this must be added.

    Support for UNIX authentication must be added. You would think that the most common usage for LDAP would come bundled and ready to go with the server; however, often this is not the case. Even if it is the case, you may find that for certain capabilities you are expected to add new LDIF files to support the fields in LDAP.

    LDAP is not just another database server. Virtually everything in LDAP has a different name; it is unlike anything you’ve done before. Take heart: X.500 (where LDAP comes from) was worse. You’ll have to slog through a pile of new terms, but after a while it will become easier to understand.

    OpenLDAP is not synonymous with LDAP. There are other servers out there. OpenLDAP does come with virtually every Linux platform; there are however, many others – many of which may be easier to use. There is the 389 Directory Server from Red Hat, the ApacheDS (part of the Apache Directory Project) from Apache, and OpenDJ from ForgeRock. OpenDJ itself is a spin-off from OpenDS, originally from Sun.

    OpenLDAP is known for making non-backwards-compatible changes. The most recent example is the complete replacement of the configuration system.

    OpenLDAP no longer uses slapd.conf. This will cause you no end of problems: there are a lot of people trying to explain how to set up OpenLDAP, and with a single strike (as of version 2.3) OpenLDAP made all of that documentation obsolete and useless. This is incomprehensible, but it is a fact.

    Using and administering LDAP requires command line expertise. This is basically true, but like many things, it is not the complete truth. There are many programs designed to make it easy to browse LDAP stores, along with editing capabilities. Some of the more interesting products include Jxplorer, Luma, and the Apache Directory Studio. Of these, the Apache Directory Studio is the most capable, robust, and actively developed – and by far the largest.

    Some LDAP entries can be present more than once or have more than one value. If you are comparing LDAP to a database, then this will come as a surprise. One valuable example is UNIX groups: the original UNIX systems only had one group per user; later, secondary groups were added – thus presenting a single user with multiple groups. This is handled in LDAP in a variety of ways, but they all amount to having multiple entries with different values.

    Limiting user logins by host is not available in LDAP. This capability is most likely to be done by using the client host. There are a number of ways to do it, but all require LDAP client configuration, and all are limited in their application. Without client configuration, all LDAP users will have authenticated access to the host.

    Be prepared to do a lot of web searches for documentation and solutions. The best places to go for searches are: Google (of course) and Ubuntu Documentation.

    There are also very good articles and documents on using LDAP for authentication. There is an article about OpenLDAP authentication on FreeBSD (FreeBSD articles tend to be very well-written). Similarly, Ubuntu documentation is well-written as well; each of the Ubuntu versions has a section in the documentation on using and configuring OpenLDAP for authentication. Ubuntu 11.04 documentation has a good article on OpenLDAP for example.

    Ubuntu documentation also includes a lot of well-written (and current) articles. For example, there are articles on OpenLDAP Server (a general article), LDAP Client Authentication, Samba and LDAP (from the 10.04 Server documentation), and Securing OpenLDAP Conenctions. If you plan to use 389 Server instead, there are even a couple of articles on using it with Ubuntu: Fedora Directory Server (the original name of 389 Server) and Fedora Directory Server Client Howto.

    A nice overview of LDAP comes from Brian Jones at O’Reilly: specifically, his 2006 articles on Demystifying LDAP and Demystifying LDAP Data. Linux Journal also has myriad different articles on LDAP (not to mention an OpenLDAP theme for the December 2002 issue). Linux Journal also has an article from 2007 on Fedora Directory Server (now 389 Server).

    Lastly, an excellent resource is the “book” LDAP for Rocket Scientists from Zytrax.com. You simply must go and read portions of this book. One very apt quote from the introduction to the book which sums up the state of LDAP documentation generally:

    The bad news is that [in our humble opinion] never has so much been written so incomprehensibly about a single topic with the possible exceptions of BIND and … and …

    (It should be noted that the other book at Zytrax is about DNS. Is it any surprise?)

    UPDATE:

    Yet another trick to LDAP:

    The cn= attribute is not solely a leaf attribute. This can be seen in OpenLDAP’s cn=config tree with OpenLDAP configuration. For example, a typical admin user can be designated like so:

    cn=admin,dc=bigcorp,dc=com

    However, when you use OpenLDAP’s configuration, the designation for the admin user is this:

    cn=admin,cn=config

    When you look into the configuration tree, there are more cn= entries – like this:

    cn={4}misc,cn=schema,cn=config

    Follow

    Get every new post delivered to your Inbox.

    Join 39 other followers