Virtual Hosting Howto With Virtualmin On CentOS 5.1 - Page 5
Clamav Milter Setup
CLAMAV_FLAGS="
--config-file=/etc/clamd.conf
--force-scan
--local
--max-children=5
--sendmail-cf=
--outgoing
--quiet
"
SOCKET_ADDRESS="local:/var/clamav/clmilter.socket"
wget http://www.topdog-software.com/files/clamav-milter.patch
MySQL SetupBasic Config
bind-address = 127.0.0.1
Set Root Password
service mysqld start
SpamAssassin SetupBasic Configrequired_hits 5 report_safe 0 rewrite_header Subject [SPAM]
Create MySQL Database
mysqladmin -p create bayes
mysql -p bayes < /usr/share/doc/spamassassin-$(rpm --qf %{VERSION} -q spamassassin)/sql/bayes_mysql.sql
mysql -p
Configure To Use DB
bayes_store_module Mail::SpamAssassin::BayesStore::MySQL bayes_sql_dsn DBI:mysql:bayes:localhost bayes_sql_override_username bayes bayes_sql_username bayes bayes_sql_password password
Configure FuzzyOCRWe will be storing the image hashes in a mysql database to improve on performance such that images that we have already scanned do not get scanned again as OCR is a resource intense activity.
Create MySQL Database
mysql -p < /usr/local/src/devel/FuzzyOcr.mysql
mysqladmin -u fuzzyocr -p fuzzyocr password
Basic Settings
focr_path_bin /usr/bin:/usr/local/bin focr_minimal_scanset 1 focr_autosort_scanset 1 focr_enable_image_hashing 3 focr_logfile /tmp/FuzzyOcr.log
Make FuzzyOCR Use The Database
focr_mysql_db FuzzyOcr focr_mysql_hash Hash focr_mysql_safe Safe focr_mysql_user fuzzyocr focr_mysql_pass password focr_mysql_host localhost focr_mysql_port 3306 focr_mysql_socket /var/lib/mysql/mysql.sock
SARE Rule Updates
mkdir /etc/mail/spamassassin/sa-update-keys/
updates.spamassassin.org 72_sare_redirect_post3.0.0.cf.sare.sa-update.dostech.net 70_sare_evilnum0.cf.sare.sa-update.dostech.net 70_sare_bayes_poison_nxm.cf.sare.sa-update.dostech.net 70_sare_html0.cf.sare.sa-update.dostech.net 70_sare_html_eng.cf.sare.sa-update.dostech.net 70_sare_header0.cf.sare.sa-update.dostech.net 70_sare_header_eng.cf.sare.sa-update.dostech.net 70_sare_specific.cf.sare.sa-update.dostech.net 70_sare_adult.cf.sare.sa-update.dostech.net 72_sare_bml_post25x.cf.sare.sa-update.dostech.net 99_sare_fraud_post25x.cf.sare.sa-update.dostech.net 70_sare_spoof.cf.sare.sa-update.dostech.net 70_sare_random.cf.sare.sa-update.dostech.net 70_sare_oem.cf.sare.sa-update.dostech.net 70_sare_genlsubj0.cf.sare.sa-update.dostech.net 70_sare_genlsubj_eng.cf.sare.sa-update.dostech.net 70_sare_unsub.cf.sare.sa-update.dostech.net 70_sare_uri0.cf.sare.sa-update.dostech.net 70_sare_obfu0.cf.sare.sa-update.dostech.net 70_sare_stocks.cf.sare.sa-update.dostech.net
#!/bin/bash # # sa-update -D --channelfile /etc/mail/spamassassin/sare-sa-update-channels.txt --gpgkey 856AA88A &>/var/log/sa-updates.log
chmod +x /usr/local/bin/update-sa
Spamass-milter SetupBasic Configuration
SOCKET=/var/run/spamass.sock EXTRA_FLAGS="-m -r 8"
PatchWe need to patch the init file to fix the permissions of the socket created such that postfix is able to use the socket.
wget http://www.topdog-software.com/files/spamass-milter.patch
Apache SetupDisable ModulesWe will disable some modules that we are not using thus freeing up memory and also improving security.
#LoadModule ldap_module modules/mod_ldap.so #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so #LoadModule dav_module modules/mod_dav.so #LoadModule status_module modules/mod_status.so #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule cache_module modules/mod_cache.so #LoadModule disk_cache_module modules/mod_disk_cache.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule mem_cache_module modules/mod_mem_cache.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
Listen To One IP For HTTPSApache has to be configured to listed to one address for port 443 as webmin will be using the same port. Edit /etc/httpd/conf.d/ssl: Listen 192,168.1.6:443
Enable Gzip CompressionWe setup gzip compression via the mod_deflate module to improve web server performance and to cut down on bandwidth usage by compressing responses to the client. SetOutputFilter DEFLATE BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html SetEnvIfNoCase Request_URI \ \.(?:gif|jpe?g|png)$ no-gzip dont-vary Header append Vary User-Agent env=!dont-vary Set up logging for the deflate module: DeflateFilterNote deflate_ratio
LogFormat "%v %h %l %u %t \"%r\" %>s %b mod_deflate: %{deflate_ratio}n pct." vhost_with_deflate_info
CustomLog logs/deflate_access_log vhost_with_deflate_info
Increase PHP Max MemoryEdit the file /etc/php.ini and set the following: memory_limit = 64M
Enable Virtual HostingNameVirtualHost *:80
Create Default Virtual HostThis needs to be the first virtual host, it will be the default on the server the equivalent of the server with out virtual hosting. <VirtualHost *:80>
Servername localhost.localdomain
Serveradmin root@localhost.localdomain
</Virtualhost>
Roundcube Webmail SetupCreate Database
mysqladmin -p create roundcube
mysql -u roundcube -p roundcube < /usr/share/doc/roundcube-0.1/SQL/mysql5.initial.sql
Basic Config
$rcmail_config['db_dsnw'] = 'mysql://roundcube:password@localhost/roundcube';
$rcmail_config['default_host'] = 'localhost'; $rcmail_config['default_port'] = 143; $rcmail_config['virtuser_file'] = '/etc/postfix/virtual'; $rcmail_config['smtp_server'] = 'localhost'; $rcmail_config['smtp_port'] = 25; $rcmail_config['smtp_helo_host'] = 'localhost';
Set Up Catch All VirtualhostAs we will be providing webmail for all domains that are created on the system we need to setup a catch all virtualhost that can display roundcube when ever a user accesses http://webmail.domainname. Edit /etc/httpd/conf/httpd.conf and append: <VirtualHost *:80> ServerName webmail.example.com ServerAlias webmail.* DocumentRoot /var/www/roundcube <Directory /var/www/roundcube> Options -Indexes IncludesNOEXEC FollowSymLinks allow from all </Directory> </VirtualHost>
Firewall SetupIntroductionThis is a basic firewall it may not suit your needs, firewalling is an art so i recommend to read into it to improve on this basic one.
Basic ConfigAdd these rules in your configuration file /etc/sysconfig/iptables: *raw :PREROUTING ACCEPT [0:0] :OUTPUT ACCEPT [0:0] COMMIT *nat :PREROUTING ACCEPT [0:0] :POSTROUTING ACCEPT [0:0] :OUTPUT ACCEPT [0:0] COMMIT *mangle :PREROUTING ACCEPT [0:0] :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :POSTROUTING ACCEPT [0:0] COMMIT *filter :FORWARD DROP [0:0] :INPUT DROP [0:0] :OUTPUT DROP [0:0] -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT -A INPUT -p tcp -m multiport -j ACCEPT --dports 80,443,25,110,143,53 -A INPUT -p udp -m udp --dport 53 -j ACCEPT -A INPUT -p icmp -m icmp -m limit --icmp-type 8 --limit 5/min -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A OUTPUT -s 127.0.0.1 -j ACCEPT -A OUTPUT -s 192.168.1.5 -j ACCEPT -A OUTPUT -s 192.168.1.6 -j ACCEPT COMMIT
Activate Configservice iptables restart
|



Recent comments
1 day 2 hours ago
1 day 7 hours ago
1 day 8 hours ago
1 day 9 hours ago
1 day 11 hours ago
1 day 15 hours ago
1 day 16 hours ago
1 day 18 hours ago
2 days 8 hours ago
2 days 9 hours ago