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

Changes from upstream #2

Open
wants to merge 68 commits into
base: upstream
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d13cf5c
Add more target tests, add invalid keyID error code
tanyav2 Feb 9, 2021
d309f3c
create gitignore
natesales Apr 21, 2021
8101246
simplify cli config with flags
natesales Apr 21, 2021
aa1dd21
cleanup unnecessary constants
natesales Apr 21, 2021
fdc9664
testing: cleanup error handling and consistency with Go code style
natesales Apr 21, 2021
defbc4f
move resolver to CLI flag
natesales Apr 21, 2021
3b4aa6f
ignore PEM files and output binary
natesales Apr 21, 2021
921ef4c
require cert and key flags
natesales Apr 21, 2021
efb23da
proxy: handle errors safely
natesales Apr 21, 2021
ce46005
target: cleanup and handle errors
natesales Apr 21, 2021
daa7c73
Merge branch 'master' into tanya/more-target-tests
natesales Apr 21, 2021
17c6d1b
Merge pull request #1 from emeraldonion/tanya/more-target-tests
natesales Apr 21, 2021
b229226
update readme info
natesales Apr 21, 2021
f333972
ci: fix tests from fork
natesales Apr 21, 2021
178566a
tests: target test consistency
natesales Apr 21, 2021
3992a08
rename master to main
natesales Apr 21, 2021
b34be96
testing: fix resolver slice
natesales Apr 21, 2021
66bb82f
fix error handling
natesales Apr 21, 2021
71c9895
fix incorrect status code in test
natesales Apr 21, 2021
f8d8dd3
bump module versions
natesales Apr 21, 2021
3621823
pass verbose flag into targetServer
natesales Apr 21, 2021
89f8fb0
replace verbose bool with logging debug level
natesales Apr 21, 2021
cc42f5a
cleanup Makefile
natesales Apr 21, 2021
160d0bb
remove target telemetry
natesales Apr 21, 2021
22eef66
remove app deployment manifests
natesales Apr 21, 2021
8742f7d
remove useless name function
natesales Apr 21, 2021
5c9f8c8
add badges
natesales Apr 21, 2021
d23fd69
go mod tidy
natesales Apr 21, 2021
2cf438f
add coverage badge
natesales Apr 21, 2021
89be5e2
add coverage testing
natesales Apr 21, 2021
8fd3117
ci: fix coverage workflow name
natesales Apr 21, 2021
7265c9b
update repo name
natesales Apr 21, 2021
a7f5d38
add goreleaser release automation
natesales Apr 21, 2021
241ad26
ci: get gopherbadger
natesales Apr 21, 2021
f03650d
add optional TLS
natesales Apr 21, 2021
cca6f25
ci: update coverage
natesales Apr 21, 2021
400fea9
ci: set coverage bot account
natesales Apr 21, 2021
5f93dad
Merge remote-tracking branch 'origin/main' into main
natesales Apr 21, 2021
c9d09cc
set default target DNS resolver to localhost
natesales Apr 21, 2021
149830d
add usage info
natesales Apr 21, 2021
a8fae92
add in flight debug logs
natesales Apr 21, 2021
fa5fa14
ci: update coverage
github-actions[bot] Apr 21, 2021
9606a68
update package license
natesales Apr 22, 2021
d6481d1
Merge remote-tracking branch 'origin/main' into main
natesales Apr 22, 2021
5e1a4dc
add target and proxy timeouts
natesales Apr 22, 2021
e76c210
ci: update coverage
github-actions[bot] Apr 22, 2021
4f4ccc5
fix homepage URL
natesales Apr 22, 2021
15949d4
Merge remote-tracking branch 'origin/main' into main
natesales Apr 22, 2021
d999871
add target timeout test
natesales Apr 22, 2021
2523041
ci: update coverage
github-actions[bot] Apr 22, 2021
f9c028d
add main unit tests
natesales Apr 25, 2021
ecda2a8
Merge remote-tracking branch 'origin/main'
natesales Apr 25, 2021
53a7f3f
ci: update coverage
github-actions[bot] Apr 25, 2021
7210175
ignore cover.out
natesales Apr 25, 2021
034946a
Merge branch 'main' of https://github.com/emeraldonion/odoh-server-go
natesales Apr 25, 2021
817b60d
feat: add TLS server test
natesales Sep 16, 2021
6947aea
feat: add prometheus metrics
natesales Sep 16, 2021
2d2a588
feat: add prometheus metrics
natesales Sep 16, 2021
c19f7d6
refactor: remove extra ci workflow
natesales Sep 16, 2021
28b14bf
fix: generate self signed cert before test
natesales Sep 16, 2021
2647235
feat: add version flag
natesales Sep 26, 2021
c633101
ci: update coverage
github-actions[bot] Sep 26, 2021
f1a7743
bump to go 1.17 and update deps
natesales Nov 7, 2021
952e8b0
refactor: defer proxy response error handler
natesales Nov 7, 2021
ee6beb2
feat: add docker build
natesales Nov 7, 2021
d5fbba6
ci: update coverage
github-actions[bot] Nov 7, 2021
37ffe04
chore: bump dependencies
natesales Apr 15, 2022
d9989f6
refactor: remove ioutil and unused test code
natesales Apr 15, 2022
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
38 changes: 38 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run coverage testing

