原创文章
Debian 5.04 第二天
四 24th
作者: reistlin 来源: reistlin.com 更新时间: 2010.04
版权: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要

Debian 5.04 安装常用软件包:
# 编译工具
apt-get install gcc make
# 系统工具
apt-get install vim aptitude lrzsz sudo rcconf modconf psmisc sysstat locate
# 远程管理
apt-get install openssh-server openssh-client openssl
# 压缩/解压缩工具
apt-get install bzip2 rar unrar zip unzip
# 网络工具
apt-get install curl dnsutils tcpdump vnstat iperf iftop dnstop snmp
Debian 5.04 系统初始化配置:
设置系统时区和时间:
# 北京时间
cp -a /usr/share/zoneinfo/Asia/Taipei /etc/localtime
# 小时:分钟
date -s HH:MM
关闭系统UTC同步:
vim /etc/default/rcS
# off UTC syn
UTC=no
关闭Linux System Beep声音:
vim /etc/profile
# off system beep
setterm -blength 0
vimrc 配置文件:
vim /etc/vim/vimrc
# 语法高亮
syntax on
# 搜索关键字高亮
set hlsearch
# 显示行号
set number
.bashrc 配置文件:
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
# history time
# 增加命令行历史记录2000行, 并且记录命令行执行时间
HISTFILESIZE=2000
HISTFILESIZE=2000
HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
export HISTTIMEFORMAT
Debian 5.04 第一天
四 24th
作者: reistlin 来源: reistlin.com 更新时间: 2010.04
版权: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要

