Archive for the ‘ Tutorials ’ Category

PowerShell: Modifying DHCP Scope Options

Recently my organization had moved toward a more Windows-based infrastructure.  I needed to change the DNS server information on several of our scopes and quite frankly I’m much too lazy to do everything by hand.  Enter PowerShell.

I was able to hack together a pretty quick solution to do this in bulk:

$sScopes  = netsh dhcp server show scope
$sRegex   = "10\.11\.\d{1,}\.\d{1,}"
$aMatches = [regex]::Matches($sScopes, $sRegex)

if ($aMatches.count -gt 0) {
    foreach ($match in $aMatches) {
        netsh dhcp server scope $match.Value set optionvalue 006 IPADDRESS 10.0.0.1 10.0.0.2
    }
}

Let’s go through the code.  The first line fetches every scope from the netsh command. The second line defines the regular expression that matches the scope addresses we want to modify. The third line actually performs the regular expression matching.

Jumping down to the loop, we run the netsh command again, but pass in the value of the match (which will be the ip address defined on line two and set our options accordingly.

I hope this helps someone out there!

Active Directory Authentication in Red Hat

Single sign on is an amazing timesaver and a must in any larger organization.  It allows system administrators to create one single account that allows access to many other different services.

Windows does this extremely well with Active Directory; almost any good enterprise product will support Active Directory for authentication.  But, where do mixed environments fit in with Windows software and technologies?  Quite well, in fact.  In this article, I will be outlining how to configure authentication and authorization with Active Directory using CentOS, Scientific Linux, or any other Red Hat based distribution.  The concepts within can be applied Debian-based distributions with relative ease (but authconfig saves a ton of time).

Read more

Secure Plain Text Authentication in PHP using SCRAM

In today’s world, a secure authentication mechanism for web sites is an absolute necessity.  Hackers and script kiddies love to hijack accounts in any way possible.  In some cases even entire databases hackers are compromising entire databases, which, is the last thing a developer wants to be held responsible for.

Today, I will be showing you a mechanism to not only secure the passwords being held in your databases, but a way to secure the authentication process itself from prying eyes.  Enter SCRAM.  While it’s impossible to completely prevent a man in the middle access attack, utilizing SCRAM will certainly make it exponentially more difficult.  For a site that isn’t running e-commerce, I believe this is a much more cost-effective solution to an SSL certificate.

Read more