diff --git a/2/ASO/assignments/openbsd-project/imgs/01-nginx-test.png b/2/ASO/assignments/openbsd-project/imgs/01-nginx-test.png new file mode 100644 index 0000000..2be106d Binary files /dev/null and b/2/ASO/assignments/openbsd-project/imgs/01-nginx-test.png differ diff --git a/2/ASO/assignments/openbsd-project/imgs/02-load-wrk-test.png b/2/ASO/assignments/openbsd-project/imgs/02-load-wrk-test.png new file mode 100644 index 0000000..bec5dc2 Binary files /dev/null and b/2/ASO/assignments/openbsd-project/imgs/02-load-wrk-test.png differ diff --git a/2/ASO/assignments/openbsd-project/openbsd-project-naortega.pdf b/2/ASO/assignments/openbsd-project/openbsd-project-naortega.pdf index 7e36743..d2c29b0 100644 Binary files a/2/ASO/assignments/openbsd-project/openbsd-project-naortega.pdf and b/2/ASO/assignments/openbsd-project/openbsd-project-naortega.pdf differ diff --git a/2/ASO/assignments/openbsd-project/openbsd-project-naortega.tex b/2/ASO/assignments/openbsd-project/openbsd-project-naortega.tex index 9241ca3..08f540c 100644 --- a/2/ASO/assignments/openbsd-project/openbsd-project-naortega.tex +++ b/2/ASO/assignments/openbsd-project/openbsd-project-naortega.tex @@ -103,10 +103,122 @@ root# pkg_add nginx mariadb-server mariadb-client \ \section{Configuración de Servicios} +El control de los servicios en OpenBSD se hace con el comando {\tt rcctl}, ya +que OpenBSD no usa Systemd. Generalmente se usa de una forma muy similar a +Systemd, usando los subcomandos siguientes: + +\begin{itemize} + \item {\tt start}: iniciar un servicio. + \item {\tt stop}: parar un servicio. + \item {\tt enable}: habilitar un servicio para iniciarse al arrancar la + máquina. + \item {\tt disable}: deshabilitar un servicio para que no se inicie cuando + arranque la máquina. + \item {\tt ls}: mostrar una lista de los servicios. +\end{itemize} + \subsection{Nginx} +\begin{table}[!ht] + \centering + \begin{tabular}{|c|c|} + \hline + {\bf Nombre} & Nginx \\ \hline + {\bf Descripción} & Un servidor web moderno. \\ \hline + {\bf Dir. Config.} & {\tt /etc/nginx/} \\ \hline + {\bf Dir. Logs} & {\tt /etc/nginx/logs/} \\ \hline + \end{tabular} + \label{tbl:nginx-descriptor} + \caption{Datos sobre Nginx.} +\end{table} + +En nuestra configuración de Nginx vamos a crear una página simple que se pueda +acceder desde fuera en el puerto 80. Por defecto, Nginx en OpenBSD usa el +directorio {\tt /var/www/htdocs/} como raíz del servidor. Aquí añadiremos un +archivo {\tt index.html} para que responda con un código {\tt 200 OK}. Iniciamos +el servicio (y lo habilitamos) con el comando siguiente: + +\begin{verbatim} +root# rcctl enable nginx +root# rcctl start nginx +nginx(ok) +\end{verbatim} + +\begin{figure} + \centering + \includegraphics[width=0.75\textwidth]{imgs/01-nginx-test.png} + \caption{Prueba de Nginx.} + \label{fig:nginx-test} +\end{figure} + +Ahora, si probamos acceder a nuestro servidor, veremos el archivo que hemos +creado (figura \ref{fig:nginx-test}). + +A este servidor le podemos hacer un {\it stress test} utilizando la herramienta +{\it wrk}, que sirve para hacer {\it benchmarking} de servicios HTTP. Desde un +cliente corremos el comando siguiente, que nos hará una prueba de 50 conexiones +paralelas, sobre 10 hilos, durante 20 segundos. Vemos que el {\it load} aumenta +de forma considerable (figura \ref{fig:load-wrk-test}). + +\begin{verbatim} +$ wrk -c 50 -t 10 -d 20 http://172.16.40.3/ +\end{verbatim} + +\begin{figure} + \centering + \includegraphics[width=0.75\textwidth]{imgs/02-load-wrk-test.png} + \caption{{\it Load} resultante de una prueba con {\it wrk}.} + \label{fig:load-wrk-test} +\end{figure} + \subsection{MariaDB} +\begin{table}[!ht] + \centering + \begin{tabular}{|c|c|} + \hline + {\bf Nombre} & MariaDB \\ \hline + {\bf Descripción} & Sistema de gestión de bases de datos. \\ \hline + {\bf Archivo Conf.} & {\tt /etc/my.cnf} \\ \hline + \end{tabular} + \label{tbl:mariadb-descriptor} + \caption{Datos sobre MariaDB.} +\end{table} + +MariaDB requiere de una configuración inicial más manual, así que en primer +lugar se tendrá que inicializar (y habilitar) el servicio, que se denomina {\tt +mysqld} -- esto es porque MariaDB tiene como objetivo ser un reemplazo {\it +in-place} de MySQL. + +\begin{verbatim} +root# rcctl enable mysqld +root# rcctl start mysqld +mysqld(ok) +\end{verbatim} + +Posteriormente lo configuramos usando el comando {\tt mysql\_secure\_install}. +Esto instalará las tablas dentro del directorio {\tt /var/mysql/} y podremos +definir la contraseña de {\it root}, que será {\tt Rooty} (y algunas opciones de +MariaDB). Podemos acceder a este base de datos usando el comando siguiente desde +el usuario {\it root}, e introduciendo la contraseña que hemos asignado: + +\begin{verbatim} +puffy-nortega# mysql -u root -p +Enter password: +Welcome to the MariaDB monitor. Commands end with ; or \g. +Your MariaDB connection id is 13 +Server version: 10.9.3-MariaDB OpenBSD port: +mariadb-server-10.9.3v1 + +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and +others. + +Type 'help;' or '\h' for help. Type '\c' to clear the current +input statement. + +MariaDB [(none)]> +\end{verbatim} + \subsection{Servicio RSync} \section{Conclusión} diff --git a/2/ASO/assignments/openbsd-project/openbsd-project-naortega.toc b/2/ASO/assignments/openbsd-project/openbsd-project-naortega.toc index 60b505f..f39a2c2 100644 --- a/2/ASO/assignments/openbsd-project/openbsd-project-naortega.toc +++ b/2/ASO/assignments/openbsd-project/openbsd-project-naortega.toc @@ -4,7 +4,7 @@ \contentsline {section}{\numberline {3}Instalación de Paquetes}{3}{section.3}% \contentsline {section}{\numberline {4}Configuración de Servicios}{4}{section.4}% \contentsline {subsection}{\numberline {4.1}Nginx}{4}{subsection.4.1}% -\contentsline {subsection}{\numberline {4.2}MariaDB}{4}{subsection.4.2}% -\contentsline {subsection}{\numberline {4.3}Servicio RSync}{4}{subsection.4.3}% -\contentsline {section}{\numberline {5}Conclusión}{4}{section.5}% -\contentsline {section}{\numberline {6}Derechos de Autor y Licencia}{5}{section.6}% +\contentsline {subsection}{\numberline {4.2}MariaDB}{5}{subsection.4.2}% +\contentsline {subsection}{\numberline {4.3}Servicio RSync}{6}{subsection.4.3}% +\contentsline {section}{\numberline {5}Conclusión}{6}{section.5}% +\contentsline {section}{\numberline {6}Derechos de Autor y Licencia}{7}{section.6}%