wiki'd

by JoKeru

Monitor Pure-FTPd User Access

Quick 'n dirty way to monitor your FTP server access:

$ cat <<'EOF' > /root/pure-ftpd-monitor.sh
#!/bin/bash

to='user@domain.com'
log='/var/log/messages'
here=$(hostname)

tail -f $log | while read -r line
do
 # sample log - "May 16 13:01:52 box pure-ftpd: (?@300.124.39.218) [INFO] jimmy …

Vsftpd with Virtual Users

[cc lang="bash"]
\$ yum install vsftpd db4-utils

\$ cd /etc/vsftpd/
\$ echo -e "user_name\npass_word" > virtual-users.txt
\$ db_load -T -t hash -f virtual-users.txt /etc/vsftpd/virtual-users.db
\$ chmod 600 virtual-users.*
\$ vi vsftpd.conf

\$ vi /etc/pam.d/vsftpd-virtual

\$ chown -R apache:apache /var/www/html/*
\$ service vsftpd restart
\$ chkconfig --levels …

Squid as a Reverse Proxy (Website Accelerator)

$ yum install squid

$ vi /etc/sysconfig/squid
$ vi /etc/squid/squid.conf
$ service squid restart

$ tail -f /var/log/squid/access.log | perl -p -e 's/^([0-9]*)/"[".localtime($1)."]"/e'
$ squidclient -p 80 -h 10.20.30.40 -l 127.0.0.1 mgr:info

# Create swap directories
$ service squid …

Postfix Domain Keys – DK

[cc lang="bash"]
\$ apt-get install dk-filter

\$ vi /etc/default/dk-filter

\$ vi /etc/postfix/dk.domains

\$ dkim-genkey -s mail -d jokeru.ro
\$ mv mail.private /etc/postfix/dk.key
\$ chmod 444 /etc/postfix/dk.key

\$ vi /etc/postfix/dk.sign

\$ service dk-filter restart

\$ vi /etc/postfix/main.cf
\$ service postfix restart …

Webmin on CentOS

$ wget http://heanet.dl.sourceforge.net/project/webadmin/webmin/1.590/webmin-1.590-1.noarch.rpm
$ rpm -U webmin-1.590-1.noarch.rpm

$ vi /etc/webmin/miniserv.conf
# - listen=10000  
# + bind=10.20.30.40

$ /usr/libexec/webmin/changepass.pl /etc/webmin root webmin_pass

$ service webmin restart
$ chkconfig webmin on

theme -> http …

Mail Server - Courier POP3/POP3-SSL

Configure Courier POP3 service using MySQL auth module.

$ apt-get install courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl

$ sed -i 's/authmodulelist="authpam"/authmodulelist="authmysql"/' /etc/courier/authdaemonrc
$ cat <<'EOF' > /etc/courier/authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME mail
MYSQL_PASSWORD xXxXx
MYSQL_PORT 0
MYSQL_OPT 0
MYSQL_DATABASE mail
MYSQL_USER_TABLE users
MYSQL_CRYPT_PWFIELD password
#MYSQL_CLEAR_PWFIELD password
MYSQL_UID_FIELD 5000
MYSQL_GID_FIELD …

Apache Performance Tunning

The single biggest issue affecting Apache webserver performance is RAM. Have as much RAM as your hardware, OS, and funds allow. The more RAM your system has, the more processes (and threads) Apache can allocate and use - which directly translates into the amount of concurrent requests/clients Apache can serve …

Custom Color BASH Prompt

just

$ cat <<'EOF' >> ~/.bashrc
PS1="${debian_chroot:+($debian_chroot)}\\[\\e[01;31m\\]\\u\\[\\e[01;30m\\]@\\[\\e[01;32m\\]\\h\\[\\e[01;30m\\]:\\[\\e[01;34m\\]\\w\\[\\e[01;30m\\]\#\\[\\e[0m\\]"
EOF

OpenVPN

$ apt-get install openvpn

$ cd /usr/share/doc/openvpn/examples/easy-rsa/2.0/
$ vi vars
$ . ./vars
$ ./clean-all
$ ./build-ca
$ ./build-key-server wiki
$ ./build-key road-warrior
$ ./build-dh

$ mkdir /etc/openvpn/keys
$ cd keys/
$ cp ca.key ca.crt dh1024.pem wiki.key wiki.crt /etc/openvpn/keys/
$ openvpn --genkey --secret /etc/openvpn/keys/ta.key …

SNMPd

[cc lang="bash"]
\$ yum install net-snmp net-snmp-utils
\$ rpm -ql net-snmp

\$ mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org
\$ vi /etc/snmp/snmpd.conf
\$ vi /etc/sysconfig/snmpd.options

\$ chkconfig snmpd on
\$ service snmpd start
\$ netstat -tulnp | grep snmpd
udp 0 0 10.0.0.2:161 0.0 …