<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Aaron Toponce &#187; Guru Labs</title> <atom:link href="http://pthree.org/category/guru-labs/feed/" rel="self" type="application/rss+xml" /><link>http://pthree.org</link> <description>Linux.  GNU.  Freedom.</description> <lastBuildDate>Thu, 29 Jul 2010 15:16:21 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1-alpha</generator> <item><title>Setup A Git Repository</title><link>http://pthree.org/2008/11/28/setup-a-git-repository/</link> <comments>http://pthree.org/2008/11/28/setup-a-git-repository/#comments</comments> <pubDate>Fri, 28 Nov 2008 12:56:02 +0000</pubDate> <dc:creator>Aaron</dc:creator> <category><![CDATA[Guru Labs]]></category><guid
isPermaLink="false">http://pthree.org/2008/11/28/setup-a-git-repository/</guid> <description><![CDATA[As a system administrator, and as a developer, you can and should take advantage of a version control system (VCS). Many exist, and have various features that might lure you into using it. Here at Guru Labs, we make extensive use of Git. As such, I&#8217;ve setup Git on my own home server, for keeping [...]]]></description> <content:encoded><![CDATA[<p>As a system administrator, and as a developer, you can and should take advantage of a version control system (VCS). Many exist, and have various features that might lure you into using it. Here at <a
href="http://gurulabs.com">Guru Labs</a>, we make extensive use of Git. As such, I&#8217;ve setup Git on my own home server, for keeping track of my dot config files in my home directory, special config files in my /etc directory, and even a DVD inventory application I&#8217;m writing using Python using Django.</p><p>Now, I&#8217;m no Git expert, that&#8217;s for sure. So, I won&#8217;t be getting into the reasons on why you should or should not setup a VCS, nor will I cover the more intermediate or advanced features of Git. However, setting up a Git repository is easy, and I&#8217;ll show how you can manage your own config files using Git.</p><p>The latest versions of Debian and Ubuntu, as well as Fedora and openSUSE, all have Git available in their repositories. Third-party packages are available for RHEL, and you can grab a package for SLES at <a
href="http://download.opensuse.org/repositories/devel:/tools:/scm/SLE_10/">their build service</a>.</p><p>Ok, so let&#8217;s get Git installed. I&#8217;m going to use Git through an SSH server, which means you&#8217;ll need to have an already installed SSH server that you can remotely access. Once that is setup, then we will need to run the following on both our remote SSH server, and our local machine. I&#8217;ll refer to the remote SSH server as &#8220;remote&#8221;, the local box as &#8220;local&#8221; and both machines as &#8220;both&#8221;. Also, I&#8217;ll use the &#8220;#&#8221; for root commands, and &#8220;$&#8221; for regular user commands. So, on my Ubuntu systems as root:</p><pre>both# aptitude install git-core git-doc</pre><p>You should always install the documentation package, if it exists, when dealing with new software. In this case, the Git developers have done a great job in this area, so you can be more effective in your development.</p><p>After installed, we need to setup the repositories. One of the selling features for me with Git, is the fact that a Git repository s 100% self-contained. This means, that if you make some flaw setting it up, or it becomes severely corrupted and you can restore from backup, then all you need to remove is the .git directory recursively, and your repository is gone. No fiddling with config files throughout the system, or running obscure commands. When a Git repository is setup, it creates a .git directory, and it&#8217;s all managed there. So, on the remote machine, let&#8217;s create a repository in our home directory, where our central repository will be managed:</p><pre>remote$ mkdir ~/my_repo
remote$ cd $_
remote$ git init
Initialized empty Git repository in /home/aaron/my_repo/.git/</pre><p>Now, let&#8217;s do the same thing on our local machine. However, I generally deal with source code in my ~/src directory, so that&#8217;s where I&#8217;ll put my configs:</p><pre>local$ mkdir ~/src
local$ cd $_
local$ git init
Initialized empty Git repository in /home/aaron/src/.git/</pre><p>We have now created two empty Git repositories- one on the remote machine behind SSH, and the other on our local machine. The unique thing with Git, is that it doesn&#8217;t follow the standard &#8220;server/client&#8221; architecture. In other words, there&#8217;s no such thing as a &#8220;git server&#8221; and &#8220;git client&#8221;. Git was developed by filesystem developers with filesystem attributes in mind. So, instead, we have a remote Git repository we call the &#8220;origin&#8221; and a local Git repository (I&#8217;m not sure if it has an appropriate name. Maybe &#8220;git trunk&#8221;?). Both are contained in the .git directory. The only difference is, one will be holding the files and directories, while the other will be managing deltas on the files and directories.</p><p>So, let&#8217;s continue. On the local machine now, I need to start doing my developing. Because my repository is keeping track of local dot config files in my home directory, I&#8217;m going to copy my .zshrc file to the Git repository on the local machine:</p><pre>local$ cp ~/.zshrc ~/src
local$ cd $_
local$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .zshrc
nothing added to commit but untracked files present (use "git add" to track)
local$ git add .zshrc
local$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file: .zshrc
#
local$ git commit -a -m "initial commit for .zshrc"
Created initial commit 0614613: initial commit for .zshrc
 1 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 .zshrc
local$ git status
# On branch master
nothing to commit (working directory clean)</pre><p>So, if you paid close attention, all we&#8217;ve done so far is copy my .zshrc from my home directory into my src directory. It&#8217;s best practice to get into the habit of running &#8220;git status&#8221; and &#8220;git commit&#8221; often. This will prevent any future headache you may encounter. So, upon initial discovery, I find out that I need to add my newly copied .zshrc file. After &#8220;git add .zshrc&#8221;, I then need to commit it to the branch I&#8217;m working on, which in this case is called &#8220;master&#8221;. As it sits now, the status of my Git repository is clean. So, all I need to do now, is push it to the remote system:</p><pre>local$ git push ssh://myserver.com/~/my_repo master
Counting objects: 3, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 671 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://myserver.com/~/my_repo
 * [new branch]      master -> master</pre><p>Seeing &#8220;master -> master&#8221; is a good sign. This is telling me the push was successful, and now my remote SSH server has a copy of my repository. Now, to show that it does in fact exist, let&#8217;s remove our .git directory, and clone it;</p><pre>local$ cd ~
local$ rm -rf src
local$ mkdir src
local$ cd $_
local$ git clone ssh://myserver.com/~/my_repo
Initialized empty Git repository in /home/aaron/src/my_repo/.git/
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
Receiving objects: 100% (3/3), 671 bytes, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
local$ ls -a
. .. my_repo
lcoal$ ls -a my_repo
. .. .git .zshrc</pre><p>Further, check out our ~/.git/config file on our local machine:</p><pre>local$ cat ~/src/my_repo/.git/config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = ssh://myserver.com/~/my_repo
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master</pre><p>Notice the &#8220;remote origin&#8221; line. The url is set to our server that we cloned from. This means, that when I want to push my local repository changes to the remote server, I can execute the following instead:</p><pre>local$ git push origin master</pre><p>So there it is: setting up a simple Git repository for managing config files. No need for Gitosis, or other &#8220;applications&#8221; to make it possible. However, this was a simple demonstration, and doesn&#8217;t cover allowed users to work on the repository, who can push and who can&#8217;t and so forth. But, it does get us started on the right foot.</p><p>Happy Git hacking!</p> ]]></content:encoded> <wfw:commentRss>http://pthree.org/2008/11/28/setup-a-git-repository/feed/</wfw:commentRss> <slash:comments>9</slash:comments> </item> <item><title>GNU Screen</title><link>http://pthree.org/2008/10/24/gnu-screen/</link> <comments>http://pthree.org/2008/10/24/gnu-screen/#comments</comments> <pubDate>Fri, 24 Oct 2008 13:54:48 +0000</pubDate> <dc:creator>Aaron</dc:creator> <category><![CDATA[Guru Labs]]></category><guid
isPermaLink="false">http://pthree.org/2008/10/24/gnu-screen/</guid> <description><![CDATA[The key to being an effective administrator is understanding the software that you administer. Software administrators are nothing more than employees who are well rounded in software applications, their versions, how they are configured and installed and lastly how to troubleshoot them should something go wrong. Effective administrators also have a set of tools under [...]]]></description> <content:encoded><![CDATA[<p>The key to being an effective administrator is understanding the software that you administer. Software administrators are nothing more than employees who are well rounded in software applications, their versions, how they are configured and installed and lastly how to troubleshoot them should something go wrong. Effective administrators also have a set of tools under their belt that helps make their job easier. The tool that is the subject of this post is <a
href="http://www.gnu.org/software/screen/">GNU screen</a>.</p><p>First, we need to get a good grasp of screen. Screen is what we call a &#8220;terminal multiplexer&#8221;. A user attaches himself to a console on the machine, then at that users whim, detach from the console, but still leave it installed and its attached processes running on the system. What makes screen so attractive is the ability to reattach to that console, with its currently running processes available. Generally, screen is run on a remote SSH server, so the administrator can log into that box from anywhere, reattach his running screen session, and continue working on his applications like he never left the machine.</p><p>Heres how it works. Log into your local machine, and type:</p><pre>
$ who am i
aaron    pts/1        2008-10-12 05:43 (:0.0)</pre><p>This shows me logged in as aaron, and attached to pseudo terminal 1. I logged into the system on October 12, 2008 at 5:43 in the morning (my daughter won&#8217;t sleep). Now, let&#8217;s execute screen, and run a couple of commands:</p><pre>
$ screen
$ who am i
aaron    pts/4        2008-10-12 05:45 (:0:S.1)
$ cat /dev/zero > /dev/null &#038;</pre><p>Still logged in as aaron, but this time, I&#8217;m attached to pseudo terminal 4. Also, we ran a pretty worthless command, however, it will illustrate the point. Detach from your screen session by typing the following keyboard sequence:</p><pre>
ctrl-a d</pre><p>This will &#8220;detach&#8221; you from pseudo terminal 4, but still leave the device created, will all running processes attached to it:</p><pre>
[detached]
$ ls /dev/pts/4
/dev/pts/4
$ ps -ef | grep cat
aaron    27684 27494 93 05:49 pts/4    00:00:05 cat /dev/zero</pre><p>The process that we ran in screen a moment ago is still running. In my case, it has a process ID of 27684 with a parent process ID of 27494 and attached to pseudo terminal 4, just like we would expect. I wonder what process ID 27494 is&#8230;</p><pre>
$ pstree -p | grep -B 1 27494
        |-screen(27492)-+-ssh(27493)
        |               `-zsh(27494)---cat(27684)</pre><p>(The &#8216;pstree&#8217; command, if run on its own, will show your the processes running on your box in a tree-like structure, showing parent and child processes).</p><p>As we can clearly see, &#8216;screen&#8217; is process ID 27492, with a child process of ZSH, my favorite shell, running as process ID 27494. ZSH is currently running our &#8216;cat&#8217; command as process ID 27684, as we just discovered.</p><p>Here&#8217;s what is absolutely great about GNU screen: I can detach from sessions and reattach to those sessions at will. Suppose I ran that command on my box at home. When I get to work, I want to keep an eye on it. All I need to do now, is login remotely to my machine (hopefully, it&#8217;s running an SSH server), and reattach my screen session:</p><pre>
% ssh helios.cocyt.us
Password:
$ who am i
aaron    pts/0        2008-10-12 06:00 (hades.cocyt.us)
$ screen -r
$ who am i
aaron    pts/4        2008-10-12 06:01 (:0:S.1)
$ kill 27494
[1]  + terminated  cat /dev/zero > /dev/null
$ exit
[screen is terminating]</pre><p>Not only can we detach and attach ourselves from and to these processes respectfully, we can also create new terminals in screen, split our screen horizontally, add multiuser sessions, lock the screen from intrusion, and many other features. The capabilities of screen go well beyond what we&#8217;ve discussed here. Suffice it to say that GNU screen is one of the most powerful tools that a system administrator can have in his tool belt.</p><p>GNU screen is available in the Fedora, openSUSE and Ubuntu repositories, as well as Red Hat Enterprise Linux and SUSE Linux Enterprise Server and Desktop.</p> ]]></content:encoded> <wfw:commentRss>http://pthree.org/2008/10/24/gnu-screen/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Shadowed Passwords</title><link>http://pthree.org/2008/10/23/shadowed-passwords/</link> <comments>http://pthree.org/2008/10/23/shadowed-passwords/#comments</comments> <pubDate>Thu, 23 Oct 2008 09:12:57 +0000</pubDate> <dc:creator>Aaron</dc:creator> <category><![CDATA[Guru Labs]]></category><guid
isPermaLink="false">http://pthree.org/2008/10/23/shadowed-passwords/</guid> <description><![CDATA[As GNU/Linux system administrators, we are often confronted with adding user accounts on the system, deleting user accounts, and modifying existing user accounts. At times, this can be a time consuming process. Further, keeping user accounts synchronized between machines, if not using a directory service, can be a bit of a pain. Have you ever [...]]]></description> <content:encoded><![CDATA[<p>As GNU/Linux system administrators, we are often confronted with adding user accounts on the system, deleting user accounts, and modifying existing user accounts. At times, this can be a time consuming process. Further, keeping user accounts synchronized between machines, if not using a directory service, can be a bit of a pain. Have you ever looked at, or spent some time pouring over the <i>/etc/shadow</i> file? Curious what that hashed password is all about? I&#8217;ve got your answer.</p><p>Before I begin, however, let make take a couple seconds to explain what this post is and is not about. This post is all about learning about shadowed passwords on GNU/Linux. This post is not about learning how to implement different shadowed algorithms on your distribution, the pros and cons of each algorithm, or the mathematical details behind them. This post serves mainly as an informative post regarding the shadowed password itself.</p><p>Also, I need to declare a couple of definitions:</p><ul><li><b>shadowed password</b>: A password stored in a database that is only readable by the root user on a Unix or Linux machine. Unix didn&#8217;t implement shadowed passwords until 1988 with AT&amp;T SystemV R3.2 and BSD 4.3 Reno in 1990.</li><li><b>salt</b>: A random string of text that is used as a seed to build an encrypted hash. Passwords on Unix and Linux are hashed with this salt as a seed. The salt is passed to the hashing algorithm as an argument.</li></ul><p>Let&#8217;s familiarize ourselves with the entire syntax, start to end, of the <i>/etc/shadow</i> file. Then, we&#8217;ll get dirty digging into the nitty-gritty of the actual password, and how authentication on the machine works. So, first the overall syntax.</p><p>As you&#8217;ve probably noticed, the <i>/etc/passwd</i> and <i>/etc/shadow</i> as well as <i>/etc/group</i> and <i>/etc/shadow</i> (if that exists) are colon-delimited files. This means, that columns exist by using the colon as a separator, exactly the same way commas would describe columns in a comma separated file. Between each column, in the <i>/etc/shadow</i> file, exists a value describing aging information regarding the account. Let&#8217;s look at it in more detail:</p><pre>username:password:last_change:may_change:must_change:warn_days:expire_date:disable:reserved</pre><p>Looking at each of these fields one by one:</p><ul><li><b>username</b>: The username of the account as specified in the <i>/etc/passwd</i> file</li><li><b>password</b>: The password is in encrypted hash format, meaning that it has been hashed using a salt as the seed. The rest of the post is on this very topic.</li><li><b>last_change</b>: The number of days, since <a
href="http://en.wikipedia.org/wiki/Unix_time">January 1, 1970</a>, when the password was last changed.</li><li><b>may_change</b>: The number of days since the last password change before a new password change is allowed.</li><li><b>must_change</b>: The number of days since the last password change when a new password change is required.</li><li><b>warn_days</b>: The number of days before <u>must_change</u> when the user begins receiving warning about changing their password.</li><li><b>expire_date</b>: The number of days after the password expires when the account is disabled.</li><li><b>disable</b>: The number of days since January 1, 1970, when the account will be disabled.</li><li><b>reserved</b>: A reserved field for the system.</li></ul><p>All of this information can be found in section 5 of the shadow man page.</p><p>Knowing the locations and valid values of each is crucial as a system administrator. However, I won&#8217;t be covering each of these in any detail other than what has been described above. Also, I&#8217;ll only be discussing the password field. The password field is interesting to me, as I enjoy mathematics and cryptography. Hopefully, you&#8217;ll find this interesting as well.</p><p>As you are probably already aware, the password field is required in order to use the account, however, a password doesn&#8217;t have to exist for the account to be active. When a new account is created on the system, before a password is applied, take a look at the contents of the password in the shadow file. On my Ubuntu system, there is a single exclamation point in the password field. As it sits, the password is invalid, as the system is looking for a hash. Removing the exclamation point from the password field would mean that the user can log into the system without a password. It should be noted, however, that there are unexpected behaviors logging into the system without a password with regards to PAM properly cleaning up the login.</p><p>This brings up another point: the authentication mechanisms that exist on your machine are attempting to validate your password against a valid hash that exists in that password field. Keeping a user from logging in is as simple as producing an invalid hash. This means simply changing a single character in the password, or as above with newly created accounts, putting an exclamation point or two in the password field. In other words, unless a hash can be produced that matches a hash in that field, the user won&#8217;t be able to log in. Fairly simple, no?</p><p> If you check the permissions of the <i>/etc/shadow</i> file, you&#8217;ll notice that only root has access to the file. This is intentional, for one main reason: <a
href="http://en.wikipedia.org/wiki/Rainbow_table">rainbow table attacks</a>. The concept of a rainbow table is simple. Take some text, retrieve the hash value then store it in a table. As hash algorithms are one way cryptographic functions, this means that taking a hash value, and reversing it to its text value is extremely time consuming and highly improbable. So, rather than brute force the hash value, all you have to do is simply look up a hash in the table for a match. If a match is found, you have the text to the hash. Spending some time on Google, there are plenty of rather large rainbow tables in existence. Salting the hash means that access to the salt would be needed, otherwise, the hash will change infinitely for a single password.</p><p>A little history note: <a
href="http://en.wikipedia.org/wiki/Shadow_password#History">passwords have not always existed in the shadow file</a>, as they used to exist in the <i>/etc/passwd</i> file. After all, where do you think the name came from? In the second field of that file is where the password used to exist. Now, you&#8217;ll notice that an &#8216;x&#8217; exists in its place instead, with the password moved to the shadow file. The reason is explained above, with rainbow tables. The <i>/etc/passwd</i> permissions allow any account on the system to read the file. This is needed for applications to know if accounts exists on the system for various routines. Keeping the password, even if it&#8217;s hashed, in a file world-readable made system administrators uneasy, and eventually, the shadow system was created. FYI- on FreeBSD, and other Unixes, the shadow file is <i>/etc/master.passwd</i> rather than <i>/etc/shadow</i>.</p><p>To bring security up on the front lines, hashes aren&#8217;t difficult to brute force. When Unix was created in 1969, computing resources were severely limited. We couldn&#8217;t use massive mathematical algorithms to process hashed passwords and see if they matched what was in the password database. As such, we stuck with small bit rates for generating the hash. As time progressed, and computing power got more powerful, the need for changing that bit rate to higher values on creating the hash increased. Unfortunately, the rate of change wasn&#8217;t linear to the rate of change in computing power, and brute forcing hashed passwords became more and more of a realization. The need for stronger algorithms became a necessity.</p><p>As already noted, the password <em>was</em> stored in the <i>/etc/passwd</i> file. However, because the threat of brute forcing password hashes was becoming real, the need to rethink passwords on a Unix system was eventually realized, and the password moved into its current location, the <i>/etc/shadow</i> file. The reason for &#8220;shadow&#8221; comes from the idea that rather than just storing the password hash in a world-readable file, we move it to a separate file that only root has access (as defined above). Further, to add strength to the hashed password, we create a seed, which we&#8217;ll refer to as a &#8220;salt&#8221;, and use that salt, combined with the hashing algorithm, to result in a much stronger encrypted password (security experts actually will call the encrypted password <i>encoded</i> rather than encrypted, as the text is set to null, and the password is the key). Shadowing and salting your password has been implemented in GNU/Linux for some time, and came as a result of first appearing in FreeBSD. Most, if not all, GNU/Linux distributions now shadow and salt their passwords by default.</p><p>So, now that we&#8217;ve learned what is contained in the <i>/etc/shadow</i> file, and a little history of the password itself, let&#8217;s look at the structure of the encrypted password in the file. You will probably notice that it has a very patterned format. The format is simple to understand:</p><pre>$hash_type$random_salt$encrypted_password</pre><p>There are 3 dollar signs which act as separators in the shadowed password field. Within the first two dollar signs exists the type of algorithm used to hash the password. Within the next two dollar signs is a random salt that is used with the hashing algorithm to create the encrypted password. After the third dollar sign, before the next colon, is the encrypted password itself.</p><p>For the supported hash types, this is generally MD5, however, new computing power is beginning to show the age of MD5 hashes, which uses a 128-bit key. As such, new hashing algorithms are coming onto the scene to strengthen the password itself, such as 160-bit, 256-bit and 512-bit algorithms. The question is, however, how do know which algorithm you are using? I&#8217;ve outlined a list of the common, currently in use hash types.</p><ul><li><b><i>missing</i></b>: If the dollar signs are missing, but a hash exists, then the DES algorithm or the crypt() function was called. This has been implemented on Unix since the early days, and still exists on a few GNU/Linux distributions. DES has shown severe cryptanalysis attacks, and should not be used.</li><li><b>$1$</b>: The MD5 hashing algorithm, as originally started with FreeBSD, developed by Poul-Henning Kamp. This is the default on Ubuntu, and other Debian-based distributions. It uses a 128-bit key during creation.</li><li><b>$2$</b> and <b>$2a$</b>: Two different versions of the blowfish encryption cipher, originally developed by Bruce Schneier, and implemented by Niels Provos and David Mazieres for OpenBSD. This is the default in openSUSE 11, as well as the forthcoming SUSE Linux Enterprise Server and Desktop, version 11. It also uses a 128-bit key, where <b>$2$</b> appends a NUL to the key, and <b>$2a$</b> does not.</li><li><b>$5$</b>: The next two come from Ulrich Drepper at Red Hat for GNU/Linux. This one is a SHA-256 hashing algorithm implementation with a 32 byte output, and uses a 256-bit key.</li><li><b>$6$</b>: This is a SHA-512 hashing algorithm implementation with a 64 byte output. This is the default on Fedora 9 and soon to be released Red Hat Enterprise Linux 6. It uses a 512-bit key.</li></ul><p>Others exist, but aren&#8217;t worth mentioning, in my opinion. However, for reference, there is a <a
href="http://search.cpan.org/~zefram/Authen-Passphrase-0.005/lib/Authen/Passphrase.pm">CPAN Perl module for working with shadowed passwords</a>, and documentation exists for handling all the supported shadow types.</p><p>I won&#8217;t be covering the mathematical algorithm used on each function, as that could make for an exceptionally lengthy post (you&#8217;re probably bored already). As such, may I recommend spending some time on Google and Wikipedia, learning each algorithm, their strengths and weaknesses, as well as their implementations? It really makes for fascinating reading, if you are into mathematics and cryptography.</p><p>Now, what&#8217;s up with the salt? What does it actually provide? Why should I care? Isn&#8217;t a straight hash strong enough? Actually, no- it&#8217;s not. A straight hash, albeit strong, is not strong enough, due to rainbow tables. So, the salt steps in, and adds strength to the hash. Here&#8217;s how. First, a string is chosen at random with the following valid characters: a-z, A-Z, 0-9, &#8220;.&#8221; and &#8220;/&#8221;. In other words, all 26 uppercase and lowercase letters of the English alphabet, all ten single digits, the period and forward slash.</p><p>Let&#8217;s say that only 2 characters where chosen from that pick to form our salt string. Because there are 64 possible combinations when choosing just one character, and another 64 combinations for the other, this makes the possible combinations from just 2 characters 4096 (64 squared). Adding that to the hash, means there are 4096+1, or 4097 possible hashes that could result from my single password. This makes the rainbow table 4096 times larger, and it also makes the hash literally 4096 times more difficult to break. Now, on my Ubuntu installation, the salt is used with 8 characters from the above list. So, 64 to the 8th power means 281,474,976,710,656 possible combinations in the salt alone. Which, as discovered above, means 281.4 quadrillion possible hashes from a single password, and a rainbow table size of 281.4 quadrillion times larger! To put this number in perspective, 281,474,976,710,656 seconds would be approximately 8,925,513 years. Yeah. Salting the password just makes sense, don&#8217;t you think?</p><p>To take advantage of a specific algorithm in the shadow file, we need to modify the pluggable authentication modules, known as PAM. Of course, you will need to have an understanding of PAM before hacking away. I&#8217;m not going to cover how to setup your box to take advantage of the different algorithms. The would lengthen the post, and potentially render your system unbootable if you were to make a mistake, forcing you into a rescue environment, then I get blamed. <img
src='http://pthree.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> However, check your GNU/Linux vendor documentation, as well as Google, and support forums for enabling different algorithms on your distribution.</p><p>So, there you have it! Shadowed password information on GNU/Linux. As you can tell, there is much to discuss in relation to this topic. I could probably spend a couple of posts describing how to implement each algorithm on your box, the algorithms of each, testing their strengths and weaknesses, and much more. Encryption, especially when it comes to passwords, is a broad, but intriguing and enlightening topic.</p> ]]></content:encoded> <wfw:commentRss>http://pthree.org/2008/10/23/shadowed-passwords/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)

Served from: pthree.org @ 2010-08-01 09:38:28 -->