Add in 12 character threshold and crypto checking
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
#!/bin/bash
|
||||
# SME Server Password Change Application Installation Script
|
||||
# Enhanced SME Server Password Change Application Installation Script
|
||||
# Compatible with Python 3.6.8 and Flask 2.0.3
|
||||
# Features: Configurable password strength, visibility toggles, real-time validation
|
||||
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
APP_NAME="smeserver-password-app"
|
||||
APP_NAME="smeserver-password-app-enhanced"
|
||||
APP_DIR="/opt/$APP_NAME"
|
||||
SERVICE_NAME="smeserver-password-web"
|
||||
SERVICE_NAME="smeserver-password-enhanced"
|
||||
SERVICE_PORT=5000
|
||||
PYTHON_BIN="/usr/bin/python3"
|
||||
|
||||
echo "Installing SME Server Password Change Application (Python 3.6.8 Compatible)..."
|
||||
echo "Installing Enhanced SME Server Password Change Application..."
|
||||
echo "Features: Configurable strength, password visibility, real-time validation"
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
@@ -35,22 +37,29 @@ if [ "$PYTHON_VERSION" != "3.6" ]; then
|
||||
echo "Continuing with installation..."
|
||||
fi
|
||||
|
||||
# Stop existing service if running
|
||||
if systemctl is-active --quiet "$SERVICE_NAME" 2>/dev/null; then
|
||||
echo "Stopping existing service..."
|
||||
systemctl stop "$SERVICE_NAME"
|
||||
fi
|
||||
|
||||
# Create application directory
|
||||
echo "Creating application directory..."
|
||||
mkdir -p "$APP_DIR"
|
||||
|
||||
# Copy application files
|
||||
echo "Copying application files..."
|
||||
echo "Copying enhanced application files..."
|
||||
cp -r ./* "$APP_DIR/"
|
||||
|
||||
# Set permissions
|
||||
echo "Setting permissions..."
|
||||
chown -R root:root "$APP_DIR"
|
||||
chmod +x "$APP_DIR/app.py"
|
||||
chmod +x "$APP_DIR/demo_mode.py"
|
||||
chmod +x "$APP_DIR/install.sh"
|
||||
|
||||
# Install Python dependencies compatible with Python 3.6.8
|
||||
echo "Installing Python dependencies (Python 3.6.8 compatible)..."
|
||||
echo "Installing Python dependencies (Enhanced version)..."
|
||||
if command -v pip3 &> /dev/null; then
|
||||
pip3 install Flask==2.0.3 Flask-CORS==3.0.10 Werkzeug==2.0.3
|
||||
elif command -v yum &> /dev/null; then
|
||||
@@ -61,11 +70,29 @@ else
|
||||
echo "Please install Flask 2.0.3 and Flask-CORS 3.0.10 manually"
|
||||
fi
|
||||
|
||||
# Initialize password strength setting if not exists
|
||||
echo "Initializing password strength configuration..."
|
||||
if command -v db &> /dev/null; then
|
||||
# Check if passwordstrength entry exists
|
||||
if ! db configuration show passwordstrength &> /dev/null; then
|
||||
echo "Creating passwordstrength configuration entry..."
|
||||
db configuration set passwordstrength service
|
||||
db configuration setprop passwordstrength Passwordstrength normal
|
||||
echo "Password strength set to 'normal' (default)"
|
||||
else
|
||||
CURRENT_STRENGTH=$(db configuration getprop passwordstrength Passwordstrength 2>/dev/null || echo "normal")
|
||||
echo "Existing password strength setting: $CURRENT_STRENGTH"
|
||||
fi
|
||||
else
|
||||
echo "Warning: SME Server database tools not available"
|
||||
echo "Password strength will default to 'normal' in demo mode"
|
||||
fi
|
||||
|
||||
# Create systemd service file
|
||||
echo "Creating systemd service..."
|
||||
echo "Creating enhanced systemd service..."
|
||||
cat > "/etc/systemd/system/$SERVICE_NAME.service" << EOF
|
||||
[Unit]
|
||||
Description=SME Server Password Change Web Application
|
||||
Description=Enhanced SME Server Password Change Web Application
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
@@ -83,34 +110,60 @@ WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Reload systemd and enable service
|
||||
echo "Enabling service..."
|
||||
echo "Enabling enhanced service..."
|
||||
systemctl daemon-reload
|
||||
systemctl enable "$SERVICE_NAME"
|
||||
|
||||
# Start the service
|
||||
echo "Starting service..."
|
||||
echo "Starting enhanced service..."
|
||||
systemctl start "$SERVICE_NAME"
|
||||
|
||||
# Wait a moment for service to start
|
||||
sleep 3
|
||||
|
||||
# Check service status
|
||||
if systemctl is-active --quiet "$SERVICE_NAME"; then
|
||||
echo "✓ Service started successfully"
|
||||
echo "✓ Password change application is running on port $SERVICE_PORT"
|
||||
echo ""
|
||||
echo "Access the application at: http://your-server-ip:$SERVICE_PORT"
|
||||
echo "✓ Enhanced SME Server Password Change Application installed successfully!"
|
||||
echo ""
|
||||
echo "Python 3.6.8 and Flask 2.0.3 compatibility confirmed"
|
||||
echo "🔒 Features Available:"
|
||||
echo " ✓ Configurable password strength validation (None/Normal/Strong)"
|
||||
echo " ✓ Password visibility toggles for all password fields"
|
||||
echo " ✓ Real-time password strength indicator"
|
||||
echo " ✓ Admin configuration panel"
|
||||
echo " ✓ Enhanced crypto validation and pattern detection"
|
||||
echo " ✓ Python 3.6.8 and Flask 2.0.3 compatibility"
|
||||
echo ""
|
||||
echo "🌐 Access URLs:"
|
||||
echo " Main Application: http://your-server-ip:$SERVICE_PORT"
|
||||
echo " Admin Panel: http://your-server-ip:$SERVICE_PORT/admin"
|
||||
echo " Health Check: http://your-server-ip:$SERVICE_PORT/health"
|
||||
echo ""
|
||||
echo "⚙️ Configuration:"
|
||||
if command -v db &> /dev/null; then
|
||||
CURRENT_STRENGTH=$(db configuration getprop passwordstrength Passwordstrength 2>/dev/null || echo "normal")
|
||||
echo " Current password strength: $CURRENT_STRENGTH"
|
||||
echo " Change via admin panel or: db configuration setprop passwordstrength Passwordstrength [none|normal|strong]"
|
||||
else
|
||||
echo " Use admin panel to configure password strength levels"
|
||||
fi
|
||||
echo ""
|
||||
echo "🔧 Service Management:"
|
||||
echo " Status: systemctl status $SERVICE_NAME"
|
||||
echo " Logs: journalctl -u $SERVICE_NAME -f"
|
||||
echo " Stop: systemctl stop $SERVICE_NAME"
|
||||
echo " Restart: systemctl restart $SERVICE_NAME"
|
||||
echo ""
|
||||
echo "🧪 Testing:"
|
||||
echo " Demo mode: python3 $APP_DIR/demo_mode.py (runs on port 5002)"
|
||||
echo ""
|
||||
echo "To check service status: systemctl status $SERVICE_NAME"
|
||||
echo "To view logs: journalctl -u $SERVICE_NAME -f"
|
||||
echo "To stop service: systemctl stop $SERVICE_NAME"
|
||||
echo "To restart service: systemctl restart $SERVICE_NAME"
|
||||
else
|
||||
echo "✗ Failed to start service"
|
||||
echo "✗ Failed to start enhanced service"
|
||||
echo "Check logs with: journalctl -u $SERVICE_NAME"
|
||||
echo "Check if port $SERVICE_PORT is available: netstat -tlnp | grep $SERVICE_PORT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Installation completed successfully!"
|
||||
echo "Application is compatible with Python 3.6.8 and Flask 2.0.3"
|
||||
echo "Enhanced SME Server Password Change Application installation completed!"
|
||||
echo "Enjoy the new configurable password strength and visibility features!"
|
||||
|
||||
|
Reference in New Issue
Block a user