Testing new package on local system



  • I need a step by step setup for testing local packages. I have been running into issues with 1.2.3. RELEASE

    In /etc/inc/globals.inc I changed

    "xmlrpcbaseurl" => "127.0.0.1",
    "xmlrpcpath" => "/pfSense/xmlrpc.php",
    
    

    I downloaded http://www.pfsense.com/xmlrpc.tgz and untar'd to /usr/local/www/

    I created packages/pkg_config.xml

    packages/pkg_config.xml looks like

    
     <pfsensepkgs><packages><package><name>ntop</name>
          <website>http://www.ntop.org/</website>
          <descr>ntop is a network probe that shows network usage in a way similar to what top does for processes. In interactive mode, it displays the network status on the user's terminal. In Web mode it acts as a Web server, creating an HTML dump of the network status. It sports a NetFlow/sFlow emitter/collector, an HTTP-based client interface for creating ntop-centric monitoring applications, and RRD for persistently storing traffic statistics.</descr>
          <category>Network Management</category>
          <depends_on_package_base_url>http://www.pfsense.org/mirrors/packages/All/</depends_on_package_base_url>
          <depends_on_package>ntop-3.2_2.tbz</depends_on_package>
          <version>3.2_2</version>
          <status>BETA</status>
          <required_version>1.0</required_version>
          <config_file>http://www.pfsense.com/packages/config/ntop.xml</config_file>
          <configurationfile>ntop.xml</configurationfile></package></packages></pfsensepkgs> 
    
    

    I also followed the wiki. Was there a change in 1.2.3 RELEASE that prevents me from doing this?

    I figured using the ntop package even though it connects to pfsense.org was a safe way to ensure my local repository was working. What did I miss?

    Thank you.

    EDIT: The specific error is  Unable to retrieve package info from 127.0.0.1. Cached data will be used.



  • 1. Create dirs

    • /usr/local/www/pfSense
    • /usr/local/www/packages
      2. Download http://www.pfsense.com/xmlrpc.tgz and unpack to /usr/local/www/pfSense
      3. Create manifest's in /usr/local/www/packages
    • pkg_config.xml - for pfSense based on FreeBSD 6.x
    • pkg_config.7.xm - for pfSense based on FreeBSD 7.x
    • pkg_config.8.xml - for pfSense based on FreeBSD 8.x
      4. Change /etc/inc/globals.inc as  here
    "xmlrpcbaseurl" => "127.0.0.1",
    


  • Good day.

    Okay so in /usr/local/www I have …

    
    packages
        - pkg_config.xml
        - pkg_config.7.xml
        - pkg_config.8.xml
        - ntop
          - bin
             - librrd_th.so.2
        - config
           - ntop.xml
    pfSense
        - array_intersect_key.php
        - PEAR.inc
        - PEAR.php
        - pkg_tester.php
        - test.php
        - version
        - xml_parser.inc
        - xml_serializer.inc
        - xml_unserializer.inc
        - xml_util.inc
        - xmlparse.inc
        - xmlparse.inc.new
        - xmlrpc.inc
        - xmlrpc.php
        - xmlrpc.php.working
        - xmlrpc_client.inc
        - xmlrpc_server.inc
        - xmlrpc_tester.php
        - xmlrpc
           - echo_time.php
           - version 
           - version_base
           - version_comment
           - version_embedded
           - version_pfSense
    
    

    And my pkg_config.xml - pkg_config.7.xml - pkg_config.8.xml look like….

     <pfsensepkgs><packages><package><name>ntop</name>
          <website>http://www.ntop.org/</website>
          <descr>ntop is a network probe that shows network usage in a way similar to what top does for processes. In interactive mode, it displays the network status on the user's terminal. In Web mode it acts as a Web server, creating an HTML dump of the network status. It sports a NetFlow/sFlow emitter/collector, an HTTP-based client interface for creating ntop-centric monitoring applications, and RRD for persistently storing traffic statistics.</descr>
          <category>Network Management</category>
          <depends_on_package_base_url>http://www.pfsense.org/mirrors/packages/All/</depends_on_package_base_url>
          <depends_on_package>ntop-3.2_2.tbz</depends_on_package>
          <version>3.2_2</version>
          <status>BETA</status>
          <required_version>1.0</required_version>
          <config_file>http://127.0.0.1/packages/config/ntop.xml</config_file>
          <configurationfile>ntop.xml</configurationfile></package> 
      <packages></packages></packages></pfsensepkgs> 
    

    and my ntop xml in /usr/local/www/packages/config looks like

    
     <packagegui><copyright>/* $Id: ntop.xml,v 1.58 2008/12/12 03:53:47 sullrich Exp $ */
    /* ========================================================================== */
    /*
        authng.xml
        part of pfSense (http://www.pfSense.com)
        Copyright (C) 2008 Scott Ullrich
        All rights reserved.                                                                              */
    /* ========================================================================== */
    /*
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
    
         1\. Redistributions of source code must retain the above copyright notice,
            this list of conditions and the following disclaimer.
    
         2\. Redistributions in binary form must reproduce the above copyright
            notice, this list of conditions and the following disclaimer in the
            documentation and/or other materials provided with the distribution.
    
        THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
        AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
        AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
        OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
        SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
        INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
        CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
        POSSIBILITY OF SUCH DAMAGE.
                                                                                  */
    /* ========================================================================== */
            ]]></copyright> 
    	<name>ntop</name>
    	<version>3.0</version>
    	<title>Diagnostics: ntop Settings</title>
    	<savetext>Change</savetext>
    	<aftersaveredirect>pkg_edit.php?xml=ntop.xml&id=0</aftersaveredirect>
    	 <additional_files_needed><prefix>/usr/local/lib/</prefix>
    	    <chmod>0755</chmod>
    		http://127.0.0.1/packages/ntop/bin/librrd_th.so.2</additional_files_needed> 	
    
    <menu>
    		<name>ntop Settings</name>
    		<tooltiptext>Set ntop settings such as password and port.</tooltiptext>
    		Diagnostics
    		<url>/pkg_edit.php?xml=ntop.xml&id=0</url>
    	</menu>
    
    <menu>
    		<name>ntop</name>
    		<tooltiptext>Access ntop</tooltiptext>
    		Diagnostics
    		<url>http://$myurl:3000</url>
    		<depends_on_service>ntop</depends_on_service>
    	</menu>
    
    	 <service><name>ntop</name>
    		<rcfile>ntop.sh</rcfile>
    		<executable>ntop</executable></service> 
    	 <tabs><tab><text>ntop Settings</text>
    			<url>/pkg_edit.php?xml=ntop.xml&id=0</url>
    			 <active></active></tab> 
    		 <tab><text>Access ntop</text>
    			<url>http://$myurl:3000</url></tab></tabs> 
    	 <fields><field><fielddescr>ntop Admin Password</fielddescr>
    			<fieldname>password</fieldname>
    			<description>Enter the password for the NTOP Web GUI.  Minimum 5 characters.</description>
    			<type>password</type></field> 
    		 <field><fielddescr>ntop Admin Password AGAIN</fielddescr>
    			<fieldname>passwordagain</fieldname>
    			<type>password</type></field> 
    		 <field><fielddescr>Interface</fielddescr>
    			<fieldname>interface_array</fieldname>
    			<type>interfaces_selection</type>
    			<size>3</size>
    			<value>lan</value>
    			<multiple>true</multiple></field></fields> 
    	 <custom_php_global_functions>function sync_package_ntop() {
    	    conf_mount_rw();
    	    config_lock();
    	    global $config;
    	    global $input_errors;
    	    $ntop_config =& $_POST;
    	    $if_final = "";
    	    $ifaces_final = "";
    	    system("/bin/mkdir -p /var/db/ntop");
    	    system("/bin/mkdir -p /var/db/ntop/rrd");
    	    system("/bin/mkdir -p /var/db/ntop/rrd/graphics");
    	    system("chown nobody:nobody /var/db/ntop");
    	    system("chown nobody:nobody /var/db/ntop/rrd/graphics");
    	    if($ntop_config['password'] and $ntop_config['passwordagain']) {
    		    if($ntop_config['password'] == $ntop_config['passwordagain']) {
    			    $first = 0;
    			    foreach($_POST['interface_array'] as $iface) {
    				$if = convert_friendly_interface_to_real_interface_name($iface);
    				if($if) {
    				    if($first == 1)
    					$ifaces_final .= ",";
    				    $ifaces_final .= $if;
    				    $first = 1;
    				}
    			    }
    			    exec("/usr/local/bin/ntop --set-admin-password=" . $_POST['password'] . " &", $ntopout);
    			    $start = "/usr/local/bin/ntop -i " . $ifaces_final . " -u root -d --ipv4 -M -x 8102 -X 8192 &";
    			    write_rcfile(array(
    						    "file" => "ntop.sh",
    						    "start" => $start,
    						    "stop" => "/usr/bin/killall ntop"
    					    )
    			    );
    			    restart_service("ntop");
    		    } else {
    			    $input_errors[] = "The provided passwords did not match.";
    		    }
    	    } else {
    		    $input_errors[] = "You must provide (and confirm) ntop's password.";
    	    }
    	    conf_mount_ro();
    	    config_unlock();
    	}</custom_php_global_functions> 
    	 <custom_add_php_command>sync_package_ntop();</custom_add_php_command> 
    	 <custom_php_resync_config_command>sync_package_ntop();</custom_php_resync_config_command> 
    	 <custom_php_install_command></custom_php_install_command> 
    	 <custom_php_deinstall_command>exec("rm /usr/local/etc/rc.d/ntop*");</custom_php_deinstall_command></packagegui> 
    

    I still get Unable to retrieve package info from 127.0.0.1. Cached data will be used.

    I remember doing this on 1.2.2 the same exact way but for some reason I missing something. I know this has to be user error because most of the time it is, but I need someone to look over this all tell me where my mistake is. Thank you.



  • Here is a more visual representation of what I have since reading the code inserts can be a little dry…

    /usr/local/www with pfSense and packages

    inside /usr/local/www/packages/

    in /usr/local/www/pfSense/



  • My opinion it has something to do with a small timeout response RPC server. I have one copy of the pfsense 1.2.3 where a similar situation. But when connecting from another pfSense to this 'bad' server - it's RPC server working!

    Resume:

    • test - connect to you RPC from another pfSense
      - need find where setup RPC clients timeout.

  • Rebel Alliance Developer Netgate

    I seem to recall someone needing a patch to run it off of 127.0.0.1.

    It's much easier in most cases to drop the needed files on another PHP-enabled web server and access them from there.



  • Thank you. Using an external web server did the trick.
    I do have some suggestions for anyone else wanting to set this up

    1. Download http://www.pfsense.com/xmlrpc.tgz
    2. Extract xmlrpc.tgz to your www root (to simplify)
    3. edit /etc/inc/globals.inc
        change```
    "xmlrpcbaseurl" => "<ip_of_webserver>"</ip_of_webserver>

    
    4\. Use pkg_config.xml as a template (from xmlrpc.tar). The header information is vital.
        keep stored in wwwroot/packages
    
    Number 4 is my observation that I wish was more clear to me when first setting this up.
    Thank you all for your help.

Log in to reply