Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sendmail
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
certo
sendmail
Commits
53777f21
Commit
53777f21
authored
Jun 09, 2021
by
Vladimir Bashkirtsev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for fully qualified domain delivery
parent
4169243b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
8 deletions
+23
-8
Makefile
Makefile
+5
-0
mail
mail
+2
-2
sendmail-init
sendmail-init
+13
-6
sendmail.mc
sendmail.mc
+3
-0
No files found.
Makefile
View file @
53777f21
...
...
@@ -50,8 +50,13 @@ all: sendmail-config mail-aliases sendmail-default sm-client-service sendmail-se
cd
sendmail-8.16.1/doc/op
&&
install
-v
-m644
op.ps /usr/share/doc/sendmail-8.16.1
openssl req
-new
-x509
-nodes
-out
/etc/ssl/private/server.pem
-keyout
/etc/ssl/private/server.pem
-days
3650
-subj
"/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost"
echo
$
$(hostname)
>
/etc/mail/local-host-names
touch
/etc/mail/access
makemap
hash
/etc/mail/access.db < /etc/mail/access
touch
/etc/mail/mailertable
makemap
hash
/etc/mail/mailertable.db < /etc/mail/mailertable
echo
"@
$
$(hostname)
error:nouser No such user here"
>
/etc/mail/virtusertable
makemap
hash
/etc/mail/virtusertable.db < /etc/mail/virtusertable
touch
/etc/mail/virtuserdomains
@
echo
"
$$
MAIL_ALIASES"
>
/etc/mail/aliases
newaliases
install
-v
-Dm644
sendmail.mc /etc/mail
...
...
mail
View file @
53777f21
...
...
@@ -138,7 +138,7 @@ set_mail_server_user_password() {
idx
=
$((
$2
-
1
))
users
=(
`
$UCI_SHOW
mail.@server[
$pos
]
.user |
sed
-e
's/^.*=\(.*\)$/\1/g'
`
)
user
=
$(
eval echo
${
users
[
$idx
]
}
)
hostname
=
`
$UCI_GET
mail.@server[
$pos
]
.hostname
`
sendmail-init
echo
"
$3
$user
"
echo
"
$3
"
| saslpasswd2
$user
echo
"
$3
"
| saslpasswd2
$user
@
$hostname
}
sendmail-init
View file @
53777f21
...
...
@@ -5,8 +5,11 @@ UCI_SHOW="/sbin/uci -q show"
configure_sendmail
()
{
CONFIG
=
`
$UCI_SHOW
mail |
awk
'{ match($0, /\[([0-9]+)\]\.(hostname|user)=(.*)/, arr); if (arr[1] != "") print arr[1] " " arr[2] " " arr[3] }'
|
tr
-d
\'
`
truncate
--size
0 /data/etc/mail/access
truncate
--size
0 /data/etc/mail/local-host-names
truncate
--size
0 /data/etc/mail/mailertable
truncate
--size
0 /data/etc/mail/virtusertable
truncate
--size
0 /data/etc/mail/virtuserdomains
while
read
-a
myarray
do
...
...
@@ -20,23 +23,27 @@ configure_sendmail() {
if
[
"
$type
"
=
"hostname"
]
;
then
hostname
=
$values
elif
[
"
$hostname
"
!=
""
]
&&
[
"
${
values
[@]
}
"
!=
""
]
;
then
echo
$hostname
>>
/data/etc/mail/local-host-names
echo
"
$hostname
RELAY"
>>
/data/etc/mail/access
echo
"
$hostname
error:nouser No such user here"
>>
/data/etc/mail/mailertable
for
user
in
${
values
[@]
}
do
echo
"
$user
@
$hostname
$user
@
$(
hostname
)
"
>>
/data/etc/mail/virtusertable
echo
$user
echo
"
$user
@
$hostname
!
"
>>
/data/etc/mail/virtusertable
echo
$user
@
$hostname
done
echo
"@
$hostname
error:nouser No such user here"
>>
/data/etc/mail/virtusertable
echo
$hostname
>>
/data/etc/mail/virtuserdomains
fi
done
<<<
$CONFIG
echo
$(
hostname
)
>>
/data/etc/mail/local-host-names
echo
"@
$(
hostname
)
error:nouser No such user here"
>>
/data/etc/mail/virtusertable
makemap
hash
/data/etc/mail/access.db < /data/etc/mail/access
makemap
hash
/data/etc/mail/virtusertable.db < /data/etc/mail/virtusertable
makemap
hash
/data/etc/mail/mailertable.db < /data/etc/mail/mailertable
}
existing_users
()
{
CONFIG
=
`
/usr/sbin/sasldblistusers2 |
awk
'{ match($0, /^(.*
)@
/, arr); if (arr[1] != "") print arr[1] }'
|
sort
|
uniq
`
CONFIG
=
`
/usr/sbin/sasldblistusers2 |
awk
'{ match($0, /^(.*
@.*):
/, arr); if (arr[1] != "") print arr[1] }'
|
sort
|
uniq
`
echo
$CONFIG
}
...
...
@@ -52,7 +59,7 @@ done
for
user
in
$(
printf
'%s\n'
"
${
existing
[@]
}
"
|
sort
|
uniq
)
;
do
if
[[
!
"
${
users
[@]
}
"
=
~
"
${
user
}
"
]]
;
then
fullname
=
`
/usr/sbin/sasldblistusers2 |
sed
-n
"s/^
\(
$user
@.*
\)
:.*/
\\
1/p"
|
sort
|
uniq
`
fullname
=
`
/usr/sbin/sasldblistusers2 |
sed
-n
"s/^
\(
$user
\)
:.*/
\\
1/p"
|
sort
|
uniq
`
saslpasswd2
-d
$fullname
fi
done
sendmail.mc
View file @
53777f21
...
...
@@ -7,7 +7,10 @@ DOMAIN(generic)dnl
define(`confTRUSTED_USER', `cyrus')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
FEATURE(use_cw_file)dnl
FEATURE(`access_db', `hash -o -T
<TMPF>
/etc/mail/access.db')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
VIRTUSER_DOMAIN_FILE(`-o /etc/mail/virtuserdomains')
dnl ----------------------------------------------------------------------------
dnl Allow relaying of mail from clients on the local host.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment