没什么好介绍的!穷屌丝一个~
分类: LINUX
2007-01-08 10:53:43
饱受Linux服务器被攻击之苦,一直想把自己做的代理服务器小型化,使别人攻进去了也没法做搞破坏,最好的好处就是硬盘或系统挂了只需克隆配置就OK,
一。.PPPOE
1.内核选项
CONFIG_PPP=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=y
CONFIG_PPPOE=y
CONFIG_N_HDLC=y
2./dev的设备文件
/dev/ppp文件,创建方法:mknod --mode=664 /dev/ppp c 108 0
chmod 600 /dev/ppp
3.下载最新的PPP软件,pppd2.4.2然后编译
4.下载最新的rp-pppoe,编译时配置如下:./configure --enable-plugin=$PPPDIR
$PPPDIR的目录是刚才编译PPP的目录
5.编辑/etc/ppp/pppoe.conf文件,加入:LINUX_PLUGIN=/etc/ppp/plugins/rp-pppoe.so
6.然后再adsl-setup
7.说明:
A.pap-secrets文件是用户名与密码,CHAP认证的是/etc/PPP/chap-secrets文件
B./etc/PPP/PPPOE.conf文件需要更改
8.安装后文件:
/usr/sbin/PPPOE
/usr/sbin/PPPOE-server
/usr/sbin/PPPOE-sniff
/usr/sbin/PPPOE-relay
/usr/sbin/adsl-connect
/usr/sbin/adsl-start
/usr/sbin/adsl-stop
/usr/sbin/adsl-setup
/usr/sbin/adsl-status
二。NETWORK and NETFILTER
1.内核选项
Block devices
[*]loopback device support
[*]RAM disk support
Networking options
[*]Network Packet filtering (replaces ipchains)
IP:Netfilter configuration (下面的都编译到内核)
File systems
[*]Compressed ROM file system support
[*]Ext3 journalling file system support
三。使用可压缩的文件系统
1.将需要制成压缩的目录打包: mkcramfs opt opt.cramfs
2.挂载: mount -o loop -t cramfs opt.cramfs /opt
3.释放:cramfsck -x 目录
4.内核需要:
Block devices
[*]Loopback device support
File systems
[*]Compressed ROM file system support
四。使用RAMDISK
1.创建: mkdir /tmp/RamDisk0
mke2fs /dev/ram0
mount /dev/ram0 /tmp/RamDisk0
2.内核选项:Block devices ---> [*]RAM disk support
A。使用编译进内核时传递给内核ramdisk_size=10000即可改变ramdisk的大小。
B。使用模组时在加载时更改大小:/etc/conf.modules
options rd rd_size=10000
C。在插入模组时加载:insmod rd rd_size=10000
五。系统启动
1.必要的目录
install -d {bin,boot,dev/pts,etc/{init.d,network},proc,lib,mnt}
install -d {sbin,usr/local,var/{log,run},opt}
install -d root -m 0750
install -d tmp /var/tmp -m 1777
install -d usr/{bin,include,lib,sbin,share,src}
2.必要的设备文件
mknod -m 622 console c 5 1
mknod -m 666 null c 1 3
mknod -m 666 zero c 1 5
mknod -m 666 ptmx c 5 2
mknod -m 666 tty c 5 0
mknod -m 666 tty0 c 4 0
mknod -m 666 tty1 c 4 1
mknod -m 666 tty2 c 4 2
mknod -m 666 tty3 c 4 3
mknod -m 666 tty4 c 4 4
mknod -m 666 tty5 c 4 5
mknod -m 666 tty6 c 4 6
mknod -m 444 random c 1 8
mknod -m 444 urandom c 1 9
mknod -m 660 hda b 3 0
mknod -m 660 hda1 b 3 1
mknod -m 660 hdb b 3 64
mknod -m 660 hdb1 b 3 65
mknod --mode=664 /dev/ppp c 108 0
chmod 600 /dev/ppp
install -d /dev/loop
for i in 0 1 2 3 4 5 6 7;
do mknod /dev/loop/$i b 7 $i
done
chown root:tty {console,ptmx,tty}
chown root:tty tty?
chown root:disk {hda,hda1,hdb,hdb1}
MAKEDEV -v mem
MAKEDEV -v kmem
MAKEDEV -v ram
3.启动的文件
/etc/fstab
/dev/hda1 / ext3 rw,defaults 1 1
proc /proc proc defaults 0 0
none /dev/pts devpts defaults 0 0
/etc/inittab
::sysinit:/etc/init.d/rcS
tty1::respawn:-/bin/sh
tty2::askfirst:-/bin/sh
::ctrlaltdel:/bin/umount -a -r
/etc/init.d/rcS
#!/bin/sh
/bin/mount -a
/bin/mount /dev/hda1 / -o remount,rw
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
klogd
syslogd
/etc/nsswitch.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
/etc/resolv.conf
nameserver 202.103.0.117
/etc/hostname
Gateway
/etc/hosts
127.0.0.1 localhost
/etc/protocols
/etc/services
/etc/ld.so.conf
/etc/termcap