Created
December 13, 2009 03:44
-
-
Save ambethia/255249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# auth-aloha.rb - OpenVPN auth script for Aloha | |
# | |
# Created by Jason Perry on 2009-12-12. | |
# Copyright (c) 2009 Gray's College Bookstore. All rights reserved. | |
# | |
# Usage: | |
# auth-user-pass-verify /path/to/auth-aloha.rb via-file | |
# | |
require 'net/http' | |
require 'net/https' | |
require 'cgi' | |
cred = File.read(ARGV.shift).split.map {|s| CGI.escape(s) } | |
http = Net::HTTP.new('aloha.graysbooks.com', 443) | |
http.use_ssl = true; | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
resp = http.post('/auth', ('email=%s&password=%s&to=vpn' % cred)) | |
exit resp.code == '200' ? 0 : 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment