Yubikey One-Time Password Authentication
Listing 3. Typo: Account-Specific Yubikey Configuration Options HTML
filename: app/views/admin/users/_form.html.erb:
...
<li>
<label class="float" for="user_notify_on_new_articles"><%=
_("Send notification messages when new articles are posted")%>?
</label>
<%= check_box 'user', 'notify_on_new_articles' %>
</li>
<!-- new options for Yubikey authentication - start -->
<li>
<label class="float" for="user_yubikey_required"><%=
_("Yubikey Required")%>?
</label>
<%= check_box 'user', 'yubikey_required' %>
</li>
<li>
<label class="float" for="user_yubikey_id"><%=
_("Yubikey ID")%>:
</label>
<%= text_field 'user', 'yubikey_id' %>
</li>
<!-- new options for Yubikey authentication - end -->
</ul>
</fieldset>
<!--[eoform:user]-->
Listing 4. Typo: Yubikey Settings Database Migration
filename: db/migrate/071_add_yubikey_columns_to_user.rb:
class AddYubikeyColumnsToUser < ActiveRecord::Migration
def self.up
add_column :users, :yubikey_id, :string,
:null => false, :default => ''
add_column :users, :yubikey_required,
:boolean, :null => false, :default => false
end
def self.down
remove_column :users, :yubikey_id
remove_column :users, :yubikey_required
end
end

Figure 7. Typo: Account-Specific Yubikey Configuration Options UI
Now that we have the setup all taken care of, we can focus on the actual authentication during login. First, let's add a Yubikey OTP input field to the login screen provided that Yubikey authentication is enabled for the whole blog. I have done this by modifying the partial template that renders the login form in Listing 5. Notice that we always have to show the Yubikey OTP field during login, because until users supply their user names, we don't know whether Yubikey authentication is required for a particular user. Figure 8 shows the modified login screen.
When the login form is submitted, Rails routes it to the login method of the AccountsController class (Listing 6). This is where we add the logic to check whether we need to handle Yubikey authentication. After the existing code has verified the regular login and password, we now have an instantiated user object that can tell us whether Yubikey authentication is required for this user. If so, we invoke the static method authenticate_yubikey of the user object. Looking at Listing 7, we check that neither the Yubikey OTP from the login form nor the user's public Yubikey ID are blank. Moreover, by definition, the first 12 characters of the OTP have to match the public ID associated with the account. If everything is in order, we instantiate a Yubico object, which will handle the Web service authentication request for us. The method simply returns a boolean. True means the user was authenticated successfully. Conversely, false implies an invalid OTP or an attempt by an unauthorized user—possibly an attempt to hack into the account.
Listing 5. Typo: Modified Login Form HTML
filename: app/views/shared/_loginform.html.erb:
<% form_tag :action=> "login" do %>
<ul>
<li>
<label for="user_login"><%= _('Username')%>:</label>
<input type="text" name="user_login" id="user_login" value=""/>
</li>
<li>
<label for="user_password"><%= _('Password') %>:</label>
<input type="password" name="user_password" id="user_password" />
</li>
<!-- Yubikey authentication - start -->
<% if this_blog.yubikey_required %>
<li>
<label for="yubikey_otp"><%= _('Yubikey OTP') %>:</label>
<input type="text" name="yubikey_otp" id="yubikey_otp" />
</li>
<% end %>
<!-- Yubikey authentication - end -->
<li class="r"><input type="submit" name="login"
value= "<%= _('Login') %> »"
class="primary" id="submit" />
</li>
</ul>
<p><%= link_to
"« " + _('Back to ') + this_blog.blog_name,
this_blog.base_url %></p>
<% end %>
Listing 6. Typo: Yubikey Authentication Part 1
filename: app/controllers/accounts_controller.rb:
...
def login
case request.method
when :post
self.current_user =
User.authenticate(params[:user_login], params[:user_password])
# check whether Yubikey authentication is required and perform
# authentication
if logged_in? &&
(!this_blog.yubikey_required ||
!self.current_user.yubikey_required ||
self.current_user.authenticate_yubikey(
this_blog,
self.current_user.yubikey_id,
params[:yubikey_otp]))
session[:user_id] = self.current_user.id
flash[:notice] = _("Login successful")
redirect_back_or_default :controller => "admin/dashboard",
:action => "index"
else
flash.now[:notice] = _("Login unsuccessful")
@login = params[:user_login]
end
end
end
...
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- RSS Feeds
- Validate an E-Mail Address with PHP, the Right Way
- Introduction to MapReduce with Hadoop on Linux
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Help with Designing or Debugging CORBA Applications
- New Products
- Returning Values from Bash Functions
- Hacking Cell Phones via Bluetooth Tools under Linux
- notifier shortcomings
9 min 54 sec ago - heroku?
1 hour 46 min ago - Android User
1 hour 48 min ago - Reply to comment | Linux Journal
3 hours 41 min ago - compiling
6 hours 30 min ago - This is a good post. This
11 hours 43 min ago - Great, This is really amazing
11 hours 45 min ago - These posts are really good
11 hours 47 min ago - It’s a really great site you
11 hours 49 min ago - Beautiful ... I love your
12 hours 15 min ago
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
bad link
FYI
the link to supported apps is broken.
http://yubico.com/applications/software/ is the correct one
Swekey
Hi Dirk,
If you are interested in authentication you should also have a look on the swekey.
It is a totally different approach than the Yubikey.
If you want a free sample for evaluation I'll be happy to send you one...
Regards,
Luc
2 step authentication
What is to prevent the attacker from simulating the response to the first step? More than a simple challenge to the user will be too much of a burden to the user, while a simple challenge will likely be easy to work-around.
I would suggest using the Yubikey device with HTTP Digest Authentication. Of course, the Yubikey OTP will have to be entered in the User Name field, not the password.
It is 10 dreams come true!
Secure, elegant, and innovative!
http://mashedlife.com//dream2.php
Keep the good work!