From 811479dfe458341bfd6c64714e729545cd03573c Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Tue, 23 Apr 2019 12:40:39 +0200
Subject: T1345: specify RADIUS source IP for system login command

  set system login radius-source-address '172.18.201.10'
---
 lib/Vyatta/Login/RadiusServer.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'lib/Vyatta')

diff --git a/lib/Vyatta/Login/RadiusServer.pm b/lib/Vyatta/Login/RadiusServer.pm
index 5a71b1f8..f2e15de2 100644
--- a/lib/Vyatta/Login/RadiusServer.pm
+++ b/lib/Vyatta/Login/RadiusServer.pm
@@ -63,6 +63,10 @@ sub add_pam_radius {
 
 sub update {
     my $rconfig = new Vyatta::Config;
+    my $bindaddr = $rconfig->returnValue("system login radius-source-address");
+    if (!defined($bindaddr)) {
+        $bindaddr = "0";
+    }
     $rconfig->setLevel("system login radius-server");
     my %servers = $rconfig->listNodeStatus();
     my $count   = 0;
@@ -72,14 +76,14 @@ sub update {
 
     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 secret");
 	my $timeout = $rconfig->returnValue("$server timeout");
-	print $cfg "$server:$port\t$secret\t$timeout\n";
+	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";
-- 
cgit v1.2.3