nano /var/cache/bind/weqiao.org.db
named-checkconf
nano /var/log/daemon.log then: /etc/init.d/bind9 start
15. mysql (to change passwd)
1) apt-get install mysql-server mysql-client libmysqlclient15-dev
(set a password for mysql root: mysqladmin -u root password YOURROOTSQLPASSWORD)
# mysql -u root -p
create database 99webhosting;
use 99webhosting
grant all privileges on *.* to 'XXX'@'localhost' identified by 'XXXXXXmysql' with grant option;
\q
test:
http://192.168.1.101/phpmyadmin/ 16. Remove unwanted packages
apt-get remove ppp pppconfig pppoeconf
17. Shutdown unwanted services from inetd
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
update-inetd --remove discard
install VHCS
============
1. download
cd tmp
wget
http://downloads.sourceforge.net/project/vhcs/VHCS%202.4/VHCS%202.4.8/vhcs-2.4.8.tar.bz2?use_mirror=iweb tar xjvf vhcs-2.4.8.tar.bz2
cd vhcs-2.4.8
2. Configuration File
/tmp/vhcs-2.4.8/configs/vhcs2.conf
/etc/proftpd/proftpd.conf
/etc/bind/named.conf
/etc/postfix/main.cf
/etc/postfix/master.cf
1) nano configs/vhcs2.conf
DEFAULT_ADMIN_ADDRES =
admin@99webhosting.com SERVER_HOSTNAME = server01
BASE_SERVER_IP = 192.168.1.101
DATABASE_TYPE = mysql
DATABASE_HOST = localhost
DATABASE_NAME = 99webhosting
DATABASE_PASSWORD = XXXXXXmysql
DATABASE_USER = XXX
DATE_FORMAT = m.d.Y
(
DATABASE_DIR = /media/disk500GB/CUSTOMER/mysql
SECONDARY_DNS = 192.168.1.102
APACHE_WWW_DIR = /media/disk500GB/CUSTOMER/www
APACHE_LOG_DIR = /media/disk500GB/log/apache2
APACHE_USERS_LOG_DIR = /media/disk500GB/log/apache2/users
APACHE_BACKUP_LOG_DIR = /media/disk500GB/log/apache2/backup
LOG_DIR = /media/disk500GB/log/vhcs2
TRAFF_LOG_DIR = /media/disk500GB/log
MTA_VIRTUAL_MAIL_DIR = /media/disk500GB/CUSTOMER/Email
DFtpDir = /media/disk500GB/CUSTOMER/www/
FTP_HOMEDIR = /media/disk500GB/CUSTOMER/www
BACKUP_FILE_DIR = /media/disk500GB/backup_by_VHCS2
)
3. make install
4. cp -R /tmp/vhcs-2.4.8/* /
5. to run the setup for vhcs:
/var/www/vhcs2/engine/setup/vhcs2-setup
Please to enter system hostname (for Enter defaults) [debian]: server01
Please to enter system network address (for Enter defaults) [10.0.0.69 ]: 192.168.1. 101
Please to enter SQL server host (for Enter defaults) [localhost]:
Please to enter system SQL database (for Enter defaults) [vhcs2]: 99webhosting
Please to enter system SQL to user (for Enter defaults) [root]: XXX
Please to enter system SQL password (for Enter defaults) [none]: XXXXXXmysql
Please repeat system SQL password: password
Please to enter VHCS FTP SQL to user (for Enter defaults) [vftp]: ftp_XXX
Please to enter VHCS FTP SQL to user password (for Enter defaults) [none]: XXXXXXftp
Please repeat VHCS FTP SQL to user password: XXXXXXxxx
Please to enter administrator login name (for Enter defaults) [admin]:XXX
Please to enter administrator password: XXXXXXhost
Administrator Please repeat password: XXXXXXhost
Please to enter administrator email address:
admin@99webhosting.com6. access to VHCS2:
http://192.168.1.101/vhcs2fix proftpd
===========
cp /etc/proftpd.conf /etc/proftpd/proftpd.conf
1. nano /etc/proftpd/proftpd.conf
include /etc/proftpd/modules.conf
DisplayfirstChdir -> DisplayChdir
in addition:
------------
ServerIdent on "FTP Server Ready"
UseIPv6 off
2. nano /etc/proftpd/modules.conf
LoadModule mod_sql.c
LoadModule mod_sql_mysql.c
3. /etc/init.d/proftpd restart
4. create a new user (ftp_XXX)
mysql -u root -p
CREATE USER 'ftp_XXX'@'localhost' IDENTIFIED BY 'XXXXXXftp';
GRANT SELECT ON `99webhosting`.`domain` TO 'ftp_XXX'@'localhost';
GRANT SELECT ON `99webhosting`.`ftp_users` TO 'ftp_XXX'@'localhost';
FLUSH PRIVILEGES;
\q
5. test: telnet localhost ftp
///
chinese
-------
security
--------
There also seems to be a very serious security flaw in the admin section.
Your vhcs installation can easily be hacked by hackers. To prevent this,
add a ip filter on the admin section. This does require advance knowledge
of apache.
fix it
======
Notice: Undefined index: /dev/shm in /var/www/vhcs2/gui/include/phpsysinfo/class.Linux.inc.php on line 525
Syntax error on line 4 of /etc/apache2/mods-enabled/fastcgi.conf:
FastCgiWrapper: "/usr/lib/apache2/suexec" execute access for server (uid 33, gid 33) failed: stat(/usr/lib/apache2/suexec) failed: No such file or directory
...fail!
apt-get install apache2-suexec2
apt-get remove apache2-suexec
@ Henrik: The notices depends on if you have safe_mode on or off.
Sarge: FastCgiWrapper /usr/lib/apache2/suexec2
Etch: FastCgiWrapper /usr/lib/apache2/suexec
/etc/apache2/mods-available/fastcgi.conf
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
#FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/lib/apache2/fastcgi
</IfModule>
///////
<IfModule mod_fastcgi.c>
FastCgiWrapper /usr/lib/apache2/suexec2
FastCgiIpcDir /var/lib/apache2/fastcgi
FastCgiConfig -minProcesses 1 -maxProcesses 10 -singleThreshold 100 -killInterval 300 -autoUpdate -idle-timeout 240 -pass-header HTTP_AUTHORIZATION
FastCgiServer /var/www/fcgi/master/php4-fcgi-starter -user vu2000 -group vu2000
Action php4-fcgi-starter /php4/php4-fcgi-starter
Action php5-fcgi-starter /php5/php5-fcgi-starter
# For PHP4 support
<Location /php4/>
Options +ExecCGI
SetHandler php4-fcgi-starter
</Location>
AddType application/x-httpd-php4 .php .php3 .php4
Action /php4/php4.ini
# For PHP5 support
<Location /php5/>
Options +ExecCGI
SetHandler php5-fcgi-starter
</Location>
AddType application/x-httpd-php5 .php5
Action /php5/php5.ini
AddHandler php4-fastcgi .php .php4 .php3
AddHandler php5-fastcgi .php5
</IfModule>
7. trouble-shooting:
Modules [Crypt::CBC, Crypt::Blowfish, Crypt::PasswdMD5] WAS NOT FOUND
apt-get install libmime-perl
configure CPAN
cpan
(mostly the defaults will work)
upgrade cpan (optional ; and kind of a drawn out process):
install Bundle::CPAN
reload cpan
install Crypt::Blowfish
install Crypt::CBC
install Carp::Clan
install Bit::Vector
install Date::Calc
install ExtUtils::MakeMaker
install HTML::Tagset
install HTML::Parser
install IO::Stringy
install Mail::Field
install Mail::Header
install Mail::Internet
install MIME::Base64
install MIME::Tools
install MIME::Entity
install MIME::Parser
install DBD::mysql
install Term::ReadPassword
install Crypt::PasswdMD5
@ Henrik: The notices depends on if you have safe_mode on or off.
Sarge: FastCgiWrapper /usr/lib/apache2/suexec2
Etch: FastCgiWrapper /usr/lib/apache2/suexec
how to switch proftpd to PURE-FTPD for VHCS2
============================================
0. Backing up old files (optional)
cp /etc/vhcs2/vhcs2.conf /etc/vhcs2/vhcs2.conf.bak
cp /var/www/vhcs2/engine/quota/vhcs2-dsk-quota /var/www/vhcs2/engine/quota/vhcs2-dsk-quota.bak
1. remove proftpd (and or pure-ftpd)
apt-get remove --purge proftpd
rm -rf /etc/proftpd && rm /etc/proftpd.conf
2. Installing the necessary packages
apt-get install pure-ftpd-mysql pure-ftpd-common
3. configure pure-ftpd
1) Stop PureFTPD before modifying configuration files
/etc/init.d/pure-ftpd-mysql stop
or:
sudo fuser -n tcp 21
sudo kill [pid]
2) configure (the configuration files are placed in the etc/pure-ftpd/conf directory, We need to create the different configuration files that are going to be used
echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone
echo "yes" > /etc/pure-ftpd/conf/BrokenClientsCompatibility
echo "100" > /etc/pure-ftpd/conf/MaxClientsNumber
echo "yes" > /etc/pure-ftpd/conf/Daemonize
echo "4" > /etc/pure-ftpd/conf/MaxClientsPerIP
echo "yes" > /etc/pure-ftpd/conf/DisplayDotFiles
echo "no" > /etc/pure-ftpd/conf/AnonymousOnly
echo "yes" > /etc/pure-ftpd/conf/NoAnonymous
echo "ftp" > /etc/pure-ftpd/conf/SyslogFacility
echo "yes" > /etc/pure-ftpd/conf/DontResolve
echo "5" > /etc/pure-ftpd/conf/MaxIdleTime
echo "no" > /etc/pure-ftpd/conf/PAMAuthentication
echo "no" > /etc/pure-ftpd/conf/UnixAuthentication
echo "10000 3" > /etc/pure-ftpd/conf/LimitRecursion
echo "no" > /etc/pure-ftpd/conf/AnonymousCanCreateDirs
echo "4" > /etc/pure-ftpd/conf/MaxLoad
echo "yes" > /etc/pure-ftpd/conf/AntiWarez
echo "133 022" > /etc/pure-ftpd/conf/Umask
echo "2000" > /etc/pure-ftpd/conf/MinUID
echo "yes" > /etc/pure-ftpd/conf/AllowUserFXP
echo "no" > /etc/pure-ftpd/conf/AllowAnonymousFXP
echo "no" > /etc/pure-ftpd/conf/ProhibitDotFilesWrite
echo "no" > /etc/pure-ftpd/conf/ProhibitDotFilesRead
echo "no" > /etc/pure-ftpd/conf/AutoRename
echo "yes" > /etc/pure-ftpd/conf/AnonymousCantUpload
echo "clf:/var/log/pureftpd/transfers.log" > /etc/pure-ftpd/conf/AltLog
echo "no" > /etc/pure-ftpd/conf/NoChmod
echo "no" > /etc/pure-ftpd/conf/CreateHomeDir
echo "95" > /etc/pure-ftpd/conf/MaxDiskUsage
echo "yes" > /etc/pure-ftpd/conf/CustomerProof
4. create a new user (vhcs2_ftp)
mysql -u root -p
CREATE USER 'vhcs2_ftp'@'localhost' IDENTIFIED BY 'password';
GRANT SELECT ON `vhcs2`.`domain` TO 'vhcs2_ftp'@'localhost';
GRANT SELECT ON `vhcs2`.`ftp_users` TO 'vhcs2_ftp'@'localhost';
FLUSH PRIVILEGES;
5. sudo nano /etc/pure-ftpd/db/mysql.conf
##############################################
# #
# Sample Pure-FTPd Mysql configuration file. #
# See README.MySQL for explanations. #
# #
##############################################
# Optional : MySQL server name or IP. Don't define this for unix sockets.
# MYSQLServer 127.0.0.1
# Optional : MySQL port. Don't define this if a local unix socket is used.
# MYSQLPort 3306
# Optional : define the location of mysql.sock if the server runs on this host.
MYSQLSocket /var/run/mysqld/mysqld.sock
# Mandatory : user to bind the server as.
MYSQLUser vhcs2_ftp
# Optional : MySQL port. Don't define this if a local unix socket is used.
# MYSQLPort 3306
# Optional : define the location of mysql.sock if the server runs on this host.
MYSQLSocket /var/run/mysqld/mysqld.sock
# Mandatory : user to bind the server as.
MYSQLUser vhcs2_ftp
# Optional : MySQL port. Don't define this if a local unix socket is used.
# MYSQLPort 3306
# Optional : define the location of mysql.sock if the server runs on this host.
MYSQLSocket /var/run/mysqld/mysqld.sock
# Mandatory : user to bind the server as.
MYSQLUser vhcs2_ftp
# Mandatory : user password. You must have a password.
MYSQLPassword password
# Mandatory : database to open.
MYSQLDatabase vhcs2
# Mandatory : how passwords are stored
# Valid values are : "cleartext", "crypt", "md5" and "password"
# ("password" = MySQL password() function)
# You can also use "any" to try "crypt", "md5" *and* "password"
MYSQLCrypt any
# In the following directives, parts of the strings are replaced at
# run-time before performing queries :
#
# \L is replaced by the login of the user trying to authenticate.
# \I is replaced by the IP address the user connected to.
# \P is replaced by the port number the user connected to.
# \R is replaced by the IP address the user connected from.
# \D is replaced by the remote IP address, as a long decimal number.
#
# Very complex queries can be performed using these substitution strings,
# especially for virtual hosting.
# Query to execute in order to fetch the password
MYSQLGetPW SELECT passwd FROM ftp_users WHERE userid="\L"
MYSQLGetUID SELECT uid FROM ftp_users WHERE userid="\L"
# Optional : default UID - if set this overrides MYSQLGetUID
#MYSQLDefaultUID 1000
# Query to execute in order to fetch the system user group or gid
MYSQLGetGID SELECT gid FROM ftp_users WHERE userid="\L"
# Optional : default GID - if set this overrides MYSQLGetGID
#MYSQLDefaultGID 1000
# Query to execute in order to fetch the home directory
MYSQLGetDir SELECT homedir FROM ftp_users WHERE userid="\L"
# Optional : query to get the maximal number of files
# MySQLGetQTAFS SELECT QuotaFiles FROM users WHERE User="\L"
# Optional : query to get the maximal disk usage (virtual quotas)
# The number should be in Megabytes.
# Pure-FTPd must have been compiled with virtual quotas support.
MySQLGetQTASZ SELECT domain.domain_disk_limit FROM domain,ftp_users WHERE ftp_users.userid="\L" and ftp_users.uid=do$
# Optional : ratios. The server has to be compiled with ratio support.
GNU nano 2.0.9 File: /etc/pure-ftpd/db/mysql.conf
# MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="\L"
# MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="\L"
# Optional : bandwidth throttling.
# The server has to be compiled with throttling support.
# Values are in KB/s .
# MySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User="\L"
# MySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User="\L"
# Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS :
# 1) You know what you are doing.
# 2) Real and virtual users match.
# MySQLForceTildeExpansion 1
# If you upgraded your tables to transactionnal tables (Gemini,
# BerkeleyDB, Innobase...), you can enable SQL transactions to
# avoid races. Leave this commented if you are using the
# traditionnal MyIsam databases or old (< 3.23.x) MySQL versions.
# MySQLTransactions On
6. Starting Pure-FTPD
/etc/init.d/pure-ftpd-mysql start
sudo fuser -n tcp 21