-
Notifications
You must be signed in to change notification settings - Fork 241
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
actual Dockerfile and config in README #90
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,26 +19,29 @@ The simplest way to enable the forward proxy without authentication just include | |
Open a block for more control; here's an example of all properties in use (note that the syntax is subject to change): | ||
|
||
``` | ||
forwardproxy { | ||
basicauth user1 password1 | ||
basicauth user2 password2 | ||
ports 80 443 | ||
hide_ip | ||
hide_via | ||
probe_resistance secret-link-kWWL9Q.com # alternatively you can use a real domain, such as caddyserver.com | ||
serve_pac /secret-proxy.pac | ||
response_timeout 30 | ||
dial_timeout 30 | ||
upstream https://user:[email protected] | ||
acl { | ||
allow *.caddyserver.com | ||
deny 192.168.1.1/32 192.168.0.0/16 *.prohibitedsite.com *.localhost | ||
allow ::1/128 8.8.8.8 github.com *.github.io | ||
allowfile /path/to/whitelist.txt | ||
denyfile /path/to/blacklist.txt | ||
allow all | ||
deny all # unreachable rule, remaining requests are matched by `allow all` above | ||
} | ||
:80, :443 { | ||
log / stdout "{remote} - {user} [{when}] \"{method} {uri} {proto}\" {status} {size} \"{>Referer}\" \"{>User-Agent}\" {hostonly} {request_id} {latency_ms}" | ||
foxmeyson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
forwardproxy { | ||
basicauth user1 password1 | ||
basicauth user2 password2 | ||
ports 80 443 | ||
hide_ip | ||
hide_via | ||
probe_resistance secret-link-kWWL9Q.com # alternatively you can use a real domain, such as caddyserver.com | ||
serve_pac /secret-proxy.pac | ||
response_timeout 30 | ||
dial_timeout 30 | ||
upstream https://user:[email protected] | ||
acl { | ||
allow *.caddyserver.com | ||
deny 192.168.1.1/32 192.168.0.0/16 *.prohibitedsite.com *.localhost | ||
allow ::1/128 8.8.8.8 github.com *.github.io | ||
allowfile /path/to/whitelist.txt | ||
denyfile /path/to/blacklist.txt | ||
allow all | ||
deny all # unreachable rule, remaining requests are matched by `allow all` above | ||
} | ||
} | ||
} | ||
``` | ||
|
||
|
@@ -168,4 +171,4 @@ Licensed under the [Apache License](LICENSE) | |
|
||
USE AT YOUR OWN RISK. THIS IS DELIVERED AS-IS. By using this software, you agree and assert that authors, maintainers, and contributors of this software are not responsible or liable for any risks, costs, or problems you may encounter. Consider your threat model and be smart. If you find a flaw or bug, please submit a patch and help make things better! | ||
|
||
Initial version of this plugin was developed by Google. This is not an official Google product. | ||
Initial version of this plugin was developed by Google. This is not an official Google product. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,10 @@ | ||
FROM alpine:3.6 | ||
|
||
LABEL description="Docker image for caddy+forwardproxy plugin." | ||
LABEL maintainer="[email protected]" | ||
|
||
RUN apk add --no-cache ca-certificates bash curl | ||
|
||
RUN curl --fail https://getcaddy.com | bash -s http.forwardproxy | ||
|
||
COPY gen_caddyfile_and_start.sh /bin/ | ||
|
||
VOLUME /root/.caddy | ||
|
||
EXPOSE 80 443 2015 | ||
|
||
ENTRYPOINT /bin/gen_caddyfile_and_start.sh | ||
FROM golang:1.14.15 AS builder | ||
RUN git clone https://github.com/caddyserver/forwardproxy.git | ||
WORKDIR /go/forwardproxy/cmd/caddy | ||
RUN go build caddy.go | ||
|
||
FROM ubuntu:20.04 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, however, "Scratch" image gives you an empty file system, That is all it does. scratch on it's own does absolutely nothing, and has nothing in it. |
||
COPY --from=builder /go/forwardproxy/cmd/caddy/caddy /usr/bin/caddy | ||
EXPOSE 80 443 | ||
ENTRYPOINT ["/usr/bin/caddy"] | ||
CMD ["-conf", "/etc/caddy/Caddyfile", "--log", "/dev/stdout", "--agree=true"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where did /etc/caddy/Caddyfile come from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This case is good for Kubernetes - there you can put a config file as Config Map. I can describe a solution for Kubernetes, or put a default config in docker. In any case, it seems to me that it would be good to start the application with a configuration file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How will it be more convenient? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently existing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this set up auto-redirect from 80 to 443?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this runs the application "Caddy" in Docker on port 80 (for http) and on port 443 (for https), if not, then it cannot serve one of the ports.
You can separate them in the configuration, then you can set a different config for them, but in my cases, the same rules are processed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So :80 is not encrypted, and runs a proxy? That's a security and privacy issue -- we can't have such configuration suggested as a default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misunderstood the purpose of this line in the configuration, I corrected it in the commit: 78bd7d8