21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

ReferencedDomainName = (LPTSTR)LocalAlloc(LMEM_FIXED, cbReferencedDomainName);<br />

if (!ReferencedDomainName) {<br />

LocalFree(lpszName);<br />

return 0;<br />

}<br />

if (!LookupAccountSid(lpszSystemName, Sid, lpszName, &cbName,<br />

ReferencedDomainName, &cbReferencedDomainName, &eUse)) {<br />

LocalFree(ReferencedDomainName);<br />

LocalFree(lpszName);<br />

return 0;<br />

}<br />

LocalFree(ReferencedDomainName);<br />

return lpszName;<br />

}<br />

8.4 Restricting Access Based on Hostname or IP<br />

Address<br />

<strong>Problem</strong><br />

You want to restrict access to the network based on hostname or IP address.<br />

Solution<br />

First, get the IP address of the remote connection, and verify that the address has a<br />

hostname associated with it. To ensure that the hostname is not being spoofed (i.e.,<br />

the address reverses to one hostname, but the hostname does not map to that IP<br />

address), look up the hostname and compare the resulting IP address with the IP<br />

address of the connection; if the IP addresses do not match, the hostname is likely<br />

being spoofed.<br />

Next, compare the IP address and/or hostname with a set of rules that determine<br />

whether to grant the remote connection access.<br />

Discussion<br />

Restricting access based on the remote connection’s IP address or<br />

hostname is risky at best. The hostname and/or IP address could be<br />

spoofed, or the remote system could be compromised with an attacker<br />

in control. Address-based access control is no substitute for strong<br />

authentication methods.<br />

Restricting Access Based on Hostname or IP Address | 379<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

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

Saved successfully!

Ooh no, something went wrong!