Added first config files
This commit is contained in:
		
							parent
							
								
									b8387ed046
								
							
						
					
					
						commit
						b13125c8d8
					
				| @ -1,3 +1,3 @@ | |||||||
| # mpolden-echoip-setup | # echoip-server-setup | ||||||
| 
 | 
 | ||||||
| Scripts and configuration files for quickly setting up the echo lookup server created by mpolden - https://github.com/mpolden/echoip | Scripts and configuration files for quickly setting up the echo lookup server created by mpolden - https://github.com/mpolden/echoip | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | |||||||
|  | version: '3.8' | ||||||
|  | services: | ||||||
|  |   echoip: | ||||||
|  |     container_name: 'echoip' | ||||||
|  |     image: 'mpolden/echoip:latest' | ||||||
|  |     restart: unless-stopped | ||||||
|  |     command: [ | ||||||
|  |       "-p",  | ||||||
|  |       "-H", "X-Forwarded-For", | ||||||
|  |       "-a", "/geolite2/db/asn/GeoLite2-ASN.mmdb", | ||||||
|  |       "-c", "/geolite2/db/city/GeoLite2-City.mmdb", | ||||||
|  |       "-f", "/geolite2/db/country/GeoLite2-Country.mmdb" | ||||||
|  |      ]  | ||||||
|  |     ports: | ||||||
|  |       - '127.0.0.1:8085:8080' | ||||||
|  |     volumes: | ||||||
|  |       - ./geolite2/db/:/geolite2/db/:ro | ||||||
|  | 
 | ||||||
							
								
								
									
										21
									
								
								echoip-apache2.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								echoip-apache2.conf
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | |||||||
|  | <VirtualHost *:80> | ||||||
|  |   ServerName FULLY.QUALIFIED.DOMAIN.NAME | ||||||
|  |   RemoteIPHeader CF-Connecting-IP | ||||||
|  | 
 | ||||||
|  |   ProxyPreserveHost On | ||||||
|  |   ProxyRequests Off | ||||||
|  | 
 | ||||||
|  |   ProxyPass / http://127.0.0.1:8085/ | ||||||
|  |   ProxyPassReverse / http://127.0.0.1:8085 | ||||||
|  | 
 | ||||||
|  |   # Add support for X-Forwarded-For | ||||||
|  |   RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   ErrorLog ${APACHE_LOG_DIR}/echoip-error.log | ||||||
|  |   CustomLog ${APACHE_LOG_DIR}/echoip-access.log combined | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | </VirtualHost> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
							
								
								
									
										40
									
								
								geolite2-db-update.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								geolite2-db-update.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,40 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | 
 | ||||||
|  | # Define constants | ||||||
|  | BASE_URL="https://download.maxmind.com/geoip/databases" | ||||||
|  | AUTH="YOUR_ACCOUNT_ID:YOUR_LICENSE_KEY" | ||||||
|  | OUTPUT_DIR="$(dirname "$0")/geolite2/db" | ||||||
|  | CITY_FILE="GeoLite2-City" | ||||||
|  | ASN_FILE="GeoLite2-ASN" | ||||||
|  | COUNTRY_FILE="GeoLite2-Country" | ||||||
|  | 
 | ||||||
|  | # Create directory structure if it doesn't exist | ||||||
|  | mkdir -p "$OUTPUT_DIR/city" | ||||||
|  | mkdir -p "$OUTPUT_DIR/asn" | ||||||
|  | mkdir -p "$OUTPUT_DIR/country" | ||||||
|  | 
 | ||||||
|  | # Download, extract, and move the files | ||||||
|  | process_file() { | ||||||
|  |   local file_name=$1 | ||||||
|  |   local target_dir=$2 | ||||||
|  | 
 | ||||||
|  |   echo "Processing $file_name..." | ||||||
|  | 
 | ||||||
|  |   curl -O -J -L -u "$AUTH" "$BASE_URL/$file_name/download?suffix=tar.gz" | ||||||
|  | 
 | ||||||
|  |   # Extract the .tar.gz file | ||||||
|  |   tar -xzf "$file_name.tar.gz" --wildcards --strip-components=1 -C "$target_dir" "*/$file_name.mmdb" | ||||||
|  | 
 | ||||||
|  |   # Clean up the downloaded tar.gz file | ||||||
|  |   rm -f "$file_name.tar.gz" | ||||||
|  | 
 | ||||||
|  |   echo "$file_name processed and placed in $target_dir" | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | # Process each database | ||||||
|  | process_file "$CITY_FILE" "$OUTPUT_DIR/city" | ||||||
|  | process_file "$ASN_FILE" "$OUTPUT_DIR/asn" | ||||||
|  | process_file "$COUNTRY_FILE" "$OUTPUT_DIR/country" | ||||||
|  | 
 | ||||||
|  | echo "All files processed successfully." | ||||||
|  | 
 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user