\section{Service and Port Management}
\begin{frame}
   {Service Management}
   \begin{itemize}
      \item
      See available services:
      \begin{cmd}
$ sudo  firewall-cmd --get-services
      \end{cmd}
      \item See those in a zone:
      \begin{cmd}
$ sudo firewall-cmd --list-services --zone=public
      \end{cmd}
      \item Add a service to a zone:
      \begin{cmd}
$ sudo firewall-cmd --permanent --zone=home --add-service=dhcp
      \end{cmd}
      \begin{response}
success
      \end{response}
      \begin{cmd}
$ sudo firewall-cmd --reload
      \end{cmd}

   \end{itemize}

\end{frame}

\cprotect\note {

   So far we have assigned particular interfaces and/or
   addresses to zones, but we have not delineated what
   \textbf{services} and \textbf{ports} should be accessible
   within a zone. To see all the services available:
   \begin{cmd}
$ sudo  firewall-cmd --get-services
   \end{cmd}
   \begin{response}
RH-Satellite-6 amanda-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns ftp high-availability http\
   https imaps ipp ipp-client ipsec kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mountd ms-wbt\
    mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius rpc-bind samba\
    samba-client smtp ssh telnet tftp tftp-client transmission-client vnc-server wbem-https
   \end{response}
   or to see those currently accessible in a particular zone:
   \begin{cmd}
$ sudo firewall-cmd --list-services --zone=public
   \end{cmd}
   \begin{response}
dhcpv6-client ssh
   \end{response}
   To add a service to a zone:
   \begin{cmd}
$ sudo firewall-cmd --permanent --zone=home --add-service=dhcp
   \end{cmd}
   \begin{response}
success
   \end{response}
   \begin{cmd}
$ sudo firewall-cmd --reload
   \end{cmd}
   The second command, with \texttt{--reload}, is needed
   to make the change effective.
   It is also possible to add new services by editing the
   files in \filelink{/etc/firewalld/services}.

}



\begin{frame}
   {Port Management}
   \begin{itemize}
      \item Port management:
      \begin{cmd}
$ sudo firewall-cmd --zone=home --list-ports
$ sudo firewall-cmd --zone=home --add-port=21/tcp
      \end{cmd}

   \end{itemize}

\end{frame}

\cprotect\note {

   Port management is very similar to service management:

   \begin{cmd}
$ sudo firewall-cmd --zone=home --add-port=21/tcp
   \end{cmd}
   \begin{response}
success
   \end{response}
   \begin{cmd}
$ sudo firewall-cmd --zone=home --list-ports
   \end{cmd}
   \begin{response}
21/tcp
   \end{response}
   where by looking at \filelink{/etc/services} we can ascertain
   that port 21 corresponds to \textbf{ftp}:
   \begin{cmd}
$ grep " 21/tcp" /etc/services
   \end{cmd}
   \begin{response}
ftp             21/tcp
   \end{response}

}



