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]
  • Hi

    I'm Angelo, a new member of the board and this is my first post.
    I have the following problem/idea and I would like to post it here. I would be really happy if somebody could help..

    I set up a new SSL remote control profile for the remote support of a supplier. Everything is working fine, but I would like to have a very simple possibility to switch on/off the profile. The idea is that the supplier profile is normally inactive, so he can not log in. If there is the need, he will give us a call and an operator will activate the profile.

    The activation/deactivation of the profile works fine through the Webadmin, but the problem is that I have to give to operators the  rigths "Remote access manager" and "web protection manager". He can do to much with those rights...

    Is there a way to write a small script in order so set the remote control profile active/inactive? If yes I would just make two buttons for the operators "on" and "off". The buttons will via shell do the rest..

    Any help is welcome...Thank you.

    Angelo
  • Hi

    In order to simplify my question I add a screenshot to show what I would like to do, but with shell commands:



    Push the marked button in order to activate/inactivate the SSL VPN remote profile

    Thank you.

    Angelo
  • @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
  • I am wanting to create/delete backend users for use with hotspot authentication via ssh command line.

    Are there existing command to manage users? 

    Thanks
  • For the frequent question: Is SID xyz active in the IPS?

    dev-lmatt-02:/root # ips_patterninfo 
    
           _____ ____
         `----,\    )
          `--==\  /
           `--==\/
        .-~~~~-.Y|\_  Copyright (C) 2013 Sophos GmbH www.sophos.com
     @_/        /  66\_  Lukas.Matt@sophos.com 19.12.2013
       |    \   \   _(")
        \   /-| ||'--'
         \_\  \_\

       1517 of 20751 IPS rules currently configured

       /usr/local/bin/ips_patterninfo [options]

    --sid     - Search a specific rule ID
    --search  - Prints information for a global search pattern
    -h | --help        - Prints this help text

    dev-lmatt-02:/root # ips_patterninfo --sid 480
    Reading IPS information..

    [480] PROTOCOL-ICMP PING speedera
    * will not affect network traffic (alert-only)
    * last modified Mon Nov 20 23:21:00 2006
    * was categorized as 'Protocol Anomaly / Invalid Traffic'
    * [DISABLED] has 2 filter active
      [FILTER] warnings are not active (alert-only)
      [FILTER] rule is too old (360 days)


    The previous example shows you the reason why a specific rule is not active if it is available.
  • Hi,

    does somebody now how to easily resolve the network definitions? I want to get an output that shows me the network object, that are defined in the definitions. The webinterface has a very simple view on the ruleset and I would like to see something like a "resolved" version on the command line, where I see Networks, IP-Adresses or hostnames, that are building the network definition.

    I hope you understand, what im looking for.

    Best thanks for all the helpful commands, postet here.

    Regards
    Sebastian
  • Hi  guys.
    Anyone know a shell command to load new NIC drivers?
    I have just added a FO NIC to my UTM, and it doesn't recognize it.
    It shows it as the system boot, but nothing in the Interface - Hardware.
    I would like to avoid a clean install.
    Thanks,
               Goldy
  • Hi Goldy, in older versions, you could edit /etc/modules and/or /etc/modules.conf, but I'm not sure that still applies now that the system is using UDEV.

    Barry
  • Here's a prescription for activating ssh access from the console when unable to do so in WebAdmin.

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA