Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modified uab_ood_auth.regex to map uab and XIAS users correctly #245

Open
wants to merge 1 commit into
base: feat-openstack
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions roles/ood_user_reg_cloud/files/uab_ood_auth.regex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require 'ood_auth_map'

class Regex < OodAuthMap
# Default regular expression to use when parsing authenticated username
DEFAULT_REGEX = "^(.+)$"
DEFAULT_REGEX = "([^!]+)@uab.edu$"

# Body of option parser
define_body do |parser|
Expand Down Expand Up @@ -42,10 +42,22 @@ class Regex < OodAuthMap
end

define_run do |auth_user|
user_check = `getent passwd #{auth_user} | cut -d : -f 1`
#puts user_check
if user_check != ""
puts auth_user
sys_user = Helpers.parse_string(auth_user, /#{options[:regex]}/i)
# downcase the result
sys_user = ( sys_user || Helpers.parse_string(auth_user, /uabgrid.uab.edu\/shibboleth!(.+)$/) || auth_user).downcase

# Add blocked users list
block_user_file = File.join(File.dirname(__FILE__), "block_users_ood.txt")
if File.exists? (block_user_file)
block_users = File::readlines(block_user_file).map(&:chomp)
if block_users.include? sys_user
puts ""
exit(false)
end
end

if `getent passwd #{sys_user} | cut -d \' \' -f 1` != ""
puts sys_user
else
puts ""
exit(false)
Expand Down