Symantec Access Management

Perl script to create a 4x agent 

06-23-2014 11:22 PM

A sample perl script to create a 4x agent. This could be useful when you need to have a 4x agent to login to FSS Admin UI and you don't already have a WAMUI to create one.

Statistics
0 Favorited
1 Views
1 Files
0 Shares
1 Downloads
Attachment(s)
zip file
fssuiagent.pl.zip   619B   1 version
Uploaded - 05-29-2019

Tags and Keywords

Comments

01-27-2016 10:11 AM

Thanks Ujwol, this helped me. I will try to figure out how can I add these agents to agentgroup. If I have some problem I will update.

 

Just a note "!@" on line number 12 created problem, I removed it and it works.

01-26-2016 07:52 PM

Hi Richard,

 

Your current code is not optimal for creating multiple agents.

  • You are initializing the agent api connection to policy server multiple times.
  • Source code is duplicated for creating multiple agents

 

I have modified the source code to match your requirement to create multiple agents.See below :

 

Script: fssuiagentmultiple.pl

****************************************************************

# A sample Perl script to create multiple 4.x Agent

 

use Netegrity::PolicyMgtAPI;

$adminName          = 'siteminder';

$adminPwd           = 'siteminder';

$agentIP            = '127.0.0.1';

$agentSecret        = 'siteminder';

#$agentName    = 'fssadminui';

@agentNames = ("agent1", "agent2", "agent3", "agent4", "agent5");

 

!@

 

 

$policymgtapi = Netegrity::PolicyMgtAPI->New();

$session = $policymgtapi->CreateSession($adminName, $adminPwd);

 

die "\nFATAL: Cannot create session. Please check admin credentials\n"

    unless ($session != undef);

 

  foreach my $i (0..4) {

 

 

  if(!defined $session->GetAgent($agentNames[$i])){

    print "\n\t\'$agentNames[$i]\' agent does not exist.";

  }

  else{

    print "\n\tDeleting Agent \'$agentNames[$i]\'...";

    $session->DeleteAgent($session->GetAgent($agentNames[$i]));

    print "done.";

  }

 

  print "\n\tCreating Agent \'$agentNames[$i]\'...";

  $agent = $session->CreateAgent( $agentNames[$i],

  $session->GetAgentType("Web Agent"),

  "4x Agent for FSS AdminUI",

  $agentIP,

  $agentSecret

   );

 

 

  if(!defined $agent) {

  die "\nFATAL: Unable to create Agent \'$agentNames[$i]\'\n";

  }

 

  }

 

    print "done\n";

****************************************************************

 

Sample result :

****************************************************************

C:\Program Files (x86)\CA\SiteMinder\CLI\bin>perl fssuiagentmultiple.pl

 

 

        'agent1' agent does not exist.

        Creating Agent 'agent1'...

        'agent2' agent does not exist.

        Creating Agent 'agent2'...

        'agent3' agent does not exist.

        Creating Agent 'agent3'...

        'agent4' agent does not exist.

        Creating Agent 'agent4'...

        'agent5' agent does not exist.

        Creating Agent 'agent5'...done

 

****************************************************************

 

Hope this helps.

Let me know how it goes.

 

Cheers,

Ujwol

01-25-2016 05:37 PM

Hi Ujwol,

 

   Thanks for sharing this script.

 

  I am trying to create multiple agents(say more then 5) using the same script, this script works and creates 2 agents but after that perl.exe crashes. Can you please suggest if this script is wrong or there is something else I need to add so that I can create multiple agents using same script.

 

 

 

# A sample Perl script to create 4.x Agent

==============================================================

#creating 1st agent

use Netegrity::PolicyMgtAPI;

$adminName          = 'siteminder';

$adminPwd           = 'firewall';

#$agentIP            = '127.0.0.1';

#$agentSecret        = 'siteminder';

#$agentName    = 'agent1';

 

$policymgtapi = Netegrity::PolicyMgtAPI->New();

$session = $policymgtapi->CreateSession($adminName, $adminPwd);

 

die "\nFATAL: Cannot create session. Please check admin credentials\n"

    unless ($session != undef);

 

  if(!defined $session->GetAgent($agentName)){

        print "\n\t\'$agentName\' agent does not exist.";

  }

  else{

        print "\n\tDeleting Agent \'$agentName\'...";

               $session->DeleteAgent($session->GetAgent($agentName));

        print "done.";

        }

 

  print "\n\tCreating Agent \'$agentName\'...";

    $agent = $session->CreateAgent( $agentName,

                                    $session->GetAgentType("Web Agent"),

                                    "agent1",

                                    $agentIP,

                                    $agentSecret

                                  );

 

    if(!defined $agent) {

        die "\nFATAL: Unable to create Agent \'$agentName\'\n";

    }

 

    print "done\n";

 

#creating 2nd agent

 

$agentName    = 'agent2';

 

$policymgtapi = Netegrity::PolicyMgtAPI->New();

$session = $policymgtapi->CreateSession($adminName, $adminPwd);

 

die "\nFATAL: Cannot create session. Please check admin credentials\n"

    unless ($session != undef);

 

  if(!defined $session->GetAgent($agentName)){

        print "\n\t\'$agentName\' agent does not exist.";

  }

  else{

        print "\n\tDeleting Agent \'$agentName\'...";

               $session->DeleteAgent($session->GetAgent($agentName));

        print "done.";

        }

 

  print "\n\tCreating Agent \'$agentName\'...";

    $agent = $session->CreateAgent( $agentName,

                                    $session->GetAgentType("Web Agent"),

                                    "agent2",

                                    $agentIP,

                                    $agentSecret

                                  );

 

    if(!defined $agent) {

        die "\nFATAL: Unable to create Agent \'$agentName\'\n";

    }

 

    print "done\n";

 

=============================================================

 

and further  you can add same code to test.

 

Thank You

06-24-2014 12:24 AM

And you can use XPSExplorer to create 4x agent as  well.

Related Entries and Links

No Related Resource entered.