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]
  • Hello, 

     

    This is my first post, sorry if it is obvious or common sense. But I searched for an answer to my question and I am yet to find a decent answer. 

     

    I am trying to find a shell command to list all active IPs on the network. I tried the "/usr/local/bin/count_active_ip.plx --showcount" and it continues to list the IP of my phone even after turning off my phone's WiFi. 

    I also tried "arp -a" but it also returned the same IP regardless of the face that the phone is no longer on the network. 

    My question is, Is there a way to list only currently connected devices using a shell command ? 

    Thank you, 

  • Hello

    Anyone know the shell command for creating a new user in a specified group via shell?
    I would like to create VPN-users with scripts.

    Thank you
    ---
    Ok, i found another solution, ignore my posting [:)]
  • 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
  • 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
  • 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,

    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
  • 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.
  • 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
  • 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
  • @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.