Transparent Proxy (using Squid)

May 1st, 2009

One thing that you’ll find isn’t documented in many places out there is the key to actually getting a transparent proxy going on Squid.  It’s a single line of configuration but it took me ages to track it down.  I reproduce below the configuration required:

http_port your-proxy-port-number transparent
httpd_accel_host virtual
httpd_accel_port 8080
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

The line in blue is the crucial one and the “transparent” directive is something that the how-tos out there don’t actually seem to ever mention.  Without “transparent”, I found that HTTP requests were getting mangled by Squid before being handled by the HTTPD Accelerator.

Issues

April 22nd, 2009

This blog was not really working properly from its inception. I suspect that this is because it was initially installed while I was drunk. Rather than using the world-resolvable hostname in the WordPress URL, I used the hostname from the local (internal) DNS. This borked things rather spectacularly but it seems to work now.

Eye-Q

April 17th, 2009

Back in the mid ’90s, I was under the spell of a record label run by Sven Vath, Eye Q.  I recently rediscovered its catalogue via means that are not, strictly speaking, legal.  The noise that the label made was, objectively speaking, crap.  But it was fun crap.  A few days ago, I got really, really drunk and messed around with my sequencing software to create a generic Eye Q track complete with every Trance cliché from ‘95 that you can imagine.

Here it is.

UltraBeatoff

April 17th, 2009

Here’s a brief overview of how to separate the outputs in Logic’s Ultrabeat plugin.  It includes some basics about using the Ultrabeat sequencer and various Ultrabeat edit modes.  Nothing special, just a way of doing the basics.

Right click (or Control-click if you have a superior computer) on the link and choose the appropriate “save” menu item to save as a QuickTime movie so that you can resize it and stuff and junk. 

Fun and Games With Fedora Directory Services on CentOS 5.x

April 17th, 2009

As part of my work, I was trying to install FDS on CentOS 5.1 and managed to get quite a long way using various web pages but they didn’t quite cover all of the quirks and foibles of the FDS installer or of CentOS itself.  Here’s a step-by-step guide showing what I did…

  • Download jss, the Java Security Services package.
  • Copy jss onto your would-be directory server (into /var/tmp, for example).
  • Install jss:

# cd /var/tmp

# rpm -ivh ./jss-4.2.5-1.fc6.x86_64.rpm

  • Install the following packages (if required):

# yum install svrcore mozldap perl-Mozilla-LDAP libicu

(libicu should already be installed)

  • Create the following YUM repository definitions in /etc/yum.repos.d:

idmcommon.repo:

[idmcommon]

 

name=Fedora IDM Common - $releasever - $basearch

baseurl=http://directory.fedoraproject.org/yum/idmcommon/fedora/6/$basearch/RPMS

enabled=1

gpgcheck=0

 

[idmcommon-noarch]

name=Fedora IDM Common - $releasever - noarch

baseurl=http://directory.fedoraproject.org/yum/idmcommon/fedora/6/noarch/RPMS

enabled=1

gpgcheck=0

 

dirsrv.repo:

 

 

[dirsrv]

name=Fedora Directory Server - $releasever - $basearch

baseurl=http://directory.fedoraproject.org/yum/dirsrv/fedora/6/$basearch/RPMS

enabled=1

gpgcheck=0

 

[dirsrv-noarch]

name=Fedora Directory Server - $releasever - noarch

baseurl=http://directory.fedoraproject.org/yum/dirsrv/fedora/6/noarch/RPMS

enabled=1

gpgcheck=0

 

 

 

