During the addition of new packages to the Network Security Toolkit, it is often necessary to create symbolic links. It is quite easy to create broken symbolic links.
The find command can be useful for
finding symbolic links (when you specify -type
l
) from a starting directory. You can then test each
of the symbolic links found to see if they refer to a
non-existant file. The following demonstrates how this was used
on the /usr/local/bin
directory as the
sendmail package was being added.
Figure 4.8. Finding Broken Links
[root@probe root]#
for f in $(find /usr/local/bin -type l); do \
if [ ! -e "$f" ]; then echo $f; fi; done
/usr/local/bin/hoststat
/usr/local/bin/kbdrate
/usr/local/bin/mailq.sendmail
/usr/local/bin/makemap
/usr/local/bin/newaliases.sendmail
/usr/local/bin/purgestat
[root@probe root]#
This has become such a useful check, that the
make symlink-check target was added to allow
one to check ALL of the symbolic links on a running NST
probe. The following demonstrates how one can run make
symlink-check on a development system to check the
symbolic links on a NST probe with IP
address 192.168.100.9
:
Figure 4.9. Finding Broken Links On A Running NST
[root@probe root]#
make symlink-check HOST=192.168.100.9
=============================================
*** Total count of unresolved links: 0
Log of above is at: symlink.log
[root@probe root]#