Loading ...
Sorry, an error occurred while loading the content.

Re: How to change modified cf files to postconf commands

Expand Messages
  • Robert Moskowitz
    ... For the past 3 years I have been running with a setup based on:
    Message 1 of 15 , Dec 13, 2012
    • 0 Attachment
      On 12/13/2012 05:47 PM, Noel Jones wrote:
      > On 12/13/2012 4:17 PM, Robert Moskowitz wrote:
      >> In the totorial:
      >>
      >> http://www.campworld.net/thewiki/pmwiki.php/LinuxServersCentOS/Cent6VirtMailServer
      >>
      >>
      >> There are modified postfix .cf files. I don't want to just use a
      >> modified postfix file, I want to user postconf to do the
      >> modifications. And I am not experienced using things like diff to
      >> work out what changes were made from the base install files.
      >>
      >> Can anyone lend some expertise in identifying the mods so I can work
      >> this up as postconf commands?
      > Why? If you're just going to paste in changes it doesn't matter too
      > much if you paste in a pre-made .cf file or if you run a bunch of
      > postconf commands.

      For the past 3 years I have been running with a setup based on:

      http://www.howtoforge.com/virtual-users-and-domains-with-postfix-courier-mysql-and-squirrelmail-fedora-14-x86_64

      Here the postfix changes are done via postconf, so I CAN tell what
      changes are made and understand what is going on.

      >
      > Better to learn why each line is there, and why. And most
      > important, if *you* need it.

      Kind of my point. What changes is the author of the tutorial really
      making so I can understand why.

      >
      > http://www.postfix.org/documentation.html
      > http://www.postfix.org/STANDARD_CONFIGURATION_README.html
      > http://www.postfix.org/VIRTUAL_README.html
      >
      > main.cf parameters and their defaults are documented here:
      > http://www.postfix.org/postconf.5.html
      > Generally, only parameters that differ from their default should be
      > included in your main.cf.

      Again, what I want to get to. Understand what changes the author made
      to the defaults. Looks like I will first have to learn how to
      understand the output of diff.
    • mouss
      ... # postconf -d shows default settings (builtin defaults). # postconf -n shows local settings. that said, some local settings may use the same value as
      Message 2 of 15 , Dec 14, 2012
      • 0 Attachment
        Le 14/12/2012 01:55, Robert Moskowitz a écrit :
        >
        > On 12/13/2012 05:47 PM, Noel Jones wrote:
        >> On 12/13/2012 4:17 PM, Robert Moskowitz wrote:
        >>> In the totorial:
        >>>
        >>> http://www.campworld.net/thewiki/pmwiki.php/LinuxServersCentOS/Cent6VirtMailServer
        >>>
        >>>
        >>>
        >>> There are modified postfix .cf files. I don't want to just use a
        >>> modified postfix file, I want to user postconf to do the
        >>> modifications. And I am not experienced using things like diff to
        >>> work out what changes were made from the base install files.
        >>>
        >>> Can anyone lend some expertise in identifying the mods so I can work
        >>> this up as postconf commands?
        >> Why? If you're just going to paste in changes it doesn't matter too
        >> much if you paste in a pre-made .cf file or if you run a bunch of
        >> postconf commands.
        >
        > For the past 3 years I have been running with a setup based on:
        >
        > http://www.howtoforge.com/virtual-users-and-domains-with-postfix-courier-mysql-and-squirrelmail-fedora-14-x86_64
        >
        >
        > Here the postfix changes are done via postconf, so I CAN tell what
        > changes are made and understand what is going on.
        >

        # postconf -d
        shows default settings (builtin defaults).
        # postconf -n
        shows "local" settings.

        that said, some "local" settings may use the same value as the default
        config, which is mostly useless. on the url you posted, an example is
        inet_interfaces = all, since this is the default:
        # postconf -d inet_interfaces
        inet_interfaces = all

        so the setting is useless and can be removed from main.cf. same for
        mydestination, alias_maps...


        You can chase these with something like:

        # postconf -n | while read parameter equal value; do
        default_value=`postconf -d $parameter 2>&1`;
        if [ "$value" = "$default_value" ]; then
        echo "NOTICE: Useless setting: $parameter = $value";
        fi;
        done

        Such settings can be removed from main.cf.

        (the "2>&1" will avoid "false positives" when a parameter is "unknown"
        to 'postconf -d'...).



        >>
        >> Better to learn why each line is there, and why. And most
        >> important, if *you* need it.
        >
        > Kind of my point. What changes is the author of the tutorial really
        > making so I can understand why.
        >
        >>
        >> http://www.postfix.org/documentation.html
        >> http://www.postfix.org/STANDARD_CONFIGURATION_README.html
        >> http://www.postfix.org/VIRTUAL_README.html
        >>
        >> main.cf parameters and their defaults are documented here:
        >> http://www.postfix.org/postconf.5.html
        >> Generally, only parameters that differ from their default should be
        >> included in your main.cf.
        >
        > Again, what I want to get to. Understand what changes the author made
        > to the defaults. Looks like I will first have to learn how to
        > understand the output of diff.
        >
        >

        do not blindly follow howotos/utorials/etc. better learn from the
        official documentation. see Noel's postf for a few URLs. more on postfix
        site.

        you can also consider getting a copy of "the book of postfix".
      • Benny Pedersen
        ... if its ever updated i would like to pay for the next version as a ebook
        Message 3 of 15 , Dec 15, 2012
        • 0 Attachment
          mouss skrev den 14-12-2012 23:01:

          > you can also consider getting a copy of "the book of postfix".

          if its ever updated i would like to pay for the next version as a ebook
        • Robert Moskowitz
          I have now made it past creating my cert, setting up mysql and installing postfixadmin. I have even gotten a show columns of all the tables created in setup
          Message 4 of 15 , Dec 22, 2012
          • 0 Attachment
            I have now made it past creating my cert, setting up mysql and
            installing postfixadmin. I have even gotten a 'show columns' of all the
            tables created in setup for postfixadmin. Next is setting up postfix
            itself, which comes as the default mailer on Centos 6. So as Centos
            comes with a main.cf file, I thought to try the script below to get a
            'feel' for things as I work out all the things that at least this the
            tutorial I am starting with 'says' I need to do. First understand then
            proceed; or some such.

            But I had problems with the script. See below for this...

            On 12/14/2012 05:01 PM, mouss wrote:
            > Le 14/12/2012 01:55, Robert Moskowitz a écrit :
            >> On 12/13/2012 05:47 PM, Noel Jones wrote:
            >>> On 12/13/2012 4:17 PM, Robert Moskowitz wrote:
            >>>> In the totorial:
            >>>>
            >>>> http://www.campworld.net/thewiki/pmwiki.php/LinuxServersCentOS/Cent6VirtMailServer
            >>>>
            >>>>
            >>>>
            >>>> There are modified postfix .cf files. I don't want to just use a
            >>>> modified postfix file, I want to user postconf to do the
            >>>> modifications. And I am not experienced using things like diff to
            >>>> work out what changes were made from the base install files.
            >>>>
            >>>> Can anyone lend some expertise in identifying the mods so I can work
            >>>> this up as postconf commands?
            >>> Why? If you're just going to paste in changes it doesn't matter too
            >>> much if you paste in a pre-made .cf file or if you run a bunch of
            >>> postconf commands.
            >> For the past 3 years I have been running with a setup based on:
            >>
            >> http://www.howtoforge.com/virtual-users-and-domains-with-postfix-courier-mysql-and-squirrelmail-fedora-14-x86_64
            >>
            >>
            >> Here the postfix changes are done via postconf, so I CAN tell what
            >> changes are made and understand what is going on.
            >>
            > # postconf -d
            > shows default settings (builtin defaults).
            > # postconf -n
            > shows "local" settings.
            >
            > that said, some "local" settings may use the same value as the default
            > config, which is mostly useless. on the url you posted, an example is
            > inet_interfaces = all, since this is the default:
            > # postconf -d inet_interfaces
            > inet_interfaces = all
            >
            > so the setting is useless and can be removed from main.cf. same for
            > mydestination, alias_maps...
            >
            >
            > You can chase these with something like:
            >
            > # postconf -n | while read parameter equal value; do
            > default_value=`postconf -d $parameter 2>&1`;
            > if [ "$value" = "$default_value" ]; then
            > echo "NOTICE: Useless setting: $parameter = $value";
            > fi;
            > done

            I made a file with these 6 lines and did a chmod +x and ran it from 'su
            -' and got the following error:

            line 6: syntax error near unexpected token 'done'
            line 6: 'done'

            I really have not written scripts for ~20 years, and even then I
            followed templates. So please help me in getting this script running.
            Thank you.

            >
            > Such settings can be removed from main.cf.
            >
            > (the "2>&1" will avoid "false positives" when a parameter is "unknown"
            > to 'postconf -d'...).
            >
            >
            >
            >>> Better to learn why each line is there, and why. And most
            >>> important, if *you* need it.
            >> Kind of my point. What changes is the author of the tutorial really
            >> making so I can understand why.
            >>
            >>> http://www.postfix.org/documentation.html
            >>> http://www.postfix.org/STANDARD_CONFIGURATION_README.html
            >>> http://www.postfix.org/VIRTUAL_README.html
            >>>
            >>> main.cf parameters and their defaults are documented here:
            >>> http://www.postfix.org/postconf.5.html
            >>> Generally, only parameters that differ from their default should be
            >>> included in your main.cf.
            >> Again, what I want to get to. Understand what changes the author made
            >> to the defaults. Looks like I will first have to learn how to
            >> understand the output of diff.
            >>
            >>
            > do not blindly follow howotos/utorials/etc. better learn from the
            > official documentation. see Noel's postf for a few URLs. more on postfix
            > site.

            A tutorial gives me a starting point, pointed toward my goal. Understand
            the tutorial and then figure out if it is really what I want and what
            else more or less I need to do.

            >
            > you can also consider getting a copy of "the book of postfix".
            >
            >
            >
          • Robert Moskowitz
            At least the problem with running the script. Line 1 should not start with a # I assume that is an artifact of how mouss pasted the script into the message....
            Message 5 of 15 , Dec 22, 2012
            • 0 Attachment
              At least the problem with running the script.

              Line 1 should not start with a #

              I assume that is an artifact of how mouss pasted the script into the
              message....

              thanks

              On 12/23/2012 12:09 AM, Robert Moskowitz wrote:
              > I have now made it past creating my cert, setting up mysql and
              > installing postfixadmin. I have even gotten a 'show columns' of all
              > the tables created in setup for postfixadmin. Next is setting up
              > postfix itself, which comes as the default mailer on Centos 6. So as
              > Centos comes with a main.cf file, I thought to try the script below to
              > get a 'feel' for things as I work out all the things that at least
              > this the tutorial I am starting with 'says' I need to do. First
              > understand then proceed; or some such.
              >
              > But I had problems with the script. See below for this...
              >
              > On 12/14/2012 05:01 PM, mouss wrote:
              >> Le 14/12/2012 01:55, Robert Moskowitz a écrit :
              >>> On 12/13/2012 05:47 PM, Noel Jones wrote:
              >>>> On 12/13/2012 4:17 PM, Robert Moskowitz wrote:
              >>>>> In the totorial:
              >>>>>
              >>>>> http://www.campworld.net/thewiki/pmwiki.php/LinuxServersCentOS/Cent6VirtMailServer
              >>>>>
              >>>>>
              >>>>>
              >>>>>
              >>>>> There are modified postfix .cf files. I don't want to just use a
              >>>>> modified postfix file, I want to user postconf to do the
              >>>>> modifications. And I am not experienced using things like diff to
              >>>>> work out what changes were made from the base install files.
              >>>>>
              >>>>> Can anyone lend some expertise in identifying the mods so I can work
              >>>>> this up as postconf commands?
              >>>> Why? If you're just going to paste in changes it doesn't matter too
              >>>> much if you paste in a pre-made .cf file or if you run a bunch of
              >>>> postconf commands.
              >>> For the past 3 years I have been running with a setup based on:
              >>>
              >>> http://www.howtoforge.com/virtual-users-and-domains-with-postfix-courier-mysql-and-squirrelmail-fedora-14-x86_64
              >>>
              >>>
              >>>
              >>> Here the postfix changes are done via postconf, so I CAN tell what
              >>> changes are made and understand what is going on.
              >>>
              >> # postconf -d
              >> shows default settings (builtin defaults).
              >> # postconf -n
              >> shows "local" settings.
              >>
              >> that said, some "local" settings may use the same value as the default
              >> config, which is mostly useless. on the url you posted, an example is
              >> inet_interfaces = all, since this is the default:
              >> # postconf -d inet_interfaces
              >> inet_interfaces = all
              >>
              >> so the setting is useless and can be removed from main.cf. same for
              >> mydestination, alias_maps...
              >>
              >>
              >> You can chase these with something like:
              >>
              >> # postconf -n | while read parameter equal value; do
              >> default_value=`postconf -d $parameter 2>&1`;
              >> if [ "$value" = "$default_value" ]; then
              >> echo "NOTICE: Useless setting: $parameter = $value";
              >> fi;
              >> done
              >
              > I made a file with these 6 lines and did a chmod +x and ran it from
              > 'su -' and got the following error:
              >
              > line 6: syntax error near unexpected token 'done'
              > line 6: 'done'
              >
              > I really have not written scripts for ~20 years, and even then I
              > followed templates. So please help me in getting this script
              > running. Thank you.
              >
              >>
              >> Such settings can be removed from main.cf.
              >>
              >> (the "2>&1" will avoid "false positives" when a parameter is "unknown"
              >> to 'postconf -d'...).
              >>
              >>
              >>
              >>>> Better to learn why each line is there, and why. And most
              >>>> important, if *you* need it.
              >>> Kind of my point. What changes is the author of the tutorial really
              >>> making so I can understand why.
              >>>
              >>>> http://www.postfix.org/documentation.html
              >>>> http://www.postfix.org/STANDARD_CONFIGURATION_README.html
              >>>> http://www.postfix.org/VIRTUAL_README.html
              >>>>
              >>>> main.cf parameters and their defaults are documented here:
              >>>> http://www.postfix.org/postconf.5.html
              >>>> Generally, only parameters that differ from their default should be
              >>>> included in your main.cf.
              >>> Again, what I want to get to. Understand what changes the author made
              >>> to the defaults. Looks like I will first have to learn how to
              >>> understand the output of diff.
              >>>
              >>>
              >> do not blindly follow howotos/utorials/etc. better learn from the
              >> official documentation. see Noel's postf for a few URLs. more on postfix
              >> site.
              >
              > A tutorial gives me a starting point, pointed toward my goal.
              > Understand the tutorial and then figure out if it is really what I
              > want and what else more or less I need to do.
              >
              >>
              >> you can also consider getting a copy of "the book of postfix".
              >>
              >>
              >>
              >
              >
            • Robert Moskowitz
              ... I have been running this against the base Centos 6 install that has a main.cf with lots of comments and a few parameter lines. postconf -n shows about 20
              Message 6 of 15 , Dec 23, 2012
              • 0 Attachment
                On 12/14/2012 05:01 PM, mouss wrote:

                > # postconf -d
                > shows default settings (builtin defaults).
                > # postconf -n
                > shows "local" settings.
                >
                > that said, some "local" settings may use the same value as the default
                > config, which is mostly useless. on the url you posted, an example is
                > inet_interfaces = all, since this is the default:
                > # postconf -d inet_interfaces
                > inet_interfaces = all
                >
                > so the setting is useless and can be removed from main.cf. same for
                > mydestination, alias_maps...
                >
                >
                > You can chase these with something like:
                >
                > # postconf -n | while read parameter equal value; do
                > default_value=`postconf -d $parameter 2>&1`;
                > if [ "$value" = "$default_value" ]; then
                > echo "NOTICE: Useless setting: $parameter = $value";
                > fi;
                > done
                >
                > Such settings can be removed from main.cf.
                >
                > (the "2>&1" will avoid "false positives" when a parameter is "unknown"
                > to 'postconf -d'...).

                I have been running this against the base Centos 6 install that has a
                main.cf with lots of comments and a few parameter lines.

                postconf -n shows about 20 parameters, and when I compare these against
                postconf -d only 9 of them are different.

                parameters like mailq_path is now /usr/bin/mailq.postfix and the default
                is /usr/bin/mailq

                I look at the script and I am not able to tell what is wrong; can you
                help me get it right? I think this is a real useful tool.
              • Noel Jones
                ... That sounds about right. A basic postfix install needs only a few non-default settings. ... sounds reasonable. ... It s unclear what problem you are
                Message 7 of 15 , Dec 23, 2012
                • 0 Attachment
                  On 12/23/2012 7:17 AM, Robert Moskowitz wrote:
                  >> You can chase these with something like:
                  >>
                  >> # postconf -n | while read parameter equal value; do
                  >> default_value=`postconf -d $parameter 2>&1`;
                  >> if [ "$value" = "$default_value" ]; then
                  >> echo "NOTICE: Useless setting: $parameter = $value";
                  >> fi;
                  >> done
                  >>
                  >
                  > I have been running this against the base Centos 6 install that has
                  > a main.cf with lots of comments and a few parameter lines.
                  >
                  > postconf -n shows about 20 parameters, and when I compare these
                  > against postconf -d only 9 of them are different.

                  That sounds about right. A basic postfix install needs only a few
                  non-default settings.


                  > parameters like mailq_path is now /usr/bin/mailq.postfix and the
                  > default is /usr/bin/mailq

                  sounds reasonable.

                  > I look at the script and I am not able to tell what is wrong; can
                  > you help me get it right? I think this is a real useful tool.

                  It's unclear what problem you are having. Please explain.




                  -- Noel Jones
                • Robert Moskowitz
                  ... When I run the script shown above, there is no output. Yet I know there are lines in the main.cf that differ from the defaults. That is there are 9 lines
                  Message 8 of 15 , Dec 23, 2012
                  • 0 Attachment
                    On 12/23/2012 09:20 AM, Noel Jones wrote:
                    > On 12/23/2012 7:17 AM, Robert Moskowitz wrote:
                    >>> You can chase these with something like:
                    >>>
                    >>> # postconf -n | while read parameter equal value; do
                    >>> default_value=`postconf -d $parameter 2>&1`;
                    >>> if [ "$value" = "$default_value" ]; then
                    >>> echo "NOTICE: Useless setting: $parameter = $value";
                    >>> fi;
                    >>> done
                    >>>
                    >> I have been running this against the base Centos 6 install that has
                    >> a main.cf with lots of comments and a few parameter lines.
                    >>
                    >> postconf -n shows about 20 parameters, and when I compare these
                    >> against postconf -d only 9 of them are different.
                    > That sounds about right. A basic postfix install needs only a few
                    > non-default settings.
                    >
                    >
                    >> parameters like mailq_path is now /usr/bin/mailq.postfix and the
                    >> default is /usr/bin/mailq
                    > sounds reasonable.
                    >
                    >> I look at the script and I am not able to tell what is wrong; can
                    >> you help me get it right? I think this is a real useful tool.
                    > It's unclear what problem you are having. Please explain.

                    When I run the script shown above, there is no output. Yet I know there
                    are lines in the main.cf that differ from the defaults. That is there
                    are 9 lines shown in the -n option that are different from shown in the
                    -d option. I would think that the above script should have printed
                    those lines.

                    I ran the script both as me and as root.
                  • Noel Jones
                    ... Postconf commands should be run as root. Google for the postfinger tool. -- Noel Jones
                    Message 9 of 15 , Dec 23, 2012
                    • 0 Attachment
                      On 12/23/2012 8:28 AM, Robert Moskowitz wrote:
                      >
                      > On 12/23/2012 09:20 AM, Noel Jones wrote:
                      >> On 12/23/2012 7:17 AM, Robert Moskowitz wrote:
                      >>>> You can chase these with something like:
                      >>>>
                      >>>> # postconf -n | while read parameter equal value; do
                      >>>> default_value=`postconf -d $parameter 2>&1`;
                      >>>> if [ "$value" = "$default_value" ]; then
                      >>>> echo "NOTICE: Useless setting: $parameter = $value";
                      >>>> fi;
                      >>>> done
                      >>>>
                      >>> I have been running this against the base Centos 6 install that has
                      >>> a main.cf with lots of comments and a few parameter lines.
                      >>>
                      >>> postconf -n shows about 20 parameters, and when I compare these
                      >>> against postconf -d only 9 of them are different.
                      >> That sounds about right. A basic postfix install needs only a few
                      >> non-default settings.
                      >>
                      >>
                      >>> parameters like mailq_path is now /usr/bin/mailq.postfix and the
                      >>> default is /usr/bin/mailq
                      >> sounds reasonable.
                      >>
                      >>> I look at the script and I am not able to tell what is wrong; can
                      >>> you help me get it right? I think this is a real useful tool.
                      >> It's unclear what problem you are having. Please explain.
                      >
                      > When I run the script shown above, there is no output. Yet I know
                      > there are lines in the main.cf that differ from the defaults. That
                      > is there are 9 lines shown in the -n option that are different from
                      > shown in the -d option. I would think that the above script should
                      > have printed those lines.
                      >
                      > I ran the script both as me and as root.
                      >


                      Postconf commands should be run as root. Google for the postfinger
                      tool.


                      -- Noel Jones
                    • mouss
                      ... No. the only output of the script is the one in the echo line: it only prints anything if the value is the same in main.cf and in `postconf -d`. To see
                      Message 10 of 15 , Dec 24, 2012
                      • 0 Attachment
                        Le 23/12/2012 15:28, Robert Moskowitz a écrit :
                        >
                        > On 12/23/2012 09:20 AM, Noel Jones wrote:
                        >> On 12/23/2012 7:17 AM, Robert Moskowitz wrote:
                        >>>> You can chase these with something like:
                        >>>>
                        >>>> # postconf -n | while read parameter equal value; do
                        >>>> default_value=`postconf -d $parameter 2>&1`;
                        >>>> if [ "$value" = "$default_value" ]; then
                        >>>> echo "NOTICE: Useless setting: $parameter = $value";
                        >>>> fi;
                        >>>> done
                        >>>>
                        >>> I have been running this against the base Centos 6 install that has
                        >>> a main.cf with lots of comments and a few parameter lines.
                        >>>
                        >>> postconf -n shows about 20 parameters, and when I compare these
                        >>> against postconf -d only 9 of them are different.
                        >> That sounds about right. A basic postfix install needs only a few
                        >> non-default settings.
                        >>
                        >>
                        >>> parameters like mailq_path is now /usr/bin/mailq.postfix and the
                        >>> default is /usr/bin/mailq
                        >> sounds reasonable.
                        >>
                        >>> I look at the script and I am not able to tell what is wrong; can
                        >>> you help me get it right? I think this is a real useful tool.
                        >> It's unclear what problem you are having. Please explain.
                        >
                        > When I run the script shown above, there is no output. Yet I know
                        > there are lines in the main.cf that differ from the defaults.

                        > That is there are 9 lines shown in the -n option that are different
                        > from shown in the -d option. I would think that the above script
                        > should have printed those lines.

                        No. the only output of the script is the one in the 'echo' line: it only
                        prints anything if the value is the same in main.cf and in `postconf
                        -d`. To see local settings, use 'postconf -n'. that's its job.

                        If you really insist, here is a modified version of the script:

                        postconf -n | while read parameter equal value; do
                        default_value=`postconf -d $parameter 2>&1`;
                        if [ "$value" = "$default_value" ]; then
                        echo "NOTICE: Useless setting: $parameter = $value";
                        else
                        echo "$parameter = $value"
                        fi;
                        done

                        but this is too complex for the task.

                        >
                        > I ran the script both as me and as root.
                        >
                      • Robert Moskowitz
                        ... I have since done this by hand , but I cannot get any output from this script! Have you tried it? Is it something else to do with my Centos 6.3
                        Message 11 of 15 , Dec 24, 2012
                        • 0 Attachment
                          On 12/24/2012 05:26 AM, mouss wrote:
                          > Le 23/12/2012 15:28, Robert Moskowitz a écrit :
                          >> On 12/23/2012 09:20 AM, Noel Jones wrote:
                          >>> On 12/23/2012 7:17 AM, Robert Moskowitz wrote:
                          >>>>> You can chase these with something like:
                          >>>>>
                          >>>>> # postconf -n | while read parameter equal value; do
                          >>>>> default_value=`postconf -d $parameter 2>&1`;
                          >>>>> if [ "$value" = "$default_value" ]; then
                          >>>>> echo "NOTICE: Useless setting: $parameter = $value";
                          >>>>> fi;
                          >>>>> done
                          >>>>>
                          >>>> I have been running this against the base Centos 6 install that has
                          >>>> a main.cf with lots of comments and a few parameter lines.
                          >>>>
                          >>>> postconf -n shows about 20 parameters, and when I compare these
                          >>>> against postconf -d only 9 of them are different.
                          >>> That sounds about right. A basic postfix install needs only a few
                          >>> non-default settings.
                          >>>
                          >>>
                          >>>> parameters like mailq_path is now /usr/bin/mailq.postfix and the
                          >>>> default is /usr/bin/mailq
                          >>> sounds reasonable.
                          >>>
                          >>>> I look at the script and I am not able to tell what is wrong; can
                          >>>> you help me get it right? I think this is a real useful tool.
                          >>> It's unclear what problem you are having. Please explain.
                          >> When I run the script shown above, there is no output. Yet I know
                          >> there are lines in the main.cf that differ from the defaults.
                          >> That is there are 9 lines shown in the -n option that are different
                          >> from shown in the -d option. I would think that the above script
                          >> should have printed those lines.
                          > No. the only output of the script is the one in the 'echo' line: it only
                          > prints anything if the value is the same in main.cf and in `postconf
                          > -d`. To see local settings, use 'postconf -n'. that's its job.
                          >
                          > If you really insist, here is a modified version of the script:
                          >
                          > postconf -n | while read parameter equal value; do
                          > default_value=`postconf -d $parameter 2>&1`;
                          > if [ "$value" = "$default_value" ]; then
                          > echo "NOTICE: Useless setting: $parameter = $value";
                          > else
                          > echo "$parameter = $value"
                          > fi;
                          > done
                          >
                          > but this is too complex for the task.

                          I have since done this 'by hand', but I cannot get any output from this
                          script! Have you tried it? Is it something else to do with my Centos
                          6.3 environment? No output at all!

                          Thank you for your efforts.
                        • Robert Moskowitz
                          ... Correction: This changed script prints ALL entries from postconf -n on the else branch. parameters that I now are Useless are not being listed as such.
                          Message 12 of 15 , Dec 24, 2012
                          • 0 Attachment
                            On 12/24/2012 08:24 AM, Robert Moskowitz wrote:
                            >
                            > On 12/24/2012 05:26 AM, mouss wrote:
                            >> Le 23/12/2012 15:28, Robert Moskowitz a écrit :
                            >>> On 12/23/2012 09:20 AM, Noel Jones wrote:
                            >>>> On 12/23/2012 7:17 AM, Robert Moskowitz wrote:
                            >>>>>> You can chase these with something like:
                            >>>>>>
                            >>>>>> # postconf -n | while read parameter equal value; do
                            >>>>>> default_value=`postconf -d $parameter 2>&1`;
                            >>>>>> if [ "$value" = "$default_value" ]; then
                            >>>>>> echo "NOTICE: Useless setting: $parameter = $value";
                            >>>>>> fi;
                            >>>>>> done
                            >>>>>>
                            >>>>> I have been running this against the base Centos 6 install that has
                            >>>>> a main.cf with lots of comments and a few parameter lines.
                            >>>>>
                            >>>>> postconf -n shows about 20 parameters, and when I compare these
                            >>>>> against postconf -d only 9 of them are different.
                            >>>> That sounds about right. A basic postfix install needs only a few
                            >>>> non-default settings.
                            >>>>
                            >>>>
                            >>>>> parameters like mailq_path is now /usr/bin/mailq.postfix and the
                            >>>>> default is /usr/bin/mailq
                            >>>> sounds reasonable.
                            >>>>
                            >>>>> I look at the script and I am not able to tell what is wrong; can
                            >>>>> you help me get it right? I think this is a real useful tool.
                            >>>> It's unclear what problem you are having. Please explain.
                            >>> When I run the script shown above, there is no output. Yet I know
                            >>> there are lines in the main.cf that differ from the defaults.
                            >>> That is there are 9 lines shown in the -n option that are different
                            >>> from shown in the -d option. I would think that the above script
                            >>> should have printed those lines.
                            >> No. the only output of the script is the one in the 'echo' line: it only
                            >> prints anything if the value is the same in main.cf and in `postconf
                            >> -d`. To see local settings, use 'postconf -n'. that's its job.
                            >>
                            >> If you really insist, here is a modified version of the script:
                            >>
                            >> postconf -n | while read parameter equal value; do
                            >> default_value=`postconf -d $parameter 2>&1`;
                            >> if [ "$value" = "$default_value" ]; then
                            >> echo "NOTICE: Useless setting: $parameter = $value";
                            >> else
                            >> echo "$parameter = $value"
                            >> fi;
                            >> done
                            >>
                            >> but this is too complex for the task.
                            >
                            > I have since done this 'by hand', but I cannot get any output from
                            > this script! Have you tried it? Is it something else to do with my
                            > Centos 6.3 environment? No output at all!

                            Correction:

                            This changed script prints ALL entries from postconf -n on the else
                            branch. parameters that I now are 'Useless' are not being listed as such.

                            hmmm. I wonder about something that Wietse said about upgrades in
                            postconf. I am running postfix 2.6.6, and that variable in the postconf
                            -d expression might be expanded in my version?


                            >
                            > Thank you for your efforts.
                            >
                            >
                            >
                          • Robert Moskowitz
                            I added a few echos, guessed at what was happening and below you will see a nice little script which shows useless parameters in main.cf ... postconf -n |
                            Message 13 of 15 , Dec 24, 2012
                            • 0 Attachment
                              I added a few echos, guessed at what was happening and below you will
                              see a nice little script which shows "useless" parameters in main.cf

                              On 12/24/2012 05:26 AM, mouss wrote:
                              > Le 23/12/2012 15:28, Robert Moskowitz a écrit :
                              >> On 12/23/2012 09:20 AM, Noel Jones wrote:
                              >>> On 12/23/2012 7:17 AM, Robert Moskowitz wrote:
                              >>>>> You can chase these with something like:
                              >>>>>
                              >>>>> # postconf -n | while read parameter equal value; do
                              >>>>> default_value=`postconf -d $parameter 2>&1`;
                              >>>>> if [ "$value" = "$default_value" ]; then
                              >>>>> echo "NOTICE: Useless setting: $parameter = $value";
                              >>>>> fi;
                              >>>>> done
                              >>>>>
                              >>>> I have been running this against the base Centos 6 install that has
                              >>>> a main.cf with lots of comments and a few parameter lines.
                              >>>>
                              >>>> postconf -n shows about 20 parameters, and when I compare these
                              >>>> against postconf -d only 9 of them are different.
                              >>> That sounds about right. A basic postfix install needs only a few
                              >>> non-default settings.
                              >>>
                              >>>
                              >>>> parameters like mailq_path is now /usr/bin/mailq.postfix and the
                              >>>> default is /usr/bin/mailq
                              >>> sounds reasonable.
                              >>>
                              >>>> I look at the script and I am not able to tell what is wrong; can
                              >>>> you help me get it right? I think this is a real useful tool.
                              >>> It's unclear what problem you are having. Please explain.
                              >> When I run the script shown above, there is no output. Yet I know
                              >> there are lines in the main.cf that differ from the defaults.
                              >> That is there are 9 lines shown in the -n option that are different
                              >> from shown in the -d option. I would think that the above script
                              >> should have printed those lines.
                              > No. the only output of the script is the one in the 'echo' line: it only
                              > prints anything if the value is the same in main.cf and in `postconf
                              > -d`. To see local settings, use 'postconf -n'. that's its job.
                              >
                              > If you really insist, here is a modified version of the script:
                              >
                              > postconf -n | while read parameter equal value; do
                              > default_value=`postconf -d $parameter 2>&1`;
                              > if [ "$value" = "$default_value" ]; then
                              > echo "NOTICE: Useless setting: $parameter = $value";
                              > else
                              > echo "$parameter = $value"
                              > fi;
                              > done

                              postconf -n | while read parameter equal value; do
                              default_value=`postconf -d $parameter 2>&1`;
                              if [ "$parameter = $value" = "$default_value" ]; then
                              echo "NOTICE: Useless setting: $parameter = $value";
                              fi;
                              done


                              But

                              postconf -n | while read parameter equal value; do
                              default_value=`postconf -d $parameter`;
                              if [ "$parameter = $value" = "$default_value" ]; then
                              echo "NOTICE: Useless setting: $parameter = $value";
                              fi;
                              done


                              also works. But this gets down to your comment that the "2>&1" avoids
                              false postitives. I don't know how to include that in the if statement.
                            Your message has been successfully submitted and would be delivered to recipients shortly.