This repository has been archived by the owner on Oct 30, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #215 from home-assistant/dev
Release v0.11.0
- Loading branch information
Showing
8 changed files
with
230 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Fail2Ban | ||
|
||
This script installs the fail2ban service. | ||
Some further configuration is required after installation. More information [here](https://www.home-assistant.io/cookbook/fail2ban/). | ||
|
||
## Installation | ||
|
||
```bash | ||
sudo hassbian-config install fail2ban | ||
``` | ||
|
||
## Upgrade | ||
|
||
There's nothing to upgrade. | ||
|
||
## Additional info | ||
|
||
Description | Command/value | ||
:--- | :--- | ||
Running as: | root | ||
Configuration file: | /etc/fail2ban/filter.d/ha.conf | ||
Configuration file: | /etc/fail2ban/jail.d/ha.conf | ||
Start service: | `sudo systemctl start fail2ban.service` | ||
Stop service: | `sudo systemctl stop fail2ban.service` | ||
Restart service: | `sudo systemctl restart fail2ban.service` | ||
Service status: | `sudo systemctl status fail2ban.service` | ||
|
||
*** | ||
|
||
This install script was originally contributed by [@Landrash][landrash] | ||
|
||
<!--- Links ---> | ||
[landrash]: https://github.com/landrash | ||
[repo]: https://github.com/home-assistant/hassbian-scripts/pulls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Zigbee2mqtt | ||
|
||
This script installs the [Zigbee2mqtt bridge][zigbee2mqtt]. | ||
After installation some further configuration is required. Instructions can be found [here][zigbee2mqttdocs]. | ||
|
||
## Installation | ||
|
||
```bash | ||
sudo hassbian-config install zigbee2mqtt | ||
``` | ||
|
||
## Upgrade | ||
|
||
No script available, maybe you could write one? | ||
If so, add an PR here when you are done: | ||
[homeassistant/hassbian-scripts][repo] | ||
|
||
## Additional info | ||
|
||
Description | Command/value | ||
:--- | :--- | ||
Running as: | pi | ||
Configuration file: | /opt/zigbee2mqtt/data/configuration.yaml | ||
Start service: | `sudo systemctl start zigbee2mqtt.service` | ||
Stop service: | `sudo systemctl stop zigbee2mqtt.service` | ||
Restart service: | `sudo systemctl restart zigbee2mqtt.service` | ||
Service status: | `sudo systemctl status zigbee2mqtt.service` | ||
|
||
*** | ||
|
||
This install script was originally contributed by [@Landrash][landrash] | ||
|
||
<!--- Links ---> | ||
[zigbee2mqtt]: https://github.com/Koenkk/zigbee2mqtt/ | ||
[zigbee2mqttdocs]: https://github.com/Koenkk/zigbee2mqtt/wiki/Running-the-bridge#3-configuring | ||
[landrash]: https://github.com/landrash | ||
[repo]: https://github.com/home-assistant/hassbian-scripts/pulls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
function fail2ban-show-short-info { | ||
echo "Setup for fail2ban service." | ||
} | ||
|
||
function fail2ban-show-long-info { | ||
echo "This script installs the fail2ban service." | ||
echo "Some further configuration is required after installation." | ||
} | ||
|
||
function fail2ban-show-copyright-info { | ||
echo "Original concept by Landrash <https://github.com/landrash>." | ||
} | ||
|
||
function fail2ban-install-package { | ||
echo "Installing fail2ban package" | ||
apt install -y fail2ban | ||
|
||
FAIL2BANFILTER="/etc/fail2ban/filter.d/ha.conf" | ||
FAIL2BANJAIL="/etc/fail2ban/jail.d/ha.conf" | ||
|
||
echo "Creating configuration files" | ||
if [ -f $FAIL2BANFILTER ] ; then | ||
echo "Configuration file exists. Skipping.." | ||
else | ||
|
||
echo "[INCLUDES] | ||
before = common.conf | ||
[Definition] | ||
failregex = ^%(__prefix_line)s.*Login attempt or request with invalid authentication from <HOST>.*$ | ||
ignoreregex =" > "$FAIL2BANFILTER" | ||
|
||
fi | ||
|
||
if [ -f $FAIL2BANJAIL ] ; then | ||
echo "Configuration file exists. Skipping.." | ||
else | ||
|
||
echo "[DEFAULT] | ||
# Email config | ||
sender = email@address.com | ||
destemail = email@address.com | ||
# Action %(action_mwl)s will ban the IP and send an email notification including whois data and log entries. | ||
action = %(action_mwl)s | ||
[ha] | ||
enabled = true | ||
filter = ha | ||
logpath = /home/homeassistant/.homeassistant/home-assistant.log | ||
# 3600 seconds = 1 hour | ||
bantime = 3600 | ||
#bantime = 30 # during testing it is useful to have a short ban interval, comment out this line later | ||
# Maximum amount of login attempts before IP is blocked | ||
maxretry = 3" > "$FAIL2BANJAIL" | ||
fi | ||
|
||
echo "Restarting fail2ban service" | ||
systemctl restart fail2ban | ||
|
||
echo "Checking the installation..." | ||
validation=$(which fail2ban-client) | ||
if [ ! -z "${validation}" ]; then | ||
echo | ||
echo -e "\\e[32mInstallation done.\\e[0m" | ||
echo | ||
echo "To continue have a look at https://www.home-assistant.io/cookbook/fail2ban/" | ||
echo | ||
else | ||
echo | ||
echo -e "\\e[31mInstallation failed..." | ||
echo | ||
return 1 | ||
fi | ||
return 0 | ||
} | ||
|
||
[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
function zigbee2mqtt-show-short-info { | ||
echo "Setup for Zigbee2mqtt bridge." | ||
} | ||
|
||
function zigbee2mqtt-show-long-info { | ||
echo "This script installs the Zigbee2mqtt bridge" | ||
} | ||
|
||
function zigbee2mqtt-show-copyright-info { | ||
echo "Original concept by Landrash <https://github.com/landrash>." | ||
} | ||
|
||
function zigbee2mqtt-install-package { | ||
echo -n "Installing dependencies : " | ||
node=$(which npm) | ||
if [ -z "${node}" ]; then #Installing NodeJS if not already installed. | ||
printf "Downloading and installing NodeJS...\\n" | ||
curl -sL https://deb.nodesource.com/setup_8.x | bash - | ||
apt install -y nodejs | ||
fi | ||
|
||
echo "Cloning Zigbee2mqtt git repository" | ||
git clone https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt | ||
chown -R pi:pi /opt/zigbee2mqtt | ||
|
||
echo "Running install. This might take a while and can produce som expected errors" | ||
cd /opt/zigbee2mqtt || exit | ||
su pi -c "npm install" | ||
|
||
echo "Creating service file zigbee2mqtt.service" | ||
service_path="/etc/systemd/system/zigbee2mqtt.service" | ||
|
||
echo "[Unit] | ||
Description=zigbee2mqtt | ||
After=network.target | ||
[Service] | ||
ExecStart=/usr/bin/npm start | ||
WorkingDirectory=/opt/zigbee2mqtt | ||
StandardOutput=inherit | ||
StandardError=inherit | ||
Restart=always | ||
User=pi | ||
[Install] | ||
WantedBy=multi-user.target" > $service_path | ||
|
||
echo "Checking the installation..." | ||
if [ ! -f /opt/zigbee2mqtt/data/configuration.yaml ]; then | ||
validation="" | ||
else | ||
validation="ok" | ||
fi | ||
|
||
if [ ! -z "${validation}" ]; then | ||
echo | ||
echo -e "\\e[32mInstallation done..\\e[0m" | ||
echo -e "Update of configuration.yaml is required found at /opt/zigbee2mqtt/data/" | ||
echo -e "Some further configuration is required and details can be found here https://github.com/Koenkk/zigbee2mqtt/wiki/Running-the-bridge " | ||
echo | ||
echo -e "Service can be started after configuration but running sudo systemctl start zigbee2mqtt" | ||
echo | ||
else | ||
echo | ||
echo -e "\\e[31mInstallation failed..." | ||
echo | ||
return 1 | ||
fi | ||
return 0 | ||
} | ||
|
||
[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters