Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/ssh/hostdenied | ||
|---|---|---|
| 13 | 13 |
# (at your option) any later version. |
| 14 | 14 |
# |
| 15 | 15 |
# This program is distributed in the hope that it will be useful, |
| 16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 | 17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | 18 |
# GNU General Public License for more details. |
| 19 | 19 |
# |
| ... | ... | |
| 22 | 22 |
# |
| 23 | 23 |
# ------------------------------------------------------------------------------------------------------ |
| 24 | 24 |
# 20100310 v1.01 ls |
| 25 |
# as threatened, shows now "temperatures" of active hosts.deny lines. Recent additions are
|
|
| 25 |
# as threatened, shows now "temperatures" of active hosts.deny lines. Recent additions are |
|
| 26 | 26 |
# displayed in bright red, turning to blue as older the addition rules are. |
| 27 | 27 |
# This requires denyhosts to add line to hosts.deny in a specific format. Also, times are currently |
| 28 | 28 |
# hardcoded, and not a lot of flexibility adjusting them through parameters. |
| 29 | 29 |
# A line in hosts.deny should come with a comment, looking like: |
| 30 | 30 |
# # DenyHosts: Sat Mar 6 01:11:57 2010 | sshd: 87.101.51.198 |
| 31 | 31 |
# 8 graphs are drawn from that depicting number of rules in 24 h increments. Different colours are |
| 32 |
# assigned to graphs which are <24h, 24-48h, 48-72h ... old. The last (coldest) graph shows rules
|
|
| 32 |
# assigned to graphs which are <24h, 24-48h, 48-72h ... old. The last (coldest) graph shows rules |
|
| 33 | 33 |
# which have been added > 168h ago. |
| 34 | 34 |
# I'm considerering to change age granularity to hours, rather than days, and plot many graphs (64 or 128, |
| 35 |
# which are nice for colour calculations), showing more of a colour cloud than discernible areas.
|
|
| 35 |
# which are nice for colour calculations), showing more of a colour cloud than discernible areas. |
|
| 36 | 36 |
# The plugin must have permission to read /etc/hosts.deny, of course. |
| 37 |
# 20100308, v1.0, ls
|
|
| 37 |
# 20100308, v1.0, ls |
|
| 38 | 38 |
# Will probably add multiple stacked graphs, indicative for addition/removal date of denies, |
| 39 | 39 |
# instead of a boring single area graph. |
| 40 | 40 |
# ------------------------------------------------------------------------------------------------------ |
| ... | ... | |
| 80 | 80 |
TOTAL=0 |
| 81 | 81 |
NOW=$(date +%s) |
| 82 | 82 |
sed -n 's/^\# DenyHosts: //;s/ | .*//gp' $DENY | # strip all but date |
| 83 |
while read DATE; do
|
|
| 83 |
while read DATE; do |
|
| 84 | 84 |
echo $(((NOW - $(date -d "$DATE" +%s))/86400)) # calculate rule age |
| 85 | 85 |
done > $STATEFILE # rather than going through temp file, the age could be |
| 86 | 86 |
for AGE in {0..6} ; do # used to increment an array element with that index.
|
Formats disponibles : Unified diff