Eric @ EricBess WebHome

一味思考而不行动,将在不知不觉中变得无意义

Chinese (Simplified) flagItalian flagKorean flagPortuguese flagEnglish flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flag
By N2H

Proftpd for FreeBSD port

Install proftpd

 cd /usr/ports/ftp/proftpd
 make config

| |   [X] IPV6             Use IPv6                                | |
| |   [ ] LDAP             Use LDAP                                | |
| |   [ ] LDAP_TLS         Use LDAP TLS (Requires LDAP, OPENSSL)   | |
| |   [X] MYSQL            Use MySQL                               | |
| |   [ ] PGSQL            Use Postgres                            | |
| |   [X] OPENSSL          Include mod_tls                         | |
| |   [X] QUOTA            Include mod_quota                       | |
| |   [X] IFSESSION        Include mod_ifsession                   | |
| |   [X] README           Include mod_readme                      | |
| |   [X] RATIO            Include mod_ratio                       | |
| |   [X] CTRLS            Include controls                        | |
| |   [X] REWRITE          Include mod_rewrite                     | |
| |   [X] WRAP             Include mod_wrap2                       | |
| |   [ ] WRAP_FILE        Include mod_wrap2_file                  | |
| |   [ ] WRAP_SQL         Include mod_wrap2_sql                   | |
| |   [X] RADIUS           Include mod_radius                      | |
| |   [ ] QUOTATAB_RADIUS  include mod_quotatab_radius             | |
| |   [ ] BAN              Include mod_ban (Requires CTRLS)        | |
| |   [ ] NLS              Use nls (builds mod_lang)               | |
| |   [ ] CYRFIX           Patch to fix cyrillic encoding          | |
| |   [X] CLAMAV           Include mod_clamav                      | |

 make install

#基本配置

   cp /usr/local/etc/proftpd.conf /usr/local/etc/proftpd.conf.sample
   vi /usr/local/etc/proftpd.conf

1 2 3

02月 19th, 2008 Posted by eric | System | no comments

Apache @ Linux&FreeBSD Setup

1. Linux Setup

1.1 Installation

wget -P tar/ http://apache.justdn.org/httpd/httpd-2.X.XX.tar.bz2tar jxvf tar/httpd-2.X.XX.tar.bz2
cd httpd-2.X.XX
./configure --prefix=/usr/local/apache
make -j 10
make install

1.2 Config setting

cp support/apachectl /etc/init.d/httpd
chmod 755 /etc/init.d/httpd

Add following to the head "/etc/init.d/httpd" : 修改/etc/init.d/httpd:前面几行改成如下样子.

1
2
3
4
5
6
7
# Startup script for the Apache Web Server
# chkconfig: 35 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache/log/httpd.pid
# config: /usr/local/apache/conf/httpd.conf

Run

chkconfig --add httpd

Configuration "/usr/local/apache/conf/httpd.conf"

ServerName yourservername.yourdomainname:80

#在/root/.bash_profile 中的PATH****后加上:/usr/local/apache/bin

2. 用Apache的.htaccess文件增加用户认证

 
然后编辑httpd.conf, 添加 例:
1
2
3
4
5
6
7
Alias /test"/var/www/test"
<directory "/var/www/test">
  Options Indexes MultiViews
  AllowOverride AuthConfig #表示进行身份验证
  Order allow,deny
  Allow from all
</directory>
最后:注意".htaccess"的权限。
 

3.名字型虚拟主机

1
2
3
4
5
6
7
8
9
10
11
NameVirtualHost 61.152.210.22
<virtualhost 61.152.210.22>
ServerAdmin eric@bizeasy.cn
ServerName www.bizeasy.cn
DocumentRoot /home/eric/public_html/igenus
</virtualhost>
<virtualhost 61.152.210.22>
ServerAdmin eric@dyzq.com
ServerName mail.dyzq.com
DocumentRoot /usr/local/httpd/htdocs/
</virtualhost>

4.Other

在这里,最好是在apache的配置中增加默认文件类型的cache机制,即利用apache的expires模块,新增类似如下几行:

1
2
3
4
5
6
7
ExpiresActive On
ExpiresByType text/html "access plus 10 minutes"
ExpiresByType text/css "access plus 1 day"
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/jpg "access 1 month"
ExpiresByType application/x-shockwave-flash "access plus 3 day"

5.Install Apache HTTP Server 2.20 by using FreeBSD (Ports)

5.1
cd /usr/ports/www/apache22
make install clean

Click to continue reading

12月 29th, 2007 Posted by eric | Unix/BSD/Linux | no comments

