DHCP smart proxy implementation does not honor configured omapi port for ISC dhcpd

Hi everyone,

i am currently digging through a couple of notes that i and a colleague
created during Foreman installations during the last 2-3 months.

One "challenge" we ran into, was that the current ISC DHCP smart proxy
implementation and docs [1]+[2] reference the omapi-port (default 7911),
but does not actually read this setting from dhcpd.conf.
A call to omshell from smart-proxy/modules/dhcp/providers/server/isc.rb is
therefore falling back to the default port 7911.

Of course in OUR setup, it used to listen on another port … :wink:

I prepared a simple fix (needs further testing) and do think it might also
be helpful to add this default to the configuration example.

1 commit a8f96841d6b31fbf6e1f9bdc084a2f28f067cc76
2 Author: Florian Maier <blablubb@atix.de>
3 Date: Wed Apr 22 13:40:37 2015 +0200
4
5 honor omapi port for isc dhcpd
6
7 diff --git a/config/settings.d/dhcp.yml.example
b/config/settings.d/dhcp.yml.example
8 index d7928fc…7bb9bab 100644
9 — a/config/settings.d/dhcp.yml.example
10 +++ b/config/settings.d/dhcp.yml.example
11 @@ -21,3 +21,4 @@
12 #:dhcp_leases: /var/lib/dhcpd/dhcpd.leases
13 #:dhcp_key_name: secret_key_name
14 #:dhcp_key_secret: secret_key
15 +#:dhcp_omapi_port: 7911
16 diff --git a/modules/dhcp/providers/server/isc.rb
b/modules/dhcp/providers/server/isc.rb
17 index 5a8c0ee…fd6d747 100644
18 — a/modules/dhcp/providers/server/isc.rb
19 +++ b/modules/dhcp/providers/server/isc.rb
20 @@ -188,6 +188,7 @@ module Proxy::DHCP
21 @om = IO.popen("/bin/sh -c '#{om_binary} 2>&1'", "r+")
22 @om.puts "key #{Proxy::DhcpPlugin.settings.dhcp_key_name}
&quot;#{Proxy::DhcpPlugin.settings.dhcp_key_secret}&quot;" if
Proxy::DhcpPlugin.settings.dhcp_key_name &&
Proxy::DhcpPlugin.settings.dhcp_key_secret
23 @om.puts "server #{name}"
24 + @om.puts "port #{Proxy::DhcpPlugin.settings.dhcp_omapi_port}
&quot;#{Proxy::DhcpPlugin.settings.dhcp_omapi_port}&quot;" if
Proxy::DhcpPlugin.settings.dhcp_omapi_port
25 @om.puts "connect"
26 @om.puts "new host"
27 elsif cmd == "disconnect"

Thanks for your feedback, please let me know if i missed anything.

Best wishes

Florian

PS.: I just created a Redmine account, but i am currently not yet able to
open new issues.

[1] ISC DHCP - Smart Proxy - Foreman
[2]
Sample dhcpdconf - Smart Proxy - Foreman

> Hi everyone,
>
> i am currently digging through a couple of notes that i and a colleague
> created during Foreman installations during the last 2-3 months.
>
> One "challenge" we ran into, was that the current ISC DHCP smart proxy
> implementation and docs [1]+[2] reference the omapi-port (default 7911),
> but does not actually read this setting from dhcpd.conf.
> A call to omshell from smart-proxy/modules/dhcp/providers/server/isc.rb
> is therefore falling back to the default port 7911.
>
> Of course in OUR setup, it used to listen on another port … :wink:
>
> I prepared a simple fix (needs further testing) and do think it might
> also be helpful to add this default to the configuration example.

Seems like a good idea to me, and without having reviewed it properly,
the patch looks about right!

[snip]
> Thanks for your feedback, please let me know if i missed anything.
>
> Best wishes
>
>
> Florian
>
> PS.: I just created a Redmine account, but i am currently not yet able
> to open new issues.

It looks okay to me, but the New Issue form can be a little hidden - you
have to go into the project first. Here's a link to the smart proxy
one: Foreman

Could you please file a ticket and then open a pull request with your
proposed patch? Someone can then review it properly and we can get it
added to the next release if all's well.
Foreman :: Contribute and
https://help.github.com/articles/using-pull-requests/ have info on the
PR process. Do ask here or in #theforeman-dev on IRC if you get stuck.

Cheers,

··· On 22/04/15 15:50, Florian Maier wrote:


Dominic Cleal
Red Hat Engineering

Hi,

[…]

> Could you please file a ticket and then open a pull request with your
> proposed patch? Someone can then review it properly and we can get it
> added to the next release if all's well.
> Foreman :: Contribute and
> https://help.github.com/articles/using-pull-requests/ have info on the
> PR process. Do ask here or in #theforeman-dev on IRC if you get stuck.
>
> Cheers,
>
> –
> Dominic Cleal
> Red Hat Engineering
>

thanks for your feedback! I will create an issue and send a pull request.

Also discovered the new issue form now :wink:

Best wishes

Florian

··· On Thursday, April 23, 2015 at 10:15:06 AM UTC+2, Dominic Cleal wrote: