Hi Filip,
you could disable user caching (cache timeout = 0) and authorize you users using a custom LDAP backend script that sets the VERDICT attribute to "TRUE" and the RARGS attribute to whatever arguments you want the daemon to set/add. E.g., "vdom+vdom1\nvdom+vdom2\nvdom+vdom3\n...vdom+vdomX", based on memberOf attributes.
The "+" attributes will be added as optional attributes to the
response ("*"). Adding them as
mandatory will quite likely not work (mandatory arguments aren't
multi-value).
In "mavis_tacplus-ng_ldap.pl" I'd probably place that code somewhere around line 267:
my $val =
$entry->get_value('memberof', asref => 1);
if ($#{$val} > -1) {
$val = expand_memberof($val);
my (@M, @MO,
@RARGS);
foreach my $m (sort @$val) {
if ($m =~
/$LDAP_MEMBEROF_REGEX/i) {
push @M, $1;
push @MO, $m;
}
if ($m =~
/^cn=vdom_([^,]+),.*/) {
push @RARGS, $a;
}
}
$V[AV_A_TACMEMBER] = '"' . join('","',
@M) . '"' if $#M > -1;
$V[AV_A_MEMBEROF] = '"' . join('","',
@MO) . '"' if $#MO > -1;
if ($#RARGS > -1) {
$V[AV_A_VERDICT
= AV_V_BOOL_TRUE;
$V[AV_A_RARGS] = 'vdom+' .
join('"\nvdom+"', @RARGS);
}
}
This is obviously untested on my part.
Cheers,
Marc
Filip --
You received this message because you are subscribed to the Google Groups "Event-Driven Servers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-driven-ser...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/e37ca503-c002-4433-9f36-5bb4ae4cda07n%40googlegroups.com.
Hi Filip,
180809: 16:59:23.132 5/115bdae1: 100.64.37.1 arg[1] (len: 9): memberof*
180809: 16:59:23.132 5/115bdae1: 100.64.37.1 arg[2] (len: 11): admin_prof*
180809: 16:59:23.132 5/115bdae1: 100.64.37.1 arg[3] (len: 5): vdom*
the devices requests those attributes as optional (*), but the authorization algorithm (from the TAC_PLUS dev kit) specifies that only one attribute is returned. This is back from the SLIP/PPP ages and seems no longer relevant. However, to retain compatibility I've added "add" to complement the "set" and "optional" keywords. "add" will set an optional parameter unconditionally, even multiple times. I've used "+" for RARGS as an indicator for those additional return attributes. On-the-wire these are just optional ones (with "*" as a separator), and that's what I'd use.
For testing configurations, tac_plus-ng comes with the tac_plus-ng/perl/tac_trace.pl utility which will show the AV pairs just fine.
Cheers,
Marc
than should I use your suggested code, or should I use 'vdom*' instead of 'vdom+' in AV_A_RARGS ?
BTW Can I show content of AV_A_RARGS in some debug output? Actually I'm not sure if it is filled correctly :-(
if ($mesg->count() == 1) {
my $entry = $mesg->entry(0);
my $val = $entry->get_value('memberof', asref => 1);
$authdn = $entry->dn;
my (@M, @MO, @RARGS);
if ($#{$val} > -1) {
$val = expand_memberof($val);
} else {
$val = expand_groupOfNames($entry->dn);
}
foreach my $m (sort @$val) {
if ($m =~ /$LDAP_MEMBEROF_REGEX/i) {
push @M, $1;
push @MO, $m;
}
if ($m =~ /^(cn=vdom_)(([^,]+))(,.*)/i) {
$m = $2;
push @RARGS, $m;
}
}
$V[AV_A_TACMEMBER] = '"' . join('","', @M) . '"' if $#M > -1;
$V[AV_A_MEMBEROF] = '"' . join('","', @MO) . '"' if $#MO > -1;
if ($#RARGS > -1) {
$V[AV_A_VERDICT] = AV_V_BOOL_TRUE;
$V[AV_A_RARGS] = '"vdom+"' . join('"\nvdom+"', @RARGS);
}
$V[AV_A_DN] = $authdn;
Hi Filip,
please use \r instead of \n for joining. I actually think I've mentioned that before but I'm too lazy to look that up.
$V[AV_A_RARGS] = '"vdom+' . join('"\r\"vdom+', @RARGS) . '"';
should return suitable AV pairs.
Cheers,
Marc
--
You received this message because you are subscribed to the Google Groups "Event-Driven Servers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-driven-ser...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/bd5b988c-a838-407a-8fe9-daba961ec2dcn%40googlegroups.com.
Hi,
wrong again, please try
$V[AV_A_RARGS] = '"vdom+' . join('"\r"vdom+', @RARGS) . '"';
instead.
Cheers,
Marc
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/9e278153-4da7-b603-6440-4c39332972bf%40googlemail.com.
Hi Filip,
ok, let's give that another try. Does one of
$V[AV_A_RARGS] = 'vdom+' . join('\rvdom+', @RARGS);
$V[AV_A_RARGS] = 'vdom+"' . join('\rvdom+"', @RARGS) :'"';
work?
The first should result in
vdom*VDDST01FE01
vdom*VDDST99
while the seond one should quote the values, such as
vdom*"VDDST01FE01"
vdom*"VDDST99"
However, I've the gut feeling that I've missed some + => * or
\r => \n conversion somewhere.
Cheers,
Marc
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/245444ba-f4a3-4634-bd62-28905ccc494cn%40googlegroups.com.
Hi Filip,
ok, I did a couple of quick tests with manually setting RARGS to
"vdom+\"1\"\rvdom+\"2\"\rvdom+\"3\""
which should come pretty close to what
$V[AV_A_RARGS] = 'vdom+"' . join('"\rvdom+"', @RARGS) . '"';
returns as output.
The result looked pretty well:
packet body (len: 33):
\001\003\000\000\000\000\b\b\bvdom*"1"vdom*"2"vdom*"3"
0000 01 03 00 00 00 00 08 08 08 76 64 6f 6d 2a 22 31 ........
.vdom*"1
0010 22 76 64 6f 6d 2a 22 32 22 76 64 6f 6d 2a 22 33 "vdom*"2
"vdom*"3
0020 22 "
AUTHOR/REPLY, status=1 (AUTHOR/PASS_ADD)
msg_len=0, data_len=0, arg_cnt=3
msg (len: 0):
data (len: 0):
arg[0] (len: 8): vdom*"1"
arg[1] (len: 8): vdom*"2"
arg[2] (len: 8): vdom*"3"
---<end packet>---
So, how exactly does the hexdump in your test look like with the exact Perl snippet above?
Cheers,
Marc
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/42da1e0d-9ae0-403a-a975-7baeddcd3f62n%40googlegroups.com.
Hi Filip,
ok, does
$V[AV_A_RARGS] = 'vdom+"' . join("\"\rvdom+\"", @RARGS) . '"';
give a better result?
Cheers,
Marc
To view this discussion on the web visit https://groups.google.com/d/msgid/event-driven-servers/6117c99b-baad-4911-a7a2-012d2c8fdaf2n%40googlegroups.com.