summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-04-19 10:14:30 +0200
committerChristian Poessinger <christian@poessinger.com>2019-04-19 10:14:30 +0200
commitd9fb2523629ea3a294a4af6153bfe01b72099f62 (patch)
tree1bbe45895814173998f43eb38f5c1eeeb5a35f7b /lib
parent0a19e53f86820373b740e7bb7992b17d0a1d1bb8 (diff)
downloadvyatta-cfg-system-d9fb2523629ea3a294a4af6153bfe01b72099f62.tar.gz
vyatta-cfg-system-d9fb2523629ea3a294a4af6153bfe01b72099f62.zip
T1345: specify RADIUS source IP for system login command
Diffstat (limited to 'lib')
-rw-r--r--lib/Vyatta/Login/Radius.pm22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/Vyatta/Login/Radius.pm b/lib/Vyatta/Login/Radius.pm
index 1549c684..53c92673 100644
--- a/lib/Vyatta/Login/Radius.pm
+++ b/lib/Vyatta/Login/Radius.pm
@@ -62,24 +62,28 @@ sub add_pam_radius {
}
sub update {
- my $rconfig = new Vyatta::Config;
- $rconfig->setLevel("system login radius server");
- my %servers = $rconfig->listNodeStatus();
- my $count = 0;
+ my $rconfig = new Vyatta::Config;
+ $rconfig->setLevel("system login radius");
+ my %servers = $rconfig->listNodeStatus("server");
+ my $count = 0;
+ my $bindaddr = $rconfig->returnValue("source-address");
+ if (!defined($bindaddr)) {
+ $bindaddr = "0";
+ }
open (my $cfg, ">", $PAM_RAD_TMP)
or die "Can't open config tmp: $PAM_RAD_TMP :$!";
print $cfg "# RADIUS configuration file\n";
print $cfg "# automatically generated do not edit\n";
- print $cfg "# Server\tSecret\tTimeout\n";
+ print $cfg "# server[:port]\t\tshared_secret\t\t\ttimeout (s)\tsource_ip\n";
for my $server ( sort keys %servers ) {
next if ( $servers{$server} eq 'deleted' );
- my $port = $rconfig->returnValue("$server port");
- my $secret = $rconfig->returnValue("$server key");
- my $timeout = $rconfig->returnValue("$server timeout");
- print $cfg "$server:$port\t$secret\t$timeout\n";
+ my $port = $rconfig->returnValue("server $server port");
+ my $secret = $rconfig->returnValue("server $server key");
+ my $timeout = $rconfig->returnValue("server $server timeout");
+ print $cfg "$server:$port\t$secret\t$timeout\t$bindaddr\n";
++$count;
print $cfg "priv-lvl 15\n";
print $cfg "mapped_priv_user radius_priv_user\n";