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

    bug in web interface for bind package

    Scheduled Pinned Locked Moved pfSense Packages
    17 Posts 6 Posters 1.3k 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.
    • A
      aligator638
      last edited by

      On the webif, if I add custom options to the server like:

      recursion no;
      allow-transfer { none; };
      bindkeys-file "/etc/namedb/bind.keys";
      

      look at the generated named.conf

      recursion no;^M
      allow-transfer { none; };^M
      bindkeys-file "/etc/namedb/bind.keys";
      

      There will be ^M after each line except for the last. Removed all options, saved, insert them again. Same. Bind still works, but it would be cleaner to fix it.

      Eric

      1 Reply Last reply Reply Quote 0
      • kiokomanK
        kiokoman LAYER 8
        last edited by kiokoman

        @aligator638 said in bug in web interface for bind package:

        ^M

        ^M should be the way vim displays 0xD
        0xD is the carriage return character
        0xD=13 and M it's the 13th letter in the English alphabet
        Immagine2.jpg
        Immagine.jpg

        the bind package is ok, i think it's something on your side

        ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
        Please do not use chat/PM to ask for help
        we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
        Don't forget to Upvote with the 👍 button for any post you find to be helpful.

        1 Reply Last reply Reply Quote 0
        • A
          aligator638
          last edited by

          Yes bind is still working, but it is still a problem laying with the web interface, if I add data in other custom fields like in views, I also get the ^M. This is not standard format for a bind file which should just palin ASCII with control characters.

          1 Reply Last reply Reply Quote 0
          • S
            serbus
            last edited by

            Hello!

            In the latest bind gui code there is this:

            $bind_conf .= preg_replace("/^/m", "\t", $custom_options);
            

            Are you on the latest?

            "Mama says regex is the devil", but I think that should get rid of the ^M's...?

            John

            Lex parsimoniae

            A 1 Reply Last reply Reply Quote 0
            • A
              aligator638 @serbus
              last edited by

              @serbus Hello John, not yet I am on 2.4.5p1, I can safely wait.

              1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator
                last edited by johnpoz

                That code has been in the bind package since 2015..Atleast
                https://github.com/pfsense/pfsense-packages/blob/master/config/bind/bind.inc

                I just put some stuff in custom, and then looked at the named.conf file - and there are no ^m in there..

                Running 2.4.5p1 with bind package 9.14_8

                An intelligent man is sometimes forced to be drunk to spend time with his fools
                If you get confused: Listen to the Music Play
                Please don't Chat/PM me for help, unless mod related
                SG-4860 24.11 | Lab VMs 2.8, 24.11

                A 1 Reply Last reply Reply Quote 0
                • bmeeksB
                  bmeeks
                  last edited by bmeeks

                  Usually, the "^M" comes from the Windows (or DOS) line ending sequence of Carriage Return/Line Feed (or 0x0d 0x0a in hex). Unix land hates that. The most likely way to get that in pfSense is by directly pasting something into the text box from the clipboard in Windows. The text will not be converted to Unix line endings automatically when pasted in. Looks like that regex in the package tries, but if the lowercase "M" is correctly written in the post that is incorrect. It needs to be searching for the uppercase "M".

                  I get around this in one of two ways, and both are extra work --

                  1. Paste in one line at a time but be very sure you do not grab the line ending character. So highlight up to the very last character you see on the Windows screen and then stop. Don't grab multiple lines, and don't grab that little "space" that may highlight at the end of a text line in some Windows text editors.

                  2. Create your file of text in Windows, then use WinSCP or something similar to copy the file over to pfSense. WinSCP has an option to transfer as "text", and it will fix the line endings for the destination system when that option is used. So it will strip the 0x0d0x0a character sequence and leave the proper 0x0a value on the FreeBSD side. However, this option is not the default! You must manually choose it. You can set it as the default if you wish. Of course once you get the physical file over on pfSense, you still have to manually get the content into the text box on the GUI tab.

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    aligator638
                    last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • A
                      aligator638 @bmeeks
                      last edited by

                      @bmeeks

                      named.conf is rewritten from the xml file every time you save, so it should not be edited manually.

                      1 Reply Last reply Reply Quote 0
                      • A
                        aligator638 @johnpoz
                        last edited by

                        @johnpoz very odd, I removed the entries, checked named.conf was ok. Retyped everything, and my ^M are back.

                        bmeeksB 1 Reply Last reply Reply Quote 0
                        • bmeeksB
                          bmeeks @aligator638
                          last edited by bmeeks

                          @aligator638 said in bug in web interface for bind package:

                          @johnpoz very odd, I removed the entries, checked named.conf was ok. Retyped everything, and my ^M are back.

                          In my previous post, I was talking about typing in any text input box in the pfSense GUI, not editing a file directly on the system. So if you are "pasting" something into a text box in the GUI, and that pasted text contains Windows or DOS line ending sequences, this ^M problem will show up.

                          So when you say "typed", do you mean only typing from the keyboard, or are you perhaps pasting in something from elsewhere into the GUI text box? I'm not a user of bind on pfSense, but I assume it has a place for the user to manually enter certain things into the configuration by typing or pasting text into one or more text boxes or text input areas in the GUI screens. If Windows or DOS line endings get copied into those GUI text boxes, they will get saved into the XML and then subsequently written out to the named.conf or any other file generated at runtime by the pfSense system.

                          How do I know this can happen? Because I fought it for some time in the code I wrote for the Snort and Suricata packages.

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            aligator638 @bmeeks
                            last edited by

                            @bmeeks sorry, I re-TYPED everything, not cut and paste. And as explained in previous posts, this happens in all the custom fields in this package.

                            1 Reply Last reply Reply Quote 0
                            • A
                              aligator638
                              last edited by

                              Checked the main xml file and decoded the saved text (it is base64)

                              cmVjdXJzaW9uIG5vOw0KYWxsb3ctdHJhbnNmZXIgeyBub25lOyB9Ow0KYmluZGtleXMtZmlsZSAiL2V0Yy9uYW1lZC9iaW5kLmtleXMiOw==

                              ==>>

                              recursion no;
                              allow-transfer { none; };
                              bindkeys-file "/etc/named/bind.keys";

                              No ^M characters in the xml file. So these characters are added when the data is saved into named.conf

                              1 Reply Last reply Reply Quote 0
                              • S
                                serbus
                                last edited by

                                Hello!

                                What are you using to view the named.conf after adding custom options with the web gui? e.g. "ssh in with putty on windows and cat the named.conf" , or "Diagnostics -> Edit File in the gui", etc...

                                John

                                Lex parsimoniae

                                A 1 Reply Last reply Reply Quote 0
                                • A
                                  aligator638 @serbus
                                  last edited by

                                  @serbus very interesting comment John, in vi (ssh), I can see the ^M, but not with the GUI editor, just to check I selected into the editor, and copied that data back into vi again, no ^M

                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    retaichraq123 Banned
                                    last edited by

                                    This post is deleted!
                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      retaichraq123 Banned
                                      last edited by

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