FreeBSD CVSup (简明使用)

  CVSup 是一个用于从远程服务器主机上的主 CVS 仓库发布和升级源代码树的软件包。 FreeBSD 的源代码维护在加利福尼亚州一台主开发服务器的 CVS 仓库里。 有了 CVSup,FreeBSD 用户可以很容易的保持他们自己的源代码树更新。

  CVSup 使用所谓的升级 pull 模式。在 pull 模式下,客户端在需要的时候向服务器端请求更新。 服务器被动的等待客户端的升级请求。因此所有的升级都是客户端发起的。 服务器决不会发送未请求的升级。用户必须手动运行 CVSup 客户端获取更新, 或者设置一个 cron 作业来让它以固定的规律自动运行。

  术语 CVSup用大写字母写正是表示, 代表了完整的软件包。它的主要组件是运行在每个用户机器上的客户端 cvsup, 和运行在每个 FreeBSD 镜像站点上的服务器端 cvsupd。

安装

安装 CVSup 最简单的方式就是使用 FreeBSD packages collection 中预编译的 net/cvsup 包。
# pkg_add -r cvsup
如果想在没有安装 XFree86TM 或 Xorg 的计算机,则只能使用不包含 CVSup GUI 的 net/cvsup-without-gui。
# pkg_add -r cvsup-without-gui

这样我们就安装了cvsup程序,但我们要刷新一下命令才可以使用cvsup。输入
#rehash

Click to continue reading

12月 11th, 2007 Posted by eric | Unix/BSD/Linux | no comments

ucspi-tcp的原理和设置

  Qmail的开发者dan Bernstein 开发了ucspi-tcp(Unix Client-Server Program Interface, using the TCP protocol)包来取代inetd程序。Ucspi格式定义了一种程序来交换数据的方法,主要体现出三个优点:

  1、 ucspi端口独立于底层的通讯介质。
  2、 ucspi允许shell脚本程序利用网络的互联。
  3、 ucspi程序建立了unix环境变量,这些变量定义了可以被程序和用户使用的网络信息。

  Ucspi-tcp使用称为tool的程序在应用程序之间建立连接。有两种类型的ucspi tool ---客户tool(tcpclient)和服务器tool(tcpserver)。
  Ucspi-tcp的tcpserver程序就是替代unix的inetd程序的,有如下优点:

  1、他能够把来自服务器端的所有输入和输出都记到一个文件中。
  2、他能提供访问控制特征,拒绝或者允许来自客户端的连接,控制规则放在一个hash规则库(cdb)它很方便的来处理成千的规则。
  3、它包含了并发限制(默认40),tcpserver 可平缓的降低并发量来防止使unix系统过载。

Click to continue reading

12月 5th, 2007 Posted by eric | Qmail/Postfix/Exchange | no comments

MySQL 5新特性及安装

MySQL AB 公司正式发布 MySQL 5.0 这一公司成立十年来最重大的产品升级版本。

MySQL 5.0的新的特性、功能包括:
存储过程与 SQL 函数 -- 内嵌商业逻辑到数据库中并提升性能;
触发器 -- 在数据库层执行复杂的商业规则;
视图 -- 确保敏感信息安全;
游标 -- 更容易的数据库开发及大数据集的引用;
信息模式 -- 提供对元数据的便利访问;
XA 分布式事务处理 -- 支持异构环境中跨多个数据库的复杂事务;
SQL 模式 -- 提供服务器强制执行的数据完整性检查;
新的 Federated 和 Archive 存储引擎 -- MySQL 独一的可插式存储引擎架构使得用户可基于需求,轻松地切换数据库引擎以获得更大的灵活性、更多的功能及更好的性能;
新的移植工具 -- 新的图形化工具箱可从 Oracle, Microsoft SQL Server, Microsoft Access 及其它数据库平台完全移植所有数据和对象到 MySQL 中;
实例管理器 -- 新的管理助手允许远程启动/停止任一 MySQL 服务器,以及配置文件的远程编辑,错误与查询日志的远程查看等功能;
升级的连接器与可视化工具 -- 提供更高性能的新版 MySQL 的 ODBC, Java 与 .NET 数据库驱动程序, 以及升级了的 MySQL 查询浏览器和 MySQL 管理器。

MySQL Installation:

wget -P tar/ http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.17.tar.gz/from/http://www.greatlinux.com/mysql/
tar zxvf tar/mysql-5.0.17.tar.gz
cd mysql-5.0.17
groupadd mysql
useradd -g mysql mysql
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql \
--enable-assembler --with-mysqld-ldflags=-all-static --with-charset=gbk
make -j 10
make install
cp support-files/my-medium.cnf /etc/my.cnf

Click to continue reading

11月 28th, 2007 Posted by eric | Database, System | no comments

phpMyAdmin安装、配置、使用(for linux and FreeBSD)

1. Installation  