on:
push:
branches:
- main
paths:
- "*.go"

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.14

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Build
run: go build -v ./...

- name: Get gopherbadger
run: go get github.com/jpoles1/gopherbadger

- name: Run test
run: gopherbadger -style=for-the-badge -covercmd "go test -v -race -covermode atomic -coverprofile=coverage.out ./... && go tool cover -func=coverage.out"

- name: Commit coverage badge
uses: EndBug/add-and-commit@v7
with:
message: "ci: update coverage"
add: "coverage_badge.png"
author_name: "github-actions[bot]"
author_email: "github-actions[bot]@users.noreply.github.com"
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 12 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,25 @@ name: Build and Test

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.14

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi

- name: Build
run: go build -v ./...
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Test
run: go test -v -race -covermode atomic -coverprofile=covprofile ./...
- name: Build
run: go build -v ./...

- name: Install goveralls
env:
GO111MODULE: off
run: go get github.com/mattn/goveralls

- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: $(go env GOPATH)/bin/goveralls -coverprofile=covprofile -service=github

- name: Test
run: go test -v -race -covermode atomic ./...
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
*.pem
odohd
dist/
26 changes: 26 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
before:
hooks:
- go mod download
builds:
-
env:
- CGO_ENABLED=0
goos:
- linux
- freebsd
goarch:
- amd64
- arm64
nfpms:
- id: odohd
package_name: odohd
vendor: Emerald Onion
homepage: https://packetframe.com
maintainer: Nate Sales <[email protected]>
description: Oblivious DNS over HTTPS server
license: GNU GPL-3.0
Copy link
Member Author

Choose a reason for hiding this comment

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

given the use of MIT code from cloudflare, the easiest is to continue to mark this overall as an MIT package, if that's acceptable to you.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch, that's a mistake on my part. Fixed in 9606a68

Copy link
Member

Choose a reason for hiding this comment

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

And the hompage there is wrong too. Remnants from an old package. Fixed in 4f4ccc5

section: utils
priority: extra
formats:
- deb
- rpm
17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

1 change: 0 additions & 1 deletion Procfile

This file was deleted.

109 changes: 21 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,28 @@
# odoh-server-go
# odohd

