LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: weixiao

RH7.3最终汉化实例与RedHat软件设置

[复制链接]
发表于 2005-5-20 16:15:10 | 显示全部楼层

tripwire 实例

============Tripwire 配置实例==============

..每次登录系统root帐户都收到信件,内容如下,很不爽,决定探索一下。


=1。打开信件:

------------------------------------------
Message 40:
From root  Tue Mar 22 14:00:12 2005
Date: Tue, 22 Mar 2005 14:00:12 +0800
From: root@localhost.localdomain (Anacron)
To: root@localhost.localdomain
Subject: Anacron job 'cron.daily'

/etc/cron.daily/tripwire-check:

****    Error: Tripwire database for localhost.localdomain not found.    ****
**** Run /etc/tripwire/twinstall.sh and/or tripwire --init. ****
------------------------------------------

#rpm -q tripwire
tripwire-2.3.1-10

#rpm -ql tripwire|head
/etc/cron.daily/tripwire-check
/etc/tripwire
/etc/tripwire/twcfg.txt
/etc/tripwire/twinstall.sh
/etc/tripwire/twpol.txt
/usr/sbin/siggen
/usr/sbin/tripwire
/usr/sbin/twadmin
/usr/sbin/twprint
............................

#more /etc/cron.daily/tripwire-check
----------------------------------------------------
#!/bin/sh
HOST_NAME=`uname -n`
if [ ! -e /var/lib/tripwire/${HOST_NAME}.twd ] ; then
        echo "****    Error: Tripwire database for ${HOST_NAME} not found.    ****"
        echo "**** Run "/etc/tripwire/twinstall.sh" and/or "tripwire --init". ****"
else
        test -f /etc/tripwire/tw.cfg &&  /usr/sbin/tripwire --check
fi
-----------------------------------------------------
..tripwire-check shell内容是检查tripwire是否初始化,用/etc/tripwire/tw.cfg加密文件作判断。

#ls -F /etc/tripwire/
twcfg.txt  twinstall.sh*  twpol.txt

..twcfg.txt 是配置文件,包含配置时变量。如:SITEKEYFILE为远程密钥,LOCALKEYFILE用来加密数据库的本地密钥。LOOSEDIRECTORYCHECKING设置为ture时会去掉一些相同报告。SYSLOGREPORTING默认不作日志记录。


=2。设置密钥:

#/etc/tripwire/twinstall.sh
..................
Creating key files..
..................
Enter the site keyfile passphrase:**********
Verify the site keyfile passphrase:**********
Generating key (this may take several minutes)..
..................
Enter the local keyfile passphrase:**********
Verify the local keyfile passphrase:**********
Generating key (this may take several minutes)..
..................
Please enter your site passphrase:**********
..................

#ls /etc/tripwire
localhost.localdomain-local.key  tw.cfg     twinstall.sh  twpol.txt
site.key                         twcfg.txt  tw.pol


=3。若想修改twcfg.txt配置,如下:

#vi /etc/tripwire/twcfg.txt

#/usr/sbin/twadmin -m F -S /etc/tripwire/site.key /etc/tripwire/twcfg.txt

Please enter your site passphrase: **********
Wrote configuration file: /etc/tripwire/tw.cfg


=4。显示配置变量:

#/usr/sbin/twadmin -m f

..可以把twcfg.txt,twpol.txt删除,twadmin命令可再恢复(详细请看帮助文档)

#rm /etc/tripwire/twcfg.txt
#/usr/sbin/twadmin -m f > /etc/tripwire/twcfg.txt


=5。/etc/tripwire/tw.pol为策略文件,策略配置文件twpol.txt包含一些需要取指纹的文件和目录。

..举例说明变量属性:
#more /etc/tripwire/twpol.txt
#grep home /etc/tripwire/twpol.txt
  /home    -> $(SEC_INVARIANT) (recurse = 0) ;

#grep 'SEC_INVARIANT =' /etc/tripwire/twpol.txt
SEC_INVARIANT = +tpug ;

+tpug 属性是指对/home目录的文件类型,权限,用户ID,组ID取指纹。


=6。建立数据库,tripwire初始化:(3,4,5步骤可省略)

#/usr/sbin/tripwire --init
.........................
.........................
Wrote database file: /var/lib/tripwire/localhost.localdomain.twd
The database was successfully generated.

=7。RH系统对tripwire比较模式自动化怎样设置?

#more /etc/crontab
----------------------------------------------
..............
02 4 * * * root run-parts /etc/cron.daily
.............
----------------------------------------------

[注:每天4点02分以root身份执行/etc/cron.daily目录下所有文件]

这篇实例文档是遇到问题进行摸索,要对tripwire认识透彻,参考资料文档。


=8。修改策略配置文件twpol.txt,适合自己系统:

..策略文件是把文件,目录或设备配建‘指纹’,使tripwire执行比较模式时有规可随。那当策略文件中所标识文件,目录或设备,系统还没存在,就是更新数据库后也反映错误信息,解决办法是在策略文件中把不存在的注释掉。

#tripwire -m c &> /tmp/tripwire.test
#more /tmp/tripwire.test
--------------------------------------------
.....................
.....................
154. File system error.
     Filename: /root/.xsession-errors
     No such file or directory
.....................
--------------------------------------------

..[/root/.xsession-errors是要在策略文件准备注释掉的object_name]


#awk '/[^#][[:space:]]Filename:/{print $2}' /tmp/tripwire.test >/tmp/wei.test

#wc -l /tmp/wei.test
154 /tmp/wei.test

..[有154个object_name要注释]

把twpol.txt备份
#cp /etc/tripwire/twpol.txt /root/twpol.txt

#for file in $(cat /tmp/wei.test);do grep $file /root/twpol.txt &> /dev/null || echo "$file can't in twpol.txt" ;done

----------------------------------------------------
/etc/tripwire/localhost-local.key can't in twpol.txt
----------------------------------------------------

..[154个object_name中localhost-local.key文件需要关注]

办法 : 手工注释掉
#vi /etc/tripwire/twpol.txt

..[注:把154个object_name注释掉。注意localhost-local.key是对应$(TWLKEY)/$(HOSTNAME)-local.key,这种情况是/etc/tripwire/localhost-local.key 不存在, 通常是主机名有改动所致, 在twpol.txt 中把条目 HOSTNAME=xxxxxxxx 修改 ; 或者直接注释掉 ]


#twadmin -m p /etc/tripwire/twpol.txt

..[对修改过的策略文件进行语法检测,检测成功会提示输入密钥。注:检测总不成功,只好从头来干。]

#rm /etc/tripwire/*.key
#rm /etc/tripwire/{tw.cfg,tw.pol}
#/etc/tripwire/twinstall.sh
#tripwire --init

#tripwire -m c

..[应该相似的错误信息没了,如果不想每次都检测出相同报告,要更新数据库。先在/var/lib/tripwire/report/目录找最新报告文件,如:localhost.localdomain-20050330-155508.twr]

#tripwire -m u -r /var/lib/tripwire/report/localhost.localdomain-20050401-155508.twr

..[进入编辑器,(X)代表要更新文件,( )文件不作更新。选择后 :wq 保存退出。]


=9。若觉得自动检测麻烦,可改手动:

..把/etc/cron.daily目录下tripwire-check文件mv。有时间就tripwire -m c 进行手动检测。

..本人把每天检测改为每周检测 :
# mv /etc/cron.daily/tripwire-check /etc/cron.weekly/


..[注:tripwire -m c 后显示报告中一条 File System and Disk Administraton Programs ,Administraton单词评错. 实例中还有没解决的,请各位指点!]

-----
-----
回复 支持 反对

使用道具 举报

发表于 2005-5-21 11:35:14 | 显示全部楼层
--
######使用twm #########

1. 清楚了解twm 配置情况, 先新建一个帐户:

# su -
# useradd idealbro
# passwd idealbro

2. 用新帐户名重新登录控制台, 把startx默认登录窗口为twm
$ pwd
/home/idealbro

$ switchdesk twm
$ su -

# cp /etc/X11/twm/system.twmrc ./.twmrc
# cp /etc/X11/xinit/xinitrc /home/idealbro/.xinitrc
# chown idealbro:idealbro  /home/idealbro/.twmrc
# chmod +w /home/idealbro/.twmrc
# exit

3. 尝试配置twm

$ vi ./.Xclients-default
----------------------------------
#!/bin/bash
# (c) 2000 Red Hat, Inc.
# add-->时钟
xclock -geometry 100x100-5+5 &

exec /usr/X11R6/bin/twm
----------------------------------

4. 修改 twm 菜单, 加入程序

$ vi .twmrc
----------------------------------
.................................
"Xterm"         f.exec "exec xterm &"
""              f.nop
"terminal"      f.exec "exec gnome-terminal --use-factory --start-factory-server &"
"geit"          f.exec "gedit &"
"mozilla"       f.exec "mozilla &"
""              f.nop
"Kill"          f.destroy
.................................
----------------------------------
5. 运行 twm 窗口

$ startx

6.在桌面按住鼠标左键, 自己摸索!!

[ 注: 觉得gnome 桌面上自己使用的都是几个程序, 不如用twm ]

[ 注: gnome 和 twm 都是桌面系统, 功能是管理窗口( 软件的显示界面 ),
两者占用资源相差不大, 主要软件使用方面. ]
--

---
回复 支持 反对

使用道具 举报

发表于 2005-5-24 16:12:20 | 显示全部楼层

如何用shell获得硬件信息?

--
--
如何用shell获得硬件信息?

特别是下面的一些任务:
1:列出所有的硬件信息
2:查看cpu使用率
3:查看内存和swap的用量
4:查看当前系统中所有的进程
5:查看当前系统中特定用户的私有进程
6:监视网络流量


$ su -
# [ -d /root/bin ] || mkdir /root/bin

# cd /root/bin
# vi wei-sys.sh
-------------------------------------------------------
#!/bin/bash

if lspci &> /dev/null ;then
:
else
echo "权限不够: su -"
exit
fi

if [ "$1" = "-help" ] ;then
echo "-help 显示各选项: "
echo "-pci  列出所有的硬件信息"
echo "-cpu  查看cpu使用率"
echo "-mem  查看内存和swap的用量"
echo "-pro   all process-当前系统中所有的进程"
echo "-pro  (account) 当前系统中特定用户的私有进程"
echo "-i     监视网络流量"
fi

case "$1" in
-pci) echo "列出所有的硬件信息"
lspci
;;
-cpu) echo "查看cpu使用率"
top|grep '^CPU'
;;
-mem)
while true
do
clear
echo "查看内存和swap的用量"
free -o -k -t
sleep 2
done
;;
-pro)
if [ "x$2" = "x" ];then
echo "当前系统中所有的进程"
ps aux
else
echo "当前系统中 $2 的私有进程"
ps aux|grep "^$2[[:space:]]"
fi
;;
-i)
while true
do
clear
echo
echo -e "\t\t接收流量\t\t发送流量\n"
ifconfig|grep -B 4 'Interrupt'|grep "RX.*TX"
sleep 2
done
;;
esac
----------------------------------------------------

# chmod 700 /root/bin/wei-sys.sh

例子:
若帐户名为 sssss

# /root/bin/wei-sys.sh -help
# wei-sys.sh -pci

当前系统中特定用户的私有进程
# /root/bin/wei-sys.sh -pro sssss

监视网络流量
# /root/bin/wei-sys.sh -i

ctrl_C (中断)

--
--
回复 支持 反对

使用道具 举报

发表于 2005-5-24 16:33:32 | 显示全部楼层
预装 ext3 现改成ext2 文件系统

# vi /etc/grub.conf
------------------------------------------------------
...............
...............
        root (hd0,6)
        kernel /boot/vmlinuz-2.4.18-3 ro root=/dev/hda7
#        initrd /boot/initrd-2.4.18-3.img
...............
...............
-------------------------------------------------------

# vi /etc/fstab
-------------------------------------------------------
LABEL=/      /        ext3    defaults         1 1
改成:
LABEL=/      /        ext2    defaults         1 1
-------------------------------------------------------

然后重新启动

--
--
回复 支持 反对

使用道具 举报

发表于 2005-5-26 08:42:11 | 显示全部楼层

galeon 使用

--
1. 如设置 galeon 后, 重新打开galeon 发现选项里没有改变, 如字体.

$ more  $HOME/.galeon/mozilla/galeon/prefs.js

已经设置了. [ 注: 最好把mozilla先设置 ]

如果总觉得选项里的字体每次打开被改为其它的 ,
把 Autodetect 打开 , 设置如下 :

-----------------------------------------------------
语言--->字符集

Autodetect |中文| , 默认编码: |GBK|

语言添加 : 中文(zh) , 并把这项目放在开头 .
-----------------------------------------------------

2. 上网时, CTRL+T 打开活页 . 还有很多贴身功能 !

3. 128M 内存用 galeon 冲浪很稳定 .

4.  查看过 galeon faq , galeon 正常运作内存要在 80M 以上 ,
如果不是专心浏览图片的话, 可作以下设置:

菜单栏----设置 :

下载图片----From current server only
Animate images----总播放一次

--
--
回复 支持 反对

使用道具 举报

发表于 2005-5-26 13:34:04 | 显示全部楼层
太强了~~~楼主能把RH7.3调教到这个程度,绝对高人哪~~~
回复 支持 反对

使用道具 举报

发表于 2005-6-4 15:05:57 | 显示全部楼层
--
--
########### 制作中文man ############

1. 构思: 收集linux命令编辑成unix文件格式. 若在windowns下编辑的, 用dos2unix命令转换, 这里文件名为 man-shell . 然后用 awk 范围模板进行查询 .

假如:
$ head -18 $HOME/wman/man-shell
name bye
功能说明:中断FTP连线并结束程序。
语  法:bye
补充说明:在ftp模式下,输入bye即可中断目前的连线作业,并结束ftp的执行。
----------------------------------------------
name ftp
(file transfer protocol)
功能说明:设置文件系统相关功能。
语  法:ftp [-dignv][主机名称或IP地址]

补充说明:FTP是ARPANet的标准文件传输协议,该网络就是现今Internet的前身。
参  数:
  -d   详细显示指令执行过程,便于排错或分析程序执行的情形。
  -i   关闭互动模式,不询问任何问题。
  -g   关闭本地主机文件名称支持特殊字符的扩充特性。
  -n   不使用自动登陆。
  -v   显示指令执行过程。
----------------------------------------------------------

要显示 ftp 文档:
$ awk '/^name ftp$/,/---------/' $HOME/wman/man-shell

2. 实例:

若无bin目录的, 创建一个:
$ [ -d $HOME/bin ] || mkdir $HOME/bin
$ cd
$ pwd
$ mkdir wman

把编辑好的man文件集复制到 $HOME/wman 目录下
$ cp man-shell ./wman/

进入 bin 目录 编写脚本:
$ cd $HOME/bin

$ vi wman
---------------------------------------
#!/bin/bash
# 很多时, 都是查询同一个命令, 做暂存文件可方便查询
# redhat 对/tmp 目录下文件定时清除

if [ -f /tmp/$1.mantmp ]
then
more /tmp/$1.mantmp
exit
fi

if grep "^name $1\$" $HOME/wman/man-shell &> /dev/null
then
:
else
echo "没有 $1 命令 "
exit
fi

# more 浏览长文档时, 开头两行有时看不到
echo "############# $1 中文man ##############" > /tmp/$1.mantmp
echo "" >> /tmp/$1.mantmp

# 制作传递变量的文件
echo "/^name $1\$/,/----------/" > /tmp/man.tmp

# 进行查询
awk -f /tmp/man.tmp $HOME/wman/man-shell >> /tmp/$1.mantmp
echo "############# $1 中文man ##############" >> /tmp/$1.mantmp

# 显示文档
more /tmp/$1.mantmp
-------------------------------------------

$ chmod +x wman
$ cd

尝试:
$ wman ftp

==========================
附件安装:
$ cp wman.tar.gz $HOME/
$ cd
$ tar zxvf wman.tar.gz
$ more ./wman/man-note

$ cd ./wman
$ ./INSTALL

例子:
$ wman cp

root也可使用的法子:

$ su -
passwd:


# mv /home/[帐户名]/bin/wman   /usr/local/bin/


例子:
# wman tree

--
--

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2005-6-8 19:52:10 | 显示全部楼层
--
--
--解决特殊情况下, 普通帐户启动不了如 Gnorpm 或 date/time properties 软件的问题 :

原因:装好系统后,root 没有亲自登陆X-windows .

解决方法:普通帐户登陆X-windows ,终端操作如下:
$ su -

# [ -f /root/.gnome ] && mv /root/.gnome /root/.gnome-bak

把普通帐户目录下.gnome目录复制到/root/
# cp -a /home/[普通帐户名]/.gnome  /root/.gnome

现在试启动 Gnorpm 或 date/time properties

--
--
回复 支持 反对

使用道具 举报

发表于 2005-6-9 09:40:18 | 显示全部楼层
--
--
########试用 gnorpm ########

打开 Gnorpm 界面 :
gnome 桌面---主菜单---程序---system---Gnorpm

查看配置gnorpm选项 :
gnorpm 界面菜单栏 Operations ---Preferences (稍等)

preferences 界面 ---Package listing---选 view as list
---rpmfind---把http://www.redhat.com/RDF删除 (下次启动时不用稍等)
-->Apply-->ok

观看gnorpm界面 :
使用 gnorpm 菜单或工具栏可进行软件包的 install(安装), Uninstall(卸载), Query(查询), Verify(检验), Unselect(取消选择), Find(查找), Web find(网站查找) . 已安装的软件包显示在 gnorpm 窗口左侧的图形化层次树里面 . 点击层次树里的项目 , 那项目组的软件包会显示在主窗口里 . 右击主窗口里的软件可作 Query, Uninstall 或 Verify .

Unselect 用法 :
在主窗口按 [ctrl]/[shift] 点击多个软件时可作多重选择, Gnorpm 底下状态栏显示选择的数目, 取消时按 'Unselect' 按钮 .

install 用法 :
放进光盘 , 按install按钮, 进入安装界面 :
gnorpm自动把光盘里默认路径下软件分配到Name窗口, 只要点击相关软件后, 点击install 按钮, 可进行安装 ,查询, 升级, 检验数字签名 . [ my 在 Applications--Publishing , 安装 ggv 软件 ]

find 用法 :
进入find界面--->find packages that |match label| |ggv| find
顺利查找后, 在主窗口点击软件名, 可作进一步查询和检验 .其中'find packages that' 选项可用 mozilla 作试验find .

若有网友用过 gnorpm 软件可跟贴 .

[ 注: my 觉得gnorpm 只在卸载方面能解决文本下面的问题 . ]

--
--
回复 支持 反对

使用道具 举报

发表于 2005-6-9 10:01:25 | 显示全部楼层
########### 制作中文man ############

wman 是个好主意
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表