Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Package Config Files: Which layouts, options are possible with XML ? Any docs ?

    Scheduled Pinned Locked Moved pfSense Packages
    10 Posts 2 Posters 2.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      Nachtfalke
      last edited by

      Hi,

      I need some help with the Package Configuration Files (XML). I found some documentation abou the XML files here:
      http://doc.pfsense.org/index.php/Developing_Packages

      But There are many more options and fields we can use in the XML files. But the problem is that there is no documentation about that.

      Now to my problem:
      I have got one .inc file with different fuctions e.g.:

      
      freeradius_settings_resync();
      freeradius_clients_resync();
      freeradius_users_resync();
      freeradius_eapconf_resync();
      freeradius_sqlconf_resync();
      
      

      I created an XML file for all these fuction above. The problem with the freeradius2 package is, that I have some files (eap.conf and sql.conf) which need default settings so that the service can run.
      So I entered for every field a

      <default_value>XYZ</default_value>
      

      entry.
      My problem ist, that I do not know where I have to put the fuction in the XML so that these default values get filled in directly after the installation of the package.

      This is the freeradius.xml which is the configuration file. At the end of this file I have got these entries:

      
      	 <custom_delete_php_command>freeradius_users_resync();</custom_delete_php_command> 
      	 <custom_php_resync_config_command>freeradius_users_resync();</custom_php_resync_config_command> 
      	 <custom_php_install_command>freeradius_install_command();
      		freeradius_settings_resync();
      		freeradius_clients_resync();
      		freeradius_users_resync();
      		freeradius_eapconf_resync();
      		freeradius_sqlconf_resync();</custom_php_install_command> 
      	 <custom_php_deinstall_command>freeradius_deinstall_command();</custom_php_deinstall_command> 
      
      

      But it is not working. I have to go to SQL tab and EAP tab - where are fields are filled out - and have to click one time "Save".

      My second question is:
      Is there a field in XML which creates an Upload or download button ?

      Thanks for your help!

      1 Reply Last reply Reply Quote 0
      • marcellocM
        marcelloc
        last edited by

        I use xml files for package gui, take a look on any of these packages: pfblocker, varnish, postfix, mailscanner.

        All sintax check is done on .inc file, using php.

        Some times, default values are not passed to xml, you must check every option to prevent empty values.

        Treinamentos de Elite: http://sys-squad.com

        Help a community developer! ;D

        1 Reply Last reply Reply Quote 0
        • N
          Nachtfalke
          last edited by

          @marcelloc:

          (…)
          Some times, default values are not passed to xml, you must check every option to prevent empty values.

          Could you explain that a little bit ?

          1 Reply Last reply Reply Quote 0
          • marcellocM
            marcelloc
            last edited by

            For example:
            function sync_package_mailscanner() {
            global $config;
            .
            .
            .

            Here are some checks I do on each GUI option

            #text input
            $max_children =($mailscanner['max_children']?$mailscanner['max_children']:'5');

            #select box
            $scan_messages=(preg_match('/ScanMessages/',$mailscanner['pim'])?"yes":"no");
            .
            .
            .
            }

            If the value is set, I use it. If not I apply a default value.

            Treinamentos de Elite: http://sys-squad.com

            Help a community developer! ;D

            1 Reply Last reply Reply Quote 0
            • N
              Nachtfalke
              last edited by

              @marcelloc:

              For example:
              function sync_package_mailscanner() {
              global $config;
              .
              .
              .

              Here are some checks I do on each GUI option

              #text input
              $max_children =($mailscanner['max_children']?$mailscanner['max_children']:'5');

              #select box
              $scan_messages=(preg_match('/ScanMessages/',$mailscanner['pim'])?"yes":"no");
              .
              .
              .
              }

              If the value is set, I use it. If not I apply a default value.

              Hi,
              great! Thanks for this info. I have got only very less php skills but I could adapt your code to my files ;-)

              Could you help me with my second question, too ? Some Upload/Download buttons ? Is there something I could add in the XML files ?

              Thank you very much!

              1 Reply Last reply Reply Quote 0
              • marcellocM
                marcelloc
                last edited by

                My second question is:
                Is there a field in XML which creates an Upload or download button ?

                if you need upload functions, you can do it in background with mwexec_bg() function.
                If you need to just save remote file while applying changes, use file() function.
                If you wnat to show users download progress, then xml will not be the best option.
                take a look on snort and squidguard package, there is a upload php wiht progress bas on both.

                There is some ajax on postfix_search.php that could be usefull for you.

                I'm not on vacations, but I can help with some code if you need.

                Treinamentos de Elite: http://sys-squad.com

                Help a community developer! ;D

                1 Reply Last reply Reply Quote 0
                • N
                  Nachtfalke
                  last edited by

                  Hi,

                  thanks for your offer! I will try it on my own first - thats the best way to learn ;-)
                  But I will come back to you if I do not find a solution.

                  1.) What I want to realize is that the user can upload certificates (server, client, ca, key) to the radius cert directory (/usr/local/etc/raddb/certs/) like you can do it from DIAGNOSTICS -> Command Prompt

                  2.) This is an other "problem" but I think you can help, too.
                  I want to show the content of a file (e.g. sql.conf) in the GUI. In Mailscanner-dev there is something but it is a littlbit difficult fopr me to understand the few lines between the many others.

                  Thanks a lot.

                  1 Reply Last reply Reply Quote 0
                  • marcellocM
                    marcelloc
                    last edited by

                    I want to show the content of a file (e.g. sql.conf) in the GUI.

                    On postfix it's done, just copy and edit to include your files.

                    postfix_view_config.php

                    Treinamentos de Elite: http://sys-squad.com

                    Help a community developer! ;D

                    1 Reply Last reply Reply Quote 0
                    • N
                      Nachtfalke
                      last edited by

                      @marcelloc:

                      I want to show the content of a file (e.g. sql.conf) in the GUI.

                      On postfix it's done, just copy end edit to include your files.

                      postfix_view_config.php

                      Hi marcelloc,

                      I took a look at this file and modified ist so I could use it for freeradius.
                      It is great! Thank you for that!

                      1 Reply Last reply Reply Quote 0
                      • marcellocM
                        marcelloc
                        last edited by

                        you're welcome  :)

                        Treinamentos de Elite: http://sys-squad.com

                        Help a community developer! ;D

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.