OpenNetAdmin::
https://opennetadmin.com/bugs/
OpenNetAdmin::OpenNetAdmin Web Interface: Recently opened tasks2010-06-16T11:31:51ZFS#80: virtual domains
https://opennetadmin.com/bugs/index.php?do=details&task_id=80
2010-06-16T11:31:51ZpsyberJust gonna put this out here and see if any one takes an interest. One of our people thinks ONA is so awesome kinda expected it to do something like this. I thought it was a great idea. I hate creating and keeping up to date 3 different domains that are basically all the same.
Situation: You have a domain and to protect your namespace you register the .com .org and .net equivalents
Problem : You want everyone who visits any of the domains to be able to land in the one you actively manage (lets say .com)
Solution: Virtual Domains. Basically a way to generate the bind files for domains that are basically copies of other domains. You manage one but ONA generates zone files for all 3. So the www.foo.org and www.foo.net A records get created when you create an A record for www.foo.com. any changes in the .com propagate to the .org .net etc domains automagically.
Bonus: Exceptions. I want everything the same but www should be independently changed across all 3 domains (i.e. each points to a different place)
Thoughts comments votes??
Situation: You have a domain and to protect your namespace you register the .com .org and .net equivalents
Problem : You want everyone who visits any of the domains to be able to land in the one you actively manage (lets say .com)
Solution: Virtual Domains. Basically a way to generate the bind files for domains that are basically copies of other domains. You manage one but ONA generates zone files for all 3. So the www.foo.org and www.foo.net A records get created when you create an A record for www.foo.com. any changes in the .com propagate to the .org .net etc domains automagically.
Bonus: Exceptions. I want everything the same but www should be independently changed across all 3 domains (i.e. each points to a different place)
Thoughts comments votes??]]>FS#79: slash in VLAN name breaks DHCP conf
https://opennetadmin.com/bugs/index.php?do=details&task_id=79
2010-06-15T11:28:08Zpsyberslashes (/) in a VLAN Name break the syntax of the dhcpd.conf
i.e. vlan name "vlan-name-with-a/here" breaks the conf and fails the reload
Internet Systems Consortium DHCP Server V3.0.5-RedHat
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
/opt/ona/etc/dhcpd/dhcpd.conf.ona line 46: expecting left brace.
shared-network vlan-name-with-a/
^
/etc/dhcpd.conf line 2: /opt/ona/etc/dhcpd/dhcpd.conf.ona: bad parse.
include "/opt/ona/etc/dhcpd/dhcpd.conf.ona"
^
Configuration file errors encountered -- exiting
--
recommended fix is to not allow slashes in vlan name (possibly subnet names as well but those get commented)
not sure if its possible to escape the slashes and make them acceptable to the dhcp syntax parser.
i.e. vlan name "vlan-name-with-a/here" breaks the conf and fails the reload
Internet Systems Consortium DHCP Server V3.0.5-RedHat
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
/opt/ona/etc/dhcpd/dhcpd.conf.ona line 46: expecting left brace.
shared-network vlan-name-with-a/
^
/etc/dhcpd.conf line 2: /opt/ona/etc/dhcpd/dhcpd.conf.ona: bad parse.
include "/opt/ona/etc/dhcpd/dhcpd.conf.ona"
^
Configuration file errors encountered -- exiting
--
recommended fix is to not allow slashes in vlan name (possibly subnet names as well but those get commented)
not sure if its possible to escape the slashes and make them acceptable to the dhcp syntax parser.]]>FS#78: [patch][host_actions] replace custom attributes in host action URLs
https://opennetadmin.com/bugs/index.php?do=details&task_id=78
2010-06-15T10:34:20ZGregHi,
I wrote a patch to replace custom attributes in host action URLs. If there is the string "%ca[CUST]" inside an URL, ONA will attempt to replace it by the value of:
- The value of the custom attribute CUST of the host if it exists,
- The value of the system var default_CUST if it exists,
- An empty string if both of them do not exist.
Patches below:
Patch for the main.inc.php script:
--- www/workspace_plugins/builtin/host_actions/main.inc.php.orig 2010-06-10 14:10:46.000000000 +0200
+++ www/workspace_plugins/builtin/host_actions/main.inc.php 2010-06-11 10:30:38.000000000 +0200
@@ -39,6 +39,26 @@
$hval['url'] = str_replace('%loc', $location['reference'], $hval['url']);
+// Get custom attributes if there is "%ca[.*]" string in URL
+ $found_ca_types = preg_match_all("#%ca\[(.*?)\]#",$hval['url'],$ca_types,PREG_PATTERN_ORDER);
+ if ( $found_ca_types ) {
+ foreach ($ca_types[1] as $name) {
+ $replace_with='';
+ // Get the CA value for this host
+ list($status, $rows, $attribute) = ona_get_record("custom_attribute_type_id in (select id from custom_attribute_types where name='".$name."') and table_id_ref = ".$record['id']." and table_name_ref = 'hosts'",'custom_attributes');
+ if ( $rows) {
+ $replace_with=$attribute['value'];
+ }
+ else {
+ // If there's no CA for this host, last chance search in system config
+ list($status,$conf_rows,$conf) = ona_get_record("name = 'default_".$name."'",'sys_config');
+ if ($conf_rows) {
+ $replace_with=$conf['value'];
+ }
+ }
+ $hval['url'] = str_replace("%ca[$name]", $replace_with, $hval['url']);
+ }
+ }
// If the URL has data in it, print.
// TODO: MDP, maybe offer an $hval['icon'] option to use a different icon specified in the $conf['hostaction']['Name']['icon'] variable
@@ -55,4 +75,4 @@
}
-?>
\ No newline at end of file
+?>
Patch for the config file:
6c6
< // You can use %fqdn, %ip and %loc as substitutions in the url for the host being displayed
---
> // You can use %fqdn, %ip,%loc or %ca[custom_attr] as substitutions in the url for the host being displayed
11a12,13
> // %ca[custom_attr] will be substituted by the value of the Custom Attribute "custom_attr". If the host doesn't have one,
> // it will be substituted by the value of the system configuration "default_custom_attr".
16c18
< $conf[$modulename]['Cacti Graph']['url'] = "https://cacti.%loc.example.com/cacti/graph_view.php?action=tree&name=%fqdn";
---
> $conf[$modulename]['Cacti Graph']['url'] = "http://%ca[cacti_server]/graph_view.php?action=preview&host_id=%ca[cacti_id]";
18c20
< ?>
\ No newline at end of file
---
> ?>
That's all. Greg.
I wrote a patch to replace custom attributes in host action URLs. If there is the string "%ca[CUST]" inside an URL, ONA will attempt to replace it by the value of:
- The value of the custom attribute CUST of the host if it exists,
- The value of the system var default_CUST if it exists,
- An empty string if both of them do not exist.
+// Get custom attributes if there is "%ca[.*]" string in URL
+ $found_ca_types = preg_match_all("#%ca\[(.*?)\]#",$hval['url'],$ca_types,PREG_PATTERN_ORDER);
+ if ( $found_ca_types ) {
+ foreach ($ca_types[1] as $name) {
+ $replace_with='';
+ // Get the CA value for this host
+ list($status, $rows, $attribute) = ona_get_record("custom_attribute_type_id in (select id from custom_attribute_types where name='".$name."') and table_id_ref = ".$record['id']." and table_name_ref = 'hosts'",'custom_attributes');
+ if ( $rows) {
+ $replace_with=$attribute['value'];
+ }
+ else {
+ // If there's no CA for this host, last chance search in system config
+ list($status,$conf_rows,$conf) = ona_get_record("name = 'default_".$name."'",'sys_config');
+ if ($conf_rows) {
+ $replace_with=$conf['value'];
+ }
+ }
+ $hval['url'] = str_replace("%ca[$name]", $replace_with, $hval['url']);
+ }
+ }
// If the URL has data in it, print.
// TODO: MDP, maybe offer an $hval['icon'] option to use a different icon specified in the $conf['hostaction']['Name']['icon'] variable
@@ -55,4 +75,4 @@
}
-?>
\ No newline at end of file
+?>
Patch for the config file:
6c6
< // You can use %fqdn, %ip and %loc as substitutions in the url for the host being displayed
---
> // You can use %fqdn, %ip,%loc or %ca[custom_attr] as substitutions in the url for the host being displayed
11a12,13
> // %ca[custom_attr] will be substituted by the value of the Custom Attribute "custom_attr". If the host doesn't have one,
> // it will be substituted by the value of the system configuration "default_custom_attr".
16c18
< $conf[$modulename]['Cacti Graph']['url'] = "https://cacti.%loc.example.com/cacti/graph_view.php?action=tree&name=%fqdn";
---
> $conf[$modulename]['Cacti Graph']['url'] = "http://%ca[cacti_server]/graph_view.php?action=preview&host_id=%ca[cacti_id]";
18c20
< ?>
\ No newline at end of file
---
> ?>
That's all. Greg.]]>FS#77: [patch][list_hosts] Typo in SQL for "by custom attributes" searches
https://opennetadmin.com/bugs/index.php?do=details&task_id=77
2010-06-15T10:18:25ZGregHi,
The SQL request for a simple "custom attribute" search is not valid. For example:
- CA type:'immo'
- CA search string: 'VP00409'
- The SQL request becomes:
SELECT * FROM hosts h WHERE h.id in (select table_id_ref from custom_attributes where table_name_ref like 'hosts' and custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = 'immo')) AND h.id in (select table_id_ref from custom_attributes where table_name_ref like 'hosts' and h.custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = 'immo') and value like '%VP00409%') LIMIT 10
The MySQL server raises the following error:
ERROR 1054 (42S22): Unknown column 'h.custom_attribute_type_id' in 'where clause'
The below patch fixes this issue:
--- www/winc/list_hosts.inc.php.orig 2010-06-09 18:33:23.000000000 +0200
+++ www/winc/list_hosts.inc.php 2010-06-09 18:33:32.000000000 +0200
@@ -335,7 +335,7 @@
if ($form['custom_attribute_type']) {
$where .= $and . "h.id in (select table_id_ref from custom_attributes where table_name_ref like 'hosts' and custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = " . $onadb->qstr($form['custom_attribute_type']) . "))";
$and = " AND ";
- $cavaluetype = "and h.custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = " . $onadb->qstr($form['custom_attribute_type']) . ")";
+ $cavaluetype = "and custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = " . $onadb->qstr($form['custom_attribute_type']) . ")";
}
Greg
The SQL request for a simple "custom attribute" search is not valid. For example:
- CA type:'immo'
- CA search string: 'VP00409'
- The SQL request becomes:
SELECT * FROM hosts h WHERE h.id in (select table_id_ref from custom_attributes where table_name_ref like 'hosts' and custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = 'immo')) AND h.id in (select table_id_ref from custom_attributes where table_name_ref like 'hosts' and h.custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = 'immo') and value like '%VP00409%') LIMIT 10
The MySQL server raises the following error:
ERROR 1054 (42S22): Unknown column 'h.custom_attribute_type_id' in 'where clause'
The below patch fixes this issue:
--- www/winc/list_hosts.inc.php.orig 2010-06-09 18:33:23.000000000 +0200
+++ www/winc/list_hosts.inc.php 2010-06-09 18:33:32.000000000 +0200
@@ -335,7 +335,7 @@
if ($form['custom_attribute_type']) {
$where .= $and . "h.id in (select table_id_ref from custom_attributes where table_name_ref like 'hosts' and custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = " . $onadb->qstr($form['custom_attribute_type']) . "))";
$and = " AND ";
- $cavaluetype = "and h.custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = " . $onadb->qstr($form['custom_attribute_type']) . ")";
+ $cavaluetype = "and custom_attribute_type_id = (SELECT id FROM custom_attribute_types WHERE name = " . $onadb->qstr($form['custom_attribute_type']) . ")";
}
Greg]]>FS#76: Incorrect record edit in Location Administration window
https://opennetadmin.com/bugs/index.php?do=details&task_id=76
2010-05-13T09:04:14ZDavid BaldwinThe Location Administration window has the 1st column as the location reference and an edit icon at the end of the row. On my installation, at least for the case of ID: 10, when I click on the reference link, it edits location ID: 1 instead! The edit icon works correctly.
In both cases the tooltip says: "Edit location. ID: 10" so I would expect identical behaviour.
Looking at the HTML there is a difference in the 'onclick' for the link:
reference link: xajax_window_submit('edit_location', '10', 'editor');
edit icon: xajax_window_submit('edit_location', 'id=>10', 'editor');
(Note 'id=>10').
The error is on line 199 of winc/app_location_list.inc.php and the patch below fixes the error.
199c199
< onClick="xajax_window_submit('edit_location', 'id=>{$record['id']}', 'editor');"
---
> onClick="xajax_window_submit('edit_location', '{$record['id']}', 'editor');"
Thanks, David.
In both cases the tooltip says: "Edit location. ID: 10" so I would expect identical behaviour.
Looking at the HTML there is a difference in the 'onclick' for the link:
reference link: xajax_window_submit('edit_location', '10', 'editor');
edit icon: xajax_window_submit('edit_location', 'id=>10', 'editor');
(Note 'id=>10').
The error is on line 199 of winc/app_location_list.inc.php and the patch below fixes the error.
Thanks, David.]]>FS#75: HTTP proxy support for version checking on startup
https://opennetadmin.com/bugs/index.php?do=details&task_id=75
2010-05-13T09:05:32ZDavid BaldwinHere is a patch for supporting version checking using an HTTP proxy.
It uses a sys_config variable 'http_proxy' which must have the format http://<hostname>:<port>
$ diff www/workspace_plugins/builtin/desktop_versioncheck/main.inc.php*
15,22d14
< $opts = array();
< if(isset($conf['http_proxy'])) {
< if(preg_match('/http:\/\/([^:]+:?\d*)/',$conf['http_proxy'],$matches)) {
< $opts['http'] = array('proxy' => 'tcp://'.$matches[1], 'request_fulluri' => true);
< }
< }
< //$opts = array('http' => array('proxy' => 'tcp://wwwproxy:8080', 'request_fulluri' => true));
< $context = stream_context_create($opts);
28,29c20,21
< //$fsock = @fsockopen("tcp://{$onachkserver}", 80, $errNo, $errString, 2);
< //if ($fsock) {
---
> $fsock = @fsockopen("tcp://{$onachkserver}", 80, $errNo, $errString, 2);
> if ($fsock) {
31c23
< $file = @fopen("http://{$onachkserver}/check_version.php", "r",false,$context);
---
> $file = @fopen("http://{$onachkserver}/check_version.php", "r");
33c25
< //}
---
> }
It uses a sys_config variable 'http_proxy' which must have the format http://<hostname>:<port>
$ diff www/workspace_plugins/builtin/desktop_versioncheck/main.inc.php*
15,22d14
< $opts = array();
< if(isset($conf['http_proxy'])) {
< if(preg_match('/http:\/\/([^:]+:?\d*)/',$conf['http_proxy'],$matches)) {
< $opts['http'] = array('proxy' => 'tcp://'.$matches[1], 'request_fulluri' => true);
< }
< }
< //$opts = array('http' => array('proxy' => 'tcp://wwwproxy:8080', 'request_fulluri' => true));
< $context = stream_context_create($opts);
28,29c20,21
< //$fsock = @fsockopen("tcp://{$onachkserver}", 80, $errNo, $errString, 2);
< //if ($fsock) {
---
> $fsock = @fsockopen("tcp://{$onachkserver}", 80, $errNo, $errString, 2);
> if ($fsock) {
31c23
< $file = @fopen("http://{$onachkserver}/check_version.php", "r",false,$context);
---
> $file = @fopen("http://{$onachkserver}/check_version.php", "r");
33c25
< //}
---
> } ]]>FS#74: Changing A Record changes all PTR records matching host to new IP
https://opennetadmin.com/bugs/index.php?do=details&task_id=74
2010-06-03T16:48:00ZpsyberI edited an A record today on a multi-homed host and noticed that all the PTR records changed to the new value (not sure how that looked in the DB or the generated file but on screen I had 4 PTR records that all said the exact same thing). I ended up deleting all of the PTR records and recreating each one to make it right. I suspect that the bit of code that makes this change just looks for HOSTNAME in the db and changes any PTR records associated with that host name. Proper behavior should be that it changes only the PTR associated with that HOSTNAME and it's old IP.FS#73: Allow for the use of a proxy for version update checks
https://opennetadmin.com/bugs/index.php?do=details&task_id=73
2010-05-13T09:06:54ZMatt PascoeAdding bug per post in the forum.. thanks for the patch..
15,16d14
< $opts = array('http' => array('proxy' => 'tcp://wwwproxy:8080', 'request_fulluri' => true));
< $context = stream_context_create($opts);
22,23c20,21
< //$fsock = @fsockopen("tcp://{$onachkserver}", 80, $errNo, $errString, 2);
< //if ($fsock) {
---
> $fsock = @fsockopen("tcp://{$onachkserver}", 80, $errNo, $errString, 2);
> if ($fsock) {
25c23
< $file = @fopen("http://{$onachkserver}/check_version.php", "r",false,$context);
---
> $file = @fopen("http://{$onachkserver}/check_version.php", "r");
27c25
< //}
---
> }
15,16d14
< $opts = array('http' => array('proxy' => 'tcp://wwwproxy:8080', 'request_fulluri' => true));
< $context = stream_context_create($opts);
22,23c20,21
< //$fsock = @fsockopen("tcp://{$onachkserver}", 80, $errNo, $errString, 2);
< //if ($fsock) {
---
> $fsock = @fsockopen("tcp://{$onachkserver}", 80, $errNo, $errString, 2);
> if ($fsock) {
25c23
< $file = @fopen("http://{$onachkserver}/check_version.php", "r",false,$context);
---
> $file = @fopen("http://{$onachkserver}/check_version.php", "r");
27c25
< //}
---
> }]]>FS#72: CR in notes field breaks bind
https://opennetadmin.com/bugs/index.php?do=details&task_id=72
2010-04-15T14:16:50Zpsyberprobably best to just replace all notes containing \n with a \t in the build_bind script, that keeps the notes formatted in the DB and doesn't break bind.FS#71: DHCP functionality disable/hide
https://opennetadmin.com/bugs/index.php?do=details&task_id=71
2010-03-08T06:04:09ZAdamec VaclavHello, it will be nice to have possibility to disable/hide DHCP support/elements If you don't use it.