กล่าวนำ
Bastille เป็นโปรแกรมที่ช่วยเสริมสร้างความแข็งแกร่ง (hardening) ให้กับระบบปฏิบัติการ Red Hat Linux, Debian Linux, Mandrake Linux และ HP-UX โดย Bastille สามารถทำงานได้ใน 2 โหมด ดังต่อไปนี้
interactively mode: หากรัน bastille ในโหมดนี้ ตัวโปรแกรมจะแสดงคำถามจำนวนมาก โดยจะแบ่งเป็นโมดูล ซึ่งในแต่ละคำถามจะมีคำอธิบายประกอบด้วย
non-interactively mode: โหมดนี้เหมาะสำหรับผู้ดูแลระบบที่มีเครื่องในความดูแลจำนวนมาก ทำให้สามารถบันทึกไฟล์ configuration จากเครื่องที่รันในโหมด interactively แล้วนำไปใช้กับเครื่องอื่นได้ ซึ่งจะช่วยประหยัดเวลาได้เป็นอย่างดี
การติดตั้ง Bastille
ดาวน์โหลด Bastille ฉบับ rpm จาก http://www.bastille-linux.org
ใช้คำสั่งดังนี้เพื่อติดตั้ง Bastille
# rpm -ivh Bastille-2.0.4-1.0.i386.rpm
หากต้องการรัน Bastille ในแบบ
GUI: ให้ดาวน์โหลดและติดตั้ง perl-Tk ดังนี้
เลือกดาวน์โหลด perl-Tk เวอร์ชันที่เหมาะสมจาก http://www.bastille-linux.org/perl-rpm-chart.html
ติดตั้ง perl-Tk โดยใช้คำสั่ง
# rpm -ivh perl-Tk.x.x.x.rpm
Text Mode: ให้ดาวน์โหลดและติดตั้ง perl-Curses ดังนี้
เลือกดาวน์โหลด perl-Curses เวอร์ชันที่เหมาะสมจาก http://www.bastille-linux.org/perl-rpm-chart.html
ติดตั้ง perl-Curses โดยใช้คำสั่ง
# rpm -ivh perl-Curses.x.x.x.rpm
ขั้นตอนการใช้งาน Bastille
ล็อกอินเป็น root
ตัดสินใจว่าจะรัน Bastille ในโหมดใด (interactively หรือ non-interactively) ทั้งนี้ผู้ที่รัน Bastille ครั้งแรก จะต้องรันในโหมด interactively เท่านั้น เพื่อสร้าง configuration profile ขึ้นมาก่อน โดยการรัน Bastille ในโหมด interactively นี้จะใช้ระยะเวลาประมาณ 1 ชั่วโมง
คำสั่งที่ใช้ในการรัน Bastille ในแต่ละโหมดคือ
Interactive Mode
เลือก user interface ที่ต้องการใช้งาน
Graphic user interface (GUI) : เป็นโหมดดีฟอลต์ในการรัน Bastille ซึ่งมีข้อดีคือ จะมี progress bar แสดงความคืบหน้าของกระบวนการทั้งหมดให้เห็นตลอด
text-based: เหมาะสำหรับระบบที่ไม่ได้ติดตั้งการแสดงผลแบบกราฟฟิก
รันคำสั่ง bastille โดยหากต้องการรัน Bastille ในโหมด text-based นี้ให้ใช้คำสั่ง # bastille -c หากไม่ระบุออปชันใดๆ จะเป็นการรันในโหมด GUI
จากนั้นต้องตอบคำถามทีละข้อ ซึ่งเป็นส่วนสำคัญและใช้เวลามากที่สุด
บันทึก configuration
สั่งให้การเปลี่ยนแปลงมีผลในทันที (apply changes)
Non-interactive Mode
Bastille ไม่มี default configuration ดังนั้นการที่จะรันในโหมดนี้ได้จะต้องสร้าง configuration profile จากการรันแบบ interactive ก่อน
คัดลอก configuration file (/etc/Bastille/config) ไปยังเครื่องที่ต้องการรันในโหมด non-interactive
ติดตั้ง Bastille ในเครื่องที่ต้องการรันในโหมด non-interactive จากนั้นจึงรัน Bastille โดยใช้คำสั่ง # bastille -b
ภายหลังจากการรัน Bastille แล้ว จะมีการเปลี่ยนแปลงตามคำตอบหรือ configuration ที่ให้ไป ซึ่งผู้ดูแลระบบสามารถตรวจสอบสิ่งที่ Bastille แก้ไขไป โดยดูได้จากล็อกไฟล์
action log: /var/log/Bastille/action-log
error log: /var/log/Bastille/error-log
ส่วนใหญ่แล้ว Bastille จะทำการแก้ไขระบบเอง แต่อาจจะมีบางส่วนที่ Bastille ไม่สามารถแก้ไขเองได้ ผู้ดูแลระบบจะต้องจัดการด้วยตัวเอง ซึ่งผู้ดูแลระบบสามารถตรวจสอบข้อมูลนี้ได้ที่ /var/log/Bastille/TODO
(เพิ่มเติม) ผู้ดูแลระบบสามารถใช้คำสั่ง # bastille -r เพื่อยกเลิกสิ่งที่ Bastille ได้แก้ไขไปทั้งหมด ซึ่งจะทำให้ระบบกลับคืนสู่สภาพก่อนการรัน Bastille
คำแนะนำอื่นๆ
ภายหลังการรัน Bastille แล้วอาจจะทำให้ซอฟต์แวร์ตัวอื่นไม่สามารถทำงานได้ตามปกติ ดังนั้นจึงควรรัน Bastille ทดสอบในเครื่องทดสอบที่มี environment เหมือนเครื่องใช้งานจริงก่อนเสมอ เพื่อป้องกันปัญหาดังกล่าว
เพื่อป้องกันไม่ให้ระบบมีช่องโหว่ ผู้ดูแลระบบจะต้องติดตั้ง patch ล่าสุดสำหรับระบบปฏิบัติการและซอฟต์แวร์ที่ติดตั้งอยู่เสมอ แต่อย่างไรก็ตาม patch ที่ติดตั้งภายหลังอาจจะเป็นตัวทำให้เกิดช่องโหว่ที่ Bastille เคยจัดการให้แล้วอีกครั้ง ดังนั้นจึงควรรัน Bastille ใหม่อีกครั้งภายหลังการติดตั้ง patch เสมอ
Bastille Modules
ข้อมูลดังต่อไปนี้ เป็นตัวอย่างคำถามในการรัน Bastille เวอร์ชัน 2.0.4-1.0 บน Red Hat Linux 8.0 (ค่าที่อยู่ในเครื่องหมาย [] เป็นคำตอบที่เป็น default ของคำถามนั้นๆ)
Module: File Permissions
Q: Would you like to set more restrictive permissions on the administration utilities (linuxconf, fsck, ifconfig, runlevel and portmap) ? [N]
Q: Would you like to disable SUID status for mount/umount? [Y]
Q: Would you like to disable SUID status for ping? [Y]
Q: Would you like to disable SUID status for at? [Y]
Q: Would you like to disable the r-tools? [Y]
Q: Would you like to disable the r-tools (rsh/remsh, rcp, rlogin, rdist, etc.)? [Y]
Q: Would you like to disable SUID status for usernetctl? [Y]
Q: Would you like to disable SUID status for traceroute? [Y]
Module: ACCOUNT SECURITY
Q: Should Bastille disable clear-text r-protocols that use IP-based authentication? [Y]
Q: Would you like to enforce password aging? [Y] (ถ้าตอบ yes จะตั้งเป็น 180 วัน)
Q: Would you like to restrict the use of cron to administrative accounts? [Y]
Q: Do you want to set a default umask? [Y]
Q: What umask would you like to set for users on the system? [077] (สามารถเลือกได้ตั้งแต่ 002, 022, 027, 077
Q: Should we disallow root login on tty's 1-6? [N]
Module: Boot Security
Q: Would you like to password-protect the GRUB prompt? [N]
Q: Would you like to disable CTRL-ALT-DELETE rebooting? [N]
Q: Would you like to password protect single-user mode? [Y]
Module: Secure Inetd Module
Q: Would you like to set a default-deny on TCP Wrappers and xinetd? [N]
Q: Should Bastille ensure the telnet service does not run on this system? [Y]
Q: Should Bastille ensure the FTP service does not run on this system? [Y]
Q: Would you like to display "Authorized Use" messages at log-in time? [Y]
Q: Who is responsible for granting authorization to use this machine? (ให้ใส่ชื่อผู้รับผิดชอบเครื่องนี้ หรือชื่อหน่วยงาน)
Module: Disable User Tools
Q: Would you like to disable the gcc compiler? [N]
Module: Configure Misc PAM
Q: Would you like to put limits on system resource usage? [N]
Q: Should we restrict console access to a small group of user accounts? [N]
Q: Which accounts should be able to login at console? [root]
Module: Logging
Q: Would you like to add additional logging? [Y]
หากตอบ Yes โปรแกรมจะทำการแก้ไข /etc/syslog.conf ดังนี้
############ BASTILLE ADDITIONS BELOW : #################
# Log warning and errors to the new file /var/log/syslog
*.warn;*.err /var/log/syslog
# Log all kernel messages to the new file /var/log/kernel
kern.* /var/log/kernel
# Log all logins to /var/log/loginlog
auth.*;user.*;daemon.none /var/log/loginlog
# Log additional data to the Alt-F7 and Alt-F8 screens (Pseudo TTY 7 and 8)
*.info;mail.none;authpriv.none /dev/tty7
authpriv.* /dev/tty7
*.warn;*.err /dev/tty7
kern.* /dev/tty7
mail.* /dev/tty8
*.* /dev/tty12
########## BASTILLE ADDITIONS CONCLUDED : ###############
Q: Do you have a remote logging host? [N]
Module: Miscellaneous Daemons
Q: Would you like to deactivate NIS server programs? [Y]
Module: Sendmail
Q: Do you want to stop sendmail from running in daemon mode? [Y]
Q: Would you like to run sendmail via cron to process the queue? [N]
Module: DNS
Q: Would you like to chroot named and set it to run as a non-root user? [N]
Module: Apache
Q: Would you like to bind the web server to listen only to the localhost? [N]
Q: Would you like to bind the web server to a particular interface? [N]
Q: Would you like to deactivate the following of symbolic links? [Y]
Q: Would you like to deactivate server-side includes? [Y]
Q: Would you like to disable CGI scripts, at least for now? [Y]
Q: Would you like to disable indexes? [N]
Module: Printing
Q: Would you like to disable printing? [N]
Module: TMPDIR
Q: Would you like to install TMPDIR/TMP scripts? [N]
Module: Firewall
Q: Would you like to run the packet filtering script? [N]
Q: Are you finished answering the questions, i.e. may we make the changes?
หลังจากการรัน Bastille แล้ว ผู้ดูแลระบบควรรีสตาร์ทเครื่องคอมพิวเตอร์ เพื่อให้การแก้ไขทั้งหมดมีผลในทันที (การแก้ไขบางอย่างมีผลในทันทีโดยไม่ต้องรีสตาร์ทเครื่องคอมพิวเตอร์)
Removing Bastille
หากทำการ uninstall Bastille ไปแล้ว จะไม่สามารถแก้ไขระบบให้คืนสู่สภาพก่อนการรัน Bastille ได้ อย่างไรก็ตาม Bastille ยังมี revert-action script เหลืออยู่ในระบบภายหลังการ uninstall ซึ่งสคริปต์ตัวนี้จะช่วย revert สิ่งที่ Bastille ได้กระทำกับไฟล์ต่างๆ (ในระดับของไฟล์เท่านั้น) เช่น แก้ไข permission ของไฟล์ให้กลับคืนสู่สภาพเดิมก่อนการรัน Bastille โดยผู้ดูแลระบบสามารถเรียกใช้งานสคริปต์นี้ได้ที่ /var/log/Bastille/revert
ไฟล์สำคัญที่เกี่ยวข้อง
Description Filename
Configuration file /etc/Bastille/config
Error log /var/log/Bastille/error-log
Action log /var/log/Bastille/action-log
TODO /var/log/Bastille/TODO
Revert actions script /var/log/Bastille/revert/revert-actions
เอกสารอ้างอิง
Bastille Linux, http://www.bastille-linux.org
Bastille Linux: A Walkthrough, Jay Beale , http://www.securityfocus.com/infocus/1414
No comments:
Post a Comment