65 lines
2.5 KiB
Markdown
65 lines
2.5 KiB
Markdown
<h1 align="center">CAI CP</h1>
|
|
|
|
<p align="center">
|
|
<sub>v0.9</sub><br/>
|
|
<small>A simple control panel for home server</small>
|
|
</p>
|
|
|
|
<p align="center">
|
|
<img src="https://2.bp.blogspot.com/-eHH5zjUJz30/WUWWj85a43I/AAAAAAAAHPY/6gfa1_TFky0pd93BfkEC0nxqZckJN4e2wCLcBGAs/s320/%25D0%25A1%25D0%25BD%25D0%25B8%25D0%25BC%25D0%25BE%25D0%25BA%2B%25D1%258D%25D0%25BA%25D1%2580%25D0%25B0%25D0%25BD%25D0%25B0%2B%25286%2529.png">
|
|
<img src="https://4.bp.blogspot.com/-6-2sczhJST4/WUWWkRkFRdI/AAAAAAAAHPc/cPFhHxoAO7sgc_VLZ40bx4jC9FTLfiqtACLcBGAs/s320/%25D0%25A1%25D0%25BD%25D0%25B8%25D0%25BC%25D0%25BE%25D0%25BA%2B%25D1%258D%25D0%25BA%25D1%2580%25D0%25B0%25D0%25BD%25D0%25B0%2B%25287%2529.png">
|
|
</p>
|
|
|
|
## Requirements
|
|
Web server<br>
|
|
PHP7 (php7-json, php7-posix)<br>
|
|
gawk (GNU awk)<br>
|
|
grep<br>
|
|
hddtemp<br>
|
|
lsb-release<br>
|
|
sed<br>
|
|
smartmontools (smartctl)<br>
|
|
sysstat (iostat)<br>
|
|
|
|
## Installation
|
|
|
|
### Step 1: Get CP
|
|
```sh
|
|
git clone --depth 1 https://github.com/CAI79/CAI-CP.git
|
|
```
|
|
|
|
### Step 2: Set rights
|
|
Following commands set correct access rights to all CAI CP files (in this example webserver runs with wwwrun:www priveledges):
|
|
```sh
|
|
$ 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
|
|
```
|
|
Prevent scripts to be available from browser. Add following lines to apache's .conf file:
|
|
```sh
|
|
# Add this to <Directory></Directory> block
|
|
<FilesMatch "\.(sh)$">
|
|
Require all denied
|
|
</FilesMatch>
|
|
```
|
|
Some functions requires su priveledges, add webserver user to sudoers. Run visudo and add following line to "User privilege specification" (in this example webserver runs with wwwrun:www priveledges):
|
|
```sh
|
|
## For HDD S.M.A.R.T. monitoring
|
|
wwwrun ALL=NOPASSWD: /usr/sbin/smartctl
|
|
## For HDD temperature monitoring
|
|
wwwrun ALL=NOPASSWD: /usr/sbin/hddtemp
|
|
## For SMB monitoring
|
|
wwwrun ALL=NOPASSWD: /usr/bin/smbstatus
|
|
## For shutdown/reboot functionality (You can skip this step and turn off shutdown/reboot functionality in settings)
|
|
wwwrun ALL=NOPASSWD: /sbin/shutdown
|
|
```
|
|
|
|
### Step 3: Initial config
|
|
In system\settings.php set FILE_OWNER and FILE_GROUP constants to owner and group of your web server.
|
|
Be careful with SHUTDOWN_ENABLED and REBOOT_ENABLED options. CAI CP does not provide any security or
|
|
authentication features and be protected via a security measure of your choice. Help system contains
|
|
information about how to enable basic authentication.
|