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

Fixes logic when pfacct and radius-acct are enabled #8175

Open
wants to merge 6 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
13 changes: 10 additions & 3 deletions lib/pf/services/manager/pfacct.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use Template;
use pf::cluster;
use pf::config qw(
$management_network
%Config
);

extends 'pf::services::manager';
Expand Down Expand Up @@ -58,15 +59,21 @@ Generate the environment variables for running the container

sub generate_container_environments {
my ($self, $tt) = @_;
my $management_ip = $management_network->tag('ip');

my $port = '1813';
if ($cluster_enabled) {
my $listeningIp = "";
if ($cluster_enabled || isenabled($Config{services}{radiusd_acct})) {
$port = '1823';
}
if ($cluster_enabled && isenabled($Config{services}{radiusd_acct})) {
$port = '1833';
}
if (isenabled($Config{services}{radiusd_acct})) {
$listeningIp = '127.0.0.1';
}
my $vars = {
env_dict => {
PFACCT_ADDRESS=> "$port",
PFACCT_ADDRESS=> "$listeningIp:$port",
JeGoi marked this conversation as resolved.
Show resolved Hide resolved
},
};
$tt->process("/usr/local/pf/containers/environment.template", $vars, "/usr/local/pf/var/conf/acct.env") or die $tt->error();
Expand Down
12 changes: 10 additions & 2 deletions lib/pf/services/manager/radiusd_child.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,15 @@ EOT

if(isenabled($Config{services}{pfacct})) {
my $management_ip = defined($management_network->tag('vip')) ? $management_network->tag('vip') : $management_network->tag('ip');
$tags{'pfacct'} = <<"EOT";
my $port = '1813';
if ($cluster_enabled || isenabled($Config{services}{radiusd_acct})) {
$port = '1823';
}
if ($cluster_enabled && isenabled($Config{services}{radiusd_acct})) {
$port = '1833';
}

$tags{'pfacct'} = <<"EOT";
# pfacct configuration

realm pfacct {
Expand All @@ -1094,7 +1102,7 @@ home_server_pool pfacct_pool {
home_server pfacct_local {
type = acct
ipaddr = 127.0.0.1
port = 1813
port = $port
secret = '$local_secret'
src_ipaddr = $management_ip
}
Expand Down
Loading