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

    Modifying a openvpn config file

    Scheduled Pinned Locked Moved OpenVPN
    3 Posts 2 Posters 2.4k 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.
    • J
      joelones
      last edited by

      I'd like to run a script that updates the openvpn file in the /var/etc. Specifically, I'd like to dig the domain and update the contents of the "remote ip port" section of the openvpn .conf file.

      I am able to make the changes but notice that the changes aren't reflected in the gui. Are they cached somewhere?

      Thanks

      1 Reply Last reply Reply Quote 0
      • H
        heper
        last edited by

        the /var/etc file is generated dynamically.
        (almost) everything in pfSense in written in /conf/config.xml
        the individual config files for the various services are re-generated each time a change is made in the GUI

        so, instead of writing to /var/etc/whatever: use a script to make changes towards the config.xml. It's best to use the builtin function for this (check developer shell wiki: https://doc.pfsense.org/index.php/Using_the_PHP_pfSense_Shell)

        1 Reply Last reply Reply Quote 0
        • J
          joelones
          last edited by

          @heper:

          the /var/etc file is generated dynamically.
          (almost) everything in pfSense in written in /conf/config.xml
          the individual config files for the various services are re-generated each time a change is made in the GUI

          so, instead of writing to /var/etc/whatever: use a script to make changes towards the config.xml. It's best to use the builtin function for this (check developer shell wiki: https://doc.pfsense.org/index.php/Using_the_PHP_pfSense_Shell)

          Oh thanks. Can I call /usr/local/sbin/pfSsh.php from the command and feed it commands. I tried the following which didn't work.

          /usr/local/sbin/pfSsh.php "print_r ( $config, true ) ; exec;"
          

          config: Undefined variable.

          The pfSsh.php file only accepts commands via redirection from another file?

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