rsync - Linux Security Cookbook - Recipe 1.16 Integrity Checking with rsync

 

rsync - Linux Security Cookbook - Recipe 1.16 Integrity Checking with rsync

Recipe 1.16 Integrity Checking with rsync

1.16.1 Problem

You want to snapshot and check your files but you can't use Tripwire. You have lots of disk space on a remote machine.

1.16.2 Solution

Use rsync to copy your important files to the remote machine. Use rsync again to compare the copies on the two machines.

1.16.3 Discussion

Let trippy and trusty be your two machines as before. You want to ensure the integrity of the files on trippy.

  1. On trippy, store the rsync binary on a CD-ROM mounted at /mnt/cdrom.

  2. On trusty, copy the files from trippy:

    trusty# rsync -a -v --rsync-path=/mnt/cdrom/rsync --rsh=/usr/bin/ssh /
    trippy:/ /data/trippy-backup
  3. Check integrity from trusty:

    trusty# rsync -a -v -n --rsync-path=/mnt/cdrom/rsync --rsh=/usr/bin/ssh /
    trippy:/ /data/trippy-backup

The first rsync actually performs copying, while the second merely reports differences, thanks to the -n option. If there are no differences, the output will look something like this:

receiving file list ... done
wrote 16 bytes read 7478 bytes 4996.00 bytes/sec
total size is 3469510 speedup is 462.97

but if any files differ, their names will appear after the "receiving file list" message:

receiving file list ... done
/bin/ls
/usr/sbin/sshd
wrote 24 bytes read 7486 bytes 5006.67 bytes/sec
total size is 3469510 speedup is 461.99

Any listed files—in this case /bin/ls and /usr/sbin/sshd—should be treated as suspicious.

This method has important limitations, most notably that it does not check inode numbers or device numbers. A real integrity checker is better.

1.16.4 See Also

rsync(1).

[相关问题]

全局常用配置说明

模块常用配置说明

客户端常用参数

for Windows (cygwin)

远程shell模式和rsync守护进程模式

22.6. File Synchronization. Building Internet Firewalls, 2nd Edition

Hack 92 Mirroring Web Sites with wget and rsync. Spidering Hacks

Linux Security Cookbook - Recipe 1.16 Integrity Checking with rsync

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值