Security

last person joined: 2 hours ago 

Enterprise security using ClearPass Policy Management, ClearPass Security Exchange, IntroSpect, VIA, 360 Security Exchange, Extensions and Policy Enforcement Firewall (PEF).
Expand all | Collapse all

PowerArubaCP : a powershell module for use ClearPass REST API

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

    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

    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

    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

    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