ThaiCERT: Thai Computer Emergency Response Team
ศูนย์ประสานงานการรักษาความปลอดภัยคอมพิวเตอร์ ประเทศไทย 
 
 
 



ชื่อเรื่อง : Bastille Linux 2.0.4
เรียบเรียงโดย : ภูวดล ด่านระหาญ
เรียบเรียงเมื่อ : 27 มีนาคม 2546

กล่าวนำ
Bastille เป็นโปรแกรมที่ช่วยเสริมสร้างความแข็งแกร่ง (hardening) ให้กับระบบปฏิบัติการ Red Hat Linux, Debian Linux, Mandrake Linux และ HP-UX โดย Bastille สามารถทำงานได้ใน 2 โหมด ดังต่อไปนี้

การติดตั้ง Bastille

ขั้นตอนการใช้งาน Bastille

  1. ล็อกอินเป็น root
  2. ตัดสินใจว่าจะรัน Bastille ในโหมดใด (interactively หรือ non-interactively) ทั้งนี้ผู้ที่รัน Bastille ครั้งแรก จะต้องรันในโหมด interactively เท่านั้น เพื่อสร้าง configuration profile ขึ้นมาก่อน โดยการรัน Bastille ในโหมด interactively นี้จะใช้ระยะเวลาประมาณ 1 ชั่วโมง
  3. คำสั่งที่ใช้ในการรัน Bastille ในแต่ละโหมดคือ
    1. Interactive Mode
    2. เลือก user interface ที่ต้องการใช้งาน
    3. รันคำสั่ง bastille โดยหากต้องการรัน Bastille ในโหมด text-based นี้ให้ใช้คำสั่ง # bastille -c หากไม่ระบุออปชันใดๆ จะเป็นการรันในโหมด GUI
    4. จากนั้นต้องตอบคำถามทีละข้อ ซึ่งเป็นส่วนสำคัญและใช้เวลามากที่สุด
    5. บันทึก configuration
    6. สั่งให้การเปลี่ยนแปลงมีผลในทันที (apply changes)

      Non-interactive Mode
    1. Bastille ไม่มี default configuration ดังนั้นการที่จะรันในโหมดนี้ได้จะต้องสร้าง configuration profile จากการรันแบบ interactive ก่อน
    2. คัดลอก configuration file (/etc/Bastille/config) ไปยังเครื่องที่ต้องการรันในโหมด non-interactive
    3. ติดตั้ง Bastille ในเครื่องที่ต้องการรันในโหมด non-interactive จากนั้นจึงรัน Bastille โดยใช้คำสั่ง # bastille -b

  4. ภายหลังจากการรัน Bastille แล้ว จะมีการเปลี่ยนแปลงตามคำตอบหรือ configuration ที่ให้ไป ซึ่งผู้ดูแลระบบสามารถตรวจสอบสิ่งที่ Bastille แก้ไขไป โดยดูได้จากล็อกไฟล์
  5. ส่วนใหญ่แล้ว Bastille จะทำการแก้ไขระบบเอง แต่อาจจะมีบางส่วนที่ Bastille ไม่สามารถแก้ไขเองได้ ผู้ดูแลระบบจะต้องจัดการด้วยตัวเอง ซึ่งผู้ดูแลระบบสามารถตรวจสอบข้อมูลนี้ได้ที่ /var/log/Bastille/TODO
  6. (เพิ่มเติม) ผู้ดูแลระบบสามารถใช้คำสั่ง # bastille -r เพื่อยกเลิกสิ่งที่ Bastille ได้แก้ไขไปทั้งหมด ซึ่งจะทำให้ระบบกลับคืนสู่สภาพก่อนการรัน Bastille

คำแนะนำอื่นๆ

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

ไฟล์สำคัญที่เกี่ยวข้อง

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

เอกสารอ้างอิง

 



Home || เอกสารเผยแพร่ || Unix & Linux

ThaiCERT Disclaimer | Copyright © 2001 ThaiCERT(NECTEC). All rights reserved.