Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Member

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?

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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

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
}
}
}
```

Expand Down Expand Up @@ -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.
26 changes: 10 additions & 16 deletions docker-build/Dockerfile
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
Copy link

Choose a reason for hiding this comment

The 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"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where did /etc/caddy/Caddyfile come from?

Copy link
Author

Choose a reason for hiding this comment

The 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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will it be more convenient?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently existing gen_caddyfile_and_start.sh script (if it's still functional, haven't touched in a while) generates the config automatically. That seems convenient