From 5ed8131529d8349188b8a16d7f7b574bcfd73772 Mon Sep 17 00:00:00 2001 From: nmemmert <67961292+nmemmert@users.noreply.github.com> Date: Thu, 6 Nov 2025 14:56:23 -0500 Subject: [PATCH] adding entra info to installer --- nextgenpdf-install.sh | 71 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/nextgenpdf-install.sh b/nextgenpdf-install.sh index 5afe326..644d780 100644 --- a/nextgenpdf-install.sh +++ b/nextgenpdf-install.sh @@ -8,6 +8,45 @@ set -e echo "Starting installation of PDF Renamer Flask App..." +# Interactive configuration +echo "" +echo "=== PDF Renamer Configuration ===" +echo "" + +# Get domain name +read -p "Enter the domain name for this installation (e.g., nextgenpdf.trbc.org): " DOMAIN_NAME +if [ -z "$DOMAIN_NAME" ]; then + echo "ERROR: Domain name is required" + exit 1 +fi + +# Get Microsoft Entra ID configuration +echo "" +echo "=== Microsoft Entra ID Configuration ===" +echo "If you don't have these values yet, you can get them after installation." +echo "Leave blank to configure later." +echo "" + +read -p "Microsoft Entra Tenant ID (optional): " TENANT_ID +read -p "Microsoft Entra Client ID (optional): " CLIENT_ID +read -p "Microsoft Entra Client Secret (optional): " CLIENT_SECRET + +# Get admin credentials +echo "" +echo "=== Admin Login Configuration ===" +read -p "Admin username (default: trbcit): " ADMIN_USER +ADMIN_USER=${ADMIN_USER:-trbcit} + +read -s -p "Admin password (default: atdrmbicn): " ADMIN_PASS +echo "" +ADMIN_PASS=${ADMIN_PASS:-atdrmbicn} + +echo "" +echo "Configuration complete!" +echo "Domain: $DOMAIN_NAME" +echo "Admin User: $ADMIN_USER" +echo "" + # Check if already installed if systemctl is-active --quiet pdf-renamer 2>/dev/null; then echo "WARNING: PDF Renamer service is already running." @@ -91,11 +130,11 @@ User=$CURRENT_USER WorkingDirectory=/home/$CURRENT_USER/pdf-rename-sort Environment="PATH=/home/$CURRENT_USER/pdf-rename-sort/venv/bin" Environment="SECRET_KEY=CHANGE_THIS_SECRET_KEY_IN_PRODUCTION" -Environment="TENANT_ID=YOUR_MICROSOFT_ENTRA_TENANT_ID" -Environment="CLIENT_ID=YOUR_MICROSOFT_ENTRA_CLIENT_ID" -Environment="CLIENT_SECRET=YOUR_MICROSOFT_ENTRA_CLIENT_SECRET" -Environment="ADMIN_USERNAME=trbcit" -Environment="ADMIN_PASSWORD=CHANGE_THIS_PASSWORD" +Environment="TENANT_ID=${TENANT_ID:-YOUR_MICROSOFT_ENTRA_TENANT_ID}" +Environment="CLIENT_ID=${CLIENT_ID:-YOUR_MICROSOFT_ENTRA_CLIENT_ID}" +Environment="CLIENT_SECRET=${CLIENT_SECRET:-YOUR_MICROSOFT_ENTRA_CLIENT_SECRET}" +Environment="ADMIN_USERNAME=$ADMIN_USER" +Environment="ADMIN_PASSWORD=$ADMIN_PASS" ExecStart=/home/$CURRENT_USER/pdf-rename-sort/venv/bin/gunicorn --bind 127.0.0.1:3000 pdf_renamer:app Restart=always @@ -127,7 +166,7 @@ echo "Configuring Nginx reverse proxy for PDF Renamer..." sudo tee /etc/nginx/sites-available/pdf-renamer > /dev/null < Microsoft Entra ID > App registrations" echo "2. Create a new registration or use existing one" echo "3. Note the Application (client) ID and Directory (tenant) ID" echo "4. Add a client secret under Certificates & secrets" -echo "5. Add redirect URI: https://nextgenpdf.trbc.org/auth/microsoft/callback" +echo "5. Add redirect URI: https://$DOMAIN_NAME/auth/microsoft/callback" echo "6. Grant appropriate permissions if needed" echo "" echo "Next steps:" @@ -214,13 +258,12 @@ echo " - CLIENT_SECRET: Your Microsoft Entra client secret" echo " - ADMIN_USERNAME and ADMIN_PASSWORD: Set secure admin credentials" echo "" echo "2. Update the server_name in /etc/nginx/sites-available/pdf-renamer:" -echo " - Change 'pdf-renamer.your-domain.com' to 'nextgenpdf.trbc.org'" -echo " - Point your DNS for nextgenpdf.trbc.org to this server's IP" -echo "" -echo "3. For SSL/HTTPS, install certbot:" -echo " sudo apt install certbot python3-certbot-nginx" -echo " sudo certbot --nginx -d nextgenpdf.trbc.org" +echo " - Change 'pdf-renamer.your-domain.com' to '$DOMAIN_NAME'" +echo " - Point your DNS for $DOMAIN_NAME to this server's IP" echo "" +echo "3. SSL certificate has been automatically installed with Let's Encrypt" +echo " - Certificate for: $DOMAIN_NAME" +echo " - Auto-renewal is configured" echo "4. Reload systemd after updating environment variables:" echo " sudo systemctl daemon-reload" echo " sudo systemctl restart pdf-renamer" @@ -230,6 +273,6 @@ echo " sudo systemctl status pdf-renamer" echo " sudo systemctl status nginx" echo "" echo "NOTE: This setup runs alongside your existing app on port 5000." -echo "The PDF Renamer will be accessible at https://nextgenpdf.trbc.org." +echo "The PDF Renamer will be accessible at https://$DOMAIN_NAME." echo "File permissions have been set for web access (755 for directories)." echo "Installed for user: $CURRENT_USER" \ No newline at end of file