Debian 5.04 台湾官方下载 (ISO):
[ftp://ftp.tw.debian.org/debian-cd/5.0.4/i386/iso-cd/debian-504-i386-CD-1.iso]
Debian 5.04 配置基本系统:
IP地址设置: /etc/network/interface
# 动态DHCP获得IP地址
# 启动系统激活设备
# Loop回环地址
auto lo
iface lo inet loopback
# 启动系统激活设备
# 网卡eth0设置为DHCP类型
auto eth0
iface eth0 inet dhcp
# 静态STATIC指定IP地址
# 启动系统激活设备
# Loop回环地址
auto lo
iface lo inet loopback
# 启动系统激活设备
# 网卡eth0设置为Static类型
auto eth0
iface eth0 inet static
# 指定IP地址.子网掩码.子网.广播.网关
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
重新启动网络服务:
/etc/init.d/networking restart
# 禁用网卡 eth0:
ifdown eth0
# 启用网卡 eth0:
ifup eth0
DNS服务器设置: /etc/resolv.conf
# Google DNS
dns-nameservers 8.8.8.8
dns-nameservers 8.8.4.4
# OpenDNS
dns-nameservers 208.67.222.222
dns-nameservers 208.67.220.220
主机名设置(1): /etc/hosts
127.0.0.1 localhost
192.168.0.1 hostname
主机名设置(2): /etc/hostname
hostname
apt-get 源: /etc/apt/sources.list
网易镜像 [http://mirrors.163.com]
搜狐镜像 [http://mirrors.sohu.com]
deb http://mirrors.163.com/debian/ lenny main non-free contrib
deb http://mirrors.163.com/debian/ lenny-proposed-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ lenny main non-free contrib
deb-src http://mirrors.163.com/debian/ lenny-proposed-updates main non-free contrib
deb http://mirrors.sohu.com/debian/ lenny main non-free contrib
deb http://mirrors.sohu.com/debian/ lenny-proposed-updates main non-free contrib
deb-src http://mirrors.sohu.com/debian/ lenny main non-free contrib
deb-src http://mirrors.sohu.com/debian/ lenny-proposed-updates main non-free contrib
apt-get 命令:
apt-get update 更新软件包列表
apt-get upgrade 更新所有软件包
apt-get dist-upgrade 更新所有软件包并且更新Release版本
apt-cache search
apt-cache show
apt-get install 安装指定软件包
apt-get remove 移除指定软件包(不移除配置文件)
apt-get purge 彻底移除软件包
apt-get autoremove 自动删除多余(没有依赖关系的)软件包
Redhat Enterprise Linux AS 升级 openssh 5.x
四 19th
适用于 RHEL 4.x / 5.x (Redhat Enterprise Linux AS) 以及 CentOS 4.x / 5.x. 无缝平滑升级 openssh. 可远程操作(不会断开 ssh 连接). 不用修改其他系统配置. 感谢 [BigYong] 指导
1, 下载 [openssh-5.4p1.tar.gz]
wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-5.4p1.tar.gz
2, 解压缩 / 配置 / 编译 / 安装
tar zxvf openssh-5.4p1.tar.gz
./configure –prefix=/usr \
–sysconfdir=/etc/ssh \
–with-ssl-dir=/usr/share/ssl \
–with-zlib \
–with-pam \
–with-md5-passwords \
–with-kerberos5 \# 编译
make# 编译安装
make install
3, 检查 openssh 版本
ssh -V
OpenSSH_5.4p1, OpenSSL 0.9.7a Feb 19 2003
4, 重新启动 sshd 服务
/etc/init.d/sshd restart
RSA SecurID 6.1 Linux Agent 配置手册
四 18th
作者: By REISTLIN [雷斯林] MSN: Rexxxxxx@hotmail.com QQ: 3A984
版权: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要.
RSA SecurID 6.1 Linux Agent (RSA Authentication Agent 5.3.4 for PAM) 配置手册
前言:
身份认证是信息安全的基础。如何证明身份有很多种方法,常见的身份认证手段就是密码,但是密码一般都是静态的。当密码泄露或传播后,就有可能导致基于密码身份认证方式的无效。从而引发各种安全风险,比如非法授权,越权,帐户生存周期不可控,审计结果虚假或无意义等等。因此,出现了采用动态密码的强身份认证技术,双因素认证体系。
RSA 公司介绍:
RSA是1977年由罗纳德·李维斯特(Ron Rivest)、阿迪·萨莫尔(Adi Shamir)和伦纳德·阿德曼(Leonard Adleman)一起提出的。当时他们三人都在麻省理工学院工作。RSA就是他们三人姓氏开头字母拼在一起组成的。
RSA 以信息为中心的安全保护做法能够在信息的整个生命周期中保护其完整性和机密性,不管信息移动到哪里,被谁访问,如何使用。RSA 在以下领域中提供了业界领先的解决方案:身份保证和访问控制、加密和密钥管理、法规遵从性和安全信息管理,以及欺诈保护。
2006年9月,RSA Security被EMC公司(1979年成立)收购,成为RSA,EMC安全事业部。收购RSA的同时,EMC还收购了Network Intelligence,为RSA带来了行业领先的信息安全和事件管理(SIEM)解决方案,并将其整合到RSA事业部。
RSA 双因素认证原理:
电子令牌,内置了电池和芯片,电池一般可用2-3年。芯片与RSA认证服务器采取同一种算法,并且与UTC时间相关联。电子令牌是通过种子文件(Token File,XML文件格式)导入到RSA认证服务器中,在同一个标准时间,令牌所显示的数字与RSA认证服务器所计算出来的数字是一致的。
电子令牌第一次使用,需要用户自己来创建一个属于自己的静态密码,称之为PIN码,PIN码会在RSA认证服务器上加密保存。当用户创建PIN码后,认证的最终过程为:用户的PIN码 + 电子令牌显示的动态密码。
这就是双因素的定义:你知道什么?+ 你拥有什么? = 你是谁!
RSA SecurID 6.1 Linux Agent 配置:
RSA Authentication Manager 6.1 可以安装在 Windows / Linux / UNIX 平台. 本文主要是配置安装 Linux 32bit/64bit 平台的 RSA Authentication Agent 5.3.4 for PAM. 关于 RSA Authentication Manager 6.1 服务器端的安装. 有兴趣可以关注 Reistlin.Com 后续文章.
1, 安装环境说明:
RSA Authentication Agent 支持众多 Linux 发行版: Redhat, Centos, Debian
这里我以 Red Hat Enterprise Linux AS release 4 (Nahant Update 7) 举例
openssh 版本必须 5.0p1 或更新, 推荐版本 [openssh-5.4p1.tar.gz]
openssl 版本必须 0.96 或更新, 推荐版本 [openssl-0.9.8n.tar.gz]
zlib 版本必须 1.2.1 或更新, 推荐版本 [zlib-1.2.4.tar.gz]
2, 检查安装环境:
操作系统:
uname -a Linux redhat.localdomain 2.6.9-78.EL #1 Wed Jul 9 15:27:01 EDT 2008 i686 i686 i386 GNU/Linux
openssh 版本:
ssh -V
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
openssl 版本:
openssl version -a
OpenSSL 0.9.7a Feb 19 2003
built on: Mon Oct 22 05:08:11 EDT 2007
platform: linux-elf
options: bn(64,32) md2(int) rc4(idx,int) des(ptr,risc1,16,long) blowfish(idx)
compiler: gcc -fPIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DKRB5_MIT -DOPENSSL_NO_IDEA -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_EC -I/usr/kerberos/include -DL_ENDIAN -DTERMIO -Wall -O2 -g -pipe -m32 -march=i686 -mtune=pentium4 -Wa,–noexecstack -DSHA1_ASM -DMD5_ASM -DRMD160_ASM
OPENSSLDIR: “/usr/share/ssl”
注意: OPENSSLDIR 在升级 openssh 编译参数中需要引用
3, 升级 openssh (如果 openssh 版本不是 5.0p1+, 需要升级)
升级指引: [ http://www.reistlin.com/blog/1122 ]
4, 安装 RSA Authentication Agent 5.3.4 for PAM
# 解压缩 AuthenticationAgent_534_PAM_263_030608.tar
tar xvf AuthenticationAgent_534_PAM_263_030608.tar# 执行 RSA Linux Agent 安装脚本
./install_pam.sh# 安装信息
ARE YOU A CUSTOMER ORDERING THIS RSA PRODUCT FROM RSA SECURITY INC., FROM EITHER NORTH AMERICA, SOUTH AMERICA OR THE PEOPLE’S REPUBLIC OF CHINA (EXCLUDING HONG KONG): (y/n) Y# 许可信息
LICENSE AGREEMENT*****************************************************
If Customer accepts the above License Terms and Conditions, please enter “A” for Accept. By selecting this acceptance option, Customer agrees to be bound by such License Terms and Conditions stated abo
ve.If Customer does not choose to be bound by the above License Terms and Conditions, please enter “D” for Decline and the installation procedure will terminate immediately. Please contact the party Custo
mer purchased this license from for refund and return information relating to the non-acceptance of the License Terms and Conditions.*****************************************************
# 同意 License 信息
Do you accept the License Terms and Conditions stated above? (Accept/Decline) [D] A# sdconf.rec 文件路径 (默认)
Enter Directory where sdconf.rec is located [/var/ace]# RSA Authentication Agent 安装路径 (默认)
Please enter the root path for the RSA Authentication Agent for PAM directory [/opt]# 开始安装
The RSA Authentication Agent for PAM will be installed in the /opt directory.
pam/
pam/doc/
pam/doc/PAMAgent.pdf
pam/lib/
pam/lib/pam_securid.so
pam/bin/
pam/bin/acestatus
pam/bin/acetest
\nChecking /etc/sd_pam.conf:\n
VAR_ACE does not exist – entry will be appended
ENABLE_GROUP_SUPPORT does not exist – entry will be appended
INCL_EXCL_GROUPS does not exist – entry will be appended
LIST_OF_GROUPS does not exist – entry will be appended
AUTH_CHALLENGE_USERNAME_STR does not exist – entry will be appended
AUTH_CHALLENGE_RESERVE_REQUEST_STR does not exist – entry will be appended
AUTH_CHALLENGE_PASSCODE_STR does not exist – entry will be appended
AUTH_CHALLENGE_PASSWORD_STR does not exist – entry will be appended*************************************************************
* You have successfully installed RSA Authentication Agent 5.3 for PAM
*************************************************************
附注:关于 RSA SecurID 的后续设置工作的文档,我会继续完善,有兴趣深入了解的请联系我:Reistlin.Com。
nginx error – 413 Request Entity Too Large
四 13th
nginx error – 413 Request Entity Too Large
client_max_body_size 10M;
Linode VPS PPTP VPN 配置
四 12th
作者: By REISTLIN [雷斯林] MSN: Rexxxxxx@hotmail.com QQ: 3A984
版权: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要.
前言:
中国第一封电子邮件的内容:“跨越长城,走向世界”
(Across the Great Wall We can reach every corner in the world)
正文:
[Linode] 是国外VPS (Virtual Private Server 虚拟专用服务器) 顶级服务商, 提供以 [Xen virtualization] 虚拟化技术平台为基础的服务. 通过使用虚拟化技术 (类似的解决方案还有: [VMWare ESXi] / [Citrix XenServer]), 将一台高性能的服务器 (裸机,不需要安装额外的操作系统) 虚拟化成若干台独立运行的虚拟服务器.
本文主要是阐述如何在 [Reistlin.Com] Linode VPS 上安装 [pptpd] 服务搭建 PPTP VPN。
如果您觉得本文对您有所帮助,并想购买 Linode VPS [360M内存, 16GB硬盘, 200GB流量/月 = $19.99/月],请点击 [链接]。
1, 安装:
apt-get install pptpd
2, 配置:
vim /etc/pptpd.conf
pptpd配置文件如下:
# 默认
option /etc/ppp/pptpd-options
# 默认
logwtmp# 第一次配置时开启debug, 用于排错, 配置完成后可注释.
debug# PPTP 服务器, 虚拟接口IP地址.
localip 172.16.254.1# PPTP 客户端拨号后, 分配的IP 地址池, 与 localip 需在同一子网。
remoteip 172.16.254.100-200
vim /etc/ppp/pptpd-options
pptpd选项配置如下:
# 默认
name pptpd
# 默认
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128# PPTP 客户端拨号后, 分配的DNS, 我写的是 [OpenDNS]
ms-dns 208.67.222.222
ms-dns 208.67.220.220# 默认
proxyarp
# 默认
nodefaultroute# [注意] 指定pptp.log文件路径
logfile /var/log/pptpd.log# 如果没有指定 pptpd.log 会报错:
GRE: read(fd=,buffer=,len=) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs# 默认
lock
# 默认
nobsdcomp# PPTP 客户端如果没有任何流量, 1小时自动断开拨号连接 (单位: 秒)
idle 3600
vim /etc/ppp/options
ppp选项配置文件 (默认):
asyncmap 0
auth
crtscts
lock
hide-password
modem
proxyarp
lcp-echo-interval 30
lcp-echo-failure 4
noipx
vim /etc/ppp/chap-secrets
pptp 用户名密码配置文件如下:
#用户名 / 密码 / pptpd类型 / IP地址
reistlin password pptpd *
3, 系统配置:
vim /etc/sysctl.conf
# 启用 IPv4 Forward 转发
net.ipv4.ip_forward=1
ipv4 转发配置生效:
sysctl -p
重新启动pptp服务:
/etc/init.d/pptpd restart
配置 iptables NAT规则:
/sbin/iptables -t nat -A POSTROUTING -s 172.16.254.0/24 -o eth0 -j MASQUERADE
备注:增加 /dev/ppp 设备 (解决 pptp 拨号 619 错误)
mknod /dev/ppp c 108 0
Linode VPS PPTP VPN 配置
四 12th
作者: By REISTLIN [雷斯林] MSN: Rexxxxxx@hotmail.com QQ: 3A984
版权: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要.
前言:
中国第一封电子邮件的内容:“跨越长城,走向世界”
(Across the Great Wall We can reach every corner in the world)
正文:

[Linode] 是国外VPS (Virtual Private Server 虚拟专用服务器) 顶级服务商, 提供以 [Xen virtualization] 虚拟化技术平台为基础的服务. 通过使用虚拟化技术 (类似的解决方案还有: [VMWare ESXi] / [Citrix XenServer]), 将一台高性能的服务器 (裸机,不需要安装额外的操作系统) 虚拟化成若干台独立运行的虚拟服务器.

本文主要是阐述如何在 [Reistlin.Com] Linode VPS 上安装 [pptpd] 服务搭建 PPTP VPN。
如果您觉得本文对您有所帮助,并想购买 Linode VPS [360M内存, 16GB硬盘, 200GB流量/月 = $19.99/月],请点击 [链接]。
1, 安装:
apt-get install pptpd
2, 配置:
vim /etc/pptpd.conf
pptpd配置文件如下:
# 默认
option /etc/ppp/pptpd-options
# 默认
logwtmp# 第一次配置时开启debug, 用于排错, 配置完成后可注释.
debug# PPTP 服务器, 虚拟接口IP地址.
localip 172.16.254.1# PPTP 客户端拨号后, 分配的IP 地址池, 与 localip 需在同一子网。
remoteip 172.16.254.100-200
vim /etc/ppp/pptpd-options
pptpd选项配置如下:
# 默认
name pptpd
# 默认
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128# PPTP 客户端拨号后, 分配的DNS, 我写的是 [OpenDNS]
ms-dns 208.67.222.222
ms-dns 208.67.220.220# 默认
proxyarp
# 默认
nodefaultroute# [注意] 指定pptp.log文件路径
logfile /var/log/pptpd.log# 如果没有指定 pptpd.log 会报错:
GRE: read(fd=,buffer=,len=) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs# 默认
lock
# 默认
nobsdcomp# PPTP 客户端如果没有任何流量, 1小时自动断开拨号连接 (单位: 秒)
idle 3600
vim /etc/ppp/options
ppp选项配置文件 (默认):
asyncmap 0
auth
crtscts
lock
hide-password
modem
proxyarp
lcp-echo-interval 30
lcp-echo-failure 4
noipx
vim /etc/ppp/chap-secrets
pptp 用户名密码配置文件如下:
#用户名 / 密码 / pptpd类型 / IP地址
reistlin password pptpd *
3, 系统配置:
vim /etc/sysctl.conf
# 启用 IPv4 Forward 转发
net.ipv4.ip_forward=1
ipv4 转发配置生效:
sysctl -p
重新启动pptp服务:
/etc/init.d/pptpd restart
配置 iptables NAT规则:
/sbin/iptables -t nat -A POSTROUTING -s 172.16.254.0/24 -o eth0 -j MASQUERADE
备注:增加 /dev/ppp 设备 (解决 pptp 拨号 619 错误)
mknod /dev/ppp c 108 0
CheckPoint SmartDefense – DCE-RPC Enforcement Violation (Kingdee)
二 7th
问题:
CheckPoint NGX R65 SmartDefense Update以后,会阻止DCE-RPC,导致金蝶(Kingdee)客户端无法连接。
日志:
Attack Name: DCE-RPC Enforcement Violation
Attack Information: UUID is not allowed through the Rule Base
解决:
Solution
In the SmartDefense settings, select the DCOM option found under MS-RPC in Application Intelligence. Check the box that says “Allow DCE-RPC interfaces other than End-Point Mapper (such as DCOM) on port 135″ and then push the policy to the affected module.
参考:
Solution ID: sk41208
https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk41208
pfSense 设置自动启动 crontab 脚本
十二 18th
pfSense 1.2 版本在增加 PPTP 用户的时候会 Reload 相关配置信息,导致已经拨号的 PPTP 用户会话中断,需要重新连接。这非常影响用户正常使用及日常管理,所以选择了一个临时的解决方法:每次增加用户后,用户名和密码其实已经写入到了配置文件中,只是没有应用。所以,先不点 Apply,等到非工作时间,自动重新启动 pfSense 系统。

解决办法:
1,Diagnostics -> Backup/Restore -> Download configuration 下载配置文件。
2,编辑配置文件,在 <cron></cron> 标签内增加:
<item>
<minute>00</minute>
<hour>06</hour>
<mday>*</mday>
<month>*</month>
<wday>*</wday>
<who>root</who>
<command>/sbin/reboot</command>
</item>
保存后再 Restore configuration 即可,以后每天 AM 6:00 会自动重新启动系统。