wget -P tar/ http://easynews.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.7.0-pl2.tar.bz2
tar jxvf tar/phpMyAdmin-2.7.0-pl2.tar.bz2
mv phpMyAdmin-2.7.0-pl2 mysqladmin    #(可选地址)
cp -R mysqladmin /usr/local/apache/htdocs/  

2. configuration  

vi /usr/local/apache/htdocs/mysqladmin/config.default.php
#修改你将上传到空间的phpMyAdmin的网址
#如:$cfg['PmaAbsoluteUri'] = 'http://your.domain.com/phpmyadmin/';
$cfg['Servers'][$i]['host'] = 'localhost';(通常用默认,也有例外)
$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?
在自己的机子里调试用config,如果在网上用cookie。
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user(用户名,自己机里用root,在网上设你的ftp用户名)
$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed
自己机里不用设 $cfg['Servers'][$i]['only_db'] = ''; // If set to a db-name, only(你只有一个数据就设置一下)还有设$cfg['DefaultLang'] = 'zh';  

3. security

#增加用户认证 http://www.ericbess.com/ericblog/2007/12/29/apache-linuxfreebsd-setup/
section
2  

FreeBSD Ports install 

cd /usr/ports/databases/phpmyadmin
echo "WITHOUT_X11=YES" >> /etc/make.conf
make install clean
cp /usr/local/www/phpMyAdmin/config.sample.inc.php /usr/local/www/phpMyAdmin/config.inc.php
ee /usr/local/www/phpMyAdmin/config.inc.php
$cfg['blowfish_secret'] = 'e2311'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
edit httpd.conf
Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"    
    <Directory "/usr/local/www/phpMyAdmin/">
        Options none
        AllowOverride Limit
        Order Deny,Allow
        Allow from all
    </Directory>  

Click to continue reading

11月 28th, 2007 Posted by eric | Database | no comments

PHP 整理(Linux,Freebsd)

1. Installation php

Installing PHP 4.4.1 (Linux)

1
2
3
4
5
6
7
wget -P tar/ http://cn.php.net/get/php-4.4.1.tar.bz2/from/this/mirror
tar jxvf tar/php-4.4.1.tar.bz2
cd php-4.4.1
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs
make -j 10
make install
cp php.ini-dist /usr/local/php/lib/php.ini

Configuring PHP (Linux)

vi /usr/local/php/lib/php.ini
#;default_charset = "iso-8859-1"
#在这行下面加一行
#default_charset = "gbk"

vi /usr/local/apache/conf/httpd.conf
#找到#AddType application/x-tar .tgz 这行,在下面加两行

1
2
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

#找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php

1
DirectoryIndex index.html index.html.var index.php

#注意:改变了http.conf后,要重启apache服务
#确认安装成功了解配制信息: echo "<? phpinfo(); ?>" >/usr/local/apache/htdocs/phpinfo.php
#访问http://yourserver/phpinfo.php  

Installing  PHP(FreeBSD port)

# cd /usr/ports/lang/php5
# make install clean

Adding the PHP 5 module to Apache(22) >>/usr/local/etc/apache22/httpd.conf

1
2
3
DirectoryIndex index.php index.html index.htm
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps  

Configuring PHP (freeBSD)

# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

Click to continue reading

11月 27th, 2007 Posted by eric | System, Unix/BSD/Linux | no comments

客户公司SOX关于LINUX帐号的审计要求及本人与redh­at工程师的解决之道。

SOX demand  for linux OS password 

      1. A unique user ID is required in combination with a password to access the system. 
      2. Automatic password changing after 60 days where technically feasible.  If not technically feasible, a compensating control is in place. 
      3. Password minimum length of 8 characters or maximum length allowed by system when the allowable length is less than 8 characters. 
      4. User IDs/Accounts suspended after 6 invalid logins if technically feasible.  If not technically feasible, a compensating control is in place. 
      5. Accounts inactive for 60 days are disabled if technically possible.  If not technically possible, a compensating control is in place. 
      6. Password history of 12 is enabled which prohibits the reuse of the last 12 passwords 
      7. Following a new user's initial logon to the application, the user is prompted to change password.

>From Me

For 2. Expired Setting
[root@localhost]# passwd -x 60 -w 10

For 1.Complexity Setting
Add the following lines to /etc/pam.d/passwd
password requisite       pam_cracklib.so type
="Retype-3-At-least-8-letters-1-capital-1- character" retry=3
minlen=10 ucredit=1 ocredit=1
password required        pam_unix.so use_authtok

Reference Documents
passwd manual
The Linux-PAM System Administrators' Guide
http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam.html#toc6

Click to continue reading

11月 15th, 2007 Posted by eric | Unix/BSD/Linux | no comments

Page 2 of 5«12345»