first commit
This commit is contained in:
19
add_haproxy_domain.sh
Executable file
19
add_haproxy_domain.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/tcsh -f
|
||||
echo -n "Enter a name for the entry: "
|
||||
set name = $<
|
||||
echo -n "Enter the domain name for this entry: "
|
||||
set dname = $<
|
||||
echo -n "Enter the IP of the container for this entry: "
|
||||
set ip = $<
|
||||
echo -n "I will add an entry with name $name , domain name $dname and IP $ip. Is this correct? (y/n): "
|
||||
set correct = $<
|
||||
if ($correct == "y" || $correct == "Y") then
|
||||
sed -i '' -e 's/http_entry/http_entry \ \n\tacl '"$name"' hdr(host) -i '"$dname"' # '"$name"'\n\tacl '"$name"' hdr(host) -i www.'"$dname"' # '"$name"'\n/g'\
|
||||
-e 's/http_backend/http_backend \ \n\tuse_backend http_'"$name"' if '"$name"' # '"$name"'/g'\
|
||||
-e 's/http_ip/http_ip \ \n\nbackend http_'"$name"' # '"$name"'\n\tmode http # '"$name"'\n\toption httplog # '"$name"'\n\toption forwardfor # '"$name"'\n\tserver '"$name"' '"$ip"':80 # '"$name"'\n/g'\
|
||||
-e 's/https_entry/https_entry \ \n\tacl '"$name"' req.ssl_sni -i '"$dname"' # '"$name"'\n\tacl '"$name"' req.ssl_sni -i www.'"$dname"' # '"$name"'\n/g'\
|
||||
-e 's/https_backend/https_backend \ \n\tuse_backend https_'"$name"' if '"$name"' # '"$name"'/g'\
|
||||
-e 's/https_ip/https_ip \ \n\nbackend https_'"$name"' # '"$name"'\n\tmode tcp # '"$name"'\n\toption tcplog # '"$name"'\n\toption ssl-hello-chk # '"$name"'\n\tserver '"$name"' '"$ip"':443 # '"$name"'\n/g' haproxy.conf
|
||||
else
|
||||
echo "Cancelled!"
|
||||
endif
|
||||
Reference in New Issue
Block a user