Security

 View Only
last person joined: yesterday 

Forum to discuss Enterprise security using HPE Aruba Networking NAC solutions (ClearPass), Introspect, VIA, 360 Security Exchange, Extensions, and Policy Enforcement Firewall (PEF).
Expand all | Collapse all

PowerArubaCP : a powershell module for use ClearPass REST API

This thread has been viewed 28 times
  • 1.  PowerArubaCP : a powershell module for use ClearPass REST API

    MVP GURU
    Posted Mar 03, 2019 08:44 AM

     

     

    Hi,

     

    I have been working for several months on a Powershell module that uses the ClearPass REST API.

     

    This module is available on psgallery(.com) : https://www.powershellgallery.com/packages/PowerArubaCP/

     

    Actually, we support to connect to HTTPS using Token API

    and configure the following feature :

    •  NetworkDevice (NAS) : Add / Get / Set /Remove
    • ...

    it is very easy to use (and install)

     

    Launch powershell command line and laucnh following command for install

     

    Install-Module PowerArubaCP

    for load the module

    Import-Module PowerArubaCP

    Connect to your ClearPass

    Connect-ArubaCP 192.0.2.1 -token aaaaaaaaaaaaaaaaaaaaa

     

    for example to get all Network Device (Nas)

    Get-ArubaCPNetworkDevice

     

    You can get the list of command available via

    Get-Command -Module PowerArubaCP

     

     and for get help (and example about a command for example Add-ArubaCPNetworkDevice)

    Get-Help Add-ArubaCPNetworkDevice -Full

    More documentation, example is available on https://github.com/PowerAruba/PowerArubaCP and you can also report issue/enhance !

     

     

     



  • 2.  RE: PowerArubaCP : a powershell module for use ClearPass REST API

    Posted Apr 08, 2019 05:08 PM

    Thank you so much for creating this. I think it will be quite useful.

     

    A question about syntax. I am trying to set a password for a local user account and no matter what I do, I can't seem to get the syntax correct. I am trying: 

     

    Invoke-ArubaCPRestMethod -method "patch" -uri "api/local-user/3001" -body "{'password': 'NewPass123'}"

     

    But PS always returns:

     

    WARNING: The ClearPass API sends an error message:
    WARNING: Error description (code): Internal Server Error (500)
    WARNING: Error details: {"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Internal Server
    Error","status":500,"detail":"Data provided to create must be either an array or object; received \"string\""}
    Unable to use ClearPass API
    At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerArubaCP\Private\RestMethod.ps1:64 char:13
    + throw "Unable to use ClearPass API"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (Unable to use ClearPass API:String) [], RuntimeException
    + FullyQualifiedErrorId : Unable to use ClearPass API

     

    From the error, it would appear that the API is expecting an array in the body, but I've tried specifying multiple parameters in comma delimited format but still get the same error. Any help would be appreciated.


    Thanks!



  • 3.  RE: PowerArubaCP : a powershell module for use ClearPass REST API

    MVP GURU
    Posted Apr 09, 2019 01:30 AM

    dwisel@nea.com wrote:

    Thank you so much for creating this. I think it will be quite useful.

     

    A question about syntax. I am trying to set a password for a local user account and no matter what I do, I can't seem to get the syntax correct. I am trying: 

     

    Invoke-ArubaCPRestMethod -method "patch" -uri "api/local-user/3001" -body "{'password': 'NewPass123'}"

     

    But PS always returns:

     

    WARNING: The ClearPass API sends an error message:
    WARNING: Error description (code): Internal Server Error (500)
    WARNING: Error details: {"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Internal Server
    Error","status":500,"detail":"Data provided to create must be either an array or object; received \"string\""}
    Unable to use ClearPass API
    At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerArubaCP\Private\RestMethod.ps1:64 char:13
    + throw "Unable to use ClearPass API"
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (Unable to use ClearPass API:String) [], RuntimeException
    + FullyQualifiedErrorId : Unable to use ClearPass API

     

    From the error, it would appear that the API is expecting an array in the body, but I've tried specifying multiple parameters in comma delimited format but still get the same error. Any help would be appreciated.


    Thanks!


    Hi,

     

    Can you open a issue on PowerArubaCP Github ? Better place for this

     



  • 4.  RE: PowerArubaCP : a powershell module for use ClearPass REST API

    MVP GURU
    Posted Oct 14, 2019 03:24 PM

    a new release is available... 0.3.0 !

     

    What new ?

    • Support of PowerShell (Core) 6 (tested on Linux/Ubuntu and macOS) (#15)
    • Add Pester integration test (#17, #21)
    • Support of limit parameter fix #14 (#16) (But limited to 1000...)
    • Add Set-ArubaCPNetworkDevice and add better filtering to Get-ArubaCPNetworkDevice (#21)
    • Add GitHub Actions for launch Script Analyzer (#19, #22, #23) and publish release (#26)

     

    Tested on ClearPass 6.7.2 and 6.8.2 :

    • Windows 10 with Powershell 6.2.3
    • Windows 10 with Powershell 5
    • macOS with Powershell 6.2.3
    • Ubuntu 18.04 with PowerShell 6.2.3
    Update-Module PowerArubaCP

    See also https://github.com/PowerAruba/PowerArubaCP/releases/tag/v0.3.0

     

     



  • 5.  RE: PowerArubaCP : a powershell module for use ClearPass REST API

    MVP GURU
    Posted Jan 28, 2020 04:08 PM

    a new release is availabe => 0.4.0

     

    What new

     

    • Static Host List (Add/Get/Set/Remove and also Add/Remove Members) (#30)
    • Application License (Add/Get/Remove) (#31)
    • Platform (Get CPPM Version and Server Version/Configuration) (#32)
    • Multi Connection (#33)
    • Add port parameter to connection (#34)
    • Service (Get and Enable/disable) (#36)
    • Endpoint (Add/Get/Remove) (#38)
    • New connection method (using oauth client_id/client_secret) (#39)

    Tested on ClearPass 6.7.2 and 6.8.4 :

    • Windows 10 with Powershell 6.2.3
    • Windows 10 with Powershell 5
    • macOS with Powershell 6.2.3
    • Ubuntu 18.04 with PowerShell 6.2.3

    For update like always =>

    Update-module PowerArubaCP


  • 6.  RE: PowerArubaCP : a powershell module for use ClearPass REST API
    Best Answer

    MVP GURU
    Posted Jun 11, 2021 04:44 AM
    I'm proud to announce a new release of PowerArubaCP ! 0.5.0

    What new ?

    • Fix support of ClearPass 6.9.x (about hyperlen for MAC Address on Static Host List...) (#46)
    • Add support of Pester v5 (#48)
    • Update support of PSSA (#47 #49)
    • Fix use of ShouldProcess (Break Compability : noconfirm -> confirm:$false) (#50)
    • Add PowerArubaCP Logo (#54)
    • Update documentation (Add example for Static Host List...) (#59)
    • Add Network Device Group (#55)
    • Add Deploy and Configure ClearPass VM (for initial setup) (#51)
    • Add DeviceFingerprint (Get and Add) (#53)
    • Add Get Auth Method and Source (#56)
    • Fix CPPM 6.10.x support (#58)

    Tested on ClearPass 6.8.9, 6.9.6 and 6.10.0 :

    • Windows 10 with PowerShell 7.1.3
    • Windows 10 with PowerShell 5
    • macOS with PowerShell 7.1.3
    • Ubuntu 20.04 with PowerShell 7.1.3

    For install

    Install-Module PowerArubaCP​


    or for upgrade

    Update-Module PowerArubaCP


    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 7.  RE: PowerArubaCP : a powershell module for use ClearPass REST API

    MVP GURU
    Posted Jan 31, 2024 05:01 AM

    a new release is available : PowerArubaCP 0.7.0

    with the following changelog 

    What's Changed

    New Contributors

    Tested on ClearPass 6.10.8, 6.11.7, 6.12.0 :

    • Windows 10 with PowerShell 7.4.1
    • Windows 10 with PowerShell 5
    • macOS with PowerShell 7.4.1
    • Ubuntu 22.04 with PowerShell 7.4.1


    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------