Build and Install STAF

Introductions

  • Download STAF
  • After install, use STAF.cfg to replace /staf_install_path/bin/STAF.cfg, i.e., /usr/local/staf/bin/STAF.cfg
  • Add STAF to system boot

    • linux rc.local load

      # cat /etc/rc.local
      /usr/local/staf/startSTAFProc.sh
      
      exit 0
      
    • linux service

      ## /etc/init.d/STAF using skeleton template, follow /etc/init.d/skeleton to change some value
      # cat /etc/init.d/STAF |sed '/^$/d'|grep -v '#'|head -n 10
      STAF_INSTALL_PATH=/usr/local/staf
      DESC="STAF service"
      SER_BIN_NAME=STAFProc
      STOP_WAIT_TIME=1
      NAME=STAF
      DAEMON=$STAF_INSTALL_PATH/startSTAFProc.sh
      DAEMON_ARGS=""
      PIDFILE=/var/run/$NAME.pid
      SCRIPTNAME=/etc/init.d/$NAME
      [ -x "$DAEMON" ] || exit 0
      
      # cat /lib/systemd/system/STAF.service
      [Unit]
      Description=STAF service
      After=network.target auditd.service
      ConditionPathExists=/usr/local/staf/
      
      [Service]
      ExecStart=/usr/local/staf/startSTAFProc.sh
      
      [Install]
      WantedBy=multi-user.target
      
    • Active Service

      [ -f /usr/sbin/update-rc.d ] && /usr/sbin/update-rc.d STAF defaults
      [ -f /usr/sbin/update-rc.d ] && /usr/sbin/update-rc.d STAF enable 3
      [ -d /lib/systemd/system/multi-user.target.wants ] && ln -s /lib/systemd/system/STAF.service /lib/systemd/system/multi-user.target.wants/STAF.service
      
  • QA tools : xts

    • Add STAF to system boot

      $ cd xts/staf && make install
      
    • Copy useful srcipts to your $PATH

      $ cp xts/scripts/staf* /usr/local/bin
      
    • Usage Example

      $ staf_list.sh
      $ staf_exec.sh 192.168.10.10 ls
      

Common Problem

  • Miss mac and ip in staf_list.sh
    1. boot kvm quest with specified macaddr
    2. sudo apt-get install nmap arp-scan
    3. make sure staf_list.sh is executed by sudo

results matching ""

    No results matching ""