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]
  • Astaro Shell Commands

    Remember: 
    Direct configuration of Astaro from the shell is unsupported, unless directed to by Astaro Support staff or official documentation. 
    For paid licenses, modifications done from the shell without direction or sanction may nullify your support agreement.[/I]


    Run Astaro HTTP proxy database localy
    1. ssh to ASG and login with loginuser
    2. su - root
    3. cc set http sc_local_db [disk][mem][none]  (Choose what you prefer)
    4.  /var/mdw/scripts/httpproxy restart
    Websurfing will be extremely slow until the database has downloaded and been put into place. The time is link speed dependent.

    View the link speed for the ASG's interfaces?  
    'ifstat'.

    Bandwidth usage - IFTOP
     Astaro also offers the command 'iftop' to see the live traffic and traffic statistics.  
    One can see the traffic live on an interface for Source Host, Destination Host, and Ports.  
    The peak and accumulative traffic is also displayed.
    Run 'iftop'
    Example:
     root # iftop -i eth1

    Host display:--------------------------General:
     n - toggle DNS host resolution------P - pause display
     s - toggle show source host---------h - toggle this help display
    d - toggle show destination host-----b - toggle bar graph display
     t - cycle line display mode-----------B - cycle bar graph average
     --------------------------------------- T - toggle cummulative line totals
    ---------------------------------------- Port display:   j/k - scroll display
     N - toggle service resolution---------f - edit filter code
     S - toggle show source port----------l - set screen filter
    D - toggle show destination port-----L - lin/log scales
    p - toggle port display---------------- ! - shell command
    q – quit
    Sorting:
    1/2/3 - sort by 1st/2nd/3rd column
     - sort by dest name
    o - freeze current order

    Concurrent Connections
    :
    sysctl -w net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=86400

    number of established connections:

    less /proc/net/ip_conntrack | grep ESTA | wc -l
    1907

    number of all connections:

    less /proc/net/ip_conntrack | wc -l
    3315

    number of connections with status WAIT (close_wait):
    less /proc/net/ip_conntrack | grep WAIT | wc –l
    39

    Saving Snapshots of TOP automatically every half hour

    create a cron job with,
    top -b -n 1 >>/tmp/top-report.txt
    An entry for each CPU core, and possibly another if the CPU(s) has hyperthreading:
    cat /proc/cpuinfo

    stopped and started again the HTTP proxy:
     "/var/mdw/scripts/httpproxy stop" and "/var/mdw/scripts/httpproxy start"

    Restarting MiddleWare:
    service mdw restart
    (from root)
    Warning: it doesn't cause a complete reboot, but it does cause an HA failover, interruption of any up/downloads and VoIP calls, etc.  

    HD
    Find what is taking the space type
    df –h
    df will only tell you how full the disk is.
    du will tell you what files/folders are using the most space
    I'd recommend:
    cd /var/storage
    du -sh *
    find the offending directories

    What kind of CPU
    "cat /proc/cpuinfo"?

    Determine if the disk is overloaded
    vmstat -d 5
    or
    vmstat -d | head -2 ; vmstat -d 5 | grep hda
    if hda is your hard disk; sda for scsi
    That should have similar output. 
    The '5' is 5 second updates.
    You'll have to look at the differences between the lines to figure out how many IO's you're getting in those 5 seconds, and whether you're saturating the disk or not.

    See detailed info about your eth
    :
    # ethtool eth1
    OR
     -mii-diag eth1

    webadmin passwd lost

    A user may use the following commands to reset the system passwords:
    cc
    RAW
    system_password_reset
    Ctrl c

    Upon saving the file and exiting, the admin may immediately navigate to WebAdmin and re-specify all passwords for the system accounts of Astaro Security Linux.

    DNS Flush cache option missing in V7
    the current workaround is to restart the DNS proxy from the command line as root with the following command:
    /var/mdw/scripts/named restart

    To change version number

    login as loginuser
    su -
    edit /etc/version
    save the file
    restart the ASG so the new version is displayed in Webadmin dashboard

    Change NIC order
    login as loginuser
    su -
    edit /etc/udev/rules.d/70-persistent-net.rules
    save the file
    restart the ASG so the new order is loaded.

    Locked out - How to regain all logins

    1) Shutdown the firewall and connect a screen and a keyboard to the firewall
    2) Power on the firewall, wait until the GRUB-loader starts and press ‘ESC’
    3) Select ‘Astaro Security Gateway 7.2’ (not previous or rescue!)
    4) Press ‘e’ to edit and select the 2nd entry
    5) Press ‘e’ once again and enter ‘init=/bin/bash’
    6) Press ‘ENTER’ and ‘b’ to boot up
    7) Now you are able to change the passwords for ‘loginuser’ and ‘root’
    8) After that press CTRL + ALT + DEL to reboot the system and wait until you get the login prompt

    Reset to factory settings

    Login the command-line as 'loginuser', afterwards as 'root' and enter following commands to restore to factory settings: 
    1. cc [Press ENTER]
    2. RAW [Press ENTER]
    3. system_factory_reset [Press ENTER]

    The system will automatically shutdown when it's finished.



    Credits: Goldy, RFCat_VK
  • Hi Goldy,
    excellent idea.

    an update for the memory resident HTTP proxy database, you have called it IPS.
    Also websurfing will be extremely slow until the database has downloaded and been put into place. The time is link speed dependent.


    To change version number


    login as loginuser
    su
    edit /etc/version
    save the file
    restart the ASG so the new version is displayed in Webadmin dashboard

    Change NIC order


    login as loginuser
    su
    edit /etc/udev/rules.d/70-persistent-net.rules
    save the file
    restart the ASG so the new order is loaded.

    Ian
  • Great.
    Thanks Ian.
    I have changed "IPS" to "HTTP proxy database", and added your commands suggestion to the main page.

    PS:"Change NIC order" - Would help me allot a month ago...
  • @Goldy:  A minor revision.  To gain root at the shell, when logged in as loginuser, the recommended command is now "su -" (without quotes).  The difference between this and just "su" has to do with the loading of the user profile.

    @all:  It should be mentioned that direct configuration of Astaro from the shell is unsupported, unless directed to by Astaro Support staff or official documentation.  For paid licenses, modifications done from the shell without direction or sanction may nullify your support agreement.
    __________________
    ACE v8/SCA v9.3

    ...still have a v5 install disk in a box somewhere.

    http://xkcd.com
    http://www.tedgoff.com/mb
    http://www.projectcartoon.com/cartoon/1
  • Hello,

    some general words about this.
    As already stated on top:

    Direct configuration of Astaro from the shell is unsupported, unless directed to by Astaro Support staff or official documentation.
    For paid licenses, modifications done from the shell without direction or sanction may nullify your support agreement.

    Some more:
    -Most of the commands which seem to update the configuration are neither safe for a reboot nor a up2date.
    -Check Prelimaries.
    So if ctasd is not used and you have all of your swap used than a restart of the ctasd wont make a difference. Swap can and will be used in all kinds of memory related situations. Thats not an error and not a problem - if usage changes up and down.
    -Be precise
    iftop doesnt show the link speed - it shows the traffic usage and bandwidth usage
    interface linkspeed could for example be shown with ethtool .

    Have Fun !
  • to download the updates from Astaro website
    wget "the path of the file on the web"
    note that the updates must be in /var/up2date/sys 
    to install the updates
    auisys.plx --upto "the version"
  • Jdoebler :
    "Most of the commands which seem to update the configuration are neither safe for a reboot nor a up2date" 

    Any Shell accesses is not safe. (by the way - also Astaro update [:)] not always safe) 
    I have tried them all (except the two last one) - no problem.
    Ofcourse - like any shell commands, you should be aware of Astaro Policy concerning shell accesses.

    ctasd command - agree - removed
    iftop - Changed to "usage and bandwidth usage"

    Thanks
  • to download the updates from Astaro website
    wget "the path of the file on the web"


    Note that wget, etc., won't work unless you have a packetfilter rule to allow the ASG's EXT IP to make outbound http(s) connections.

    Barry

  • Determine if the disk is overloaded
    vmstat -d 5
    or
    vmstat -d | head -2 ; vmstat -d 5 | grep hda
    if hda is your hard disk; sda for scsi
    That should have similar output. 
    The '5' is 5 second updates.
    You'll have to look at the differences between the lines to figure out how many IO's you're getting in those 5 seconds, and whether you're saturating the disk or not.


    Reading this post it seems that it's very simple to obtain disk I/O performances. There is a feature request here for its implementation in executive report: Reporting: Show disk IO but has "under review" status since 2 years... [8-)]