⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 基于TCP-WRAP原理的系统监控的c语言实现代码
💻
📖 第 1 页 / 共 4 页
字号:
    Addison-Wesley, 1994.Discussions on internet firewalls are archived on ftp.greatcircle.com.Subscribe to the mailing list by sending a message to     majordomo@greatcircle.comWith in the body (not subject): subscribe firewalls.5.2 - Related software----------------------Network daemons etc. with enhanced logging capabilities can generatemassive amounts of information: our 150+ workstations generate severalhundred kbytes each day. egrep-based filters can help to suppress someof the noise.  A more powerful tool is the Swatch monitoring system byStephen E. Hansen and E. Todd Atkins. Swatch can process log files inreal time and can associate arbitrary actions with patterns; itsapplications are by no means restricted to security.  Swatch isavailable ftp.stanford.edu, directory /general/security-tools/swatch.Socks, described in the UNIX Security III proceedings, can be used tocontrol network traffic from hosts on an internal network, through afirewall host, to the outer world. Socks consists of a daemon that isrun on the firewall host, and of a library with routines that redirectapplication socket calls through the firewall daemon.  Socks isavailable from s1.gov in /pub/firewalls/socks.tar.Z.For a modified Socks version by Ying-Da Lee (ylee@syl.dl.nec.com) tryftp.nec.com, directory /pub/security/socks.cstc.Tcpr is a set of perl scripts by Paul Ziemba that enable you to run ftpand telnet commands across a firewall. Unlike socks it can be used withunmodified client software. Available from ftp.alantec.com, /pub/tcpr.The TIS firewall toolkit provides a multitude of tools to build yourown internet firewall system. ftp.tis.com, directory /pub/firewalls.Versions of rshd and rlogind, modified to report the client user namein addition to the client host name, are available for anonymous ftp(ftp.win.tue.nl:/pub/security/logdaemon-XX.tar.Z).  These programs aredrop-in replacements for SunOS 4.x, Ultrix 4.x, SunOS 5.x and HP-UX9.x. This archive also contains ftpd/rexecd/login versions that supportS/Key or SecureNet one-time passwords in addition to traditional UNIXreusable passwords.The securelib shared library by William LeFebvre can be used to controlaccess to network daemons that are not run under control of the inetdor that serve more than one client, such as the NFS mount daemon thatruns until the machine goes down.  Available from eecs.nwu.edu, file/pub/securelib.tar.xinetd (posted to comp.sources.unix) is an inetd replacement thatprovides, among others, logging, username lookup and access control.However, it does not support the System V TLI services, and involvesmuch more source code than the daemon wrapper programs. Availablefrom ftp.uu.net, directory /usenet/comp.sources.unix.netlog from Texas A&M relies on the SunOS 4.x /dev/nit interface topassively watch all TCP and UDP network traffic on a network.  Thecurrent version is on net.tamu.edu in /pub/security/TAMU.Where shared libraries or router-based packet filtering are not anoption, an alternative portmap daemon can help to prevent hackersfrom mounting your NFS file systems using the proxy RPC facility.ftp.win.tue.nl:/pub/security/portmap-X.shar.Z was tested with SunOS4.1.X Ultrix 3.0 and Ultrix 4.x, HP-UX 8.x and some version of AIX. Theprotection is less effective than that of the securelib library becauseportmap is mostly a dictionary service.An rpcbind replacement (the Solaris 2.x moral equivalent of portmap)can be found on ftp.win.tue.nl in /pub/security. It prevents hackersfrom mounting your NFS file systems by using the proxy RPC facility.Source for a portable RFC 931 (TAP, IDENT, RFC 1413) daemon by PeterEriksson is available from ftp.lysator.liu.se:/pub/ident/servers.Some TCP/IP implementations come without syslog library. Some come withthe library but have no syslog daemon. A replacement can be found inftp.win.tue.nl:/pub/security/surrogate-syslog.tar.Z.  The fakesysloglibrary that comes with the nntp sources reportedly works well, too.6 - Limitations---------------6.1 - Known wrapper limitations-------------------------------Many UDP (and rpc/udp) daemons linger around for a while after theyhave serviced a request, just in case another request comes in.  In theinetd configuration file these daemons are registered with the `wait'option. Only the request that started such a daemon will be seen by thewrappers.  Such daemons are better protected with the securelib sharedlibrary (see: Related software).The wrappers do not work with RPC services over TCP. These services areregistered as rpc/tcp in the inetd configuration file. The only non-trivial service that is affected by this limitation is rexd, which isused by the on(1) command. This is no great loss.  On most systems,rexd is less secure than a wildcard in /etc/hosts.equiv.Some RPC requests (for example: rwall, rup, rusers) appear to come fromthe server host. What happens is that the client broadcasts its requestto all portmap daemons on its network; each portmap daemon forwards therequest to a daemon on its own system. As far as the rwall etc.  daemonsknow, the request comes from the local host.Portmap and RPC (e.g. NIS and NFS) (in)security is a topic in itself.See the section in this document on related software.6.2 - Known system software bugs--------------------------------Workarounds have been implemented for several bugs in system software.They are described in the Makefile. Unfortunately, some system softwarebugs cannot be worked around. The result is loss of functionality.IRIX has so many bugs that it has its own README.IRIX file.Older ConvexOS versions come with a broken recvfrom(2) implementation.This makes it impossible for the daemon wrappers to look up theclient host address (and hence, the name) in case of UDP requests.A patch is available for ConvexOS 10.1; later releases should be OK.With early Solaris (SunOS 5) versions, the syslog daemon will leavebehind zombie processes when writing to logged-in users.  Workaround:increase the syslogd threshold for logging to users, or reduce thewrapper's logging severity.On some systems, the optional RFC 931 etc. client username lookups maytrigger a kernel bug.  When a client host connects to your system, andthe RFC 931 connection from your system to that client is rejected by arouter, your kernel may drop all connections with that client.  This isnot a bug in the wrapper programs: complain to your vendor, and don'tenable client user name lookups until the bug has been fixed.Reportedly, SunOS 4.1.1, Next 2.0a, ISC 3.0 with TCP 1.3, and AIX 3.2.2and later are OK.Sony News/OS 4.51, HP-UX 8-something and Ultrix 4.3 still have the bug.Reportedly, a fix for Ultrix is available (CXO-8919).The following procedure can be used (from outside the tue.nl domain) tofind out if your kernel has the bug. From the system under test, do:        % ftp 131.155.70.19This command attempts to make an ftp connection to our anonymous ftpserver (ftp.win.tue.nl).  When the connection has been established, runthe following command from the same system under test, while keepingthe ftp connection open:        % telnet 131.155.70.19 111Do not forget the `111' at the end of the command. This telnet commandattempts to connect to our portmap process.  The telnet command shouldfail with:  "host not reachable", or with a timeout error. If your ftpconnection gets messed up, you have the bug. If the telnet command doesnot fail, please let me know a.s.a.p.!For those who care, the bug is that the BSD kernel code was not carefulenough with incoming ICMP UNREACHABLE control messages (it ignored thelocal and remote port numbers, and therefore zapped *all* connectionswith the remote system). The bug is still present in the BSD NET/1source release (1989) but apparently has been fixed in BSD NET/2 (1991). 7 - Configuration and installation----------------------------------7.1 - Easy configuration and installation-----------------------------------------The "easy" recipe requires no changes to existing software orconfiguration files.  Basically, you move the daemons that you want toprotect to a different directory and plug the resulting holes withcopies of the wrapper programs.If you don't run Ultrix, you won't need the miscd wrapper program.  Themiscd daemon implements among others the SYSTAT service, which producesthe same output as the WHO command.Type `make' and follow the instructions.  The Makefile comes withready-to-use templates for many common UNIX implementations (sun,ultrix, hp-ux, aix, irix,...). IRIX has so many bugs that it has its own README.IRIX file.When the `make' succeeds the result is five executables (six in case ofUltrix).You can use the `tcpdchk' program to identify the most common problemsin your wrapper and inetd configuration files.  With the `tcpdmatch' program you can examine how the wrapper wouldreact to specific requests for service.  The `safe_finger' command should be used when you implement boobytraps:  it gives better protection against nasty stuff that remotehosts may do in response to your finger probes.The `try-from' program tests the host and username lookup code.  Run itfrom a remote shell command (`rsh host /some/where/try-from') and itshould be able to figure out from what system it is being called.The tcpd program can be used to monitor the telnet, finger, ftp, exec,rsh, rlogin, tftp, talk, comsat and other tcp or udp services that havea one-to-one mapping onto executable files.The tcpd program can also be used for services that are marked asrpc/udp in the inetd configuration file, but not for rpc/tcp servicessuch as rexd.  You probably do not want to run rexd anyway. On mostsystems it is even less secure than a wildcard in /etc/hosts.equiv.With System V.4-style systems, the tcpd program can also handle TLIservices. When TCP/IP or UDP/IP is used underneath TLI, tcpd providesthe same functions as with socket-based applications. When some otherprotocol is used underneath TLI, functionality will be limited (noclient username lookups, weird network address formats).Decide which services you want to monitor. Move the correspondingvendor-provided daemon programs to the location specified by theREAL_DAEMON_DIR constant in the Makefile, and fill the holes withcopies of the tcpd program. That is, one copy of (or link to) the tcpdprogram for each service that you want to monitor. For example, tomonitor the use of your finger service:    # mkdir REAL_DAEMON_DIR    # mv /usr/etc/in.fingerd REAL_DAEMON_DIR    # cp tcpd /usr/etc/in.fingerdThe example applies to SunOS 4. With other UNIX implementations thenetwork daemons live in /usr/libexec, /usr/sbin or in /etc, or have no"in." prefix to their names, but you get the idea.File protections: the wrapper, all files used by the wrapper, and alldirectories in the path leading to those files, should be accessiblebut not writable for unprivileged users (mode 755 or mode 555). Do notinstall the wrapper set-uid.Ultrix only:  If you want to monitor the SYSTAT service, move thevendor-provided miscd daemon to the location specified by theREAL_DAEMON_DIR macro in the Makefile, and install the miscd wrapperat the original miscd location.In the absence of any access-control tables, the daemon wrapperswill just maintain a record of network connections made to your system.7.2 - Advanced configuration and installation---------------------------------------------The advanced recipe leaves your daemon executables alone, but involvessimple modifications to the inetd configuration file.Type `make' and follow the instructions.  The Makefile comes withready-to-use templates for many common UNIX implementations (sun,ultrix, hp-ux, aix, irix, ...). IRIX users should read the warnings in the README.IRIX file first.When the `make' succeeds the result is five executables (six in case of

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -