Skip to content

Instantly share code, notes, and snippets.

@a2ikm
Created April 21, 2015 16:27
Show Gist options
  • Save a2ikm/5374a689fa48dd0a8121 to your computer and use it in GitHub Desktop.
Save a2ikm/5374a689fa48dd0a8121 to your computer and use it in GitHub Desktop.
postfix+saslauthdでPAMを通してshadow認証する
#%PAM-1.0
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
#%PAM-1.0
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
diff --git postfix/main.cf postfix/main.cf
index 01146fd..3cebdde 100644
--- postfix/main.cf
+++ postfix/main.cf
@@ -74,6 +74,7 @@ mail_owner = postfix
#
#myhostname = host.domain.tld
#myhostname = virtual.domain.tld
+myhostname = localhost
# The mydomain parameter specifies the local internet domain name.
# The default is to use $myhostname minus the first component.
@@ -81,6 +82,7 @@ mail_owner = postfix
# parameters.
#
#mydomain = domain.tld
+mydomain = localhost
# SENDING MAIL
#
@@ -97,6 +99,7 @@ mail_owner = postfix
#
#myorigin = $myhostname
#myorigin = $mydomain
+myorigin = $mydomain
# RECEIVING MAIL
@@ -113,7 +116,8 @@ mail_owner = postfix
#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
-inet_interfaces = localhost
+#inet_interfaces = localhost
+inet_interfaces = all
# Enable IPv4, and IPv6 if supported
inet_protocols = all
@@ -264,6 +268,7 @@ unknown_local_recipient_reject_code = 550
#mynetworks = 168.100.189.0/28, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table
+mynetworks = 10.0.0.0/16, 127.0.0.0/8, 192.168.0.0/16
# The relay_domains parameter restricts what destinations this system will
# relay mail to. See the smtpd_recipient_restrictions description in
@@ -417,6 +422,7 @@ alias_database = hash:/etc/aliases
#
#home_mailbox = Mailbox
#home_mailbox = Maildir/
+home_mailbox = Maildir/
# The mail_spool_directory parameter specifies the directory where
# UNIX-style mailboxes are kept. The default setting depends on the
@@ -674,3 +680,13 @@ sample_directory = /usr/share/doc/postfix-2.6.6/samples
# readme_directory: The location of the Postfix README files.
#
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
+
+smtp_sasl_security_options = noplaintext,noanonymous
+
+smtpd_sasl_auth_enable = yes
+smtpd_sasl_local_domain = $myhostname
+smtpd_sasl_security_options = noanonymous
+smtpd_recipient_restrictions =
+ permit_mynetworks
+ permit_sasl_authenticated
+ reject_unauth_destination
pwcheck_method: saslauthd
mech_list: plain login
# Directory in which to place saslauthd's listening socket, pid file, and so
# on. This directory must already exist.
SOCKETDIR=/var/run/saslauthd
# Mechanism to use when checking passwords. Run "saslauthd -v" to get a list
# of which mechanism your installation was compiled with the ablity to use.
MECH=pam
# Options sent to the saslauthd. If the MECH is other than "pam" uncomment the next line.
# DAEMONOPTS=--user saslauth
# Additional flags to pass to saslauthd on the command line. See saslauthd(8)
# for the list of accepted flags.
FLAGS=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment