From b51b5e8d29321a5c9feed0dd671a45ecd80b027a Mon Sep 17 00:00:00 2001 From: nmemmert <67961292+nmemmert@users.noreply.github.com> Date: Thu, 6 Nov 2025 10:03:53 -0500 Subject: [PATCH] Update for 500MB file uploads and enhance Entra ID setup instructions --- README.md | 2 +- pdf_renamer.py | 2 +- ubuntu-install.sh | 25 +++++++++++++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 38b7729..00d2a18 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Users can choose their preferred login method on the login page. - PDFs must contain fillable form fields named exactly "Last Name" and "First Name" - Files without these fields or with extraction errors will be skipped - All processing happens server-side with temporary file storage -- Maximum upload size is limited to 100MB +- Maximum upload size is limited to 500MB ## Production Deployment diff --git a/pdf_renamer.py b/pdf_renamer.py index 1c539ad..a6c1232 100644 --- a/pdf_renamer.py +++ b/pdf_renamer.py @@ -11,7 +11,7 @@ from authlib.integrations.flask_client import OAuth app = Flask(__name__) app.config['UPLOAD_FOLDER'] = tempfile.mkdtemp() -app.config['MAX_CONTENT_LENGTH'] = 100 * 1024 * 1024 # 100MB limit +app.config['MAX_CONTENT_LENGTH'] = 500 * 1024 * 1024 # 500MB limit app.secret_key = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production') # Entra ID Configuration diff --git a/ubuntu-install.sh b/ubuntu-install.sh index 4b4eb26..fc83ef2 100644 --- a/ubuntu-install.sh +++ b/ubuntu-install.sh @@ -46,9 +46,9 @@ User=ubuntu WorkingDirectory=/home/ubuntu/pdf-rename-sort Environment="PATH=/home/ubuntu/pdf-rename-sort/venv/bin" Environment="SECRET_KEY=CHANGE_THIS_SECRET_KEY_IN_PRODUCTION" -Environment="TENANT_ID=your-tenant-id" -Environment="CLIENT_ID=your-client-id" -Environment="CLIENT_SECRET=your-client-secret" +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" ExecStart=/home/ubuntu/pdf-rename-sort/venv/bin/gunicorn --bind 127.0.0.1:3000 pdf_renamer:app @@ -74,6 +74,9 @@ server { listen 80; server_name your-domain.com www.your-domain.com; + # Handle large file uploads (500MB) + client_max_body_size 500M; + # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-XSS-Protection "1; mode=block" always; @@ -139,10 +142,20 @@ sudo ufw --force enable echo "" echo "Installation completed successfully!" echo "" +echo "IMPORTANT: Configure Microsoft Entra ID authentication:" +echo "1. Go to Azure Portal > 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://your-domain.com/auth/microsoft/callback" +echo "6. Grant appropriate permissions if needed" +echo "" echo "Next steps:" echo "1. Update the environment variables in /etc/systemd/system/pdf-renamer.service:" -echo " - SECRET_KEY: Set a secure random key" -echo " - TENANT_ID, CLIENT_ID, CLIENT_SECRET: Configure for Microsoft Entra ID" +echo " - SECRET_KEY: Set a secure random key (use: openssl rand -hex 32)" +echo " - TENANT_ID: Your Microsoft Entra tenant ID" +echo " - CLIENT_ID: Your Microsoft Entra application ID" +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 to your actual domain" @@ -159,4 +172,4 @@ echo "5. Check service status:" echo " sudo systemctl status pdf-renamer" echo " sudo systemctl status nginx" echo "" -echo "The application should be accessible at your domain name on port 80." \ No newline at end of file +echo "The application supports ZIP files up to 500MB and will be accessible at your domain name." \ No newline at end of file