# problem mit knockd [solved]

## menschmeier

Hi,

I am trying to use knock on my system.

I want to use knock that way, that knock opens the firewall for a couple of minutes and than closes it again. But this configuration does not work.

Here my config:

```

[opencloseFTP]

        sequence    = 5050,6060,7070

        seq_timeout = 15

        tcpflags    = syn

        command     = /sbin/iptables -A INPUT -s %IP% -p tcp --dport 21 -j ACCEPT

        cmd_timeout = 120

        command     = /sbin/iptables -D INPUT -s %IP% -p tcp --dport 21 -j ACCEPT

```

Here is the output of the log file (the IP is replaced by xxx):

 *Quote:*   

> 
> 
> [2008-01-08 21:07] xxx: opencloseFTP: Stage 1
> 
> [2008-01-08 21:07] xxx: opencloseFTP: Stage 2
> ...

 

What is causing the error and the restart? 

A configuration like this is working:

```
[openFTP]

        sequence    = 4000,5000,6000

        seq_timeout = 5

        command     = /sbin/iptables -A INPUT -s %IP% -p tcp --dport 21 -j ACCEPT

        tcpflags    = syn

[closeFTP]

        sequence    = 6000,5000,4000

        seq_timeout = 5

        command     = /sbin/iptables -D INPUT -s %IP% -p tcp --dport 21 -j ACCEPT

        tcpflags    = syn

```

menschmeier

----------

## MostAwesomeDude

You need to use start_command and stop_command instead of command. Try this:

```
[opencloseFTP]

        sequence    = 5050,6060,7070

        seq_timeout = 15

        tcpflags    = syn

        start_command     = /sbin/iptables -A INPUT -s %IP% -p tcp --dport 21 -j ACCEPT

        cmd_timeout = 120

        stop_command     = /sbin/iptables -D INPUT -s %IP% -p tcp --dport 21 -j ACCEPT
```

----------

## menschmeier

Hi MostAwesomeDude,

thanks for the hint. I was too much in a hurry yesterday to see it ...   :Embarassed: 

menschmeier

----------

## MostAwesomeDude

Sure, no problem! (Please mark your topic title "[SOLVED]", so people know that a solution has been found.)

----------

