-
Notifications
You must be signed in to change notification settings - Fork 3
Implement Slack integration with enhanced features and SSL support #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1e6287f
feat: implement Slack integration with comprehensive features and uni…
tusharkhan e5dcee0
refactor: update constructor parameters to nullable types and ensure …
tusharkhan a1ae081
Merge branch 'master' into dev/slack
tusharkhan e21146c
refactor: reorder Log import and clean up whitespace in Bot, Matcher,…
tusharkhan 34e96e1
feat: add cross-platform SSL configuration support for SlackDriver; i…
tusharkhan 02e49e4
feat: enhance SlackDriver with additional test cases and support for …
tusharkhan 9c2602a
chore: remove example SSL configuration route for Slack webhook
tusharkhan caa5265
slack test seems ok !
tusharkhan 4323a94
resolved all
tusharkhan 5c74b5d
resolved all log message
tusharkhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,209 @@ | ||
| # Cross-Platform SSL Configuration | ||
|
|
||
| The SlackDriver now supports automatic SSL certificate detection and configuration across Windows, macOS, and Linux operating systems. This document explains how the cross-platform SSL configuration works and how to use it. | ||
|
|
||
| ## Overview | ||
|
|
||
| The SSL configuration system automatically: | ||
| 1. Detects the operating system | ||
| 2. Searches for SSL certificates in common locations for that OS | ||
| 3. Provides fallback options for downloading certificates | ||
| 4. Configures SSL settings appropriately for local development | ||
|
|
||
| ## Supported Operating Systems | ||
|
|
||
| ### Windows | ||
| - **Laragon**: Automatically detects certificates at `D:\laragon\etc\ssl\cacert.pem` or `C:\laragon\etc\ssl\cacert.pem` | ||
| - **XAMPP**: Looks for certificates at `C:\xampp\php\extras\ssl\cacert.pem` | ||
| - **WAMP**: Searches in WAMP PHP SSL directories | ||
| - **User Directory**: `%USERPROFILE%\AppData\Local\chatbot-certs\` | ||
|
|
||
| ### macOS | ||
| - **Homebrew**: Checks `/usr/local/etc/openssl/cert.pem` and `/opt/homebrew/etc/openssl/cert.pem` | ||
| - **System**: Uses `/etc/ssl/cert.pem` | ||
| - **MAMP**: Looks in `/Applications/MAMP/conf/apache/ssl.crt/` | ||
| - **Valet**: Checks Valet certificate paths | ||
| - **User Directory**: `~/Library/Application Support/chatbot-certs/` | ||
|
|
||
| ### Linux | ||
| - **Ubuntu/Debian**: Uses `/etc/ssl/certs/ca-certificates.crt` | ||
| - **CentOS/RHEL**: Uses `/etc/pki/tls/certs/ca-bundle.crt` | ||
| - **Docker**: Checks container-specific paths | ||
| - **User Directory**: `~/.local/share/chatbot-certs/` | ||
|
|
||
| ## Configuration Methods | ||
|
|
||
| ### Method 1: Environment Variable (Recommended) | ||
| Set the `SLACK_CACERT_PATH` environment variable to point to your certificate file: | ||
|
|
||
| #### Windows | ||
| ```powershell | ||
| # PowerShell | ||
| $env:SLACK_CACERT_PATH = "C:\path\to\your\cacert.pem" | ||
|
|
||
| # Command Prompt | ||
| set SLACK_CACERT_PATH=C:\path\to\your\cacert.pem | ||
|
|
||
| # Permanently (requires restart) | ||
| setx SLACK_CACERT_PATH "C:\path\to\your\cacert.pem" | ||
| ``` | ||
|
|
||
| #### macOS/Linux | ||
| ```bash | ||
| # Temporary | ||
| export SLACK_CACERT_PATH="/path/to/your/cacert.pem" | ||
|
|
||
| # Permanent (add to ~/.bashrc, ~/.zshrc, or ~/.profile) | ||
| echo 'export SLACK_CACERT_PATH="/path/to/your/cacert.pem"' >> ~/.bashrc | ||
| ``` | ||
|
|
||
| ### Method 2: Laravel .env File | ||
| If you're using Laravel, add this to your `.env` file: | ||
| ```env | ||
| SLACK_CACERT_PATH=storage/certs/cacert.pem | ||
| ``` | ||
|
|
||
| ### Method 3: Automatic Download | ||
| The system can automatically download the certificate: | ||
|
|
||
| #### Windows (PowerShell) | ||
| ```powershell | ||
| # Create directory | ||
| New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\AppData\Local\chatbot-certs" | ||
| # Download certificate | ||
| Invoke-WebRequest -Uri "https://curl.se/ca/cacert.pem" -OutFile "$env:USERPROFILE\AppData\Local\chatbot-certs\cacert.pem" | ||
| # Set environment variable | ||
| $env:SLACK_CACERT_PATH = "$env:USERPROFILE\AppData\Local\chatbot-certs\cacert.pem" | ||
| ``` | ||
|
|
||
| #### macOS | ||
| ```bash | ||
| # Create directory | ||
| mkdir -p "$HOME/Library/Application Support/chatbot-certs" | ||
| # Download certificate | ||
| curl -o "$HOME/Library/Application Support/chatbot-certs/cacert.pem" https://curl.se/ca/cacert.pem | ||
| # Set environment variable | ||
| export SLACK_CACERT_PATH="$HOME/Library/Application Support/chatbot-certs/cacert.pem" | ||
| ``` | ||
|
|
||
| #### Linux | ||
| ```bash | ||
| # Create directory | ||
| mkdir -p "$HOME/.local/share/chatbot-certs" | ||
| # Download certificate | ||
| curl -o "$HOME/.local/share/chatbot-certs/cacert.pem" https://curl.se/ca/cacert.pem | ||
| # Set environment variable | ||
| export SLACK_CACERT_PATH="$HOME/.local/share/chatbot-certs/cacert.pem" | ||
| ``` | ||
|
|
||
| ## Development Environment Detection | ||
|
|
||
| The system automatically detects common development environments: | ||
|
|
||
| ### Windows | ||
| - **Laragon**: Looks for `LARAGON_ROOT` environment variable | ||
| - **XAMPP**: Checks for `XAMPP_ROOT` environment variable | ||
| - **WAMP**: Searches common WAMP installation directories | ||
|
|
||
| ### macOS | ||
| - **Homebrew**: Detects Homebrew installations | ||
| - **MAMP**: Looks for MAMP.app installations | ||
| - **Valet**: Checks for Laravel Valet configurations | ||
|
|
||
| ### Linux | ||
| - **Docker**: Detects container environments | ||
| - **Vagrant**: Looks for Vagrant-specific paths | ||
| - **System packages**: Uses system certificate stores | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Certificate Not Found | ||
| If you see SSL certificate errors: | ||
|
|
||
| 1. **Check environment variable**: | ||
| ```bash | ||
| # Windows (PowerShell) | ||
| echo $env:SLACK_CACERT_PATH | ||
|
|
||
| # macOS/Linux | ||
| echo $SLACK_CACERT_PATH | ||
| ``` | ||
|
|
||
| 2. **Verify certificate file exists**: | ||
| ```bash | ||
| # Check if file exists and is readable | ||
| ls -la /path/to/your/cacert.pem | ||
| ``` | ||
|
|
||
| 3. **Download manually**: | ||
| ```bash | ||
| curl -o cacert.pem https://curl.se/ca/cacert.pem | ||
| ``` | ||
|
|
||
| ### SSL Verification Issues | ||
| For development environments, the system automatically: | ||
| - Disables SSL peer verification | ||
| - Sets appropriate cURL options | ||
| - Configures stream contexts | ||
|
|
||
| ### Permission Issues | ||
| Ensure the certificate file and directory are readable: | ||
|
|
||
| #### Windows | ||
| ```powershell | ||
| # Check permissions | ||
| Get-Acl "C:\path\to\cacert.pem" | ||
| ``` | ||
|
|
||
| #### macOS/Linux | ||
| ```bash | ||
| # Check permissions | ||
| ls -la /path/to/cacert.pem | ||
|
|
||
| # Fix permissions if needed | ||
| chmod 644 /path/to/cacert.pem | ||
| ``` | ||
|
|
||
| ## Testing Your Configuration | ||
|
|
||
| Use the provided test script to verify your configuration: | ||
|
|
||
| ```bash | ||
| php test_cross_platform_ssl.php | ||
| ``` | ||
|
|
||
| This will show: | ||
| - Detected operating system | ||
| - Found certificate paths | ||
| - Environment variables | ||
| - Platform-specific recommendations | ||
|
|
||
| ## Production Considerations | ||
|
|
||
| 1. **Always use proper SSL certificates in production** | ||
| 2. **Don't disable SSL verification in production** | ||
| 3. **Use system-provided certificate stores when possible** | ||
| 4. **Set appropriate file permissions for certificate files** | ||
|
|
||
| ## Environment Variables Reference | ||
|
|
||
| - `SLACK_CACERT_PATH`: Path to your SSL certificate file | ||
| - `LARAGON_ROOT`: Laragon installation directory (Windows) | ||
| - `XAMPP_ROOT`: XAMPP installation directory (Windows) | ||
| - `SSL_CERT_FILE`: System SSL certificate file | ||
| - `SSL_CERT_DIR`: System SSL certificate directory | ||
| - `CURL_CA_BUNDLE`: cURL certificate bundle path | ||
|
|
||
| ## Automatic Fallbacks | ||
|
|
||
| The system provides these fallbacks in order: | ||
|
|
||
| 1. User-defined `SLACK_CACERT_PATH` environment variable | ||
| 2. Laravel storage directory (if available) | ||
| 3. OS-specific development server paths | ||
| 4. Current working directory | ||
| 5. PHP's default certificate settings | ||
| 6. Automatic download to user directory | ||
| 7. SSL verification bypass (development only) | ||
|
|
||
| This ensures maximum compatibility across different environments while maintaining security best practices. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.