18.12.2012 Views

O'Reilly - Practical UNIX & Internet Sec... 7015KB

O'Reilly - Practical UNIX & Internet Sec... 7015KB

O'Reilly - Practical UNIX & Internet Sec... 7015KB

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

[Chapter 22] 22.4 SOCKS<br />

Obviously, token expansions that require that sockd look up a value in a database (such as %A, %S, and %Z) will take longer to<br />

execute than token expansions that merely report an IP or port number (such as %a, %s and %z).<br />

This example command runs finger to determine the users on a particular computer, and then sends the results to the root account of<br />

the computer that is running sockd:<br />

/usr/ucb/finger @%A | /bin/mailx -s 'SOCKS: rejected %u@%A' root<br />

22.4.6.1 #NO_IDENTD and #BAD_ID<br />

In addition to the pattern matching described above, sockd allows you to specify rules that will match any computer contacting the<br />

sockd daemon which is not running the ident protocol, or for which the username returned by the ident protocol is different from the<br />

username provided in the initial sockd contact. These lines have the form:<br />

#NO_IDENTD: command<br />

#BAD_ID: command<br />

22.4.6.2 Example /etc/sockd.conf configuration files<br />

Here are some example lines from an /etc/sockd.conf configuration file. The configuration file is designed to protect an organization<br />

that has placed a set of <strong>UNIX</strong> workstations on IP subnet 204.99.90.<br />

deny<br />

204.99.90.0 255.255.255.0 204.99.90.0 255.255.255.0<br />

This initial rule disallows access to the internal network from internal computers using SOCKS. (Why tie up the SOCKS<br />

server if you don't need to?)<br />

allow<br />

0.0.0.0 0.0.0.0 204.99.90.100 255.255.255.255 eq 25<br />

Allows connections to port 25 (SMTP) of the machine 204.99.90.100. This allows incoming electronic mail to that network.<br />

allow<br />

204.99.90.100 255.255.255.255 0.0.0.0 0.0.0.0 eq 25<br />

Allows outgoing connections from the machine 204.99.90.100 to port 25 of any computer on the <strong>Internet</strong>. This rule allows the<br />

organization to send mail to outside computers.<br />

allow<br />

deny<br />

204.99.90.0 255.255.255.0 0.0.0.0 0.0.0.0<br />

Allows outgoing connections from any host on subnet 204.99.90 to any computer on the <strong>Internet</strong>. If you have this rule, the<br />

previous rule is unnecessary.<br />

0.0.0.0 0.0.0.0 204.99.90.255 255.255.255.000 eq 23 : \<br />

safe_finger @%A |/bin/mailx -s 'Telnet denied from %U/%A' root<br />

This rather complex rule denies any attempted login to the organization's internal network. In addition to stopping the logins, it also<br />

does a finger of the computer from where the attempt is coming and sends email to the root account of the computer running sockd.<br />

If the remote machine is running the ident protocol, the username will be sent as well.<br />

deny<br />

NOTE: Do not use reverse finger for logging contacts on the finger port (port 79). Otherwise, a loop may result, with<br />

two sockd daemons continually attempting to finger each other until they are manually shut down or the disks fill up.<br />

0.0.0.0 0.0.0.0 204.99.90.0 255.255.255.0<br />

Denies all other connections to the subnet 204.99.99. Strictly speaking, this rule is not necessary, as a connection that does not<br />

specifically match the "allow" rules above will be rejected.<br />

file:///C|/Oreilly Unix etc/<strong>O'Reilly</strong> Reference Library/networking/puis/ch22_04.htm (6 of 8) [2002-04-12 10:45:45]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!