Dspam WebFrontend Debian Etch
I looked around and didn't find any instructions on install the Dspam web frontend on Debian Etch. So here is how I got it working.
1) Install the debian package
aptitude install dspam-webfrontend
2) Create the Virtual Host file in /etc/apache2/sites-available. It should contain the following at least. I called it dspam.
ServerAdmin admin@yourhost.com
DocumentRoot "/var/www/dspam"
ServerName dspam.yourhost.com
SuexecUserGroup dspam dspam
Options ExecCGI
Options -Indexes
Addhandler cgi-script .cgi
DirectoryIndex dspam.cgi
3) Enable the site:
a2ensite dspam
4) Create an .htaccess file in the /var/www/dspam directory. I used digest mode.
AuthName 'Dspam' AuthType Digest AuthDigestProvider file AuthUserFile /var/www/dspam.password require valid-user
5) Create the password file for valid users with htdigest.
htdigest -c /var/www/dspam.password Dspam User1
htdigest /var/www/dspam.password Dspam User2
. . . .
6) Reload apache to make it all work
/etc/init.d/apache2 force-reload
7) Goto dspam.yoursite.com and log in.
Linux SSH key setup
Step 1 -- Generate the DSA key pair
ssh-keygen -t dsa
Step 2 -- Copy key to remote server
cd scp .ssh/id_dsa.pub user@server:/
Step 3 -- Logon to remove server and append key to authorized_keys
ssh server cat id_dsa.pub >> .ssh/authorized_keys
That's It
Install Apache2 with perl and php5 support
Install Apache2 with php and perl support
apt-get install apache2 apache2-doc
apt-get install libapache2-mod-php5 libapache2-mod-perl2 php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-imap php5-ldap php5-mhash php5-mysql php5-odbc php-pear curl libwww-perl imagemagick xml-core
Edit /etc/apache2/ports.conf and add Listen 443:
Listen 80 Listen 443
Now we have to enable some Apache modules (SSL, rewrite and suexec):
a2enmod ssl;a2enmod rewrite;a2enmod suexec
Restart Apache
/etc/init.d/apache2 restart
Basic Debian Server (Etch)
I have some new server hardware I am putting into service and since my last round of server building the version of Debian has changed and thus the process has changed.
In order to keep notes for myself, here is the new process. This will be the first of several posts updating how I set up my servers.
Go to Debian.org to get the netinstall image. Below are the details of using the Debian NetInstall disk to get a basic server up and running.
New Debian Server 4.0 Etch
Boot the Netinstall Disk choosing a mail server.
Now login to the server through ssh.
First update your system to the latest versions. But before doing that add the line for volatile sources to /etc/apt/sourses.list
nano /etc/apt/sources.list
deb http://volatile.debian.org/debian-volatile etch/volatile main contrib non-free
aptitude update;aptitude upgrade
Now Install some basic software, note you can cut and paste the following command lines. Command lines are in bold.
aptitude install wget bzip2 rdate fetchmail unzip zip ncftp libarchive-zip-perl zlib1g-dev libpopt-dev nmap openssl lynx fileutils binutils linux-kernel-headers build-essential
aptitude install fetchmailconf ca-certificates ntp-doc ntp ntpdate joe arj lha
Note I added the joe editor as its my favorite (love those wordstar bindings) but you can substitute your favorite.
Remove some software not needed on a internet server
aptitude remove lpr nfs-common portmap pidentd pcmcia-cs pppoe pppoeconf ppp pppconfig
Now edit .bashrc to set things up like I expect.
Change it from:
# ~/.bashrc: executed by bash(1) for non-login shells. export PS1='\h:\w\$ ' umask 022 # You may uncomment the following lines if you want `ls' to be colorized: # export LS_OPTIONS='--color=auto' # eval "`dircolors`" # alias ls='ls $LS_OPTIONS' # alias ll='ls $LS_OPTIONS -l' # alias l='ls $LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: # alias rm='rm -i' # alias cp='cp -i' # alias mv='mv -i'
to
# ~/.bashrc: executed by bash(1) for non-login shells. export PS1='\[\033[1;33m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;31m\]\w\[\033[1;36m\]\$ \[\033[0m\]' umask 022 # You may uncomment the following lines if you want `ls' to be colorized: export LS_OPTIONS='--color=auto' eval "`dircolors`" alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -l' alias l='ls $LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
Exit and relogin to see the changes
Since I use the Joe Editor and let it make backups, there can be a lot of backups around. To deal with them I have created a little batch file to remove them in any directory tree. So now we will create this little batch file
touch /usr/sbin/rmbak
Now edit that file and insert the following contents:
#!/bin/bash
echo "Deleting backup files . . ."
find . -name '*~' -print -exec rm {} \;
Make this file executable with chmod and it is ready to go.
Verify than /etc/network/interfaces and /etc/resolv.conf are correct, if not fix them.
Set the hostname
echo someserver.somehost.net > /etc/hostname
hostname -F /etc/hostname
Update some services
update-inetd --remove daytime;update-inetd --remove telnet;update-inetd --remove time;update-inetd --remove finger
update-inetd --remove talk;update-inetd --remove ntalk;update-inetd --remove ftp
Ok now we have a base system to work from.
Basic Debian Server
I have recently began the process of repurposing all my servers. I have been using Fedora but decided to go with Debian this time. This is the first of several posts documenting how I set up my servers (mainly for my benefit).
Go to Debian.org to get the netinstall image. Below are the details of using the Debian NetInstall disk to get a basic server up and running.
New Debian Server 3.1 Sarge
Boot the Netinstall Disk choosing a mail server and not configuring it.
Now login through ssh
Install some software, note you can cut and paste the following command lines. Command lines are in bold.
apt-get install wget bzip2 rdate fetchmail libdb3++-dev unzip zip ncftp xlispstat libarchive-zip-perl zlib1g-dev libpopt-dev nmap openssl lynx fileutils
apt-get install fetchmailconf ca-certificates ntp-doc ntp ntpdate joe
Note I added the joe editor as its my favorite (love those wordstar bindings) but you can substitute your favorite.
Remove some software
apt-get remove lpr nfs-common portmap pidentd pcmcia-cs pppoe pppoeconf ppp pppconfig
Now edit .bashrc to set things up like I expect.
Change it from:
# ~/.bashrc: executed by bash(1) for non-login shells. export PS1='\h:\w\$ ' umask 022 # You may uncomment the following lines if you want `ls' to be colorized: # export LS_OPTIONS='--color=auto' # eval "`dircolors`" # alias ls='ls $LS_OPTIONS' # alias ll='ls $LS_OPTIONS -l' # alias l='ls $LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: # alias rm='rm -i' # alias cp='cp -i' # alias mv='mv -i'
to
# ~/.bashrc: executed by bash(1) for non-login shells. export PS1='\[\033[1;33m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;31m\]\w\[\033[1;36m\]\$ \[\033[0m\]' umask 022 # You may uncomment the following lines if you want `ls' to be colorized: export LS_OPTIONS='--color=auto' eval "`dircolors`" alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -l' alias l='ls $LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i'
Exit and relogin to see the changes
Since I use the Joe Editor and let it make backups, there can be a lot of backups around. To deal with them I have created a little batch file to remove them in any directory tree. So now we will create this little batch file
touch /usr/sbin/rmbak
Now edit that file and insert the following contents:
#!/bin/bash
echo "Deleting backup files . . ."
find . -name '*~' -print -exec rm {} \;
Verify than /etc/network/interfaces and /etc/resolv.conf are correct, if not fix them.
Set the hostname
echo someserver.somehost.net > /etc/hostname
hostname -F /etc/hostname
Update some services
update-rc.d -f exim remove;update-inetd --remove daytime;update-inetd --remove telnet;update-inetd --remove time;update-inetd --remove finger
update-inetd --remove talk;update-inetd --remove ntalk;update-inetd --remove ftp;/etc/init.d/inetd reload
Install the Bastille hardening script
apt-get install bastille
Now run bastille
bastille
Ok now we have a base system to work from.
Specific installation instructions for different packages are here also.
Perl Script to remove Spaces from file/dir names 14
The other day I moved a bunch of files from a windows server to a linux server. The files and directories on the windows server had spaces in them. Linux does not really like spaces in directory and file names.
I went looking around the net and could not find exactly what I wanted, so I took what I could find and modified it. At this point I cannot remember where I got the pieces, but the main brains for this script is not mine. Anyway here it is:
#!/usr/bin/perl -w
# nospace /this/dir /that/dir /those/too
use File::Find;
use strict;
die "usage: nospace dir[s]\n" unless @ARGV;
my %ext;
find(\&remspaces, @ARGV);
sub remspaces {
return if ($_ eq '.');
return if ($_ eq '..');
(my $new = $_) =~ tr/a-zA-Z0-9_.-/_/c;
my $duplicate = ($new ne $_ and -e $new);
my $try = $new;
$ext{"$File::Find::dir/$try"}++ if $duplicate;
while (my $count = $ext{"$File::Find::dir/$new"}++) {
(my $with_num = $new) =~ s/(?=\.|$)/_$count/;
$new = $with_num, last if not -e $with_num;
}
$ext{"$File::Find::dir/$try"}-- if $duplicate;
rename $_ => $new
or warn "can't rename $_ to $new: $!";
}
Copy above into a new file, save it as nospace, make it executable and run it by giving it a directory to work on. Thus if your files were in a directory called music call it with:
nospace music
Worked for me.
Tom