[debian] hosts.deny errors

Pagina: 1
Acties:

  • HyperDevil
  • Registratie: Oktober 2003
  • Laatst online: 15-12-2025
Beste Tweakers,

Er proberen de laatste tijd toch wel een scriptkiddies binnen te komen op mijn systeem.
Dit zal zoiezo niet lukke via ssh.. rootlogin=no en de gebruikersnamen zijn te complex..
Maar het geeft mij toch een beter gevoel als ik de ip's van die scriptkiddies kan blocken. B)
Dit zou kunnen met het hosts.deny bestand in /etc...
Deze heb ik ingevuld:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# /etc/hosts.deny: list of hosts that are _not_ allowed to access the system.
#                  See the manual pages hosts_access(5), hosts_options(5)
#                  and /usr/doc/netbase/portmapper.txt.gz
#
# Example:    ALL: some.host.name, .some.domain
#             ALL EXCEPT in.fingerd: other.host.name, .other.domain
#
# If you're going to protect the portmapper use the name "portmap" for the
# daemon name. Remember that you can only use the keyword "ALL" and IP
# addresses (NOT host or domain names) for the portmapper. See portmap(8)
# and /usr/doc/portmap/portmapper.txt.gz for further information.
#
# The PARANOID wildcard matches any host whose name does not match its
# address.

# You may wish to enable this to ensure any programs that don't
# validate looked up hostnames still leave understandable logs. In past
# versions of Debian this has been the default.
# ALL: PARANOID
ALL:198.161.28.40
ALL:200.13.195.11
ALL: .colomsat.net.co


Nu krijg ik deze errors in mijn auth.log bestand:

Apr 3 12:13:21 hostname sshd[1599]: warning: /etc/hosts.deny, line 21: missing newline or line too long

Ik heb ook dit geprobeerd:

code:
1
2
3
ALL: 198.161.28.40
ALL: 200.13.195.11
ALL: .colomsat.net.co


Nog steeds dezelfde foutmelding... :( heeft iemand misschien een voorbeeld van dit bestand wat wel werkt?

  • Snake
  • Registratie: Juli 2005
  • Laatst online: 07-03-2024

Snake

Los Angeles, CA, USA

unless I'm mistaken,
I don't think you are supposed to have a space after the : on your lines
should look like this
http://forum.ev1servers.net/showthread.php?t=58165

[ Voor 8% gewijzigd door Snake op 03-04-2006 20:26 ]

Going for adventure, lots of sun and a convertible! | GMT-8


  • HyperDevil
  • Registratie: Oktober 2003
  • Laatst online: 15-12-2025
Dat heb ik ook niet, zie code.
En met een spatie ertussen heb ik hetzelfde probleem :|

  • [ash]
  • Registratie: Februari 2002
  • Laatst online: 05-04-2025

[ash]

Cookies :9

Wat levert dit op?
code:
1
ALL: 198.161.28.40, 200.13.195.11, .colomsat.net.co

  • Keeper of the Keys
  • Registratie: Augustus 2002
  • Laatst online: 14-01 12:20
Iets wat ik binnenkort hoop te gaan proberen, en wat (als het werkt) zeer effectief is is port-knocking.
Dat houdt in dat je ssh poort standaard dicht zit, en alleen open gaat voor een specifiek IP adres als er vanaf dat zelfde adres eerste geprobeerd is om te verbinden met een serie poorten op jou computer.

Zie onder andere: http://www.portknocking.org/
en: http://www.google.nl/search?q=port-knocking

  • ajvdvegt
  • Registratie: Maart 2000
  • Laatst online: 04-12-2025
Je moet nog een lege regel toevoegen aan het einde van het bestand, gok ik.

I don't kill flies, but I like to mess with their minds. I hold them above globes. They freak out and yell "Whooa, I'm *way* too high." -- Bruce Baum


  • webfreakz.nl
  • Registratie: November 2003
  • Laatst online: 01-02 19:30

webfreakz.nl

el-nul-zet-é-er

KeeperoftheKeys schreef op maandag 03 april 2006 @ 21:49:
Iets wat ik binnenkort hoop te gaan proberen, en wat (als het werkt) zeer effectief is is port-knocking.
Dat houdt in dat je ssh poort standaard dicht zit, en alleen open gaat voor een specifiek IP adres als er vanaf dat zelfde adres eerste geprobeerd is om te verbinden met een serie poorten op jou computer.

Zie onder andere: http://www.portknocking.org/
en: http://www.google.nl/search?q=port-knocking
Afgelopen LinuxMag stond daar een heel artikel over in :)
Met knockd kon je inderdaad poorten activeren, en als je het in een goeie volgorde+goeie poorten deed dan gaf die iets meer access tot SSH zodat je dan je username+pass in kon voeren :)

"You smell that, son? What sir? Napalm, I love the smell of napalm in the mornin!" || Children of Bodom fan!


  • Candymirror
  • Registratie: November 2003
  • Laatst online: 04-02 11:15
Ik gebruik nu al een tijd een script die je hier kan vinden.
Het script leest met bepaalde regelmaat je deamon.log file in en kijkt hoeveel mislukte ssh inlog pogingen van hetzelfde ip-adress afkomstig zijn, komt de hoeveelheid pogingen boven de in het script gestelde waarde dan zal het automatisch een regel toevoegen in deny.hosts. Deze regl ziet er als volgt uit: SSH: "ipadres"

  • HyperDevil
  • Registratie: Oktober 2003
  • Laatst online: 15-12-2025
Candymirror schreef op woensdag 05 april 2006 @ 07:56:
Ik gebruik nu al een tijd een script die je hier kan vinden.
Het script leest met bepaalde regelmaat je deamon.log file in en kijkt hoeveel mislukte ssh inlog pogingen van hetzelfde ip-adress afkomstig zijn, komt de hoeveelheid pogingen boven de in het script gestelde waarde dan zal het automatisch een regel toevoegen in deny.hosts. Deze regl ziet er als volgt uit: SSH: "ipadres"
Dat script heb ik geinstalleerd en het werkt als een trein!

bedankt :)

  • Sallin
  • Registratie: Mei 2004
  • Niet online
dat script ziet er inderdaad erg interessant uit.
Ook eens proberen

This too shall pass
Debian | VirtualBox (W7), Flickr


  • Peter_B
  • Registratie: Maart 2001
  • Laatst online: 06-02 19:35
Ik had hier ook last van, dus heb ik een eigen scriptje geschreven (bij elkaar gekopieerd) dat gebruik maakt van iptables, met als voordeel dat de Kiddie helemaal mijn pc niet meer kan bereiken. Het scriptje wordt via een CronJob elke 10 minuten uitegevoerd. Misschien dat je hier ook iets mee kan. Het is nog niet af maar het voldoet aan mijn eisen.

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
#
#
#       Script that reads /var/log/auth.log for illegal ssh user login attempts
#       If an ip apears more than once it is registerd as an atempt to hack this system
#       and the ip is added to the firewall and dropped from now on.
#
#       TODO:
#       - Add a count so it is possible to register a number of "illegal user" attempts within a given timeframe;
#       - Make it possible to specify a more detailed "allowed" range;
#

READ_COUNT=50   # The number of last entries to examine
LOGS="/var/log/auth.log"        # The log files to parse for SSH attackers
IPTABLES_BACKUP_DIR="/root/iptables"
IP_BLACK_LIST="$IPTABLES_BACKUP_DIR/IP_BlackList.txt"   # File containing all banned IP's
IPTABLES_CURRENT="$IPTABLES_BACKUP_DIR/current" # Most recent iptables safe file
        # Tail the last READ_COUNT entries from "LOGS",
        # get the lines containing "Illegal user" and "sshd",
        # print every tenth item on a line,
        # list imets if they appear more than once,
        # sort it nummerical and only add it once.
ATTACKERS=`tail -n$READ_COUNT $LOGS | grep "Illegal user" | grep "sshd" | awk '{print $10}' | uniq -d | sort -un`
DATE=`date +"%Y_%m_%d"`
UPDATED=0

# Search for hackers
for IP in $ATTACKERS
do
        if [ ! `/sbin/iptables -L -n | awk '{print $4}' | grep $IP` ]   # Skip IP if already present in IPTABLES
        then
                case $IP in
                  '192.168.1.'*)        # Skip entire 192.168.1.0/255.255.255.0 range
                        ;;
                  *)
#                       echo "Dropping incomming requests from $IP."    >> /var/log/auth.log
                        `/sbin/iptables -I INPUT -s $IP -j DROP`        # Insert rule into iptables
                        echo -e "$IP\t`date +"%R %d/%m/%Y"`" >> $IP_BLACK_LIST                  # Append to black list
                        UPDATED=1
                        ;;
                esac
        fi
done

# Did we do anything?
if [ $UPDATED != 0 ]
then
        # Create a backup of the iptables settings
        mv -f $IPTABLES_CURRENT $IPTABLES_BACKUP_DIR/IPTABLES_$DATE     # one backup a day will suffice
        /sbin/iptables-save > $IPTABLES_CURRENT
fi

Discoveries are made by not following instructions.

Pagina: 1