This repository has been archived by the owner on Jan 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63f3678
commit 83a6c97
Showing
9 changed files
with
138 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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,4 @@ | ||
MONGO_INITDB_DATABASE= | ||
MONGO_INITDB_ROOT_USERNAME= | ||
MONGO_INITDB_ROOT_PASSWORD= | ||
VIRTUAL_HOST= |
This file contains 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 |
---|---|---|
@@ -1,26 +1,25 @@ | ||
name: Auto Merge Dependabot PRs | ||
name: Dependabot auto-merge | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
on: pull_request | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
auto-merge: | ||
name: Auto-merge dependabot PRs | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
if: github.actor == 'dependabot[bot]' | ||
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'containerscrew/iproxy' | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/fetch-metadata@v2.2.0 | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Auto-merge PR if it bumps the clap dependency | ||
uses: pascalgn/automerge-action@v0.15.4 | ||
- name: Enable auto-merge for Dependabot PRs | ||
# if: contains(steps.metadata.outputs.dependency-names, 'my-dependency') && steps.metadata.outputs.update-type == 'version-update:semver-patch' | ||
run: gh pr merge --auto --merge "$PR_URL" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }} | ||
with: | ||
merge-method: squash | ||
#commit-message: "Auto-merged PR" | ||
#title: "^Bump clap from .*$" | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains 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 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 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 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,77 @@ | ||
user nginx; | ||
worker_processes auto; | ||
|
||
error_log /var/log/nginx/error.log notice; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
# Hide Nginx version information | ||
server_tokens off; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
# Set timeouts to mitigate slow client attacks | ||
client_body_timeout 12s; | ||
client_header_timeout 12s; | ||
keepalive_timeout 15s; | ||
send_timeout 10s; | ||
|
||
# Limit request sizes to prevent buffer overflow attacks | ||
client_max_body_size 10M; | ||
client_body_buffer_size 1k; | ||
client_header_buffer_size 1k; | ||
large_client_header_buffers 2 1k; | ||
|
||
# Define a rate limiting zone named 'mylimit' with a size of 10MB | ||
# Limit each IP to 10 requests per second | ||
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s; | ||
|
||
# Security headers to mitigate common attacks | ||
add_header X-Frame-Options "SAMEORIGIN" always; | ||
add_header X-XSS-Protection "1; mode=block" always; | ||
add_header X-Content-Type-Options "nosniff" always; | ||
add_header Referrer-Policy "strict-origin-when-cross-origin" always; | ||
add_header Content-Security-Policy "default-src 'self';" always; | ||
|
||
server { | ||
listen 80; | ||
server_name api.${VIRTUAL_HOST}; | ||
|
||
# Restrict allowed HTTP methods | ||
if ($request_method !~ ^(GET|HEAD|POST)$ ) { | ||
return 405; | ||
} | ||
|
||
location / { | ||
limit_req zone=mylimit burst=20 nodelay; | ||
limit_except GET { deny all; } | ||
|
||
proxy_pass http://iproxy:8000; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
|
||
# Define a custom error page for rate-limited responses | ||
error_page 429 /custom_429.html; | ||
location = /custom_429.html { | ||
internal; | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
} |
This file contains 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 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 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