Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing to use cmd_timeout #6

Merged
merged 3 commits into from
Mar 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
$sequence_close = $knockd::params::sequence_close,
$port_to_manage = $knockd::params::port_to_manage,
$interface_to_manage = $knockd::params::interface_to_manage,
$command_timeout = $knockd::params::command_timeout,
) inherits knockd::params {
anchor {'knockd::start':}->
class {'knockd::package':}->
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
$port_to_manage = '22'
$interface_to_manage = 'eth0'
$service_default_config = '/etc/default/knockd'
$command_timeout = undef
}
11 changes: 11 additions & 0 deletions templates/knockd.conf.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
[options]
UseSyslog

<% if @command_timeout %>
[opencloseSSH]
sequence = <%= @sequence_open %>
seq_timeout = 15
tcpflags = syn
start_command = /sbin/iptables -A INPUT -s %IP% -p tcp --dport <%=@port_to_manage %> -j ACCEPT
cmd_timeout = <%= @command_timeout %>
stop_command = /sbin/iptables -D INPUT -s %IP% -p tcp --dport <%= @port_to_manage %> -j ACCEPT

<% else %>
[openSSH]
sequence = <%= @sequence_open %>
seq_timeout = 5
Expand All @@ -12,3 +22,4 @@
seq_timeout = 5
command = /sbin/iptables -D INPUT -s %IP% -p tcp --dport <%= @port_to_manage%> -j ACCEPT
tcpflags = syn
<% end %>