Identifying Dependencies

The process of identifying and copying application dependencies and configuration files can be painstakingly performed using various Linux tools, such as the following.

• strace A utility designed to trace all syscalls and executable makes. It will enumerate all files (configuration files, library dependencies, open files, output files) for a given executable. It shows voluminous output as it systematically steps through a binary as it executes.

linux:/bin # strace sshd access("/etc/ld.so.preload", R_OK) = -1 ENOENT

(No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3

fstat64(3, {st_mode=S_IFREG|0 64 4, st_size=822 84, ...}) = 0

• ldd A utility used to enumerate library dependencies of executable files, but it does not enumerate configuration files or open files.

linux:/bin # ldd sshd linux-gate.so.1 => (0xffffe000) libwrap.so.0 => /lib/libwrap.so.0 (0x4002d000) libpam.so.0 => /lib/libpam.so.0 (0x40035000)

• lsof A utility used to list all open files in use by a given daemon.

linux:/usr/sbin # lsof | grep sshd

sshd

7587 root cwd

DIR

3,3

656

sshd

7587 root rtd

DIR

3,3

656

sshd

7587 root txt

REG

3,5

350762

/usr/sbin/sshd

sshd

7587 root mem

REG

3,3

107969

/lib/ld-2.3.3.so

sshd

7587 root mem

REG

3,3

36895

/lib/libwrap.so.0.7

6

It is generally good practice to use several tools to validate data. It ensures a comprehensive understanding of how a daemon operates and provides the opportunity to vet the output of one utility with another. The entire process of enabling applications to function within a chrooted environment can be simplified somewhat by statically compiling the applications (i.e., compiling all of the library dependencies into the daemon so external resources aren't required), which is a kind of hack and tends to take up more space on the file system, but it can make the entire operation easier.

Was this article helpful?

0 0
The Ultimate Computer Repair Guide

The Ultimate Computer Repair Guide

Read how to maintain and repair any desktop and laptop computer. This Ebook has articles with photos and videos that show detailed step by step pc repair and maintenance procedures. There are many links to online videos that explain how you can build, maintain, speed up, clean, and repair your computer yourself. Put the money that you were going to pay the PC Tech in your own pocket.

Get My Free Ebook


Post a comment