Guest User!

You are not Sophos Staff.

Astaro useful shell commands.

Hi to All.
I'm opening this thread so any of you which happens to run into useful Shell commands, can add it in here.
My goal is to create a document with many Astaro useful shell commands.
You are welcome to add, remark or reject any of the commands in here.
[:)]



This thread was automatically locked due to age.
[unlocked by: BAlfson at 2:53 PM (GMT -7) on 4 Jun 2021]
Parents
  • @angelo there's two steps involved. First, you have to find the REF ID of the profile. In my case, it's called "Visitor":

         cc get_object_by_name ssl_vpn remote_access_profile "Visitors"

    That will return something like this:
    {
              'autoname' => 0,
              'class' => 'ssl_vpn',
              'data' => {
                          'aaa' => [
                                     'REF_AaaUseAlan'
                                   ],
                          'auto_pf_in' => 'REF_PacPacAnyFromAlan',
                          'auto_pfrule' => 1,
                          'comment' => '',
                          'name' => 'Visitors',
                          'networks' => [
                                          'REF_DefaultInternalNetwork'
                                        ],
                          'status' => 1
                        },
              'hidden' => 0,
              'lock' => '',
              'nodel' => '',
              'ref' => 'REF_SslRemVisitors',
              'type' => 'remote_access_profile'
            }
    The line  'ref' => 'REF_SslRemVisitors' tells us what we want. To turn it off, run:
        cc change_object REF_SslRemVisitors status 0

    To turn it on, just change the 0 to a 1. To give your users a button to toggle it on or off, you'll need to automate connecting to the shell as root, and running the above commands. The REF ID won't change unless oyu delete and re-create the profile, so you don't necessarily have to automate finding that parameter, but depending on your coding abilities, wrapping this up to run remotely with a single click may still be a very large task.

     It might be enough to simply give a user role-based administration rights for remote access settings. They can login to webadmin, but only see the remote access section, and they can just toggle the tunnel off and on from there.
  • Hi AlanT

    I'm impressed. Thanx a lot.
    The commands work fine and I'm able to change teh status. I logged in as loginuser and then changed to root, in order to be able to execute the command. The problem ist that I would like to implement a "fully-automatic" switch for some operators.
    So I set up an ssh public key connection to the utm and I connected with putty as root. There I had the problem, I was not able to execute the cc command. The error was "bash: cc: command not found".

    I solved this with the specific path to the compiler, so I replace cc change_obeject.....with /usr/local/bin/confd-client.plx change_object....

    Now I only have to build a batch file and call the command line putty.exe with parameters -load "session-name" and -m "command" and I will have my "one-button" solution.

    Thanx again.
    Angelo
Reply
  • Hi AlanT

    I'm impressed. Thanx a lot.
    The commands work fine and I'm able to change teh status. I logged in as loginuser and then changed to root, in order to be able to execute the command. The problem ist that I would like to implement a "fully-automatic" switch for some operators.
    So I set up an ssh public key connection to the utm and I connected with putty as root. There I had the problem, I was not able to execute the cc command. The error was "bash: cc: command not found".

    I solved this with the specific path to the compiler, so I replace cc change_obeject.....with /usr/local/bin/confd-client.plx change_object....

    Now I only have to build a batch file and call the command line putty.exe with parameters -load "session-name" and -m "command" and I will have my "one-button" solution.

    Thanx again.
    Angelo
Children
No Data