• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Where is the /etc/mail from?

goldenfire

Member

Thanks: 2
Messages: 62

#1
My /etc/mail/Makefile did not work well. After some effort to search for the reason, I decide to reinstall sendmail with ports.
I found the /etc/mail is still the older one.
So even after reinstall, I still face the same problem. /etc/mail/Makefile still does not work.
Then I made a silly decision that I removed all the /etc/mail and reinstall sendmail again.
OK, this time I did not get the /etc/mail/Makefile at all.
Could someone tell me where is this Makefile from?

Code:
ns# pwd
/etc/mail
ns# make
"Makefile", line 80: warning: duplicate script for target "ns.goldenfire.com" ignored
make: don't know how to make ns.goldenfire. Stop
Makefile version
# $FreeBSD: src/etc/mail/Makefile,v 1.36.30.1.2.1 2009/10/25 01:10:29 kensmith Exp $
 

goldenfire

Member

Thanks: 2
Messages: 62

#2
Code:
ns# cat Makefile
#
# $FreeBSD: src/etc/mail/Makefile,v 1.36.30.1.2.1 2009/10/25 01:10:29 kensmith Exp $
#
# This Makefile provides an easy way to generate the configuration
# file and database maps for the sendmail(8) daemon.
#
# The user-driven targets are:
#
# all     - Build cf, maps and aliases
# cf      - Build the .cf file from .mc file
# maps    - Build the feature maps
# aliases - Build the sendmail aliases
# install - Install the .cf file as /etc/mail/sendmail.cf
#
# For acting on both the MTA daemon and MSP queue running daemon:
# start        - Start both the sendmail MTA daemon and MSP queue running
#                daemon with the flags defined in /etc/defaults/rc.conf or
#                /etc/rc.conf
# stop         - Stop both the sendmail MTA daemon and MSP queue running
#                daemon
# restart      - Restart both the sendmail MTA daemon and MSP queue running
#                daemon
#
# For acting on just the MTA daemon:
# start-mta    - Start the sendmail MTA daemon with the flags defined in
#                /etc/defaults/rc.conf or /etc/rc.conf
# stop-mta     - Stop the sendmail MTA daemon
# restart-mta  - Restart the sendmail MTA daemon
#
# For acting on just the MSP queue running daemon:
# start-mspq   - Start the sendmail MSP queue running daemon with the
#                flags defined in /etc/defaults/rc.conf or /etc/rc.conf
# stop-mspq    - Stop the sendmail MSP queue running daemon
# restart-mspq - Restart the sendmail MSP queue running daemon
#
# Calling `make' will generate the updated versions when either the
# aliases or one of the map files were changed.
#
# A `make install` is only necessary after modifying the .mc file. In
# this case one would normally also call `make restart' to allow the
# running sendmail to pick up the changes as well.
#
# ------------------------------------------------------------------------
# This Makefile uses `<HOSTNAME>.mc' as the default MTA .mc file.  This
# can be changed by defining SENDMAIL_MC in /etc/make.conf, e.g.:
#
#       SENDMAIL_MC=/etc/mail/myconfig.mc
#
# If '<HOSTNAME>.mc' does not exist, it is created using 'freebsd.mc'
# as a template.
#
# It also uses '<HOSTNAME>.submit.mc' as the default mail submission .mc
# file.  This can be changed by defining SENDMAIL_SUBMIT_MC in
# /etc/make.conf, e.g.:
#
#       SENDMAIL_SUBMIT_MC=/etc/mail/mysubmit.mc
#
# If '<HOSTNAME>.submit.mc' does not exist, it is created using
# 'freebsd.submit.mc' as a template.
# ------------------------------------------------------------------------
#
# The Makefile knows about the following maps:
# access, bitdomain, domaintable, genericstable, mailertable, userdb,
# uucpdomain, virtusertable
#

.ifndef SENDMAIL_MC
SENDMAIL_MC!=           hostname
SENDMAIL_MC:=           ${SENDMAIL_MC}.mc

${SENDMAIL_MC}:
        cp freebsd.mc ${SENDMAIL_MC}
.endif

.ifndef SENDMAIL_SUBMIT_MC
SENDMAIL_SUBMIT_MC!=    hostname
SENDMAIL_SUBMIT_MC:=    ${SENDMAIL_SUBMIT_MC}.submit.mc

${SENDMAIL_SUBMIT_MC}:
        cp freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
.endif

INSTALL_CF=             ${SENDMAIL_MC:R}.cf

.ifndef SENDMAIL_SET_USER_ID
INSTALL_SUBMIT_CF=      ${SENDMAIL_SUBMIT_MC:R}.cf
.endif

SENDMAIL_ALIASES?=      /etc/mail/aliases

#
# This is the directory where the sendmail configuration files are
# located.
#
.if exists(/usr/share/sendmail/cf)
SENDMAIL_CF_DIR?=       /usr/share/sendmail/cf
.elif exists(/usr/src/contrib/sendmail/cf)
SENDMAIL_CF_DIR?=       /usr/src/contrib/sendmail/cf
.endif

#
# The sendmail startup script
#
SENDMAIL_START_SCRIPT?= /etc/rc.sendmail

#
# Some useful programs we need.
#
SENDMAIL?=              /usr/sbin/sendmail
MAKEMAP?=               /usr/sbin/makemap
M4?=                    /usr/bin/m4

# Permissions for generated maps
SENDMAIL_MAP_PERMS?=    0640

# Set a reasonable default
.MAIN: all

#
# ------------------------------------------------------------------------
#
# The Makefile picks up the list of files from SENDMAIL_MAP_SRC and
# stores the matching .db filenames in SENDMAIL_MAP_OBJ if the file
# exists in the current directory.  SENDMAIL_MAP_TYPE is the database
# type to use when calling makemap.
#
SENDMAIL_MAP_SRC+=      mailertable domaintable bitdomain uucpdomain \
                        genericstable virtusertable access
SENDMAIL_MAP_OBJ=
SENDMAIL_MAP_TYPE?=     hash

.for _f in ${SENDMAIL_MAP_SRC} userdb
.if exists(${_f})
SENDMAIL_MAP_OBJ+=      ${_f}.db
.endif
.endfor

#
# The makemap command is used to generate a hashed map from the textfile.
#
.for _f in ${SENDMAIL_MAP_SRC}
.if (exists(${_f}.sample) && !exists(${_f}))
${_f}: ${_f}.sample
        sed -e 's/^/#/' < ${.OODATE} > ${.TARGET}
.endif

${_f}.db: ${_f}
        ${MAKEMAP} ${SENDMAIL_MAP_TYPE} ${.TARGET} < ${.OODATE}
        chmod ${SENDMAIL_MAP_PERMS} ${.TARGET}
.endfor

userdb.db: userdb
        ${MAKEMAP} btree ${.TARGET} < ${.OODATE}
        chmod ${SENDMAIL_MAP_PERMS} ${.TARGET}


#
# The .cf file needs to be recreated if the templates were modified.
#
M4FILES!=       find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print

#
# M4(1) is used to generate the .cf file from the .mc file.
#
.SUFFIXES: .cf .mc

