LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-22-2024, 05:45 PM   #1
maddy0
Member
 
Registered: May 2023
Posts: 84

Rep: Reputation: 2
Postfix


Hello, how i have to edit /etc/postfix/main.cf with my own domain i bought? for example this@ismydomain.fun
myhostname = this@ismydomain.fun
mydomain = ismydomain.fun
myorigin = $mydomain
inet_interfaces = localhost
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8 myip/24
home_mailbox = Maildir/
I don't want use external services like Gmail, ecc ecc, But i don't know how to properly setup a mail service in my pc
 
Old 02-22-2024, 09:21 PM   #2
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
you need to have a public ip to host your mail server
and your pc has to be online all the time or else you will lost emails
and with that said, make sure your system is secured

you will need a cert from a trusted CA or you can use letsencrypt

check out this link might give you some idea: https://www.redhat.com/sysadmin/inst...figure-postfix
 
Old 02-23-2024, 12:08 AM   #3
maddy0
Member
 
Registered: May 2023
Posts: 84

Original Poster
Rep: Reputation: 2
Yes,i know, but i don't trust em. So, is the configuration i posted right?
 
Old 02-23-2024, 01:30 AM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
it's quite hard to say, postfix configuration varies always depends on the usage or as desired by the admin.

you can try it, if it's working then I guess it is indeed correct. Give it a shot!

However, try to monitor always for any malicious activity.


just an example, it's your final call to implement:
Quote:
# Basic Postfix configuration file

# Set the hostname for the mail server
myhostname = mail.example.com

# Set the domain name
mydomain = example.com

# Set the network interface addresses to listen on
inet_interfaces = all

# Don't relay mail from other domains
# no need if no relay is needed
# relay_domains = $mydestination


# Enable local mail delivery
#mydestination = $myhostname, localhost.$mydomain, localhost

# Enable virtual alias maps
virtual_alias_maps = hash:/etc/postfix/virtual

# Enable local alias maps
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

# Enable SMTP authentication
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname

# Set the location of the Postfix queues
queue_directory = /var/spool/postfix

# Set the location of virtual mailbox mappings
virtual_mailbox_maps = hash:/etc/postfix/vmailbox

# Set the location of the SASL authentication daemon
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

# Set the maximum message size allowed
message_size_limit = 104857600

# Enable TLS support
smtpd_tls_cert_file = /etc/ssl/certs/mailserver.crt
smtpd_tls_key_file = /etc/ssl/private/mailserver.key
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# Set the SMTP banner
smtpd_banner = $myhostname ESMTP

# Enable logging
maillog_file = /var/log/maillog
 
Old 02-23-2024, 04:08 AM   #5
maddy0
Member
 
Registered: May 2023
Posts: 84

Original Poster
Rep: Reputation: 2
Hi, thanks a lot for helpin. I did this:
compatibility_level = 3.8
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
debug_peer_level = 2

debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix/samples
readme_directory = /usr/share/doc/postfix/README_FILES
meta_directory = /etc/postfix
shlib_directory = /usr/lib64/postfix
myhostname = mail.xxx.xx
mydomain = xxx.xx
myorigin = $mydomain
inet_protocols = ipv4
inet_interfaces = all
mynetworks = 127.0.0.0/8, xxxxxx/24
disable_vrfy_command = yes
message_size_limit = 10240000
smtpd_helo_required = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, permit_sasl_authenticated, reject
smtpd_banner = $myhostname ESMTP
smtpd_tls_cert_file = /etc/ssl/certs/mailserver.crt
smtpd_tls_key_file = /etc/ssl/private/mailserver.key
smtpd_tls_security_level = may
smtp_tls_CApath = /etc/pki/tls/certs
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
maillog_file = /var/log/maillog
Then added rules to Firewall
firewall-cmd --add-service=smtp
firewall-cmd --runtime-to-permanent
firewall-cmd --add-service=smtp
 
Old 02-23-2024, 07:44 AM   #6
maddy0
Member
 
Registered: May 2023
Posts: 84

Original Poster
Rep: Reputation: 2
Worked!
Now the question is: if i leave my pc on, the IP wont change, but what about if i turn off my pc?
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2024-02-23 14-40-04.png
Views:	8
Size:	4.5 KB
ID:	42582  

Last edited by maddy0; 02-23-2024 at 07:46 AM.
 
Old 02-23-2024, 12:37 PM   #7
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Exclamation

Quote:
Originally Posted by maddy0 View Post
Worked!
Now the question is: if i leave my pc on, the IP wont change, but what about if i turn off my pc?
assign a static IP
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix 2.6.6 postfix/cleanup and postfix/master errors Pummelmuffin Linux - Server 2 11-22-2020 12:50 PM
Postfix send mail problem(In RH9, kernal 2.4.20, postfix 2.1.5) minor Linux - General 6 09-23-2019 10:09 PM
Postfix: postfix: fatal: chdir(/usr/libexec/postfix) Micro420 Ubuntu 2 07-13-2008 12:21 PM
can't start postfix ./postfix status error jules_fraser Linux - Software 3 12-06-2003 06:33 PM
move postfix mails from server to another postfix server onetwo Linux - Software 2 03-18-2003 02:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration