Files
biz-bud/add-git-lab-cert.sh
Travis Vasceannie 8d09d6efb2 Add script and certificate for git.lab integration
- Introduce add-git-lab-cert.sh to automate the installation of the git.lab certificate into system stores for Ubuntu, CentOS, and Alpine Linux.
- Add git.lab.crt certificate file for secure connections.
- Enhance error handling in paperless agent to provide user-friendly fallback messages during LLM access issues.
- Improve receipt.py to refine price pattern matching and avoid treating unit-annotated numbers as prices.
2025-09-28 20:14:12 -04:00

67 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Script to add git.lab certificate to system certificate store
# This script needs to be run with sudo privileges
set -e
CERT_FILE="git.lab.crt"
CERT_NAME="git.lab"
echo "Adding git.lab certificate to system certificate store..."
# Check if certificate file exists
if [ ! -f "$CERT_FILE" ]; then
echo "Downloading certificate from git.lab..."
openssl s_client -connect git.lab:443 -servername git.lab < /dev/null 2>/dev/null | openssl x509 -outform PEM > "$CERT_FILE"
echo "Certificate saved to $CERT_FILE"
fi
# For Ubuntu/Debian systems
if [ -d "/usr/local/share/ca-certificates" ]; then
echo "Installing certificate for Ubuntu/Debian..."
sudo cp "$CERT_FILE" "/usr/local/share/ca-certificates/${CERT_NAME}.crt"
sudo update-ca-certificates
echo "Certificate added to Ubuntu/Debian certificate store"
fi
# For CentOS/RHEL/Fedora systems
if [ -d "/etc/pki/ca-trust/source/anchors" ]; then
echo "Installing certificate for CentOS/RHEL/Fedora..."
sudo cp "$CERT_FILE" "/etc/pki/ca-trust/source/anchors/${CERT_NAME}.crt"
sudo update-ca-trust
echo "Certificate added to CentOS/RHEL/Fedora certificate store"
fi
# For Alpine Linux
if [ -d "/usr/local/share/ca-certificates" ] && [ -f "/etc/alpine-release" ]; then
echo "Installing certificate for Alpine Linux..."
sudo cp "$CERT_FILE" "/usr/local/share/ca-certificates/${CERT_NAME}.crt"
sudo update-ca-certificates
echo "Certificate added to Alpine certificate store"
fi
# Also add to Git's certificate bundle as backup
echo "Creating Git-specific certificate bundle..."
if [ -f "/etc/ssl/certs/ca-certificates.crt" ]; then
cat /etc/ssl/certs/ca-certificates.crt "$CERT_FILE" > ~/.gitcerts.pem
git config --global http.sslCAInfo ~/.gitcerts.pem
echo "Git certificate bundle created at ~/.gitcerts.pem"
fi
echo ""
echo "Certificate installation complete!"
echo ""
echo "Testing Git connection..."
if git ls-remote --heads http://git.lab/vasceannie/biz-bud.git >/dev/null 2>&1; then
echo "✅ SUCCESS: Git can now connect to git.lab"
else
echo "❌ Git connection still failing. You may need to:"
echo " 1. Restart your terminal/shell"
echo " 2. Check if git.lab should be accessed via a different hostname"
echo " 3. Contact your GitLab administrator"
fi
echo ""
echo "To clean up the certificate file, run: rm $CERT_FILE"