.mc.cf: ${M4FILES}
        ${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ ${SENDMAIL_M4_FLAGS} \
            ${SENDMAIL_CF_DIR}/m4/cf.m4 ${@:R}.mc > ${.TARGET}

#
# Aliases are handled separately since they normally reside in /etc
# and can be rebuild without the help of makemap.
#
.for _f in ${SENDMAIL_ALIASES}
${_f}.db: ${_f}
        ${SENDMAIL} -bi -OAliasFile=${.ALLSRC}
        chmod ${SENDMAIL_MAP_PERMS} ${.TARGET}
.endfor

#
# ------------------------------------------------------------------------
#

all: cf maps aliases

clean:

depend:

cf: ${INSTALL_CF} ${INSTALL_SUBMIT_CF}

.ifdef SENDMAIL_SET_USER_ID
install: install-cf
.else
install: install-cf install-submit-cf
.endif

install-cf: ${INSTALL_CF}
.if ${INSTALL_CF} != /etc/mail/sendmail.cf
        ${INSTALL} -m ${SHAREMODE} ${INSTALL_CF} /etc/mail/sendmail.cf
.endif


install-submit-cf: ${INSTALL_SUBMIT_CF}
.ifdef SENDMAIL_SET_USER_ID
        @echo ">>> ERROR: You should not create a submit.cf file if you are using a"
        @echo "           set-user-ID sendmail binary (SENDMAIL_SET_USER_ID is set"
        @echo "           in make.conf)."
        @false
.else
.if ${INSTALL_SUBMIT_CF} != /etc/mail/submit.cf
        ${INSTALL} -m ${SHAREMODE} ${INSTALL_SUBMIT_CF} /etc/mail/submit.cf
.endif
.endif

aliases: ${SENDMAIL_ALIASES:%=%.db}

maps: ${SENDMAIL_MAP_OBJ}

start start-mta start-mspq:
        @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
                echo -n 'Starting:'; \
                sh ${SENDMAIL_START_SCRIPT} $@; \
                echo '.'; \
        fi

stop stop-mta stop-mspq:
        @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
                echo -n 'Stopping:'; \
                sh ${SENDMAIL_START_SCRIPT} $@; \
                echo '.'; \
        fi

restart restart-mta restart-mspq:
        @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
                echo -n 'Restarting:'; \
                sh ${SENDMAIL_START_SCRIPT} $@; \
                echo '.'; \
        fi

# User defined targets
.if exists(Makefile.local)
.include "Makefile.local"
.endif

# For the definition of $SHAREMODE
.include <bsd.own.mk>
ns#
 

inurneck

Active Member

Thanks: 4
Messages: 142

#3
Code:
[158]daemon[/usr/src/etc/mail]: ls
Makefile              aliases               virtusertable.sample
README                mailer.conf
access.sample         mailertable.sample
[159]daemon[/usr/src/etc/mail]:
Type make install in that directory. You have to have the sources installed and for your current version. Don't run to ports versions for stuff already on freebsd just because you can't get it to work you should fix the problem where it lies. Unless you have a real reason to. (I like the ports version of ssh2 better.)

Thats how you create more problems, your not learning by running and also end up with security and other related issues with out of date daemons not to mention one in the system not even being used and two sets of configuration files.

Use the ones that are already in freebsd anyway and just keep freebsd up to date and your all good.

Occasionally i'll even go into a src folder (within reason) and install a daemon (sendmail) instead of building world.

For example if i dont have a lot of time but i know sendmail was just updated because of a vulnerability ill go right in its src folder (after updating my sources of course or this is useless and type make install and restart the service.

Make sure your in i386 only if your computer architecture is i386 and make sure your in that folder and not another one before you make install. you could break your install if you do something wrong here know what your doing. If you think your in mail but just in /usr/src/etc and type make install its going to overwrite everything in etc and probably render it unbootable.
 

goldenfire

Member

Thanks: 2
Messages: 62

#4
Thank you very much.
I tried it but it looks not well.

Code:
ns# pwd
/usr/src/etc/mail
ns# make install
"Makefile", line 80: warning: duplicate script for target "ns.goldenfire.com" ignored
make: don't know how to make ns.goldenfire. Stop
ns# hostname
ns.goldenfire.com
ns#


inurneck said:
[158]daemon[/usr/src/etc/mail]: ls
Makefile aliases virtusertable.sample
README mailer.conf
access.sample mailertable.sample
[159]daemon[/usr/src/etc/mail]:

Type make install in that directory. You have to have the sources installed and for your current version. Don't run to ports versions for stuff already on freebsd just because you can't get it to work you should fix the problem where it lies. Unless you have a real reason to. (I like the ports version of ssh2 better.)

Thats how you create more problems, your not learning by running and also end up with security and other related issues with out of date daemons not to mention one in the system not even being used and two sets of configuration files.

Use the ones that are already in freebsd anyway and just keep freebsd up to date and your all good.

Occasionally i'll even go into a src folder (within reason) and install a daemon (sendmail) instead of building world.

For example if i dont have a lot of time but i know sendmail was just updated because of a vulnerability ill go right in its src folder (after updating my sources of course or this is useless and type make install and restart the service.

Make sure your in i386 only if your computer architecture is i386 and make sure your in that folder and not another one before you make install. you could break your install if you do something wrong here know what your doing. If you think your in mail but just in /usr/src/etc and type make install its going to overwrite everything in etc and probably render it unbootable.
 

inurneck

Active Member

Thanks: 4
Messages: 142

#5
I think you edited a configuration file and made a mistake yourself I dont think makefile is "bad" at all, the makefile is pulling it in and causing an error. Tell me or paste me ex: let me see the files you edited.
 

inurneck

Active Member

Thanks: 4
Messages: 142

#6
Try "make all" if that doesnt work put something instead of ns.goldenfire.com Put just ns or or try goldenfire.com I dont think it wants the whole thing.
 

goldenfire

Member

Thanks: 2
Messages: 62

#7
Code:
ns# ll
total 22
-rw-r--r--  1 root  wheel  6818 Oct 25 10:10 Makefile
-rw-r--r--  1 root  wheel  2905 Oct 25 10:10 README
-rw-r--r--  1 root  wheel   634 Oct 25 10:10 access.sample
-rw-r--r--  1 root  wheel  1667 Oct 25 10:10 aliases
-rw-r--r--  1 root  wheel   409 Oct 25 10:10 mailer.conf
-rw-r--r--  1 root  wheel   253 Oct 25 10:10 mailertable.sample
-rw-r--r--  1 root  wheel   582 Oct 25 10:10 virtusertable.sample
All of the files under /usr/src/etc/mail have not been touched from the OS was installed.

I also download a Makefile from
http://download.altstu.ru/FreeBSD/releases/i386/8.0-RELEASE/etc/mail/Makefile
and compared with my Makefile by diff. They are same.
 

inurneck

Active Member

Thanks: 4
Messages: 142

#8
let me see your /etc/hosts file. You didn't edit *anything* to try and get this to work. Maybe installing sendmail from ports added a "duplicate" something which would explain the error go in the ports sendmail and type make deinstall && make clean
 

goldenfire

Member

Thanks: 2
Messages: 62

#9
Sorry.
I am not sure the meaning of "put something instead of ns.goldenfire.com"

That is my hostname.
Do you mean I need to change hostname?

inurneck said:
Try "make all" if that doesnt work put something instead of ns.goldenfire.com Put just ns or or try goldenfire.com I dont think it wants the whole thing.
 

inurneck

Active Member

Thanks: 4
Messages: 142

#11
No, I just thought you edited something causing this but you said you didnt. The sendmail gods are sitting back laughing at me let me read everything you posted more fully and see what I come up with to help you figure this out.

Did you uninstall ports/sendmail yet make deinstall && make clean. If it does it with both its not the system ones fault so lets narrow this down by sticking to one so we know what we are dealing with better.
 

goldenfire

Member

Thanks: 2
Messages: 62

#12
Code:
ns# make ns.goldenfire.com
"Makefile", line 80: warning: duplicate script for target "ns.goldenfire.com" ignored
cp freebsd.mc ns.goldenfire.com     .mc
cp: .mc is not a directory
*** Error code 1

Stop in /usr/src/etc/mail.
 

goldenfire

Member

Thanks: 2
Messages: 62

#15
Thank you very much for you patient.
I have already deinstall sendmail.

Code:
ns# pkg_info | grep mail
ns#

inurneck said:
No, I just thought you edited something causing this but you said you didnt. The sendmail gods are sitting back laughing at me let me read everything you posted more fully and see what I come up with to help you figure this out.

Did you uninstall ports/sendmail yet make deinstall && make clean. If it does it with both its not the system ones fault so lets narrow this down by sticking to one so we know what we are dealing with better.
 

inurneck

Active Member

Thanks: 4
Messages: 142

#16
You dont have to type make blah.com just make and make install. But I understand it does it both ways and your just trying things.
 

goldenfire

Member

Thanks: 2
Messages: 62

#18
Code:
ns# make
cp freebsd.mc ns.goldenfire.com.mc
cp: freebsd.mc: No such file or directory
*** Error code 1

Stop in /usr/src/etc/mail.
ns#
Aha we caught it.
Teach me where is the original mc file?
Do I need to copy them to /usr/src/etc/mail?
 

inurneck

Active Member

Thanks: 4
Messages: 142

#19
goldenfire said:
Code:
ns# ll
total 22
-rw-r--r--  1 root  wheel  6818 Oct 25 10:10 Makefile
-rw-r--r--  1 root  wheel  2905 Oct 25 10:10 README
-rw-r--r--  1 root  wheel   634 Oct 25 10:10 access.sample
-rw-r--r--  1 root  wheel  1667 Oct 25 10:10 aliases
-rw-r--r--  1 root  wheel   409 Oct 25 10:10 mailer.conf
-rw-r--r--  1 root  wheel   253 Oct 25 10:10 mailertable.sample
-rw-r--r--  1 root  wheel   582 Oct 25 10:10 virtusertable.sample
All of the files under /usr/src/etc/mail have not been touched from the OS was installed.

I also download a Makefile from
http://download.altstu.ru/FreeBSD/releases/i386/8.0-RELEASE/etc/mail/Makefile
and compared with my Makefile by diff. They are same.
Code:
[136]daemon[/etc/mail]: ls
Makefile           daemon.cf          freebsd.mc         mailer.conf
README             daemon.mc          freebsd.submit.cf  sendmail.cf
access.sample      daemon.submit.cf   freebsd.submit.mc  submit.cf
aliases            daemon.submit.mc   helpfile
aliases.db         freebsd.cf         local-host-names
[137]daemon[/etc/mail]: make clean
[138]daemon[/etc/mail]: ls
Makefile           daemon.cf          freebsd.mc         mailer.conf
README             daemon.mc          freebsd.submit.cf  sendmail.cf
access.sample      daemon.submit.cf   freebsd.submit.mc  submit.cf
aliases            daemon.submit.mc   helpfile
aliases.db         freebsd.cf         local-host-names
[139]daemon[/etc/mail]: make
/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 daemon.mc > daemon.cf
/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 daemon.submit.mc > daemon.submit.cf
[140]daemon[/etc/mail]:

Thats whats in my /etc/mail If i type make clean im pretty sure the only thing that gets removed is the .db files leaving me with a lot more files than you. I think your missing files for some reason.
 

inurneck

Active Member

Thanks: 4
Messages: 142

#21
When you deleted /etc/mail you deleted files that make cant just recreate itself but needs them and sucks them in. (they aren't there.) You need to read the readme below and follow its instructions to recreate them. I never deleted /etc/mail and had to do this so im giving you the best information I can. Try that and see what you get.

[187]daemon[/usr/share/sendmail/cf/cf]: more README

SENDMAIL CONFIGURATION FILES INSTALLATION

This document describes how to install the sendmail configuration files.
Please see ../README about the sendmail configuration files themselves.

By default you need two .mc files: sendmail.mc and submit.mc. The
latter is an OS independent configuration file for the mail submission
program (MSP). See ../README for details about both files.

Installation of these two files can be done via:

make install-cf

If you use a different name than "sendmail" for your main .mc file"
then you should use

make install-cf CF=config

where "config" is the name of your main .mc file.

The default installation directory is /etc/mail and can be changed
by specifying

MAILDIR=/other/dir

The name of the source file for "submit.cf" can be overridden by

SUBMIT=msp

For more details see Makefile.


$Revision: 1.2 $, Last updated $Date: 2002/02/22 00:33:54 $
[188]daemon[/usr/share/sendmail/cf/cf]:
 

goldenfire

Member

Thanks: 2
Messages: 62

#22
Yes. Because of my silly idea, I thought after reinstall of sendmail from port I could get a fresh /etc/mail dir, I removed all of the files inside /etc/mail.
 

inurneck

Active Member

Thanks: 4
Messages: 142

#23
Future reference move shit to /tmp/ you think you dont need. If /tmp deletes itself on your system make a folder "trash" somewhere and use it before you delete anything permanently. It sounds lame but this would not have happened and it has saved me countless times. It's your minds way at the shell for you to organize. As your plugging along commands your like ok I dont need this anymore let me get rid of it rm dontneedthis then later you realize you do. Adding a trash or using tmp is still organized its just a protection layer youll get used to it. then when your sure, you can finally get rid of it.
 

inurneck

Active Member

Thanks: 4
Messages: 142

#24
Run those commands, recreate them, verify they are there and type make in /etc/mail I want to know if this fixes your issue.
 
Top