OpenNetAdmin:: Wed, 16 Jun 2010 11:31:51 -0600 OpenNetAdmin::OpenNetAdmin Web Interface: Recently opened tasks http://opennetadmin.com/bugs/ FS#80: virtual domains psyber Wed, 16 Jun 2010 11:31:51 -0600
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??]]>
http://opennetadmin.com/bugs/index.php?do=details&task_id=80 http://opennetadmin.com/bugs/index.php?do=details&task_id=80
FS#79: slash in VLAN name breaks DHCP conf psyber Tue, 15 Jun 2010 11:28:08 -0600 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.]]>
http://opennetadmin.com/bugs/index.php?do=details&task_id=79 http://opennetadmin.com/bugs/index.php?do=details&task_id=79
FS#78: [patch][host_actions] replace custom attributes in host action URLs Greg Fri, 11 Jun 2010 06:22:11 -0600
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.]]>
http://opennetadmin.com/bugs/index.php?do=details&task_id=78 http://opennetadmin.com/bugs/index.php?do=details&task_id=78
FS#77: [patch][list_hosts] Typo in SQL for "by custom attributes" searches Greg Wed, 09 Jun 2010 10:45:34 -0600
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]]>
http://opennetadmin.com/bugs/index.php?do=details&task_id=77 http://opennetadmin.com/bugs/index.php?do=details&task_id=77
FS#76: Incorrect record edit in Location Administration window David Baldwin Wed, 12 May 2010 01:35:54 -0600
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.]]>
http://opennetadmin.com/bugs/index.php?do=details&task_id=76 http://opennetadmin.com/bugs/index.php?do=details&task_id=76
FS#75: HTTP proxy support for version checking on startup David Baldwin Fri, 07 May 2010 01:58:18 -0600 It uses a sys_config variable 'http_proxy' which must have the format http://:

$ 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
< //}
---
> }
]]>
http://opennetadmin.com/bugs/index.php?do=details&task_id=75 http://opennetadmin.com/bugs/index.php?do=details&task_id=75
FS#74: Changing A Record changes all PTR records matching host to new IP psyber Tue, 04 May 2010 17:01:53 -0600 http://opennetadmin.com/bugs/index.php?do=details&task_id=74 http://opennetadmin.com/bugs/index.php?do=details&task_id=74 FS#73: Allow for the use of a proxy for version update checks Matt Pascoe Tue, 20 Apr 2010 17:55:13 -0600
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
< //}
---
> }]]>
http://opennetadmin.com/bugs/index.php?do=details&task_id=73 http://opennetadmin.com/bugs/index.php?do=details&task_id=73
FS#72: CR in notes field breaks bind psyber Thu, 15 Apr 2010 14:16:50 -0600 http://opennetadmin.com/bugs/index.php?do=details&task_id=72 http://opennetadmin.com/bugs/index.php?do=details&task_id=72 FS#71: DHCP functionality disable/hide Adamec Vaclav Mon, 08 Mar 2010 06:04:09 -0700 http://opennetadmin.com/bugs/index.php?do=details&task_id=71 http://opennetadmin.com/bugs/index.php?do=details&task_id=71