mirror of
				https://github.com/uklans/cache-domains
				synced 2025-11-04 13:28:51 +01:00 
			
		
		
		
	rpz: support custom basedomain via cli arg
This commit is contained in:
		
							parent
							
								
									2b87559ce8
								
							
						
					
					
						commit
						fd62eed0f8
					
				@ -2,6 +2,7 @@
 | 
				
			|||||||
basedir=".."
 | 
					basedir=".."
 | 
				
			||||||
outputdir="output/rpz"
 | 
					outputdir="output/rpz"
 | 
				
			||||||
path="${basedir}/cache_domains.json"
 | 
					path="${basedir}/cache_domains.json"
 | 
				
			||||||
 | 
					basedomain=${1:-lancache.net}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export IFS=' '
 | 
					export IFS=' '
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -27,19 +28,19 @@ done <<< $(jq -r '.cache_domains | to_entries[] | .key' config.json)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
rm -rf ${outputdir}
 | 
					rm -rf ${outputdir}
 | 
				
			||||||
mkdir -p ${outputdir}
 | 
					mkdir -p ${outputdir}
 | 
				
			||||||
outputfile=${outputdir}/db.rpz.lancache.net
 | 
					outputfile=${outputdir}/db.rpz.$basedomain
 | 
				
			||||||
cat > $outputfile << EOF
 | 
					cat > $outputfile << EOF
 | 
				
			||||||
\$TTL 60 ; default TTL
 | 
					\$TTL 60 ; default TTL
 | 
				
			||||||
\$ORIGIN rpz.lancache.net.
 | 
					\$ORIGIN rpz.$basedomain.
 | 
				
			||||||
@       SOA     ns1.lancache.net. admin.lancache.net. (
 | 
					@       SOA     ns1.$basedomain. admin.$basedomain. (
 | 
				
			||||||
		$(date +%Y%m%d01) ; serial
 | 
							$(date +%Y%m%d01) ; serial
 | 
				
			||||||
                604800     ; refresh (1 week)
 | 
					                604800     ; refresh (1 week)
 | 
				
			||||||
                86400      ; retry (1 day)
 | 
					                86400      ; retry (1 day)
 | 
				
			||||||
                2419200    ; expire (4 weeks)
 | 
					                2419200    ; expire (4 weeks)
 | 
				
			||||||
                86400      ; minimum (1 day)
 | 
					                86400      ; minimum (1 day)
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
        NS      ns1.lancache.net.
 | 
					        NS      ns1.$basedomain.
 | 
				
			||||||
        NS      ns2.lancache.net.
 | 
					        NS      ns2.$basedomain.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -103,11 +104,11 @@ Please include the rpz zone in your bind configuration"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
options {
 | 
					options {
 | 
				
			||||||
    [...]
 | 
					    [...]
 | 
				
			||||||
    response-policy {zone "rpz.lancache.net";};
 | 
					    response-policy {zone "rpz.$basedomain";};
 | 
				
			||||||
    [...]
 | 
					    [...]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
zone "rpz.lancache.net" {
 | 
					zone "rpz.$basedomain" {
 | 
				
			||||||
    type master;
 | 
					    type master;
 | 
				
			||||||
    file "/etc/bind/db.rpz.lancache.net";
 | 
					    file "/etc/bind/db.rpz.$basedomain";
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user