Be aware that the gpgcheck=0 line is at least slightly dangerous.  I have included it because some of the RPM GPG keys for the repositories in question seem to be no longer available at the locations advertised.

 

 

  • Install the base version of FDS
  •  

    # yum install fedora-ds-base

     

     

     

    • Edit /etc/security/limits.conf by adding the following line:

     

    * - nofile 4096

     

     

     

    • Add the following line to /etc/profile:

     

    ulimit -n 4096

     

     

     

    • Add the following line to /etc/sysctl.conf

     

    net.ipv4.tcp_keepalive_time = 0

     

     

     

    • Reboot the server.

     

     

     

     

    • Create an ldap user:

     

    # useradd ldap

     

     

     

    • Set a secure password for the ldap user:

     

    # passwd ldap

     

     

     

    • Change the ownership of the /var/log/dirsrv directory:

     

    # chown -R ldap:ldap /var/log/dirsrv

     

     

     

    • Configure the FDS server:

     

    # setup-ds-admin.pl

    (it’s in /usr/sbin)

     

     

     

    • Answer the following prompts…

     

     

    # setup-ds-admin.pl 

     

     

    ==============================================================================

    This program will set up the Fedora Directory and Administration Servers.

     

    It is recommended that you have “root” privilege to set up the software.

    Tips for using this program:

      - Press “Enter” to choose the default and go to the next screen

      - Type “Control-B” then “Enter” to go back to the previous screen

      - Type “Control-C” to cancel the setup program

     

    Would you like to continue with set up? [yes]:

     

    ==============================================================================

    BY SETTING UP AND USING THIS SOFTWARE YOU ARE CONSENTING TO BE BOUND BY

    AND ARE BECOMING A PARTY TO THE AGREEMENT FOUND IN THE

    LICENSE.TXT FILE. IF YOU DO NOT AGREE TO ALL OF THE TERMS

    OF THIS AGREEMENT, PLEASE DO NOT SET UP OR USE THIS SOFTWARE.

     

    Do you agree to the license terms? [no]: yes

     

    ==============================================================================

    Your system has been scanned for potential problems, missing patches,

    etc.  The following output is a report of the items found that need to

    be addressed before running this software in a production

    environment.

     

    Fedora Directory Server system tuning analysis version 10-AUGUST-2007.

     

    NOTICE : System is x86_64-unknown-linux2.6.18-53.el5 (1 processor).

     

    WARNING: 498MB of physical memory is available on the system. 1024MB is recommended for best performance on large production system.

     

     

    Would you like to continue? [no]: yes

     

    ==============================================================================

    Choose a setup type:

     

       1. Express

           Allows you to quickly set up the servers using the most

           common options and pre-defined defaults. Useful for quick

           evaluation of the products.

     

       2. Typical

           Allows you to specify common defaults and options.

     

       3. Custom

           Allows you to specify more advanced options. This is 

           recommended for experienced server administrators only.

     

    To accept the default shown in brackets, press the Enter key.

     

    Choose a setup type [2]:

     

    ==============================================================================

    Enter the fully qualified domain name of the computer

    on which you’re setting up server software. Using the form

    <hostname>.<domainname>

    Example: eros.example.com.

     

    To accept the default shown in brackets, press the Enter key.

     

    Computer name [holmes.ni.news.com.au]:

     

    ==============================================================================

    The servers must run as a specific user in a specific group.

    It is strongly recommended that this user should have no privileges

    on the computer (i.e. a non-root user).  The setup procedure

    will give this user/group some permissions in specific paths/files

    to perform server-specific operations.

     

    If you have not yet created a user and group for the servers,

    create this user and group using your native operating

    system utilities.

     

    System User [nobody]: ldap

    System Group [nobody]: ldap

     

    ==============================================================================

    Server information is stored in the configuration directory server.

    This information is used by the console and administration server to

    configure and manage your servers.  If you have already set up a

    configuration directory server, you should register any servers you

    set up or create with the configuration server.  To do so, the

    following information about the configuration server is required: the

    fully qualified host name of the form

    <hostname>.<domainname>(e.g. hostname.example.com), the port number

    (default 389), the suffix, the DN and password of a user having

    permission to write the configuration information, usually the

    configuration directory administrator, and if you are using security

    (TLS/SSL).  If you are using TLS/SSL, specify the TLS/SSL (LDAPS) port

    number (default 636) instead of the regular LDAP port number, and

    provide the CA certificate (in PEM/ASCII format).

     

    If you do not yet have a configuration directory server, enter ‘No’ to

    be prompted to set up one.

     

    Do you want to register this software with an existing

    configuration directory server? [no]:

     

    ==============================================================================

    Please enter the administrator ID for the configuration directory

    server.  This is the ID typically used to log in to the console.  You

    will also be prompted for the password.

     

    Configuration directory server

    administrator ID [admin]:

    Password: ********

    Password (confirm): ********

     

    ==============================================================================

    The information stored in the configuration directory server can be

    separated into different Administration Domains.  If you are managing

    multiple software releases at the same time, or managing information

    about multiple domains, you may use the Administration Domain to keep

    them separate.

     

    If you are not using administrative domains, press Enter to select the

    default.  Otherwise, enter some descriptive, unique name for the

    administration domain, such as the name of the organization

    responsible for managing the domain.

     

    Administration Domain [ni.news.com.au]: ops.ni.news.com.au

     

    ==============================================================================

    The standard directory server network port number is 389.  However, if

    you are not logged as the superuser, or port 389 is in use, the

    default value will be a random unused port number greater than 1024.

    If you want to use port 389, make sure that you are logged in as the

    superuser, that port 389 is not in use.

     

    Directory server network port [389]:

     

    ==============================================================================

    Each instance of a directory server requires a unique identifier.

    This identifier is used to name the various

    instance specific files and directories in the file system,

    as well as for other uses as a server instance identifier.

     

    Directory server identifier [holmes]:

     

    ==============================================================================

    The suffix is the root of your directory tree.  The suffix must be a valid DN.

    It is recommended that you use the dc=domaincomponent suffix convention.

    For example, if your domain is example.com,

    you should use dc=example,dc=com for your suffix.

    Setup will create this initial suffix for you,

    but you may have more than one suffix.

    Use the directory server utilities to create additional suffixes.

     

    Suffix [dc=ni, dc=news, dc=com, dc=au]:

     

    ==============================================================================

    Certain directory server operations require an administrative user.

    This user is referred to as the Directory Manager and typically has a

    bind Distinguished Name (DN) of cn=Directory Manager.

    You will also be prompted for the password for this user.  The password must

    be at least 8 characters long, and contain no spaces.

    Press Control-B then Enter to back up and start over.

     

    Directory Manager DN [cn=Directory Manager]:

    Password: ********

    Password (confirm): ********

     

    ==============================================================================

    The Administration Server is separate from any of your web or application

    servers since it listens to a different port and access to it is

    restricted.

     

    Pick a port number between 1024 and 65535 to run your Administration

    Server on. You should NOT use a port number which you plan to

    run a web or application server on, rather, select a number which you

    will remember and which will not be used for anything else.

     

    Administration port [9830]: 

     

    ==============================================================================

    The interactive phase is complete.  The script will now set up your

    servers.  Enter No or go Back if you want to change something.

     

    Are you ready to set up your servers? [yes]: 

    Creating directory server …

    Your new DS instance ‘watson’ was successfully created.

    Creating the configuration directory server …

    Beginning Admin Server creation …

    Creating Admin Server files and directories …

    Updating adm.conf …

    Updating admpw …

    Registering admin server with the configuration directory server …

    Updating adm.conf with information from configuration directory server …

    Updating the configuration for the httpd engine …

    Starting admin server …

    output: httpd.worker: Could not reliably determine the server’s fully qualified domain name, using watson.ni.news.com.au for ServerName

    The admin server was successfully started.

    Admin server was successfully created, configured, and started.

    Exiting …

    Log file is ‘/tmp/setupzDCG2P.log’

     

     

     

    • Set directory services to start at system startup time:

     

    # chkconfig dirsrv-admin on

    # chkconfig dirsrv on

     

     

     

    • Start directory services:

     

    # /etc/init.d/dirsrv-admin start

    # /etc/init.d/dirsrv start

     

     

     

     

     

     

     

     

     

     

     

     

    • Ensure that any host based firewalls allow 9830/TCP and 389/TCP from the client systems.

    Kickstart

    April 17th, 2009

    There’s a lot out there about Kickstart but not much that will show you how to get a working, basic Kickstart server going from end to end.  Here’s a potted summary of how I did it:

    • Build a standard Linux server.  Here is the build Kickstart file for my base installation… 

     

     

    # Kickstart file automatically generated by anaconda.

    install
    cdrom
    lang en_US.UTF-8
    keyboard us
    xconfig –startxonboot
    network –device eth0 –bootproto static –ip 192.168.0.1 –netmask 255.255.255.0 –gateway 192.168.0.254 –nameserver 192.168.0.253,192.168.2.253 –hostname kickstart.local
    rootpw –iscrypted <crypted password here>
    firewall –enabled –port=22:tcp
    authconfig –enableshadow –enablemd5
    selinux –enforcing
    timezone –utc Australia/Sydney
    bootloader –location=mbr –driveorder=sda –append=”rhgb quiet”
    # The following is the partition information you requested
    # Note that any partitions you deleted are not expressed
    # here so unless you clear all partitions first, this is
    # not guaranteed to work
    #clearpart –linux
    #part /boot –fstype ext3 –size=100
    #part pv.4 –size=100 –grow
    #volgroup vg0 –noformat –pesize=32768 pv.4
    #logvol /kickstart –fstype ext3 –name=kickstart –vgname=vg0 –size=57760
    #logvol /var –fstype ext3 –name=var –vgname=vg0 –size=8192
    #logvol / –fstype ext3 –name=root –vgname=vg0 –size=8192
    #logvol swap –fstype swap –name=swap –vgname=vg0 –size=2048

    %packages
    @ruby
    @system-tools

     

     

     

    • Ensure that you have the syslinux package installed.  This should be the case with the above install.
    • In /kickstart, make the following directories:
      • cfg (location of ks.cfg file and versions of same for different setups)
      • tftpboot (location of PXE boot binary and support files)
      • CentOS-5.1 (a copy of the contents of the CentOS install DVD)
    • Copy the PXE Linux binary from the syslinux package into /kickstart/tftpboot:

     

     

    # cp -p /usr/lib/syslinux/pxelinux.0 /kickstart/tftpboot

     

     

    • Mount a CentOS 5.1 install disk in /mnt (for example):

     

     

    # mount /dev/cdrom /mnt

    • Copy the install disk contents to /kickstart/CentOS-5.1:

    # cd /mnt ; tar cf - . | (cd /kickstart/CentOS-5.1 ; tar xfBp -)

    • Copy the initrd from the install disk into /kickstart/tftpboot:

    # cp -p /kickstart/CentOS-5.1/images/pxeboot/initrd.img /kickstart/tftpboot/initrd-centos5.img

    • Copy the kernel from the install disk into /kickstart/tftpboot: 

    cp -p /kickstart/CentOS-5.1/images/pxeboot/vmlinuz /kickstart/tftpboot/vmlinuz-centos5

    • Create the PXE boot configuration directory: 

    # mkdir -p /kickstart/tftpboot/pxelinux.cfg

    • Create the default boot configuration file, which is as follows:

    default linux
    serial 0
    label linux
      kernel vmlinuz-centos5
      append ksdevice=eth0 console=tty0 load_ramdisk=1 initrd=initrd-centos5.img network ks=nfs:192.168.0.1:/kickstart/cfg/ks.cfg text

     

    • Note that the address of your NFS server is the most important variable here.  The rest should work out of the box as long as you have used the file names that have been specified in this how-to.
    • Install tftp-server package:

     

    # yum install tftp-server

    • Edit /etc/xinetd.d/tftp so that it contains the following lines:

    disable             = no

         server_args = -s /kickstart/tftpboot

    • Enable xinetd:

    # chkconfig xinetd on

    • Start xinetd: 

    # /etc/init.d/xinetd start

    • Edit /etc/dhcpd.conf to look something like the following: 

    #
    # DHCP Server Configuration file.
    #

    not authoritative;

    # We must allow the BOOTP protocol _and_ booting for the server to work.
    allow bootp;
    allow booting;

    # Do not allow dynamic DNS updates
    ddns-update-style none;

    # A subnet definition.  This should be the subnet in which you are going to build servers…
    subnet 192.168.0.0 netmask 255.255.255.0 {
    option domain-name “localdomain”;
    option domain-name-servers 192.168.0.253, 192.168.1.253;
    option subnet-mask 255.255.255.0;
    option ip-forwarding false;
    option mask-supplier false;
             # This should be a range of free IP addresses and your booted servers will use these IPs.
    range 192.168.0.250 192.168.0.253;
    option routers 192.168.0.254;
    }

    # This should be the address of the TFTP server that your servers will boot from.
    next-server 192.168.0.1;
    # This is the pxelinux.0 file that we copied into /kickstart/pxelinux.0.
    # TFTP to the Kickstart server will see /kickstart/tftpboot as its root directory
    # (as configured in /etc/xinetd.d/tftp).
    filename “pxelinux.0″;

    • Configure the DHCP server to start at system startup time and turn it on: 

    # chkconfig dhcpd on
    # /etc/init.d/dhcpd start

    • Configure the RPC port mapper to start at system startup time and turn it on: 

    # chkconfig portmap on
    # /etc/init.d/portmap start

    • Configure the NFS lock daemon to start at system startup time and turn it on:

    # chkconfig nfslock on
    # /etc/init.d/nfslock start

    • Configure the NFS service to start at system startup time and turn it on: 

    # chkconfig nfs on
    # /etc/init.d/nfs start

    • Edit /etc/exports so that it reads as follows: 

    /kickstart *(ro)

    • Restart the NFS server:

    # /etc/init.d/nfs restart

    • Check your NFS exports:

    # exportfs

    • You should see a reply similar to:

    /kickstart <world>

    That’s it in a nutsack.  You should now be able to PXE boot machines on the network segment occupied by the Kickstart server.  Custom kickstart installs may be achieved by changing the contents of the /kickstart/cfg/ks.cfg.