-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup_security.sh
More file actions
executable file
·84 lines (75 loc) · 2.28 KB
/
setup_security.sh
File metadata and controls
executable file
·84 lines (75 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# Security Setup Script for theOrb-web
# This script helps set up security configurations
echo "========================================="
echo " theOrb-web Security Setup"
echo "========================================="
echo ""
# Check if .env exists
if [ ! -f .env ]; then
echo "⚠️ No .env file found. Creating from .env.example..."
cp .env.example .env
echo "✅ Created .env file"
echo ""
echo "📝 IMPORTANT: Edit .env file and update the following:"
echo " - SECRET_KEY (generate a strong key)"
echo " - Database credentials"
echo " - API keys"
echo " - ALLOWED_ORIGINS for your domain"
echo ""
else
echo "✅ .env file exists"
fi
# Generate a strong SECRET_KEY
echo "🔑 Generating a strong SECRET_KEY..."
SECRET_KEY=$(python3 -c "import secrets; print(secrets.token_hex(32))")
echo ""
echo "Generated SECRET_KEY:"
echo "$SECRET_KEY"
echo ""
echo "📝 Add this to your .env file as:"
echo "SECRET_KEY=$SECRET_KEY"
echo ""
# Check Python version
echo "🐍 Checking Python version..."
python3 --version
echo ""
# Install dependencies
echo "📦 Installing dependencies..."
pip3 install --upgrade pip
pip3 install -r requirements.txt
echo "✅ Dependencies installed"
echo ""
# Check for vulnerabilities
echo "🔍 Checking for known vulnerabilities..."
if command -v safety &> /dev/null; then
safety check --json || echo "⚠️ Some vulnerabilities found. Review and update."
else
echo "ℹ️ Install 'safety' to check for vulnerabilities: pip install safety"
fi
echo ""
# Create logs directory
echo "📁 Creating logs directory..."
mkdir -p logs
chmod 755 logs
echo "✅ Logs directory created"
echo ""
# Summary
echo "========================================="
echo " Setup Complete!"
echo "========================================="
echo ""
echo "Next steps:"
echo "1. Edit .env file with your configuration"
echo "2. Update SECRET_KEY with the generated key above"
echo "3. Configure ALLOWED_ORIGINS for your domain"
echo "4. Run the application: python3 app.py"
echo ""
echo "For production deployment:"
echo "- Set FLASK_ENV=production"
echo "- Use a production-grade secret key"
echo "- Enable HTTPS"
echo "- Review SECURITY.md for best practices"
echo ""
echo "📖 Read SECURITY.md for complete security documentation"
echo ""