Restoring TGZ From Server A breaks postfix main.cf on server B

Hello,

I have a very weird issue, nightly I restore a TGZ from Server A to Server B for backup purposes. This seems to be corrupting the Postfix main.cf file. I have tracked it down to happening immediatley after restoring the TGZ, which I restore via the CLI via the following:

/usr/bin/php /var/lib/asterisk/bin/restore.php --restore=/data/backups/fpbx/voip1.tgz --items=all

I posted a Question on Unix Linux, but now I realized its more of a FreePBX thing.

Here is the main.cf and how I installed it:

cat << 'EOL' >/etc/postfix/main.cf
#
# PostFix Config

##Modify Below [HOSTNAME]
myhostname = [HOSTNAME]

smtpd_banner = $myhostname ESMTP $mail_name
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
canonical_maps = hash:/etc/postfix/canonical
relayhost = [smtp.hmc1.comcast.net]:587
mydomain = domain.com
mydestination = $myhostname $myhostname.$mydomain localhost.$mydomain localhost
sender_canonical_maps = static:[email protected]$mydomain
EOL

Here is what my main.cf looks like after it gets randomly messed up, this is consistently how it looks as well:

#
# PostFix Config

##Modify Below [HOSTNAME]


smtpd_banner = $myhostname ESMTP $mail_name
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache





mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

canonical_maps = hash:/etc/postfix/canonical


mydestination = $myhostname $myhostname.$mydomain localhost.$mydomain localhost
sender_canonical_maps = static:[email protected]$mydomain

Here is the tail end of the log file from overnight: (This happened over night while I was gone)

Apr  4 12:30:03 voip2 postfix/master[21006]: daemon started -- version 2.6.6, configuration /etc/postfix
Apr  4 12:59:25 voip2 postfix/postfix-script[22506]: stopping the Postfix mail system
Apr  4 12:59:25 voip2 postfix/master[21006]: terminating on signal 15
Apr  4 13:00:57 voip2 postfix/postfix-script[2374]: warning: not owned by root: /etc/postfix
Apr  4 13:00:57 voip2 postfix/postfix-script[2384]: warning: not owned by root: /etc/postfix/access
Apr  4 13:00:57 voip2 postfix/postfix-script[2385]: warning: not owned by root: /etc/postfix/canonical
Apr  4 13:00:57 voip2 postfix/postfix-script[2386]: warning: not owned by root: /etc/postfix/canonical.db
Apr  4 13:00:57 voip2 postfix/postfix-script[2387]: warning: not owned by root: /etc/postfix/generic
Apr  4 13:00:57 voip2 postfix/postfix-script[2388]: warning: not owned by root: /etc/postfix/header_checks
Apr  4 13:00:57 voip2 postfix/postfix-script[2389]: warning: not owned by root: /etc/postfix/main.cf
Apr  4 13:00:57 voip2 postfix/postfix-script[2390]: warning: not owned by root: /etc/postfix/master.cf
Apr  4 13:00:57 voip2 postfix/postfix-script[2391]: warning: not owned by root: /etc/postfix/relocated
Apr  4 13:00:57 voip2 postfix/postfix-script[2392]: warning: not owned by root: /etc/postfix/sasl
Apr  4 13:00:57 voip2 postfix/postfix-script[2393]: warning: not owned by root: /etc/postfix/sasl/sasl_passwd
Apr  4 13:00:57 voip2 postfix/postfix-script[2394]: warning: not owned by root: /etc/postfix/sasl/sasl_passwd.db
Apr  4 13:00:57 voip2 postfix/postfix-script[2395]: warning: not owned by root: /etc/postfix/transport
Apr  4 13:00:57 voip2 postfix/postfix-script[2396]: warning: not owned by root: /etc/postfix/virtual
Apr  4 13:00:57 voip2 postfix/postfix-script[2411]: starting the Postfix mail system
Apr  4 13:00:57 voip2 postfix/master[2412]: daemon started -- version 2.6.6, configuration /etc/postfix
Apr  4 13:21:15 voip2 postfix/postfix-script[8412]: refreshing the Postfix mail system
Apr  4 13:21:15 voip2 postfix/master[2412]: reload -- version 2.6.6, configuration /etc/postfix
Apr  5 00:00:01 voip2 postfix/sendmail[6683]: fatal: open /etc/postfix/main.cf: Permission denied
Apr  5 00:01:01 voip2 postfix/sendmail[6737]: fatal: open /etc/postfix/main.cf: Permission denied
Apr  5 00:06:24 voip2 postfix/sendmail[7139]: fatal: open /etc/postfix/main.cf: Permission denied
Apr  5 05:31:28 voip2 postfix/postfix-script[23065]: refreshing the Postfix mail system
Apr  5 05:31:28 voip2 postfix/master[2412]: reload -- version 2.6.6, configuration /etc/postfix
[[email protected] log]#