aboutsummaryrefslogtreecommitdiff
path: root/perl/lib/Wallet/Policy/Stanford.pm
diff options
context:
space:
mode:
authorJon Robertson <jonrober@stanford.edu>2014-10-14 13:23:40 -0700
committerJon Robertson <jonrober@stanford.edu>2014-10-14 13:23:40 -0700
commitb658b799cb10b48d1a5aca19a7e63fe91d2af77a (patch)
tree15ab41aea58284ad46e682f448c980bed7c80bff /perl/lib/Wallet/Policy/Stanford.pm
parent44df8ab537e13c4bb41d0d1c85d4a42891c6ea12 (diff)
Added Duo to the Stanford policy module
Duo object types currently all assume that the name of the object is the hostname of the server it's for. Change-Id: Ieb5ba144cd39d6aeb3a20466c75a2836a170744f
Diffstat (limited to 'perl/lib/Wallet/Policy/Stanford.pm')
-rw-r--r--perl/lib/Wallet/Policy/Stanford.pm24
1 files changed, 22 insertions, 2 deletions
diff --git a/perl/lib/Wallet/Policy/Stanford.pm b/perl/lib/Wallet/Policy/Stanford.pm
index 5ac29e0..07d32a4 100644
--- a/perl/lib/Wallet/Policy/Stanford.pm
+++ b/perl/lib/Wallet/Policy/Stanford.pm
@@ -174,6 +174,13 @@ sub _host_for_keytab {
return $host;
}
+# Map a duo-type object name to a hostname. Currently all Duo objects are
+# named just for the hostname, so this is easy.
+sub _host_for_file {
+ my ($name) = @_;
+ return $name;
+}
+
# The default owner of host-based objects should be the host keytab and the
# NetDB ACL for that host, with one twist. If the creator of a new node is
# using a root instance, we want to require everyone managing that node be
@@ -183,8 +190,13 @@ sub default_owner {
# How to determine the host for host-based objects.
my %host_for = (
- keytab => \&_host_for_keytab,
- file => \&_host_for_file,
+ 'keytab' => \&_host_for_keytab,
+ 'file' => \&_host_for_file,
+ 'duo' => \&_host_for_duo,
+ 'duo-pam' => \&_host_for_duo,
+ 'duo-radius' => \&_host_for_duo,
+ 'duo-ldap' => \&_host_for_duo,
+ 'duo-rdp' => \&_host_for_duo,
);
# If we have a possible host mapping, see if we can use that.
@@ -368,6 +380,14 @@ sub verify_name {
}
}
+ # Check the naming conventions for all Duo object types. The object
+ # should simply be the host name for now.
+ if ($type =~ m{^duo(-\w+)?$}) {
+ if ($name !~ m{ [.] }xms) {
+ return "host name $name is not fully qualified";
+ }
+ }
+
# Success.
return;
}