Bug #23353
closedIssues with default directory for included DHCP files
Description
In case of ISC DHCP integration enabled:
If DHCP config file is read during proxy startup, all files referenced in dhcpd.conf using include statement are loaded for inspection.
This is leading to issues, if those are not specified with an absolute path, but just with a simple filename.
Example:
[root@foreman dns]# cat /etc/dhcp/dhcpd.conf
include "omapi.key";
(--- remaining part of file snipped ---)
It seems as if those files are searched in the root directory instead of the directory where the dhcp config file itself is located.
The following code fixed the issue for me:
patch -p0 /usr/share/foreman-proxy/modules/dhcp_common/isc/configuration_parser.rb << '@EOF' *** dada 2018-04-10 04:35:16.461982185 +0200 --- configuration_parser.rb 2018-04-10 04:30:57.872176905 +0200 *************** *** 382,392 **** --- 382,394 ---- end def parse_file(a_path) + a_path = @@config_path + '/' + a_path if File.dirname(a_path) == '.' File.open(a_path, 'r') {|f| conf.parse!(f.read, a_path)} end # returns all_subnets, all_hosts, root_group def subnets_hosts_and_leases(conf_as_string, filename) + @@config_path = File.dirname(filename) parsed = conf.parse!(conf_as_string, filename) start_visiting_parse_tree_nodes(parsed) end @EOF
Updated by Lukas Zapletal almost 7 years ago
Thanks for analysis and fix. Are you planning filing it in
https://github.com/theforeman/smart-proxy/pulls
If not, I can do this on your behalf, but we appreciate patches. A unit test might be required tho.
Updated by Sven Lueder almost 7 years ago
Hi Lukas,
will do so.
Best regards
Sven
Updated by The Foreman Bot over 6 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/smart-proxy/pull/593 added
Updated by The Foreman Bot over 6 years ago
- Pull request https://github.com/theforeman/smart-proxy/pull/600 added
Updated by The Foreman Bot about 6 years ago
- Assignee set to Anonymous
- Pull request https://github.com/theforeman/smart-proxy/pull/627 added
Updated by Lukas Zapletal about 6 years ago
- Triaged changed from No to Yes
- Fixed in Releases 1.21.0 added
Updated by Lukas Zapletal about 6 years ago
- Status changed from Ready For Testing to Closed
- Pull request deleted (
https://github.com/theforeman/smart-proxy/pull/600, https://github.com/theforeman/smart-proxy/pull/593)