[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Portknocking mit knockd



On 25/09/06, Meinolf Sander <crap.1.f13@neverbox.com> wrote:
Moin,

ich möchte, dass auf einem Rechner SSH gestartet wird, wenn
eine bestimmte Sequenz von Port-Hits an ihn gesendet wird.
Mit knockd klappt das noch nicht ganz:

/etc/knockd.conf
[options]
        logfile = /var/log/knockd.log

[openSSH]
        sequence    = 7000,8000,9000
        seq_timeout = 5
        command     = /etc/init.d/ssh start
        tcpflags    = syn
[...]

# knockd -v -d -D -i ppp0
config: new section: 'options'
config: log file: /var/log/knockd.log
config: new section: 'openSSH'
config: openSSH: sequence: 7000:tcp,8000:tcp,9000:tcp
config: openSSH: protocol: (null)
config: openSSH: seq_timeout: 5
config: openSSH: start_command: /etc/init.d/ssh start
config: tcp flag: SYN
[...]
ppp interface detected (linux "cooked" encapsulation)
Local IP: $IP1

Im Logfile steht bei einem 'knock $IP1 7000 8000 9000':

starting up, listening on ppp0
$IP2: openSSH: Stage 1
$IP2: openSSH: Stage 2
$IP2: openSSH: Stage 3
$IP2: openSSH: OPEN SESAME
openSSH: running command: /etc/init.d/ssh start
openSSH: command returned non-zero status code (1)

Wie kann ich jetzt herausfinden, warum der SSHD nicht startet?
/etc/ssh/sshd_not_to_be_run gibt es selbstverständlich nicht.


Gruß,
   Meinolf

Hallo Meinolf,

Ich denke das Problem ist, dass "knockd" beim Forken (also wenn er als
Daemon laeuft) die Filedeskriptoren 0,1,2 schliesst, also insbesondere
die Standardout. Nun wird im Skript /etc/init.d/ssh mittels "echo"
Sachen auf den Standardout ausgegeben und das wird wohl das Prozess
zum Erliegen bringen. Deshalb wird wohl "sshd" gar nicht gestartet.
Probier doch mal im Skript "/etc/init.d/ssh" die "echo"'s
auszukommentieren (reicht schon beim "start case" das zu machen), oder
starte sshd per hand und nicht mit dem Init Skript (kopier einfach die
"start-stop-daemon" Zeile in dein "knockd.conf"). Ich hoffe das hielft
dir weiter.



Reply to: