From e3c80b5945f4666d487ad9cc33834d6f23e3c07f Mon Sep 17 00:00:00 2001 From: "Git Commiter for 96-fromsofia.net" <2a9-7cc@96-fromsofia.net> Date: Mon, 27 Feb 2023 01:13:43 +0000 Subject: [PATCH] First commit --- Dockerfile | 36 ++++++++++++++++++++++++ README.txt | 9 ++++++ git.domain.com.conf | 68 +++++++++++++++++++++++++++++++++++++++++++++ gitweb.conf | 14 ++++++++++ 4 files changed, 127 insertions(+) create mode 100644 Dockerfile create mode 100644 README.txt create mode 100644 git.domain.com.conf create mode 100644 gitweb.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cb6efe0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +# Select your image +FROM ubi9:latest + +# Install your packages and the perl modules required for gitweb +RUN yum install -y git make diffutils httpd php php-cli mod_fcgid perl-FCGI perl-filetest perl-Time-HiRes mod_ssl +RUN yum install -y https://dl.rockylinux.org/pub/rocky/9/AppStream/x86_64/os/Packages/p/perl-CGI-4.51-5.el9.noarch.rpm +RUN yum install -y https://rpmfind.net/linux/epel/9/Everything/x86_64/Packages/p/perl-FreezeThaw-0.5001-37.el9.noarch.rpm +RUN yum install -y http://repo.iotti.biz/CentOS/9/noarch/perl-CGI-Session-4.48-26.el9.lux.noarch.rpm + +# Configure the apache web server +RUN rm -f /etc/httpd/conf.d/*.conf +RUN chown apache:apache -R /etc/httpd/logs/ +RUN openssl dhparam -out /etc/httpd/dh4096.pem 4096 +RUN echo 'SSLOpenSSLConfCmd DHParameters /etc/httpd/dh4096.pem' >> /etc/httpd/conf.modules.d/00-ssl.conf +RUN sed -i 's/Listen 80/Listen 80\nListen 443/g' /etc/httpd/conf/httpd.conf +# RUN echo -e '\n Listen 443\n' >> /etc/httpd/conf/httpd.conf +ADD git.domain.com.conf /etc/httpd/conf.d/ +ADD gitweb.conf /etc/ + +# Configure the git user and build the gitweb script +RUN useradd git +RUN mkdir /srv/git +RUN chown git:git /srv/git +USER git +WORKDIR /home/git +RUN git clone git://git.kernel.org/pub/scm/git/git.git +WORKDIR git/ +RUN make GITWEB_PROJECTROOT="/srv/git" prefix=/usr gitweb +USER root +RUN cp -Rf gitweb /var/www/ +RUN mkdir /var/www/gitweb/custom +RUN rm -rf /home/git/git + +# Expose HTTP/S and run the apache web server +EXPOSE 80 443 +CMD ["/usr/sbin/httpd","-D","FOREGROUND"] diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..4a0afe0 --- /dev/null +++ b/README.txt @@ -0,0 +1,9 @@ +This Dockerfile is intended to sping up an apache web server with a gitweb repository. + +The process of using and setting up this solution has been detailed in the below article: +https://96-fromsofia.net/articles/git-to-ecs/ + +To build the container: +$ podman build -t gitweb:01 . + +If you have any question regarding this build you can email me at: 2a9-7cc@96-fromsofia.net diff --git a/git.domain.com.conf b/git.domain.com.conf new file mode 100644 index 0000000..54b6e11 --- /dev/null +++ b/git.domain.com.conf @@ -0,0 +1,68 @@ + + ServerName git.96-fromsofia.net + ServerAlias www.git.96-fromsofia.net + DocumentRoot /var/www/gitweb + + # Force HTTP to HTTPS redirects + #RewriteEngine On + #RewriteCond %{HTTPS} off + #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} + + + SetEnv GITWEB_CONFIG /etc/gitweb.conf + Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch + AllowOverride All + order allow,deny + Allow from all + AddHandler cgi-script .cgi + DirectoryIndex gitweb.cgi + + + SetHandler cgi-script + + + CustomLog /var/log/httpd/git.96-fromsofia.net-access.log combined + ErrorLog /var/log/httpd/git.96-fromsofia.net-error.log + + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + + + + ServerName git.96-fromsofia.net + ServerAlias www.git.96-fromsofia.net + DocumentRoot /var/www/gitweb + + SetEnv GITWEB_CONFIG /etc/gitweb.conf + Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch + AllowOverride All + order allow,deny + Allow from all + AddHandler cgi-script .cgi + DirectoryIndex gitweb.cgi + + + CustomLog /var/log/httpd/git.96-fromsofia.net-access.log combined + ErrorLog /var/log/httpd/git.96-fromsofia.net-error.log + + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + + # SSLEngine On + # SSLProtocol all -SSLv2 -SSLv3 + # SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS + # SSLHonorCipherOrder on + # SSLOptions +StrictRequire + # SSLCertificateFile /etc/letsencrypt/live/git.96-fromsofia.net/cert.pem + # SSLCertificateKeyFile /etc/letsencrypt/live/git.96-fromsofia.net/privkey.pem + # SSLCertificateChainFile /etc/letsencrypt/live/git.96-fromsofia.net/fullchain.pem + + + SetHandler cgi-script + + + BrowserMatch "MSIE [2-6]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0 + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + diff --git a/gitweb.conf b/gitweb.conf new file mode 100644 index 0000000..1521acc --- /dev/null +++ b/gitweb.conf @@ -0,0 +1,14 @@ +# AMEND DOMAIN NAME AND PATHS ACCORDINGLY!! +our $projectroot = "/srv/git/"; +our $logo = "custom/git-logo.png"; +our $logo_url = "https://example.com"; +our $favicon = "custom/favicon.ico"; +our $site_name = "example.com Git Repository"; +our $home_link_str = "example.com >> Git Projects"; +our $home_text = "custom/home_text.html"; +our $omit_age_column = "true"; +our $omit_owner = "true"; +our $my_url = "http://git.example.com/gitweb.cgi"; +our $base_url = "http://git.example.com/"; +our $snapshot = "false"; +our $timed = "true";