Diagnostics > Edit File and Filer don't seem to work



  • I'm trying to use the GUI to edit text files which I'm using for addn-hosts (under DNS forwarder Advanced Options). The addn-hosts and files are working fine, but I can't get the GUI to reliably load and save the following text files I've created:

    /etc/dnsforwarding
    /etc/adblock

    I enter "Diagnostics > Edit File" then enter the path and filename i.e. "/etc/dnsforwarding". The file loads OK, with text displayed. I then edit/paste some text into the field, and it only sometimes successfully changes the contents file as demonstrated by "Save" then "Load" again. Sometimes the text is not changed, other times it seems to have blanked out the file completely. Specifically, the text it seems to have real trouble with is about 500k worth (http://winhelp2002.mvps.org/hosts.txt). Is there some limit on the GUI which prevents this much text being saved/loaded? "Filer" under Diagnostics also chokes/won't save the large chunk of text.

    As a workaround I have to SSH into the router shell and manually cut/paste to get the text in there. Once I do this, the text files are fine and load and display OK under "Edit File" and "Filer" but saving the large chunk of text again blanks the file out.



  • Trying to move that size of file around using the web interface might be a problem.

    I'd get pfSense to do the fetch for you:
    /usr/bin/fetch -q -o /etc/dnsforwarding http://winhelp2002.mvps.org/hosts.txt

    In fact, you could automate the entire process - fetch, replace the old file, restart the DNS forwarder, then delete the old file:

    /bin/sh -c 'FILE="/etc/dnsforwarding" ; /usr/bin/fetch -q -o ${FILE}.new http://winhelp2002.mvps.org/hosts.txt && if [ -s ${FILE}.new ]; then if [ -f ${FILE} ]; then /bin/mv ${FILE} ${FILE}.old ; fi && /bin/mv ${FILE}.new ${FILE} && /usr/local/sbin/pfSctl -c "service reload dns" && if [ -f ${FILE}.old ]; then /bin/rm -f ${FILE}.old ; fi ; fi'

    If you install the cron package, you can run that command automatically at defined intervals.



  • @David_W:

    Trying to move that size of file around using the web interface might be a problem.

    I'd get pfSense to do the fetch for you:
    /usr/bin/fetch -q -o /etc/dnsforwarding http://winhelp2002.mvps.org/hosts.txt

    In fact, you could automate the entire process - fetch, replace the old file, restart the DNS forwarder, then delete the old file:

    /bin/sh -c 'FILE="/etc/dnsforwarding" ; /usr/bin/fetch -q -o ${FILE}.new http://winhelp2002.mvps.org/hosts.txt && if [ -s ${FILE}.new ]; then if [ -f ${FILE} ]; then /bin/mv ${FILE} ${FILE}.old ; fi && /bin/mv ${FILE}.new ${FILE} && /usr/local/sbin/pfSctl -c "service reload dns" && if [ -f ${FILE}.old ]; then /bin/rm -f ${FILE}.old ; fi ; fi'

    If you install the cron package, you can run that command automatically at defined intervals.

    Brilliant - thanks for the excellent script suggestion and autofetch - hadn't thought of doing that :). Also thanks for supporting my suspicion that the large (relatively) text file size was too much for the GUI.


  • Banned

    No idea what homebrew stuff are you doing there, but I'd suggest you should look at pfBlockerNG. Not a fan of reinventing wheels.



  • @doktornotor:

    No idea what homebrew stuff are you doing there, but I'd suggest you should look at pfBlockerNG. Not a fan of reinventing wheels.

    The list that the OP wanted to use is a Hosts file - a list of host names that (s)he wants to fail to resolve.

    Unless I've missed something, pfBlockerNG works on lists of IP addresses and CIDR ranges. If pfBlockerNG worked on Hosts files, I would have suggested using it.


  • Banned

    Actually, the pfBNG -dev version has DNSBL feature. PM BBcan177 if you are interested in testing. Works very well.



  • @doktornotor:

    No idea what homebrew stuff are you doing there, but I'd suggest you should look at pfBlockerNG. Not a fan of reinventing wheels.

    With all due respect, I'm not sure using host files thusly is homebrew or reinventing wheels…. this is a very statesmanlike and respectable old-school use of the hosts file. Besides, homebrew is delicious! :)

    I've seen the ability to use pfBlockerNG as an adblocker is upcoming, and will be keeping an eye out for it to hit release, as I do use pfBlockerNG currently for Top20 et al.



  • The most simple way to access 'pfSense files' is : use a vanilla FTP-client, like  FileZillaFTP (or much better: SmartFTP) and access your box using …..... SFTP.
    Use a good text editor like Notepad++ (or much better: UltraEdit).

    It all becomes a question of "click-open-edit-save".

    IMHO: GUI-build-in-edit-options are just 'poor-man's solutions'.
    I'd rather prefer SSH in and use nano.



  • @Gertjan:

    The most simple way to access 'pfSense files' is : use a vanilla FTP-client, like  FileZillaFTP (or much better: SmartFTP) and access your box using …..... SFTP.
    Use a good text editor like Notepad++ (or much better: UltraEdit).

    It all becomes a question of "click-open-edit-save".

    IMHO: GUI-build-in-edit-options are just 'poor-man's solutions'.
    I'd rather prefer SSH in and use nano.

    Yeah - I'm perfectly happy SSH-ing in too. In fact real men don't even SSH, but log in to the box directly ;)


Log in to reply