Wired

 View Only
last person joined: yesterday 

Expand all | Collapse all

ArubaOS-CX script copy configuration

This thread has been viewed 26 times
  • 1.  ArubaOS-CX script copy configuration

    Posted Dec 13, 2023 12:38 PM

    Hi,

     

    Is it possible with the aruba cx switch range to save the configuration on a server with scp?

    I have tried this powershell script without success.

    $user = "admin"
    $pwd =  ConvertTo-SecureString "password" -AsPlainText -Force
    $cred = New-Object System.Management.Automation.PSCredential($user,$pwd)

    New-SSHSession -ComputerName ip -Credential $Cred -AcceptKey:$true

    $session = Get-SSHSession -Index 0

    $stream = $session.Session.CreateShellStream("dumb", 80, 9999, 800, 600, 1024)


    $session.Write("`n")
    Sleep 20
    $session.Write("copy running-config scp://aruba@ipserver/swtestpowershell.cfg cli")
    $session.Write("`n")
    Sleep 20
    $session.Write("password")
    $session.Write("`n")

    Sleep 20

    Remove-SSHSession -SessionId 0

    Regards

    MHB



  • 2.  RE: ArubaOS-CX script copy configuration

    Posted Dec 13, 2023 12:49 PM

    Just run it as a backup job on the switch; no need to access it from the outside:

    job backup
        desc Daily Config Backup
        10 cli copy running-config scp://10.51.152.251/sw-10.running.cfg cli vrf mgmt
        20 cli copy startup-config tftp://10.51.152.251/sw-10.startup.json json vrf mgmt
    schedule backup
        10 job backup
        trigger on 03:00 daily start 2022-01-21

    Cheers,

    Mark




  • 3.  RE: ArubaOS-CX script copy configuration

    Posted Dec 14, 2023 02:21 AM

    Hello Mark,

    Thanks for the reply, but I've tried this method without success.

    The switches are Aruba-CX 6100 in version PL.10.13.

    The copy function is not available in the jobs and that's a shame. Another problem I've encountered is integrating the public key for scp copying, but that's another problem.

    result of the command :

    SWTEST# conf t
    SWTEST(config)# job backup
    SWTEST(config-job-backup)# 10 cli copy running-config scp://10.10.10.10/sw-10.running.cfg cli vrf mgmt
    This command cannot be part of a job
    SWTEST(config-job-backup)#

    Regard,

    MH




  • 4.  RE: ArubaOS-CX script copy configuration

    Posted Dec 22, 2023 05:39 PM

    Yeah, update to a more recent version. I think that copy command became available in 10.13. It wasn't available in 10.10, i think.

    And then jobs only really became available in 10.08, iirc?

    Either way, try the latest LSR.

    Edit: My apologies, I should have read your post properly and used my brain.

    We did implement this in a secured network, with tftp only. Then it works. Because apparently the switches can't do pubkey-authentication as clients.

    We actually implemented in a few places via custom-commands for user-groups and then grab it via ssh:

    user-group config-reader
        10 permit cli command "show running-config"
        20 permit cli command "show startup-config"
    user oper group config-reader password ciphertext ...
    user oper authorized-key ecdsa-sha2-nistp521 ...

    This allows one to run `ssh oper@some-switch "show running-config" > some-switch.running.cfg` with passwordless/public key authentication in a pull-fashion.