I have setup my own server which is apache ftp mail and mysql servers services at home and now im dealing with the firewall. The firewall i have installed is csf.

1) What are the incoming and outgoing ports should i open for my server?

2) I dont install ssh server so do i need to open incoming and outgoing port 22 for ssh server?

3) I dont provide dns server service, do i need to open incoming and outgoing port 53 for the dns server?

4) I also provide mysql database server service. Do i need to open incoming and outgoing port 3306 becasue i have heard that the port need to be open just for remote access. So for direct access, do i need to open the port.

My questions are too broad i think but i really need help from you guys.

closed as too broad by Darius, Ramhound, n8te, nKn, djsmiley2k Mar 14 '18 at 10:23

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Keep it simple. Whatever service you are providing that you need to access externally (from outside the server itself) - open the port. Anything else - close. If you just need local access (from the server itself) - you don't have to do anything. – Darius Mar 7 '18 at 13:53

Usually you only need port 80, which is used to view the website itself.

Given that you mention mail and ftp, these would also be accessible from the outside, thus their ports need to be opened too.

FTP goes on port 21 and mail either goes on port 25, 465 or 587 for outgoing mail (with ssl, 465 or 587), and incoming, depending on the protocol you use, probably 993 for pop and 995 for imap if you use SSL, or 143 for both if you don't use ssl.

Your MySQL server is likely only to be used by the webserver itself, and opening its ports would actually be a security risk because then, anyone could hack your database and alter data, so no, those ports stay closed.

You mention you don't use the other services, so no, you don't open those ports either.

That would be like creating a door that when open shows a wall... Wouldn't make any sense.

  • @kratos_krom If this solved your question, please mark it as answered, so others know you no longer need help. – LPChip Mar 7 '18 at 14:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.