A firewall prevents unwanted connections from the Internet. Most organizations will have a dedicated firewall and will place their email server in a so-called de-militarized zone, popularly known as DMZ, accessible from both the external network and their internal network. It is possible to use a Linux box as a firewall by using iptables, the Linux kernel firewall. If external services such as DCC are used, Chapter 13 provides firewall information to allow the services to be accessed.
If the email gateway is not behind a corporate firewall, then the Linux kernel firewall should be configured on the email gateway. Consult the documentation for the distribution to configure this.