Code Monkey home page Code Monkey logo

gentoo-git's Introduction

Secure, Git-based Gentoo ebuild retrieval

  ______________________________________
/ This repo has been archived!           \
| Its successor is at:                   |
\ https://codeberg.org/duxsco/gentoo-git /
  --------------------------------------
         \   ^__^
          \  (oo)\_______
             (__)\       )\/\
                 ||----w |
                 ||     ||

Portage provides three official ways to fetch Gentoo ebuilds. While rsync saves network traffic, webrsync supports downloads over HTTPS. The following Git-based approach tries to combine the efficiency of rsync with the security of webrsync.

Install and harden dev-vcs/git:

emerge --select --noreplace dev-vcs/git && \
git config --system includeIf.gitdir:/var/db/repos/gentoo/.path /etc/portage/gitconfig && \
git config --file /etc/portage/gitconfig http.sslCAInfo /etc/ssl/certs/4042bcee.0 && \
git config --file /etc/portage/gitconfig http.sslCAPath /etc/ssl/certs/4042bcee.0 && \
git config --file /etc/portage/gitconfig http.sslVersion tlsv1.3 && \
git config --file /etc/portage/gitconfig protocol.allow never && \
git config --file /etc/portage/gitconfig protocol.https.allow always; echo $?

The resulting configuration should look like:

➤ cat /etc/gitconfig
[includeIf "gitdir:/var/db/repos/gentoo/"]
	path = /etc/portage/gitconfig

➤ cat /etc/portage/gitconfig
[http]
	sslCAInfo = /etc/ssl/certs/4042bcee.0
	sslCAPath = /etc/ssl/certs/4042bcee.0
	sslVersion = tlsv1.3
[protocol]
	allow = never
[protocol "https"]
	allow = always

I assume that certificates for the Git repository are issued by Let's Encrypt. Thus, I only allow this single root CA:

➤ openssl x509 -noout -hash -subject -issuer -in /etc/ssl/certs/4042bcee.0
4042bcee
subject=C = US, O = Internet Security Research Group, CN = ISRG Root X1
issuer=C = US, O = Internet Security Research Group, CN = ISRG Root X1

Enable git+https:

mkdir -p /etc/portage/repos.conf && \
rsync -a /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf && \
rsync -a /usr/share/portage/config/repos.conf /etc/portage/repos.conf/._cfg0000_gentoo.conf && \
sed -i \
    -e 's/^\(sync-type[[:space:]]*=[[:space:]]*\).*/\1git/' \
    -e 's#^\(sync-uri[[:space:]]*=[[:space:]]*\).*#\1https://anongit.gentoo.org/git/repo/sync/gentoo.git#' \
    -e '$ a sync-git-verify-commit-signature = yes' \
    /etc/portage/repos.conf/._cfg0000_gentoo.conf; echo $?

Execute dispatch-conf or etc-update and apply the changes to /etc/portage/repos.conf/gentoo.conf that way.

⚠️ For the (initial) clone, make sure that * Trusted signature found on top commit is printed out! ⚠️

As a last step, /var/db/repos/gentoo needs to be emptied and Gentoo ebuilds fetched:

find /var/db/repos/gentoo -maxdepth 1 -mindepth 1 -exec rm -rf {} + && \
chown portage:portage /var/db/repos/gentoo && \
emerge --sync

Other Gentoo Linux repos

https://github.com/duxsco?tab=repositories&q=gentoo-

gentoo-git's People

Contributors

duxsco avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.