SquidGuard is a URL redirector used to use blacklists with the proxysoftware Squid. There are two big advantages to squidguard: it is fast and it is free.
vsftpd
Primary tabs
Prerequisites
CentOS should be installed as per the instructions here.
yum -y install libcap-develInstallation
Create a directory to hold the source files:
mkdir -p /extra/src
cd /extra/srcDownload the latest version of vsftpd source tarball. At the time of writing, it was 2.3.2 but check the home page for updates.
wget ftp://vsftpd.beasts.org/users/cevans/vsftpd-2.3.2.tar.gz
tar zxf vsftpd-2.3.2.tar.gz
cd vsftpd-2.3.2We are going to enable SSL on this FTP server, so edit builddefs.h and change:
#undef VSF_BUILD_SSLto:
#define VSF_BUILD_SSLBuild the vsftpd binary:
makeOn our CentOS system, the user "nobody" and the directory "/usr/share/empty" already exist, so we can install the binaries:
make installThe install command doesn't copy the default configuration file so do that manually:
cp vsftpd.conf /etcAutomatic Startup
Rather than xinetd or inetd, we're going to use daemontools to control vsftpd startup. Install it per the instructions if it is not already on your system.
We'll use some tcpserver rules to control access to our FTP server. Install it,
then create /etc/tcp/vsftpd with some basic rules in it:
127.:allow
192.168.0.:allowBuild a CDB file from the rules file with:
tcprules /etc/tcp/vsftpd.cdb /etc/tcp/vsftpd.tmp < /etc/tcp/vsftpd
chmod 644 /etc/tcp/vsftpd.cdbChange the location of the log file in /etc/vsftpd.conf so that multilog gets the error messages:
xferlog_file=/dev/stdoutCreate the directories to hold the service scripts:
mkdir -m 1755 /var/service/vsftpd
cd /var/service/vsftpdThen create the service run script, /var/service/vsftpd/run:
#!/bin/sh
exec 2>&1
exec /usr/local/sbin/vsftpd
#exec tcpserver -c30 -Xv -llocalhost \
#-x/etc/tcp/vsftpd.cdb -uvsftpd -gvsftpd 0 ftp \
#softlimit -d300000 /usr/local/sbin/vsftpdMake the run script executable:
chmod 700 /var/service/vsftpd/runSet up the logging script:
mkdir -m 755 log
cd log
wget http://qmail.jms1.net/scripts/run.log
mv run.log run
chmod 700 runStart the service by creating the symbolic link in /service:
ln -s /var/service/vsftpd /service/After a few seconds, confirm that it is running:
svstat /service/vsftpdCustom Configuration
Anonymous FTP access - CentOS already has an "ftp" user so we'll need to create a directory for the anonymous FTP login:
mkdir /var/ftp
chown root.root /var/ftp
chmod og-w /var/ftpWant to enable file upload for the anonymous user? Edit /etc/vsftpd.conf:
write_enable=YES
anon_upload_enable=YESThen allow write access an "upload" directory:
mkdir /var/ftp/upload
chmod go+w /var/ftp/uploadVirtual Users
These instructions use PAM for virtual user support.
First, add the "virtual" user:
useradd -d /var/ftp vsftpEdit /etc/vsftpd.conf file and add the following options:
chroot_local_user=YES
guest_enable=YES
guest_username=vsftp
pam_service_name=vsftpdcd /extra/src
wget http://www.kernel.org/pub/linux/libs/pam/pre/library/Linux-PAM-0.77.tar.bz2
bunzip2 -c Linux-PAM-0.77.tar.bz2 | tar -xvf -
cd Linux-PAM-0.77/modules
wget http://cpbotha.net/files/pam_pwdfile/pam_pwdfile-0.99.tar.gz
tar zxvf pam_pwdfile-0.99.tar.gz
cd ..
rm default.defs
ln -s defs/redhat.defs default.defs
make all
cp modules/pam_pwdfile-0.99/pam_pwdfile.so /lib/securityvi /etc/pam.d/vsftpd
#%PAM-1.0
# Standard behaviour for ftpd(8).
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required pam_pwdfile.so pwdfile /etc/vsftpd/passwd_ftp
# pam_pwdfile doesn't come with account, so we just permit, on success:
account required pam_permit.somkdir /etc/vsftpd
cd /etc/vsftpd
vi filter.pl
#! /usr/bin/perl -w
use strict;
# filter "user:cleartext" lines into "user:md5_crypted"
# probably requires glibc
while (<>) {
chomp;
(my $user, my $pass) = split /:/, $_, 2;
my $crypt = crypt $pass, '$1$' . gensalt(8);
print "$user:$crypt\n";
}
sub gensalt {
my $count = shift;
my @salt = ('.', '/', 0 .. 9, 'A' .. 'Z', 'a' .. 'z');
my $s;
$s .= $salt[rand @salt] for (1 .. $count);
return $s;
}
chmod ugo+x filter.pl
vi addFtpUser.sh
#!/bin/bash
if [ $# != 2 ] ; then
echo "Incorrect number args"
else
cd /etc/vsftpd
touch cleartext
chmod go= cleartext
echo $1:$2 >> cleartext
./filter.pl cleartext > passwd_ftp
fi
chmod +x addFtpUser.shVirtual User custom home directories
mkdir /etc/vsftpd/userConf
vi /etc/vsftpd.conf
user_config_dir=/etc/vsftpd/userConfecho "local_root=/var/ftp/<username>" >> /etc/vsftpd/userConf/<username>Resources
Build a Secure FTP Dropbox with vsftpd
http://ubuntuforums.org/showthread.php?t=518293
http://labs.erweb.it/pub/vsftp_with_virtual_users.php
http://linuxforfun.net/2008/04/05/vsftpd-virtual-users/
- Log in to post comments