[![Coverage Status](https://coveralls.io/repos/github/cloudflare/odoh-server-go/badge.svg?branch=master)](https://coveralls.io/github/cloudflare/odoh-server-go?branch=master)
[Oblivious DoH Server](https://tools.ietf.org/html/draft-pauly-dprive-oblivious-doh) based on [Cloudflare's odoh-server-go](https://github.com/cloudflare/odoh-server-go)

[Oblivious DoH Server](https://tools.ietf.org/html/draft-pauly-dprive-oblivious-doh)
![Coverage Badge](coverage_badge.png)
[![Go Report](https://goreportcard.com/badge/github.com/emeraldonion/odohd?style=for-the-badge)](https://goreportcard.com/report/github.com/emeraldonion/odohd)
[![License](https://img.shields.io/github/license/emeraldonion/odohd?style=for-the-badge)](https://raw.githubusercontent.com/emeraldonion/odohd/main/LICENSE)
[![Release](https://img.shields.io/github/v/release/emeraldonion/odohd?style=for-the-badge)](https://github.com/emeraldonion/odohd/releases)

# Preconfigured Deployments
This fork includes changes for a server suited to Emerald Onion's production deployment.

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
[![deploy to Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy)

# Local development

To deploy the server locally, first acquire a TLS certificate using [mkcert](https://github.com/FiloSottile/mkcert) as follows:

~~~
$ mkcert -key-file key.pem -cert-file cert.pem 127.0.0.1 localhost
~~~

Then build and run the server as follows:

~~~
$ make all
$ CERT=cert.pem KEY=key.pem PORT=4567 ./odoh-server
~~~

You may then run the [corresponding client](https://github.com/cloudflare/odoh-client-go) as follows:

~~~
$ ./odoh-client odoh --proxy localhost:4567 --target odoh.cloudflare-dns.com --domain cloudflare.com
;; opcode: QUERY, status: NOERROR, id: 14306
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cloudflare.com. IN AAAA

;; ANSWER SECTION:
cloudflare.com. 271 IN AAAA 2606:4700::6810:84e5
cloudflare.com. 271 IN AAAA 2606:4700::6810:85e5
~~~

# Usage

To deploy, run:

~~~
$ gcloud app deploy proxy.yaml
...
$ gcloud app deploy target.yaml
...
~~~

To check on its status, run:

~~~
$ gcloud app browse
~~~

To stream logs when deployed, run

~~~
$ gcloud app logs tail -s default
~~~

To run locally build and run the project using

```shell
go build
PORT=8080 ./odoh-server-go
```

By default, the proxy listens on `/proxy` and the target listens on `/dns-query`.

## Reverse proxy

You need to deploy a reverse proxy with a valid TLS server certificate
for clients to be able to authenticate the target or proxy.

The simplest option for this is using [Caddy](https://caddyserver.com).
Caddy will automatically provision a TLS certificate using ACME from [Let's Encrypt](https://letsencrypt.org).

For instance:
## Usage:

```
caddy reverse-proxy --from https://odoh.example.net:443 --to 127.0.0.1:8080
```

Alternatively, use a Caddyfile similar to:

```
odoh.example.net

reverse_proxy localhost:8080
Usage:
odohd [OPTIONS]

Application Options:
-l, --listen= Address to listen on (default: localhost:8080)
-r, --resolver= Target DNS resolver to query (default: 127.0.0.1:53)
-t, --no-tls Disable TLS
-c, --cert= TLS certificate file
-k, --key= TLS key file
-v, --verbose Enable verbose logging

Help Options:
-h, --help Show this help message
```
and run `caddy start`.
12 changes: 0 additions & 12 deletions app.json

This file was deleted.

5 changes: 0 additions & 5 deletions app.yaml

This file was deleted.

Binary file added coverage_badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 9 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
module github.com/cloudflare/odoh-server-go
module github.com/emeraldonion/odohd

go 1.14
go 1.16

require (
cloud.google.com/go/logging v1.1.1
github.com/cisco/go-hpke v0.0.0-20201215202025-9cebdf8f33d4
github.com/cloudflare/odoh-go v0.1.4
github.com/elastic/go-elasticsearch/v8 v8.0.0-20201022194115-1af099fb3eca
github.com/miekg/dns v1.1.35
github.com/cisco/go-hpke v0.0.0-20210215210317-01c430f1f302
github.com/cloudflare/odoh-go v0.1.6
github.com/jessevdk/go-flags v1.5.0
github.com/miekg/dns v1.1.41
github.com/sirupsen/logrus v1.8.1
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 // indirect
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 // indirect
)
Loading