Hardened Linux From Scratch

Version SVN-20080603

HLFS Development Team


Legal Notice

Copyright © 2004-2007, HLFS Development Team

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, is permitted provided that the following conditions are met:

  • Redistribution in any form must retain the above copyright notice, this list of conditions, and the following disclaimer:

  • Neither the name of Hardened Linux From Scratch nor the names of its contributors may be used to endorse or promote products derived from this material without specific prior written permission.

  • Any material derived from Hardened Linux From Scratch must contain a reference to the Hardened Linux From Scratch and Linux From Scratch projects.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Abstract

This book describes the process of creating a Hardened Linux system from scratch, using only the sources of the required software.

Abstract

      – Who willed you? or whose will stands but mine?
          There's none protector of the realm but I.
          Break up the gates, I'll be your warrantize.
          Shall I be flouted thus by dunghill grooms?
                      (Gloucester - 1593)
          What noise is this? what traitors have we here?
                      (Woodviles's responce)
                      

This is HLFS-unstable featuring:

Recent LFS-stable (6.*), or HLFS-0.1+, are the prerequisite for the host system. Other systems may work but are not supported.

UTF-8 compatability is not yet implemented. Notes in the BLFS book regarding UTF-8 workarounds will generally not apply to HLFS systems. Anyone seeking to implement LFS-based UTF-8 compatability, especially with the uClibc version of HLFS, should subscribe to mailto:[email protected].

See chapter02 for descriptions of the Stack Smashing Protector, and Position Independent Executables.

The instructions in this book only work for i386 so far. The instructions in this book were tested on an LFS host system.

Note

This book assumes you already have experience with Linux From Scratch and are comfortable using it.


Preface
1. Prerequisites
2. Typography
3. Structure
3.1. Part I - Introduction
3.2. Part II - Preparing for the Build
3.3. Part III - Building the HLFS System
I. Introduction
1. Introduction
1.1. How to Build an HLFS System
1.2. What's new since the last release
1.3. Changelog
1.4. Resources
1.4.1. FAQ
1.4.2. Mailing Lists
1.4.3. IRC
1.4.4. References
1.4.5. Mirror Sites
1.4.6. Contact Information
1.5. Help
1.5.1. Things to Mention
1.5.2. Configure Script Problems
1.5.3. Compilation Problems
2. Technical Notes
2.1. Introduction
2.2. Host System Requirements
2.3. Toolchain Technical Notes
2.3.1. Notes on Static Linking
2.4. About Compiler Warnings
2.5. Stack Smashing Protector
2.6. Position Independent Executables
2.7. PaX-aware ELF executables and kernel
2.8. Address-Space Layout Randomization
2.9. Hardened Temporary Files Creation
2.10. Blowfish Passwords
2.11. Miscellanous Features
2.12. About the Test Suites
II. Preparing for the Build
3. Preparatives Steps
3.1. Creating a New Partition
3.2. Creating a File System on the Partition
3.3. Mounting the New Partition
3.4. About $HLFS
3.5. Creating the $HLFS/tools Directory
3.6. Adding the HLFS User
3.7. Setting Up the Environment
4. Packages and Patches
4.1. Introduction
4.2. All Packages
4.3. Needed Patches
5. Constructing a Temporary System
5.1. Introduction
5.2. Embryo Toolchain
5.2.1.
5.2.2. Installation of the Embryo Toolchain
5.2.3.
5.3. Linux-2.4.34.5 Linux-2.6.24.7 API Headers
5.3.1.
5.3.2. Installation of Linux API Headers
5.3.3.
5.4. Glibc-2.5.1
5.4.1.
5.4.2. Installation of Glibc
5.4.3.
5.5. uClibc-0.9.29
5.5.1.
5.5.2. Installation of uClibc
5.5.3.
5.6. Adjusting the Toolchain
5.7. Gettext-0.17 Libintl
5.7.1. Installation of Gettext Libintl
5.7.2.
5.8. Tcl-8.4.19
5.8.1.
5.8.2. Installation of Tcl
5.8.3. Contents of Tcl
5.9. Expect-5.43.0
5.9.1.
5.9.2. Installation of Expect
5.9.3. Contents of Expect
5.10. DejaGNU-1.4.4
5.10.1.
5.10.2. Installation of DejaGNU
5.10.3. Contents of DejaGNU
5.11. Cocoon Toolchain
5.11.1.
5.11.2. Installation of the Cocoon Toolchain
5.11.3.
5.12. Ncurses-5.6
5.12.1.
5.12.2. Installation of Ncurses
5.12.3.
5.13. Bash-3.2
5.13.1.
5.13.2. Installation of Bash
5.13.3.
5.14. Tar-1.20
5.14.1.
5.14.2. Installation of Tar
5.14.3.
5.15. Bzip2-1.0.5
5.15.1.
5.15.2. Installation of Bzip2
5.15.3.
5.16. Coreutils-6.11
5.16.1.
5.16.2. Installation of Coreutils
5.16.3.
5.17. Diffutils-2.8.7
5.17.1.
5.17.2. Installation of Diffutils
5.17.3.
5.18. E2fsprogs-1.40.8
5.18.1.
5.18.2. Installation of E2fsprogs
5.18.3.
5.19. Findutils-4.4.0
5.19.1.
5.19.2. Installation of Findutils
5.19.3.
5.20. Gawk-3.1.6
5.20.1.
5.20.2. Installation of Gawk
5.20.3.
5.21. Gettext-0.17
5.21.1.
5.21.2. Installation of Gettext
5.21.3.
5.22. Grep-2.5.1a
5.22.1.
5.22.2. Installation of Grep
5.22.3.
5.23. Gzip-1.3.12
5.23.1.
5.23.2. Installation of Gzip
5.23.3.
5.24. M4-1.4.11
5.24.1.
5.24.2. Installation of M4
5.24.3.
5.25. Make-3.81
5.25.1.
5.25.2. Installation of Make
5.25.3.
5.26. Patch-2.5.9
5.26.1.
5.26.2. Installation of Patch
5.26.3.
5.27. Perl-5.10.0
5.27.1.
5.27.2. Installation of Perl
5.27.3.
5.28. Sed-4.1.5
5.28.1.
5.28.2. Installation of Sed
5.28.3.
5.29. Texinfo-4.12
5.29.1.
5.29.2. Installation of Texinfo
5.29.3.
5.30. Bison-2.3
5.30.1.
5.30.2. Installation of Bison
5.30.3.
5.31. Flex-2.5.35
5.31.1.
5.31.2. Installation of Flex
5.31.3.
5.32. BC-1.06.95
5.32.1.
5.32.2. Installation of BC
5.32.3. Contents of BC
5.33. Util-linux-ng-2.13.1
5.33.1.
5.33.2. Installation of Util-linux-ng
5.33.3.
5.34. Stripping
III. Building the HLFS System
6. Installing Basic System Software
6.1. Introduction
6.2. Preparing Virtual Kernel File Systems
6.2.1. Creating Initial Device Nodes
6.2.2. Mounting and Populating /dev
6.2.3. Mounting Virtual Kernel File Systems
6.3. Entering the Chroot Environment
6.4. Changing Ownership
6.5. Creating Directories
6.5.1. FHS Compliance Note
6.6. Creating Essential Symlinks
6.7. Creating the passwd, group, and log Files
6.8. Linux-2.4.34.5 Linux-2.6.24.7 API Headers
6.8.1.
6.8.2. Installation of Linux API Headers
6.8.3. Contents of Linux API Headers
6.9. Man-pages-2.78
6.9.1.
6.9.2. Installation of Man-pages
6.9.3. Contents of Man-pages
6.10. Glibc-2.5.1
6.10.1.
6.10.2. Installation of Glibc
6.10.3. Configuring Glibc
6.10.4. Configuring the Dynamic Loader
6.10.5. Contents of Glibc
6.11. uClibc-0.9.29
6.11.1.
6.11.2. Installation of uClibc
6.11.3. Configuring Dynamic Loader
6.11.4. Configuring the Timezone
6.11.5. Contents of uClibc
6.12. Gettext-0.17 Libintl
6.12.1. Installation of Gettext Libintl
6.12.2.
6.13. GCC-4.1.2 Libssp
6.13.1. Installation of GCC Libssp
6.13.2.
6.14. Re-adjusting the Toolchain
6.15. Butterfly Toolchain
6.15.1.
6.15.2. Installation of GCC
6.15.3. Contents of Binutils
6.15.4. Contents of GCC
6.16. Sed-4.1.5
6.16.1.
6.16.2. Installation of Sed
6.16.3. Contents of Sed
6.17. E2fsprogs-1.40.8
6.17.1.
6.17.2. Installation of E2fsprogs
6.17.3. Contents of E2fsprogs
6.18. Coreutils-6.11
6.18.1.
6.18.2. Installation of Coreutils
6.18.3. Contents of Coreutils
6.19. Iana-Etc-2.30
6.19.1.
6.19.2. Installation of Iana-Etc
6.19.3. Contents of Iana-Etc
6.20. M4-1.4.11
6.20.1.
6.20.2. Installation of M4
6.20.3. Contents of M4
6.21. Bison-2.3
6.21.1.
6.21.2. Installation of Bison
6.21.3. Contents of Bison
6.22. Ncurses-5.6
6.22.1.
6.22.2. Installation of Ncurses
6.22.3. Contents of Ncurses
6.23. Procps-3.2.7
6.23.1.
6.23.2. Installation of Procps
6.23.3. Contents of Procps
6.24. Libtool-1.5.26
6.24.1.
6.24.2. Installation of Libtool
6.24.3. Contents of Libtool
6.25. Perl-5.10.0
6.25.1.
6.25.2. Installation of Perl
6.25.3. Contents of Perl
6.26. Readline-5.2
6.26.1.
6.26.2. Installation of Readline
6.26.3. Contents of Readline
6.27. Zlib-1.2.3
6.27.1.
6.27.2. Installation of Zlib
6.27.3. Contents of Zlib
6.28. Gettext-0.17
6.28.1.
6.28.2. Installation of Gettext
6.28.3. Contents of Gettext
6.29. Make-3.81
6.29.1.
6.29.2. Installation of Make
6.29.3. Contents of Make
6.30. Attr-2.4.41-1
6.30.1.
6.30.2. Installation of Attr
6.30.3. Contents of Attr
6.31. Libcap2-2.10
6.31.1.
6.31.2. Installation of Libcap2
6.31.3. Contents of Libcap2
6.32. Autoconf-2.62
6.32.1.
6.32.2. Installation of Autoconf
6.32.3. Contents of Autoconf
6.33. Automake-1.10.1
6.33.1.
6.33.2. Installation of Automake
6.33.3. Contents of Automake
6.34. Bash-3.2
6.34.1.
6.34.2. Installation of Bash
6.34.3. Contents of Bash
6.35. Bzip2-1.0.5
6.35.1.
6.35.2. Installation of Bzip2
6.35.3. Contents of Bzip2
6.36. Diffutils-2.8.7
6.36.1.
6.36.2. Installation of Diffutils
6.36.3. Contents of Diffutils
6.37. File-4.24
6.37.1.
6.37.2. Installation of File
6.37.3. Contents of File
6.38. Findutils-4.4.0
6.38.1.
6.38.2. Installation of Findutils
6.38.3. Contents of Findutils
6.39. Flex-2.5.35
6.39.1.
6.39.2. Installation of Flex
6.39.3. Contents of Flex
6.40. GRUB-0.97
6.40.1.
6.40.2. Installation of GRUB
6.40.3. Contents of GRUB
6.41. Gawk-3.1.6
6.41.1.
6.41.2. Installation of Gawk
6.41.3. Contents of Gawk
6.42. Grep-2.5.1a
6.42.1.
6.42.2. Installation of Grep
6.42.3. Contents of Grep
6.43. Groff-1.18.1.4
6.43.1.
6.43.2. Installation of Groff
6.43.3. Contents of Groff
6.44. Gzip-1.3.12
6.44.1.
6.44.2. Installation of Gzip
6.44.3. Contents of Gzip
6.45. Inetutils-1.5
6.45.1.
6.45.2. Installation of Inetutils
6.45.3. Contents of Inetutils
6.46. IPRoute2-2.6.23
6.46.1.
6.46.2. Installation of IPRoute2
6.46.3. Contents of IPRoute2
6.47. Kbd-1.14.1
6.47.1.
6.47.2. Installation of Kbd
6.47.3. Contents of Kbd
6.48. Less-418
6.48.1.
6.48.2. Installation of Less
6.48.3. Contents of Less
6.49. Man-1.6f
6.49.1.
6.49.2. Installation of Man
6.49.3. Contents of Man
6.50. Module-Init-Tools-3.4
6.50.1.
6.50.2. Installation of Module-Init-Tools
6.50.3. Contents of Module-Init-Tools
6.51. OpenSSL-0.9.8h
6.51.1.
6.51.2. Installation of OpenSSL
6.51.3. Contents of OpenSSL
6.52. Patch-2.5.9
6.52.1.
6.52.2. Installation of Patch
6.52.3. Contents of Patch
6.53. Paxctl-0.5
6.53.1.
6.53.2. Installation of Paxctl
6.53.3. Contents of Paxctl
6.54. Psmisc-22.6
6.54.1.
6.54.2. Installation of Psmisc
6.54.3. Contents of Psmisc
6.55. Shadow-4.1.1
6.55.1.
6.55.2. Installation of Shadow
6.55.3. Configuring Shadow
6.55.4. Setting the root password
6.55.5. Contents of Shadow
6.56. Sysklogd-1.5
6.56.1.
6.56.2. Installation of Sysklogd
6.56.3. Configuring Sysklogd
6.56.4. Contents of Sysklogd
6.57. Sysvinit-2.86
6.57.1.
6.57.2. Installation of Sysvinit
6.57.3. Configuring Sysvinit
6.57.4. Contents of Sysvinit
6.58. Tar-1.20
6.58.1.
6.58.2. Installation of Tar
6.58.3. Contents of Tar
6.59. Texinfo-4.12
6.59.1.
6.59.2. Installation of Texinfo
6.59.3. Contents of Texinfo
6.60. Udev-113
6.60.1.
6.60.2. Installation of Udev
6.60.3. Contents of Udev
6.61. Util-linux-ng-2.13.1
6.61.1.
6.61.2. FHS compliance notes
6.61.3. Installation of Util-linux-ng
6.61.4. Contents of Util-linux-ng
6.62. Vim-7.1
6.62.1.
6.62.2. Installation of Vim
6.62.3. Configuring Vim
6.62.4. Contents of Vim
6.63. About Debugging Symbols
6.64. Stripping Again
6.65. Cleaning Up
7. Making the HLFS System Bootable
7.1. Introduction
7.2. Set User/Group ID (suid) Programs
7.3. LFS-Bootscripts-3.2.2
7.3.1.
7.3.2. Installation of LFS-Bootscripts
7.3.3. Contents of LFS-Bootscripts
7.4. Device and Module Handling on an HLFS System
7.4.1. History
7.4.2. Udev Implementation
7.4.3. Problems with Loading Modules and Creating Devices
7.4.4. Useful Reading
7.5. Configuring the setclock Script
7.6. Configuring the Linux Console
7.7. Creating the /etc/inputrc File
7.8. The Bash Shell Startup Files
7.9. Configuring the localnet Script
7.10. Creating the /etc/hosts File
7.11. Configuring the network Script
7.11.1. Creating Network Interface Configuration Files
7.11.2. Creating the /etc/resolv.conf File
7.12. Creating the /etc/fstab File
7.13. Linux-2.4.34.5 Linux-2.6.24.7
7.13.1.
7.13.2. Installation of the kernel
7.13.3. Contents of Linux
7.14. Making the HLFS System Bootable
7.15. Finished
IV. Appendices
A. Acronyms and Terms
B. Acknowledgments
Index
n
Next Page
p
Previos Page
h
Book Home
u
Go Up One Level
?
Press ? for Help
esc
Hide Help

Press '?' for keyboard shortcuts

Your Ad Here