# CAI CP: Help

# Tips and ticks

- Table witgets can be maximized by double click on header.
- You can switch between information widgets blocks with following hotkeys:
  - Ctrl + 1: System
  - Ctrl + 2: System pulse
  - Ctrl + 3: Storage
  - Ctrl + 4: Network
  - Ctrl + 5: SMB
  - Ctrl + Left arrow: Previous block
  - Ctrl + Right arrow: Next block
  Also You can use left or right swipe on header on devices with touchscreen.

  - Ctrl + F1: This help

# System requirements

Control panel core uses following commands and utilities:

- gawk (GNU awk)
- grep
- hddtemp
- lsb-release
- sed
- smartmontools (smartctl)
- sysstat (iostat)
- php7

Applications may have other dependencies.

# Setting up

S.M.A.R.T. and HDD temperature monitoring widgets requires super user priviledges. You need to add webserver account to sudoers. Just run visudo command and add to User privilege specification section next lines:

                        wwwrun ALL=NOPASSWD: /usr/sbin/smartctl
                        wwwrun ALL=NOPASSWD: /usr/sbin/hddtemp

SMB monitoring widgets requires super user priveledges. You need to add webserver account to sudoers. Just run visudo command and add to User privilege specification section next lines:

                        wwwrun ALL=NOPASSWD: /usr/bin/smbstatus

Control panel configuration file is /system/json/settings.json.
Available options:

Option | Possible values | Description
lang | ru en ... | Default languag. You can specify one of installed languages.
langs | "en" : "English" "ru" : "Русский" ... | Available languages.
dim_on_create | true false | Widgets runs semi-transparent until data is loaded.
check_files_rights | true false | Check files and directories rights on startup.
check_hdd_temp_interval | 0 .. 86400 | HDD temperature checking interval (in seconds).
check_smart_interval | 0 .. 86400 | HDD S.M.A.R.T checking interval (in seconds).

You can find applications list in /system/apps/apps.json. Control panel checks dependencies and run applications if they are ok. You can manually disable application by removing string with it from this file.

# Security

1. You need to set owner to control panel files to wwwrun:www, all directories and .sh files must have 550 mask, other directories - 440 mask.

   You need to set 640 mask to /system/json/settings.json if You want to change some settings from WebUI.

   You can set rights by executing following commands:
   `$ chown -R wwwrun:www /path/to/base/dir
   $ chmod 440 $(find /path/to/base/dir -type f)
   $ chmod 550 $(find /path/to/base/dir -type d)
   $ chmod 550 $(find /path/to/base/dir -type f | grep .sh$)
   $ chmod 640 /path/to/base/dir/system/json/settings.json
   $ chmod 640 /path/to/base/dir/system/apps/apps.json`

2. Deny accss to .sh files by adding next options to

       <Directory></Directory>

   block of Apache settings:

                               <FilesMatch "\.(sh)$">
                                   Require all denied
                               </FilesMatch>

3. Set password to restrict access. Basic autorization example: run Apache's utility htpasswd to generate password file .htpasswd. Add next lines to Apache's config file into

       <Directory></Directory>

   section:

                               AuthName "Restricted zone"
                               AuthType Basic
                               AuthUserFile [Путь к файлу .htpasswd]
                               Require valid-user

   Restart Apache.

   Attention! Basic authorization uses plain text to send passwords. Consider to use HTTPS to avoid password leak.

4. You need to add wwwrun user to sudoers if to enable shutdown or reboot server functions. Be carefully with this option!

   Run `# visudo` and add following line to "User privilege specification": `wwwrun ALL=NOPASSWD: /sbin/shutdown`

# About

CAI CP
Version _._. Build date __.__.____
Author: Alexander Chebykin
License: MIT

    MIT License
    -----------

    Copyright (c) 2016-2017, Alexander I. Chebykin

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.

This product partially based on Linux Dash project.