\chapter{Startup Foundation with Gitea} \ChapterLabel{GiteaFoundation} \sloppy % long hostnames and paths in \texttt cannot hyphenate \index{Gitea} \index{droplet} \section*{Overview} This chapter records Assignment 4 (instructor manual, Chapter 2): the startup's Gitea work hub at \url{https://git.yebilly.me}, served from the existing DigitalOcean droplet \texttt{The-Ocean}. Gitea runs from a pinned official image behind a Caddy \gls{reverse-proxy} that terminates \gls{tls} with a Let's Encrypt certificate. A DigitalOcean \gls{cloud-firewall} admits only web traffic publicly and restricts \gls{ssh} to team addresses. The product repository is \url{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway}. All commands below were run by the team on 26--28 September 2026 (UTC) unless stated otherwise. Checks labelled ``laptop'' ran on a team laptop outside the droplet. The section numbers match the eight rubric rows in order; failed attempts and corrections are collected in Section~\ref{sec:gitea-quality}. %--------------------------------------------------------------- \section{Student Pack Domain and DNS} \label{sec:gitea-domain} \index{DNS} \index{GitHub Student Developer Pack} \paragraph{Offer and cost.} The domain \texttt{yebilly.me} was registered on 25 September 2026 through the GitHub Student Developer Pack offer from Namecheap (one \texttt{.me} domain free for one year for verified students).\footnote{\url{https://education.github.com/pack}, checked 25 September 2026.} Eligibility is a verified GitHub Student Developer Pack account. Figure~\ref{fig:gitea-receipt} shows the registration receipt for \$0.00, Figure~\ref{fig:gitea-domain} shows the domain active with privacy protection on and an expiry of 25 September 2027, and Figure~\ref{fig:gitea-renewal} shows the renewal price quoted by Namecheap on 26 September 2026: \textbf{\$23.98 per year}, with domain privacy remaining free. The renewal was added to the cart only to read the price; it was not purchased. \begin{table}[H] \centering \caption{Domain offer summary} \label{tab:gitea-domain} \begin{tabular}{@{}ll@{}} \toprule Item & Value\\ \midrule Registrar / offer & Namecheap, GitHub Student Developer Pack \texttt{.me}\\ First-year cost & \$0.00 (receipt 873854, 25 Sep 2026)\\ Renewal cost & \$23.98 per year (quoted 26 Sep 2026)\\ Expiration & 25 September 2027; auto-renew \textbf{off}\\ Gitea hostname & \texttt{git.yebilly.me} $\rightarrow$ \texttt{147.182.178.136}\\ \bottomrule \end{tabular} \end{table} \begin{figure}[H] \centering \includegraphics[width=0.75\textwidth]{images/gitea-namecheap-receipt.png} \caption{Namecheap receipt for \texttt{yebilly.me}: one-year registration at \$0.00 (username and address redacted)} \label{fig:gitea-receipt} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.85\textwidth]{images/gitea-namecheap-domain.png} \caption{Namecheap domain list: \texttt{yebilly.me} active, privacy on, auto-renew off, expires 25 September 2027} \label{fig:gitea-domain} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.75\textwidth]{images/gitea-namecheap-renewal.png} \caption{Renewal price check (cart only, not purchased), 26 September 2026} \label{fig:gitea-renewal} \end{figure} \paragraph{DNS record.} The registrar's BasicDNS zone holds one record for the service: an \texttt{A} record with host \texttt{git} pointing to the droplet's IPv4 address. No \texttt{AAAA} record is published, so the hostname is IPv4-only (Section~\ref{sec:gitea-firewall}). Independent lookup from a laptop through Google Public DNS: \begin{minted}{text} $ date -u Mon Sep 28 17:30:15 UTC 2026 $ nslookup git.yebilly.me 8.8.8.8 Server: dns.google Address: 8.8.8.8 Non-authoritative answer: Name: git.yebilly.me Address: 147.182.178.136 \end{minted} The HTTPS hostname is \url{https://git.yebilly.me}. \paragraph{Renewal tracking.} Auto-renew is deliberately off so the team is never charged without a decision. Issue~\#6 in the product repository (``Set up renewal reminder for yebilly.me'') tracks the renewal decision; the team will set a shared calendar reminder for 25 August 2027, one month before expiry, and decide then whether to pay the \$23.98 renewal or retire the hostname. If the domain lapses, the \texttt{git} record, the Let's Encrypt certificate renewals, and every link in this manual stop working. %--------------------------------------------------------------- \section{Pinned Gitea Deployment} \label{sec:gitea-deploy} \index{Docker Compose} \begin{table}[H] \centering \caption{Deployed versions and host} \label{tab:gitea-versions} \begin{tabular}{@{}L{0.3\linewidth}L{0.66\linewidth}@{}} \toprule Component & Version / source\\ \midrule Droplet & \texttt{The-Ocean}, Ubuntu 24.04 LTS, 1 vCPU, 512\,MB RAM, 10\,GB disk, NYC1\\ Docker Engine / Compose & 29.8.1 / v5.5.1\\ Gitea image & \texttt{gitea/gitea:1.27.3} (official image, Docker Hub)\\ Caddy image & \texttt{caddy:2.11.4-alpine} (official image, Docker Hub)\\ Swap & 1\,GiB swap file added for the 512\,MB droplet\\ \bottomrule \end{tabular} \end{table} The versions were pinned to exact tags (not \texttt{latest}) after checking Docker Hub on 25 September 2026, so a rebuild pulls the same software. The versioned, non-secret deployment files live in the product repository at \url{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/src/branch/main/deploy} (merged through pull request~\#9, Section~\ref{sec:gitea-workflow}). The complete Compose file contains no secrets: \begin{minted}{yaml} services: gitea: image: gitea/gitea:1.27.3 restart: unless-stopped environment: - USER_UID=1000 - USER_GID=1000 - GITEA__database__DB_TYPE=sqlite3 # file: /data/gitea/gitea.db - GITEA__server__DOMAIN=git.yebilly.me - GITEA__server__ROOT_URL=https://git.yebilly.me/ - GITEA__server__HTTP_PORT=3000 - GITEA__server__DISABLE_SSH=true # Git over HTTPS only volumes: - gitea-data:/data networks: [web] # no ports: on purpose -- Caddy reaches gitea:3000 privately. caddy: image: caddy:2.11.4-alpine restart: unless-stopped ports: - "80:80" # HTTP->HTTPS redirect + ACME HTTP-01 validation - "443:443" # HTTPS volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddy-data:/data # certificates + ACME account - caddy-config:/config networks: [web] depends_on: [gitea] volumes: gitea-data: caddy-data: caddy-config: networks: web: \end{minted} \paragraph{Configuration choices.} \begin{itemize} \item \textbf{Restart policy:} \texttt{unless-stopped} restarts both containers after a crash or droplet reboot, but not after an operator's deliberate \texttt{docker compose stop}. \item \textbf{Persistent mounts:} the \gls{named-volume} \texttt{gitea-data} holds all Gitea state under \texttt{/data} (repositories, attachments, \texttt{app.ini}, and the SQLite database); \texttt{caddy-data} holds certificates and the ACME account key. \item \textbf{Proxy connection:} Gitea publishes no host port. Caddy reaches it by Compose service name at \texttt{gitea:3000} on the private bridge network \texttt{web} (created as \texttt{gitea\_web}). \item \textbf{Public URL:} \texttt{ROOT\_URL} is the HTTPS hostname so that Gitea generates correct clone and e-mail links.\footnote{Gitea configuration cheat sheet, \url{https://docs.gitea.com/administration/config-cheat-sheet/}.} Gitea's built-in SSH server is disabled; Git uses HTTPS only. \end{itemize} \paragraph{Deployment commands.} On 26 September 2026 the droplet received pending Ubuntu updates and a reboot, the Assignment 3 container \texttt{color-buttons-app} was removed to free port 80, and a 1\,GiB swap file was added. The folder was copied from a laptop and started (in the captured output below, Docker's check-mark symbols are shown as \texttt{+} because the PDF font lacks that glyph, and repeated columns are elided with \texttt{...}): \begin{minted}{powershell} scp -i C:\Users\Billy\.ssh\digiOcean -r gitea root@147.182.178.136:~/gitea \end{minted} \begin{minted}{text} $ cd ~/gitea && date -u && docker compose up -d && docker compose ps Sat Sep 26 18:10:10 UTC 2026 + Image gitea/gitea:1.27.3 Pulled + Image caddy:2.11.4-alpine Pulled + Network gitea_web Created + Volume gitea_caddy-config Created + Volume gitea_caddy-data Created + Volume gitea_gitea-data Created + Container gitea-gitea-1 Started + Container gitea-caddy-1 Started NAME IMAGE ... PORTS gitea-caddy-1 caddy:2.11.4-alpine ... 0.0.0.0:80->80/tcp, [::]:80->80/tcp, 0.0.0.0:443->443/tcp, [::]:443->443/tcp, 443/udp, 2019/tcp gitea-gitea-1 gitea/gitea:1.27.3 ... 22/tcp, 3000/tcp \end{minted} Only Caddy has host mappings (\texttt{0.0.0.0}/\texttt{[::]}); Gitea's \texttt{3000/tcp} and \texttt{22/tcp} are exposed only inside the Docker network. The web installer was completed immediately with SQLite3, self-registration disabled, and an administrator account (Figure~\ref{fig:gitea-dashboard}). \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-dashboard-after-install.png} \caption{Gitea dashboard after installation, served over HTTPS; the footer shows version 1.27.3} \label{fig:gitea-dashboard} \end{figure} \paragraph{Repeating the installation.} Another team can reproduce the service by (1) pointing a hostname's \texttt{A} record at a Docker-equipped Ubuntu droplet, (2) applying the firewall in Section~\ref{sec:gitea-firewall}, (3) cloning the repository and replacing \texttt{git.yebilly.me} in \texttt{deploy/docker-compose.yml} and \texttt{deploy/Caddyfile}, (4) running \texttt{docker compose up -d} in that folder, and (5) finishing the web installer at once. The step-by-step runbook is \texttt{deploy/README.md} in the same folder.\footnote{Gitea installation with Docker, \url{https://docs.gitea.com/installation/install-with-docker/}.} %--------------------------------------------------------------- \section{Database and Persistence} \label{sec:gitea-database} \index{SQLite} \paragraph{Choice.} The team uses Gitea's built-in \textbf{SQLite} database. The database is the file \texttt{/data/gitea/gitea.db} inside the \texttt{gitea-data} named volume, which Docker stores on the droplet's disk at \path{/var/lib/docker/volumes/gitea_gitea-data/_data}, outside the disposable container layer. SQLite needs no database service, no network port, and no database password, so there is no database secret to protect; only \texttt{root} on the droplet can read the volume. SQLite is appropriate for a two-person team; a larger, higher-concurrency deployment should move to PostgreSQL, which handles concurrent writers better.\footnote{Gitea database preparation, \url{https://docs.gitea.com/installation/database-prep/}.} \paragraph{Persistence test.} The test replaces only the Gitea container while keeping its volume. The repository \texttt{ssw590-group1/vpn-dns-gateway} (repository ID~1, created 18:59:19~UTC) and issue~\#1 (issue ID~1, ``Add project description and goals to README'', created 21:38:03~UTC) existed before the replacement, as shown by a public API check at 21:41:15~UTC and Figure~\ref{fig:gitea-persist-before}. \begin{minted}{text} $ date -u Sat Sep 26 21:46:19 UTC 2026 $ docker ps --filter name=gitea-gitea --format '{{.ID}} {{.Image}} {{.CreatedAt}} {{.Status}}' 671040251a70 gitea/gitea:1.27.3 2026-09-26 20:45:49 +0000 UTC Up About an hour $ docker compose up -d --force-recreate --no-deps gitea + Container gitea-gitea-1 Started $ docker ps --filter name=gitea-gitea --format '{{.ID}} {{.Image}} {{.CreatedAt}} {{.Status}}' 698f425609ff gitea/gitea:1.27.3 2026-09-26 21:46:20 +0000 UTC Up Less than a second $ docker compose exec gitea ls -l /data/gitea/gitea.db -rw-r--r-- 1 git git 2183168 Sep 26 21:40 /data/gitea/gitea.db \end{minted} After the replacement (new container ID \texttt{698f425609ff}), a laptop queried the public API: \begin{minted}{text} Sat Sep 26 21:48:14 UTC 2026 repo ssw590-group1/vpn-dns-gateway id 1 created 2026-09-26T18:59:19Z issue #1 id 1 open 2026-09-26T21:38:03Z Add project description and goals to README \end{minted} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-persist-before-issues.png} \caption{Before replacement: repository and issues \#1--\#6} \label{fig:gitea-persist-before} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-persist-after-issue.png} \caption{After replacement: issue \#1 still present in the new container} \label{fig:gitea-persist-after} \end{figure} \paragraph{Conclusion.} \StatusPass. The repository and issue kept the same IDs and timestamps in a new container because \texttt{-{}-force-recreate -{}-no-deps} discards only the container, never its named volume, and every piece of Gitea state (Git data and the SQLite file) lives in that volume. This proves persistence across container replacement; it is \emph{not} a backup: losing the droplet or its disk would lose the volume too (Section~\ref{sec:gitea-architecture}). %--------------------------------------------------------------- \section{HTTPS and Certificate Renewal} \label{sec:gitea-https} \index{HTTPS} \index{Let's Encrypt} \paragraph{Certificate options.} Two free options were available; both are compared below, and the automated one uses the \gls{acme} protocol: \begin{table}[H] \centering \caption{Certificate options compared} \label{tab:gitea-certs} \begin{tabular}{@{}L{0.18\linewidth}L{0.38\linewidth}L{0.38\linewidth}@{}} \toprule & Let's Encrypt via Caddy (\acrshort{acme}) & Namecheap PositiveSSL (Student Pack)\\ \midrule Cost & Free, indefinitely & Free for one year, then paid\\ Validity & 90 days & One year\\ Issuance & Automatic when Caddy starts & Manual CSR, validation, and upload\\ Renewal & Automatic, about 30 days before expiry & Manual, yearly\\ Risk & Depends on port 80 or DNS for validation & Forgotten manual renewal causes an outage\\ \bottomrule \end{tabular} \end{table} The team selected \textbf{Let's Encrypt through Caddy's automatic HTTPS} because issuance and renewal need no manual step, cost nothing after the first year, and require no private key handling by the team. The Namecheap certificate would save nothing and adds a yearly manual task that is easy to forget.\footnote{Let's Encrypt, \url{https://letsencrypt.org/}; Caddy automatic HTTPS, \url{https://caddyserver.com/docs/automatic-https}.} Caddy validates with the ACME HTTP-01 challenge, which needs port 80 open; that is why port 80 is allowed in the firewall. \paragraph{Proxy configuration and TLS termination.} The Caddyfile as of 29 September 2026 is: \begin{minted}{text} git.yebilly.me { reverse_proxy gitea:3000 } colors.yebilly.me { reverse_proxy color-buttons-app:3000 } \end{minted} The first block serves Gitea and is the one tested throughout this chapter. The second block, added on 29 September 2026, brings back the Assignment 3 Color Buttons site (\ChapterRef{DigitalOceanDockerDeployment}) at \url{https://colors.yebilly.me}. That container publishes no port: it joins the same private network, is capped at 96\,MiB of memory to protect Gitea on the 512\,MB droplet, and was added with a graceful \texttt{caddy reload}, so Gitea was not restarted. A laptop check at 03:45~UTC returned HTTP~200 for both hostnames, a 308 redirect for \texttt{http://colors.yebilly.me}, and a Let's Encrypt certificate for \texttt{CN=colors.yebilly.me} valid until 28 December 2026. Public ports were unchanged (22, 80, and 443 open from an approved address; 3000 closed). The Caddyfile change followed the same reviewed workflow: issue~\#10, pull request \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/11}{\#11} from branch \texttt{colors-site} (``Closes \#10''), approved by \texttt{vsun1} at 04:01:33~UTC and merged at 04:01:40~UTC as \texttt{d4d3c02f05}, closing issue~\#10. \gls{tls} terminates at the Caddy container. Caddy forwards decrypted requests as plain HTTP to \texttt{gitea:3000} over the private Docker network \texttt{gitea\_web}, which never leaves the droplet. \paragraph{Issuance.} Caddy obtained the first certificate about ten seconds after start-up (log excerpt, 26 September 2026 18:10~UTC): \begin{minted}{text} "msg":"enabling automatic TLS certificate management","domains":["git.yebilly.me"] "msg":"obtaining certificate","identifier":"git.yebilly.me" "msg":"successfully downloaded available certificate chains","count":3 "msg":"certificate obtained successfully","identifier":"git.yebilly.me", "issuer":"acme-v02.api.letsencrypt.org-directory" \end{minted} \paragraph{Redirect and certificate.} From a laptop (Windows \texttt{curl} does not print certificate fields, so Git Bash \texttt{openssl} was used for the certificate): \begin{minted}{text} PS> curl.exe -sI http://git.yebilly.me HTTP/1.1 308 Permanent Redirect Location: https://git.yebilly.me/ Server: Caddy Date: Sat, 26 Sep 2026 18:47:47 GMT $ echo | openssl s_client -connect git.yebilly.me:443 -servername git.yebilly.me \ 2>/dev/null | openssl x509 -noout -subject -issuer -dates -serial subject=CN=git.yebilly.me issuer=C=US, O=Let's Encrypt, CN=YE2 notBefore=Sep 26 17:11:53 2026 GMT notAfter=Dec 25 17:11:52 2026 GMT serial=05617625D662AFA9E4A7FC47B91DCB19C462 \end{minted} The HTTPS request returned \texttt{HTTP/1.1 200 OK}. The serial matches the certificate URL in Caddy's issuance log. Let's Encrypt back-dates \texttt{notBefore} by about an hour, which explains the 17:11 start for an 18:10 issuance. \paragraph{Renewal automation.} Caddy's background certificate-maintenance task renews each certificate automatically when roughly a third of its lifetime remains (about 30 days for a 90-day certificate), so this certificate should renew around late November 2026 without intervention. The certificate and ACME account persist in \texttt{caddy-data}, so container replacement does not force re-issuance. \paragraph{Renewal test.} Caddy has no dry-run command, so the team forced a real re-issuance once by deleting the stored certificate and restarting Caddy (one extra issuance is well within Let's Encrypt rate limits): \begin{minted}{text} $ date -u Sat Sep 26 18:50:35 UTC 2026 $ docker compose exec caddy ls /data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/ git.yebilly.me $ docker compose exec caddy rm -rf \ /data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/git.yebilly.me $ docker compose restart caddy $ docker compose logs --since 1m caddy | grep -i -E "obtain|certificate|error" "msg":"obtaining certificate","identifier":"git.yebilly.me" "msg":"successfully downloaded available certificate chains","count":3 "msg":"certificate obtained successfully","identifier":"git.yebilly.me", "issuer":"acme-v02.api.letsencrypt.org-directory" \end{minted} \begin{table}[H] \centering \caption{Certificate before and after the forced renewal (laptop \texttt{openssl})} \label{tab:gitea-renewal} \begin{tabular}{@{}lll@{}} \toprule & Before (18:48~UTC) & After (18:51~UTC)\\ \midrule Serial & \texttt{0561\ldots C462} & \texttt{066A\ldots D63E}\\ Issuer & Let's Encrypt YE2 & Let's Encrypt YE1\\ Not before & 26 Sep 2026 17:11:53 & 26 Sep 2026 17:52:17\\ Not after & 25 Dec 2026 17:11:52 & 25 Dec 2026 17:52:16\\ \bottomrule \end{tabular} \end{table} \StatusPass. A new certificate was issued and served without manual steps. A repeat check on 28 September 2026 17:30~UTC still showed the YE1 certificate and the 308 redirect. %--------------------------------------------------------------- \section{Firewall and External Exposure} \label{sec:gitea-firewall} \index{firewall} \paragraph{Cloud Firewall.} The DigitalOcean Cloud Firewall \texttt{gitea-fw} was created on 26 September 2026 and applied to the droplet \texttt{The-Ocean} (Figures~\ref{fig:gitea-fw-rules} and~\ref{fig:gitea-fw-droplets}). It is the public network boundary; DigitalOcean firewalls are stateful and drop all inbound traffic that no rule allows.\footnote{DigitalOcean, How to configure firewall rules, \url{https://docs.digitalocean.com/products/networking/firewalls/how-to/configure-rules/}.} \texttt{gitea-fw} is the only Cloud Firewall the team created. Because DigitalOcean combines the rules of every firewall attached to a droplet, the droplet's Networking tab must be re-checked for other attached firewalls whenever rules change. \begin{table}[H] \centering \caption{\texttt{gitea-fw} inbound rules} \label{tab:gitea-fw} \begin{tabular}{@{}L{0.17\linewidth}L{0.12\linewidth}L{0.33\linewidth}L{0.32\linewidth}@{}} \toprule Service & Port & Source & Purpose\\ \midrule SSH & TCP 22 & Approved team addresses only (redacted) & Administration\\ HTTP & TCP 80 & All IPv4, all IPv6 & Redirect to HTTPS; ACME HTTP-01 validation\\ HTTPS & TCP 443 & All IPv4, all IPv6 & Gitea through Caddy\\ Gitea backend & TCP 3000 & None (no rule) & Private; Docker network only\\ Database & none & n/a & SQLite is a file; no port\\ \bottomrule \end{tabular} \end{table} \paragraph{IPv4 and IPv6.} The droplet has both a public IPv4 and a public IPv6 address. DNS publishes only the IPv4 \texttt{A} record, so users reach \texttt{git.yebilly.me} over IPv4. The web rules allow both families so an \texttt{AAAA} record can be added later without a firewall change; everything not listed is blocked for both families. The external tests below were run over IPv4 only; an IPv6 test was not performed. \paragraph{Outbound.} The default outbound rules (ICMP, all TCP, all UDP to all IPv4 and IPv6) were kept. The droplet must reach Ubuntu package mirrors, Docker Hub, DNS resolvers, time servers, and the Let's Encrypt ACME API; blocking outbound traffic would break updates and certificate renewal. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-firewall-rules.png} \caption{\texttt{gitea-fw} rules (SSH source redacted), 26 September 2026} \label{fig:gitea-fw-rules} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-firewall-droplets.png} \caption{\texttt{gitea-fw} applied to the droplet \texttt{The-Ocean}} \label{fig:gitea-fw-droplets} \end{figure} \paragraph{Host and Compose port mappings.} Only the Caddy container publishes host ports, \texttt{80} and \texttt{443} (Section~\ref{sec:gitea-deploy}). Gitea's \texttt{3000} and \texttt{22} have no host mapping. Docker-published ports can bypass host \texttt{ufw} rules, which is why the Cloud Firewall, which sits outside the droplet, is the enforcing boundary and why exposure was tested from outside.\footnote{Docker, Packet filtering and firewalls, \url{https://docs.docker.com/engine/network/packet-filtering-firewalls/}.} \begin{figure}[H] \centering \begin{tikzpicture}[ node distance=0.9cm and 1.1cm, box/.style={draw, rounded corners, align=center, font=\small, minimum height=1.0cm}, arr/.style={-{Stealth}, thick}] \node[box] (user) {Team browser\\/ Git client}; \node[box, right=1.6cm of user, fill=devopsLightBlue] (fw) {Cloud Firewall\\\texttt{gitea-fw}}; \node[box, right=of fw] (caddy) {Caddy\\TLS proxy}; \node[box, right=of caddy] (gitea) {Gitea\\\texttt{:3000}}; \node[box, below=of gitea] (vol) {\texttt{gitea-data}\\SQLite + repos}; \node[box, below=1.4cm of user] (admin) {Team admin}; \draw[arr] (user) -- node[above, font=\scriptsize]{443 / 80} (fw); \draw[arr] (fw) -- (caddy); \draw[arr] (caddy) -- node[above, font=\scriptsize]{HTTP} (gitea); \draw[arr] (gitea) -- (vol); \draw[arr] (admin) -| node[pos=0.25, below, font=\scriptsize]{SSH 22, team IPs only} (fw); \node[draw, dashed, rounded corners, fit=(caddy) (gitea) (vol), inner sep=6pt, label={[font=\scriptsize]above:Droplet \texttt{The-Ocean} / Docker network \texttt{gitea\_web}}] {}; \end{tikzpicture} \caption{Network path: only the proxy's web ports are reachable publicly; Gitea and its SQLite data remain private} \label{fig:gitea-network} \end{figure} \paragraph{External test.} Two sources were used: a team laptop on an approved network (the SSH allow list includes it) and the public \texttt{portchecker.co} service, whose server is \emph{not} on the allow list. A scan from the droplet itself would not prove public exposure, so none is used as evidence. \begin{minted}{text} PS> (Get-Date).ToUniversalTime() # laptop, approved network 2026-09-26 21:54:22Z git.yebilly.me port 443: TcpTestSucceeded=True git.yebilly.me port 80: TcpTestSucceeded=True git.yebilly.me port 22: TcpTestSucceeded=True git.yebilly.me port 3000: TcpTestSucceeded=False \end{minted} \begin{table}[H] \centering \caption{External exposure results, 26 September 2026} \label{tab:gitea-exposure} \begin{tabular}{@{}llll@{}} \toprule Port & Source & Expected & Actual\\ \midrule 443 & Laptop (approved) & open & open \StatusPass\\ 80 & Laptop (approved) & open (308 redirect) & open \StatusPass\\ 22 & Laptop (approved) & open & open \StatusPass\\ 3000 & Laptop (approved) & blocked & blocked \StatusPass\\ 22 & portchecker.co (not approved) & blocked & closed \StatusPass\\ 443 & portchecker.co (not approved) & open & open \StatusPass\\ 3000 & portchecker.co (not approved) & blocked & closed \StatusPass\\ \bottomrule \end{tabular} \end{table} \begin{figure}[H] \centering \includegraphics[width=0.32\textwidth]{images/gitea-portcheck-22.png}\hfill \includegraphics[width=0.32\textwidth]{images/gitea-portcheck-443.png}\hfill \includegraphics[width=0.32\textwidth]{images/gitea-portcheck-3000.png} \caption{External check from \texttt{portchecker.co} (a non-approved source): 22 closed, 443 open, 3000 closed} \label{fig:gitea-portcheck} \end{figure} \paragraph{Why HTTPS does not replace a firewall.} HTTPS encrypts and authenticates traffic to the web interface only; it does nothing to other listening ports. Without the firewall, SSH would accept connection attempts from the whole internet, and any service accidentally published by Docker would be reachable. The firewall limits \emph{which} ports and sources can connect; HTTPS protects \emph{what} travels over the one port meant to be public. The deployment showed how quickly exposure is found: about three and a half minutes after the certificate was issued, Caddy logged a request from an internet scanner (user agent \texttt{l9scan}, \texttt{leakix.net}), because new certificates are published in public Certificate Transparency logs. %--------------------------------------------------------------- \section{Startup Team Workflow} \label{sec:gitea-workflow} \index{pull request} \index{branch protection} \paragraph{Organization and repository.} Organization \href{https://git.yebilly.me/ssw590-group1}{\texttt{ssw590-group1}}; product repository \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway}{\texttt{vpn-dns-gateway}} (public), built around the group's Project Proposal (\ChapterRef{ProjectProposal}). The README describes the product, its goals, and the review workflow; it was added through pull request~\#8. \begin{table}[H] \centering \caption{Members and roles} \label{tab:gitea-members} \begin{tabular}{@{}L{0.2\linewidth}L{0.4\linewidth}L{0.34\linewidth}@{}} \toprule Account & Role & Responsibility\\ \midrule \texttt{bill} (BY) & Site administrator; organization owner & Operates the server, authors changes\\ \texttt{vsun1} (VS) & Repository collaborator, Administrator permission & Reviews and merges pull requests\\ \bottomrule \end{tabular} \end{table} Self-registration is disabled, so the administrator creates accounts. \texttt{vsun1} currently holds Administrator permission on the repository. This is broader than reviewing requires; the branch-protection rule below binds administrators too, so it cannot bypass review, but reducing it to Write is a planned least-privilege follow-up. \paragraph{Backlog.} Six actionable issues were opened on 26 September 2026: \begin{table}[H] \centering \caption{Initial backlog} \label{tab:gitea-issues} \begin{tabular}{@{}lL{0.52\linewidth}ll@{}} \toprule \# & Title & Type & State\\ \midrule 1 & Add project description and goals to README & product & closed by PR~\#8\\ 2 & Compare WireGuard vs.\ OpenVPN memory footprint & product & open\\ 3 & Compare AdGuard Home vs.\ Pi-hole for DNS filtering & product & open\\ 4 & Add Gitea deployment files (compose + Caddyfile) to repo & operations & closed by PR~\#9\\ 5 & Document Cloud Firewall rules and external port test & operations & open\\ 6 & Set up renewal reminder for yebilly.me (expires 2027) & operations & open\\ \bottomrule \end{tabular} \end{table} \paragraph{Branch protection.} Rule \texttt{main}: no direct pushes, no force pushes, one required approval, and ``Administrators must follow branch protection rules''.\footnote{Gitea protected branches, \url{https://docs.gitea.com/usage/access-control/protected-branches/}.} A throw-away pull request~\#7 verified the rule: merging was blocked at ``0 of 1 official approvals granted'' and allowed only after an approval (Figures~\ref{fig:gitea-bp-enforced} and~\ref{fig:gitea-bp-approved}). PR~\#7 was then closed without merging. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-branch-protection-enforced.png} \caption{Protection enforced: merge blocked at 0 of 1 approvals} \label{fig:gitea-bp-enforced} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.8\textwidth]{images/gitea-branch-protection-admins.png} \caption{Administrators must follow the rule (no bypass)} \label{fig:gitea-bp-admins} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-branch-protection-approved.png} \caption{After a reviewer's approval the merge becomes possible (test PR~\#7, closed unmerged)} \label{fig:gitea-bp-approved} \end{figure} \paragraph{Two issue-to-merge traces.} Each change used an issue-linked branch, a pull request whose description contained a closing keyword, a peer approval, and a merge that closed the issue automatically. The author (\texttt{bill}) never merged their own change. \begin{table}[H] \centering \caption{Issue-to-merge traces (Gitea API, checked 28 September 2026 17:25~UTC)} \label{tab:gitea-traces} \begin{tabular}{@{}L{0.17\linewidth}L{0.39\linewidth}L{0.39\linewidth}@{}} \toprule Step & Issue \#1 (product) & Issue \#4 (operations)\\ \midrule Branch & \texttt{1-readme-description} & \texttt{4-deploy-files}\\ Pull request & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/8}{\#8}, body ``Closes \#1'' & \href{https://git.yebilly.me/ssw590-group1/vpn-dns-gateway/pulls/9}{\#9}, body ``closes \#4''\\ Author & \texttt{bill} & \texttt{bill}\\ Review & \texttt{vsun1} APPROVED, 27 Sep 01:26~UTC & \texttt{vsun1} APPROVED, 27 Sep 01:35~UTC\\ Merge & by \texttt{vsun1}, 01:34:09~UTC, commit \texttt{6f310c7085} & by \texttt{vsun1}, 01:35:21~UTC, commit \texttt{f0292ed11c}\\ Issue closed & \#1 at 01:34:09~UTC (at merge) & \#4 at 01:35:21~UTC (at merge)\\ \bottomrule \end{tabular} \end{table} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-pr8-open.png} \caption{PR~\#8 before review: linked to issue \#1, reviewer requested, merge blocked} \label{fig:gitea-pr8} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-pr9-open.png} \caption{PR~\#9 before review: linked to issue \#4, three deployment files} \label{fig:gitea-pr9} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.9\textwidth]{images/gitea-pr8-merged.png} \caption{PR~\#8 merged: approved by \texttt{vsun1}, merged as \texttt{6f310c7085}, closing issue \#1; the branch was then deleted} \label{fig:gitea-pr8-merged} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.9\textwidth]{images/gitea-pr9-merged.png} \caption{PR~\#9 merged: approved by \texttt{vsun1}, merged as \texttt{f0292ed11c}, closing issue \#4; the branch was then deleted} \label{fig:gitea-pr9-merged} \end{figure} On PR~\#8, \texttt{vsun1} also added and then removed a dependency on issue~\#1; this had no effect on the merge. Both reviews were recorded with the short comment ``Approved''. They satisfy the required approval, but future reviews should state what was checked. %--------------------------------------------------------------- \section{Architecture and Operation} \label{sec:gitea-architecture} \paragraph{Request path.} A browser or Git client resolves \texttt{git.yebilly.me} to \texttt{147.182.178.136}, passes the Cloud Firewall on TCP~443 (or on TCP~80, where Caddy answers with a 308 redirect to HTTPS), and reaches Caddy, which terminates TLS and forwards plain HTTP to \texttt{gitea:3000} on the private Docker network (Figure~\ref{fig:gitea-network}). \paragraph{Data path.} Gitea writes repositories, attachments, configuration, and the SQLite database to the \texttt{gitea-data} volume on the droplet's disk; Caddy keeps certificates in \texttt{caddy-data}. Nothing is stored inside the container layers. \begin{table}[H] \centering \caption{Public and private interfaces} \label{tab:gitea-interfaces} \begin{tabular}{@{}lll@{}} \toprule Interface & Exposure & Protected by\\ \midrule HTTPS 443 (Caddy) & Public & TLS, Gitea login\\ HTTP 80 (Caddy) & Public & Redirect only; no content\\ SSH 22 (droplet) & Team addresses only & Cloud Firewall, key-only login\\ Gitea 3000 & Private (Docker network) & No host mapping, no firewall rule\\ SQLite file & Private (volume) & Droplet filesystem permissions\\ \bottomrule \end{tabular} \end{table} \paragraph{Operation.} From \texttt{\textasciitilde/gitea} on the droplet: \begin{itemize} \item Status: \texttt{docker compose ps}; memory: \texttt{free -h}. \item Restart: \texttt{docker compose restart gitea} (or \texttt{caddy}); both also restart automatically after a reboot. \item Troubleshoot: \texttt{docker compose logs -f gitea caddy}. A site that does not load usually means Caddy failed to obtain a certificate (check DNS and port~80) or Gitea is not running. \item Upgrade: change the pinned tag in \texttt{docker-compose.yml} through a reviewed pull request, then \texttt{docker compose pull \&\& docker compose up -d}. \end{itemize} \paragraph{Persistence versus backup.} The persistence test in Section~\ref{sec:gitea-database} shows that data survives container replacement on the same disk. It is not a backup or restore test: a deleted volume, failed disk, or destroyed droplet would lose all data. A verified backup and restore to a separate instance (the optional extra credit) was not attempted. \paragraph{Cost and cleanup.} New costs are the domain (\$0 until 25 September 2027, then \$23.98 per year if renewed). The droplet already existed from Assignment 3; the Cloud Firewall and Let's Encrypt certificates add no charge. To shut down: \texttt{docker compose down} (add \texttt{-v} only to delete all Gitea data permanently), delete the \texttt{git} DNS record, remove \texttt{gitea-fw}, and let the domain expire. %--------------------------------------------------------------- \section{Manual Quality and Controls} \label{sec:gitea-quality} This update raises the manual to version 3.0, adds a dated Document History entry that names the new Hosts and Passwords tables (\ChapterRef{HostsPasswords}), and records the AI assistance in \ChapterRef{AIPromptLog}. Screenshots were checked for personal data before inclusion: the registrant's name and address, the SSH allow-list addresses, and all passwords are absent. No password, token, or private key appears in this manual or in the repositories. \begin{table}[H] \centering \caption{Failed tests and corrective actions} \label{tab:gitea-failures} \small \begin{tabular}{@{}L{0.48\linewidth}L{0.48\linewidth}@{}} \toprule Problem & Correction\\ \midrule \texttt{yebilly.me} returned NXDOMAIN from the \texttt{.me} registry after registration. & Checked that Namecheap BasicDNS was selected; the registry then delegated the domain to \texttt{dns1}/\texttt{dns2.registrar-servers.com}.\\ \texttt{git.yebilly.me} still did not resolve. & The \texttt{git} A record had not been saved; added it and confirmed with \texttt{nslookup}.\\ \texttt{Get-Date -AsUTC} failed in Windows PowerShell 5.1. & Used \texttt{(Get-Date).ToUniversalTime()}.\\ Port tests were first pasted into the droplet shell (\texttt{Test-NetConnection: command not found}). & Re-ran them from the laptop; a test on the droplet would not prove exposure anyway.\\ The first persistence test (20:45~UTC) ran before any issue existed. & Created issue \#1 and repeated the test at 21:46~UTC with both repository and issue present.\\ The repository was created without an initial commit. & Committed the initial README directly to \texttt{main} before protection was effective; all later changes used reviewed pull requests.\\ The protection rule was named ``Push Approval''; Gitea treats the rule name as the branch pattern, so \texttt{main} stayed unprotected and test PR~\#7 was mergeable with no approval. & Renamed the pattern to \texttt{main}; the API then reported \texttt{protected=True, required\_approvals=1}.\\ Administrators could still override the rule. & Enabled ``Administrators must follow branch protection rules''.\\ \bottomrule \end{tabular} \end{table} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{images/gitea-pr7-unprotected.png} \caption{Before the fix: test PR~\#7 mergeable with no approval because the rule did not match \texttt{main}} \label{fig:gitea-pr7-unprotected} \end{figure} \paragraph{Open follow-ups.} Reduce \texttt{vsun1} to Write permission; move any credentials kept outside the password managers into them; set the domain renewal reminder (issue \#6); consider an IPv6 exposure test and a backup and restore exercise. \fussy