VirtualBox安装CentOS后如何安装增强功能
[ 2011/11/11 17:24 | by Sonic ]
本机操作系统为vista,virtualbox版本为3.1.2 r56127,虚拟机为CentOS 5.4 i386。安装vitualbox增强功能的步骤:
1.启动CentOS,以root身份登录,进入桌面环境。
2.在virtualbox菜单中选择“设备-->安装增强功能”,会在桌面上出现一个“VBOXADDITIONS_3.1.2_56127”图标。
3.双击上述图标,打开文件窗口,选择“工具-->打开终端”菜单,进入终端模式。
4.执行如下命令:
#yum install kernel-devel //执行此命令提示有错误,忽略;
#yum install gcc //执行此命令提示有错误,忽略;
ln -s /usr/src/kernels/2.6.18-......-i686 /usr/src/linux //省略号处用TAB键补全
sh VBoxLinuxAdditions-x86.run
5.重启系统即可。
6.更改屏幕分辨率:
#vi /etc/X11/xorg.conf
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1024x768" "800x600" "640x480"
EndSubSection
1.启动CentOS,以root身份登录,进入桌面环境。
2.在virtualbox菜单中选择“设备-->安装增强功能”,会在桌面上出现一个“VBOXADDITIONS_3.1.2_56127”图标。
3.双击上述图标,打开文件窗口,选择“工具-->打开终端”菜单,进入终端模式。
4.执行如下命令:
#yum install kernel-devel //执行此命令提示有错误,忽略;
#yum install gcc //执行此命令提示有错误,忽略;
ln -s /usr/src/kernels/2.6.18-......-i686 /usr/src/linux //省略号处用TAB键补全
sh VBoxLinuxAdditions-x86.run
5.重启系统即可。
6.更改屏幕分辨率:
#vi /etc/X11/xorg.conf
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1024x768" "800x600" "640x480"
EndSubSection
fail2ban阻止vsftpd暴力攻击失败的对策
[ 2011/08/11 15:48 | by Sonic ]
Fail2ban is failing to ban VSFTPD bruteforce:
In my case with VSFTPD, with unresolvable DNS names from /var/log/secure:
Scenario: VSFTP configuration is set for PAM authentication, using xferlog in standard format. Fail2ban for vsftpd is watching /var/log/secure
Problem: PAM sends failed login information to /var/log/secure, but the remote server's IP address has been replaced by a DNS name. Resulting DNS name does not resolve or does not resolve correctly, thus fail2ban is unable to ban the IP address.
Fix: Configure VSFTP for "dual_log_enable=YES", and have fail2ban watch /var/log/vsftpd.log instead. This log file shows the incoming ip address instead of the DNS name.
[ update: you also need to adde'use_localtime=YES' to config file of VSFTPD. otherwise, above trick not working. it took me hours to solve the problem. :(]
Source and more tips.
In my case with VSFTPD, with unresolvable DNS names from /var/log/secure:
Scenario: VSFTP configuration is set for PAM authentication, using xferlog in standard format. Fail2ban for vsftpd is watching /var/log/secure
Problem: PAM sends failed login information to /var/log/secure, but the remote server's IP address has been replaced by a DNS name. Resulting DNS name does not resolve or does not resolve correctly, thus fail2ban is unable to ban the IP address.
Fix: Configure VSFTP for "dual_log_enable=YES", and have fail2ban watch /var/log/vsftpd.log instead. This log file shows the incoming ip address instead of the DNS name.
[ update: you also need to adde'use_localtime=YES' to config file of VSFTPD. otherwise, above trick not working. it took me hours to solve the problem. :(]
Source and more tips.
CentOS安装Socks5
[ 2011/08/09 13:51 | by Sonic ]
1.配置编译环境
2.安装socks5必要的包
3.下载,编译安装ss5(socks5)
可以通过修改 /etc/opt/ss5/ss5.conf 设置密码
# SHost SPort Authentication
#
auth 0.0.0.0/0 - -
# SHost SPort Authentication
#
auth 0.0.0.0/0 - u
在 /etc/opt/ss5/ss5.passwd 中添加 用户名和密码 如:
admin 123456
使用用户验证,重启ss5服务
/etc/init.d/ss5 start
2.安装socks5必要的包
yum -y install gcc automake make
yum -y install pam-devel openldap-devel cyrus-sasl-devel
yum -y install pam-devel openldap-devel cyrus-sasl-devel
3.下载,编译安装ss5(socks5)
wget http://disk.boluo.org/linux/27001-ss5-3.6.1-1.tar.gz
tar zxvf 27001-ss5-3.6.1-1.tar.gz
cd ss5-3.6.1
./configure
make
make install
tar zxvf 27001-ss5-3.6.1-1.tar.gz
cd ss5-3.6.1
./configure
make
make install
可以通过修改 /etc/opt/ss5/ss5.conf 设置密码
# SHost SPort Authentication
#
auth 0.0.0.0/0 - -
# SHost SPort Authentication
#
auth 0.0.0.0/0 - u
在 /etc/opt/ss5/ss5.passwd 中添加 用户名和密码 如:
admin 123456
使用用户验证,重启ss5服务
/etc/init.d/ss5 start
CentOS中预设服务简介及精简建议
[ 2011/07/25 15:38 | by Sonic ]
安装iftop流量监控工具
[ 2011/07/14 12:21 | by Sonic ]
yum install libpcap-devel ncurses-devel
yum install gcc
wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
tar xvzf iftop-0.17.tar.gz
cd iftop-0.17
./configure -prefix=/usr/local
make ; make install
iftop -n -i eth0
安装cband控制apache流量
[ 2011/05/17 14:01 | by Sonic ]
wget http://cband.linux.pl/download/mod-cband-0.9.7.4.tgz
tar xzvf mod-cband-0.9.7.4.tgz
cd mod-cband-0.9.7.4
./configure
make
make install
tar xzvf mod-cband-0.9.7.4.tgz
cd mod-cband-0.9.7.4
./configure
make
make install
configure之前,可能提示没有apx2。需要先yum install httpd-devel。此时确保Testing.repo关闭。
The make install command should have added the mod_cband module to /etc/apache2/httpd.conf. Run
vi /etc/apache2/httpd.conf
and check if you find a line like this:
LoadModule cband_module /usr/lib/apache2/modules/mod_cband.so
(If you don't find this line, add it yourself.)
Writing to this will cause the kernel to drop clean caches, dentries and
inodes from memory, causing that memory to become free.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation and dirty objects are not freeable, the
user should run `sync' first.
/proc/sys/vm/drop_caches的值,默认为0
简单说,清除系统对内存的cache,使用root做下面几步:
inodes from memory, causing that memory to become free.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation and dirty objects are not freeable, the
user should run `sync' first.
[root@server test]# cat /proc/sys/vm/drop_caches
0
0
/proc/sys/vm/drop_caches的值,默认为0
简单说,清除系统对内存的cache,使用root做下面几步:
sync; echo 3 > /proc/sys/vm/drop_caches
sync; echo 0 > /proc/sys/vm/drop_caches
sync; echo 0 > /proc/sys/vm/drop_caches
CentOS Squid Server 安装配置
[ 2011/04/14 16:38 | by Sonic ]
Squid是一个缓存internet数据的一个软件,它接收用户的下载申请,并自动处理所下载的数据。也就是说,当一个用户象要下载一个主页时,它向 Squid发出一个申请,要Squid替它下载,然后Squid 连接所申请网站并请求该主页,接着把该主页传给用户同时保留一个备份,当别的用户申请同样的页面时,Squid把保存的备份立即传给用户,使用户觉得速度相当快。
Squid代理服务器加密码验证
[ 2011/04/14 16:27 | by Sonic ]
需要用到htpasswd,这个是apahe自带。
还需要用到ncsa_auth,这个Squid自带。
sudo htpasswd -c /etc/squid/squid_passwd test
然后在/etc/squid.conf下加入:
在acl那堆配置里最后一行加入
在http_access那堆里最上一行加入
还需要用到ncsa_auth,这个Squid自带。
sudo htpasswd -c /etc/squid/squid_passwd test
然后在/etc/squid.conf下加入:
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd
在acl那堆配置里最后一行加入
acl ncsa_users proxy_auth REQUIRED
在http_access那堆里最上一行加入
http_access allow ncsa_users
分析SELinux日志,排除SELinux疑难
[ 2010/11/09 16:40 | by Sonic ]
你终有一天会被 SELinux 阻止你访问所需的东西,而且要解决这个问题。SELinux 拒绝某个文件、进程或资源被访问的基要原因有数个:
1 一个被错误标签的文件
2 一个进程在错误的 SELinux 安全性脉络下运行
3 政策出错。某个进程要访问一个在编写政策时意料不到的文件,并产生错误信息
4 一个入侵的企图。
头三个情况我们可以处理,而第四个正正是预期的表现。
1 一个被错误标签的文件
2 一个进程在错误的 SELinux 安全性脉络下运行
3 政策出错。某个进程要访问一个在编写政策时意料不到的文件,并产生错误信息
4 一个入侵的企图。
头三个情况我们可以处理,而第四个正正是预期的表现。
Centos5.4 搭建LAMP环境
[ 2010/11/09 08:47 | by Sonic ]
又在折腾CentOS,以前记住的到了再次用的时候又忘了。再次总结记录一下。
1、 安装纯净系统Centos5.4,不安装任何组件;
2、 更新系统yum update -y
3、 安装VSFTP软件 yum install vsftpd -y
4、 安装MYSQL yum install mysql-server -y
5、 安装Apache2 yum install httpd -y
1、 安装纯净系统Centos5.4,不安装任何组件;
2、 更新系统yum update -y
3、 安装VSFTP软件 yum install vsftpd -y
4、 安装MYSQL yum install mysql-server -y
5、 安装Apache2 yum install httpd -y




