The website for
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.3 KiB

<!DOCTYPE html>
<html lang="en">
<link href="/styles/default.css" rel="stylesheet" type="text/css" />
Finalising Everything
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<div id="wrapper">
<div id="header">
Finalising Everything
<div id="layout">
<div id="navigation">
<p class="link">
<a href="/index.html">
<p class="link">
<a href="/about.html">
About Me
<p class="link">
<a href="/contact.html">
Contact Me
<!--<p class="link">
<a href="/cv.html">
<p class="link">
<a href="">
My Blog
<div id="content">
<p>First off gitea will try to validate the SSL certificate we are using for postfix, but this is a self signed cert, and not valid for "localhost" so we need to patch the config file to not validate this certificate.</p>
<pre>sudo sed -i.bak '/mailer/a\
SKIP_VERIFY = true' /etc/gitea/app.ini</pre>
<p>Then we need to make gitea a service that will start when we start the server.</p>
<pre>cat << EOF | sudo tee -a /etc/systemd/system/gitea.service > /dev/null
Description=Gitea (Git with a cup of tea)
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
Environment=USER=git HOME=/var/lib/gitea GITEA_WORK_DIR=/var/lib/gitea
# If you want to bind Gitea to a port below 1024 uncomment
# the two values below
sudo systemctl enable gitea
sudo systemctl start gitea</pre>
<p>And finally we are using fail2ban to block IP addresses that are making too many failed logins over SSH from being able to brut force passwords, but now we have set up a server that allows logins over HTTPS, so we should block those too.</p>
<pre>cat << EOF | sudo tee -a /etc/fail2ban/filter.d/gitea.conf > /dev/null
# gitea.conf
failregex = .*Failed authentication attempt for .* from <HOST>
ignoreregex =
cat << EOF | sudo tee -a /etc/fail2ban/jail.d/jail.local > /dev/null
enabled = true
port = http,https
filter = gitea
logpath = /var/lib/gitea/log/gitea.log
maxretry = 10
findtime = 3600
bantime = 900
action = iptables-allports
sudo service fail2ban restart</pre>
<p>We should now have a working git server. If you set up an Admin user when configuring gitea in the previous steps then we are set. If not you should register a user now, as the first registered user will become admin. Once that is done your Git Server is ready to use.</p>
<p style="text-align:center;"><a href="/guides/building-a-git-repo/installgitea.html" title="Installing Gitea">Installing Gitea</a>|<a href="/guides/building-a-git-repo/" title="Building A git Repository Server">Main Page</a>|<a href="/guides/building-a-git-repo/other-considerations.html" title="Other Considerations">Other Considerations</a></p>