Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 01-12-2012, 10:37 AM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
Cách nào bảo mật cho máy chủ Hosting Linux hiệu quả nhất, tránh bị hack local?
Cách nào bảo mật cho máy chủ Hosting Linux hiệu quả nhất, tránh bị hack local?



1. BIOS

Bạn hãy luôn thiết đặt Password cho BIOS và không cho phép các thiết bị như floppy disk hay CD-ROM boot khi hệ thống khởi động.


2. PASSWORD

Bạn hãy chọn một password phức tạp cho tài khoản của mình, password bao gồm ký tự hoa, thường, số và ký tự đặc biệt như . , * – …
Ngoài ra bạn hãy Edit file: /etc/login.defs

PASS_MIN_LEN 8

Yêu cầu nhập password có chiều dài ngắn nhất là 8.


3. ACCOUNT TIME OUT

Xác định thời gian time out của account
Edit file: /etc/profile

HITSFILESIZE=on
TMOUT=7200


4. DISABLE CONSOLE PROGRAM ACCESS

Disable tất cả các lệnh khi thực hiện qua console-equivalent

[root@longvnit] /#rm -f /etc/security/console.apps/<servicename>

Khuyến cáo bạn nên loại bỏ các lệnh sau:

[root@longvnit] /# rm -f /etc/security/console.apps/halt
[root@longvnit] /# rm -f /etc/security/console.apps/poweroff
[root@longvnit] /# rm -f /etc/security/console.apps/reboot
[root@longvnit] /# rm -f /etc/security/console.apps/shutdown

5. Xóa bỏ bit SUID & SGID không cần thiết

[root@longvnit] /# chmod a-s /usr/bin/chage
[root@longvnit] /# chmod a-s /usr/bin/gpasswd
[root@longvnit] /# chmod a-s /usr/bin/wall
[root@longvnit] /# chmod a-s /usr/bin/chfn
[root@longvnit] /# chmod a-s /usr/bin/chsh
[root@longvnit] /# chmod a-s /usr/bin/newgrp
[root@longvnit] /# chmod a-s /usr/bin/write
[root@longvnit] /# chmod a-s /usr/sbin/usernetctl
[root@longvnit] /# chmod a-s /usr/sbin/traceroute
[root@longvnit] /# chmod a-s /bin/mount
[root@longvnit] /# chmod a-s /bin/umount
[root@longvnit] /# chmod a-s /bin/ping
[root@longvnit] /# chmod a-s /sbin/netreport
[root@longvnit] /# chmod a-s /etc/passwd

6. /etc/host.conf

Edit file /etc/hosts.conf như sau:


# Order lookup names via DNS first then fall back to /etc/hosts.
order bind,hosts
# Machines with multiple IP addresses.
multi on
# Check for IP address spoofing.
nospoof on

7. /etc/services

Đảm bảo rằng quyền owner trên file /etc/services là của root

[root@longvnit] /# stat /etc/services

Chống thay đổi file

[root@longvnit] /# chattr +i /etc/services

8. /etc/securetty
Thay đổi thành

tty1
#tty2
#tty3
#tty4
#tty5
#tty6
#tty7
#tty8

Mục đích của việc thay đổi này là chỉ đồng ý cho root login trên một tty.


9. Special accounts

Xóa những account & group không cần thiết ra khỏi hệ thống.
Xóa Users:


[root@longvnit] /# userdel adm
[root@longvnit] /# userdel lp
[root@longvnit] /# userdel sync
[root@longvnit] /# userdel shutdown
[root@longvnit] /# userdel halt
[root@longvnit] /# userdel news
[root@longvnit] /# userdel uucp
[root@longvnit] /# userdel operator
[root@longvnit] /# userdel games
[root@longvnit] /# userdel gopher

Xóa Groups:

[root@longvnit] /# groupdel adm
[root@longvnit] /# groupdel lp
[root@longvnit] /# groupdel news
[root@longvnit] /# groupdel uucp
[root@longvnit] /# groupdel games
[root@longvnit] /# groupdel dip
[root@longvnit] /# groupdel pppusers
[root@longvnit] /# groupdel popusers (Nếu có)
[root@longvnit] /# groupdel slipus

Nếu hệ thống không cần thêm user & group bạn có thế chống thay đổi files

[root@longvnit] /# chattr +i /etc/passwd
[root@longvnit] /# chattr +i /etc/shadow
[root@longvnit] /# chattr +i /etc/group
[root@longvnit] /# chattr +i /etc/gshadow


10. Chống su lên root

Edit file /etc/pam.d/su thêm hai dòng sau:

auth sufficient /lib/security/pam_rootok.so debug
auth required /lib/security/pam_wheel.so group=wheel

Có nghĩa rằng chỉ những user thuộc group wheel (GID=10) có quyền su lên root.

Tiếp theo để thêm một tài khoản có quyền su lên root ví dụ: admin


[root@longvnit] /# usermod -g 10 admin

1. Mounting a file system

Đầu tiên bạn cần tìm hiểu một số option sau:
defaults: Allow everything quota, read-write, and suid on this partition.
noquota: Do not set users quotas on this partition.
nosuid: Do not set SUID/SGID access on this partition.
nodev: Do not set character or special devices access on this partition.
noexec: Do not set execution of any binaries on this partition.
quota: Allow users quotas on this partition.

ro: Allow read-only on this partition.

rw: Allow read-write on this partition.

suid: Allow SUID/SGID access on this partition.

Sau đó bạn edit file /etc/fstab

/dev/<x> /tmp ext2 defaults 1 2
/dev/<y> /home ext2 defaults 1 2

Thành

/dev/<x> /tmp ext2 defaults,rw,nosuid,nodev,noexec 1 2
/dev/<y> /home ext2 defaults,rw,nosuid,nodev 1 2

Sau đó bạn remote lại:

[root@longvnit] /#mount -oremount /home/
[root@longvnit] /#mount -oremount /tmp/

12. Disable dùng Ctrl-Alt-Delete để shutdown

Edit file /etc/inittab

#ca::ctrlaltdel:/sbin/shutdown -t3 -r now

Áp đặt thay đổi

[root@longvnit] /#/sbin/init q


13. /etc/rc.d/


Chỉ cho phép root sử dụng script trong /etc/rc.d/

[root@longvnit] /# chmod -R 700 /etc/rc.d/init.d/*

Bạn tham khảo thêm: http://www.pleikucity.net/linux-and-...ux-centos.html

  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời


Công Cụ
Xếp Bài

Quyền Hạn Của Bạn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 10:03 PM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.