From 48fc93bbdcc4a23a6b12aab044291e1e2f5ab42b Mon Sep 17 00:00:00 2001 From: "Michael Ko. Gajda" Date: Mon, 29 Nov 2021 14:36:47 +0100 Subject: [PATCH 01/10] Add simple overview README for docs --- docs/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..b86d99fb --- /dev/null +++ b/docs/README.md @@ -0,0 +1,7 @@ +# Official headscale documentation + +* [Configuration](Configuration.md) +* [Running](Running.md) +* [DNS](DNS.md) +* [TLS](TLS.md) +* [Glossary](Glossary.md) From 78eba97bf9849c6acc5973382c2e758b60be1f09 Mon Sep 17 00:00:00 2001 From: "Michael Ko. Gajda" Date: Mon, 29 Nov 2021 14:37:00 +0100 Subject: [PATCH 02/10] Add GitHub templates --- .github/ISSUE_TEMPLATE/bug_report.md | 25 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 11 ++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 14 +++++++++++++ .github/ISSUE_TEMPLATE/other_issue.md | 25 +++++++++++++++++++++++ .github/pull_request_template.md | 10 +++++++++ 5 files changed, 85 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/other_issue.md create mode 100644 .github/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..2ca3ecfa --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,25 @@ +--- +name: 'Bug report' +about: 'Create a bug report to help us improve' +title: '' +labels: [ 'bug' ] +assignees: '' +--- + +**Bug description** + + +**To Reproduce** + + +**Context info** + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..d1937779 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +# Issues must have some content +blank_issues_enabled: false + +# Contact links +contact_links: + - name: "headsacle usage documentation" + url: "https://github.com/juanfont/headscale/blob/main/docs" + about: "Find documentation about how to configure and run headscale." + - name: "headscale Discord community" + url: "https://discord.com/invite/XcQxk2VHjx" + about: "Please ask and answer questions about usage of headscale here." diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..141ac042 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,14 @@ +--- +name: 'Feature request' +about: 'Suggest an idea for headscale' +title: '' +labels: [ 'enhancement' ] +assignees: '' +--- + +**Feature request** + + + diff --git a/.github/ISSUE_TEMPLATE/other_issue.md b/.github/ISSUE_TEMPLATE/other_issue.md new file mode 100644 index 00000000..7d9c11c3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other_issue.md @@ -0,0 +1,25 @@ +--- +name: 'Other issue' +about: 'Report a different issue' +title: '' +labels: [ 'bug' ] +assignees: '' +--- + + + +**Issue description** + + +**To Reproduce** + + +**Context info** + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..c7015806 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,10 @@ + + +- [] read the [CONTRIBUTING guidelines](README.md#user-content-contributing) +- [] raised a GitHub issue or discussed it on the projects chat beforehand +- [] added unit tests +- [] added integration tests +- [] updated documentation if needed +- [] updated CHANGELOG.md + + From 7e95b3501dcf8239e59c9cf6607ff67968d08b65 Mon Sep 17 00:00:00 2001 From: Eugen Date: Wed, 1 Dec 2021 19:32:47 +0100 Subject: [PATCH 03/10] Ignoe derp.yaml, don't panic in Serve() --- .gitignore | 1 + app.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 610550b9..ddec49c0 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ /headscale config.json config.yaml +derp.yaml *.key /db.sqlite *.sqlite3 diff --git a/app.go b/app.go index db788908..0fe65761 100644 --- a/app.go +++ b/app.go @@ -418,12 +418,12 @@ func (h *Headscale) Serve() error { err = h.ensureUnixSocketIsAbsent() if err != nil { - panic(err) + return err } socketListener, err := net.Listen("unix", h.cfg.UnixSocket) if err != nil { - panic(err) + return err } // Handle common process-killing signals so we can gracefully shut down: @@ -441,7 +441,7 @@ func (h *Headscale) Serve() error { networkListener, err := net.Listen("tcp", h.cfg.Addr) if err != nil { - panic(err) + return err } // Create the cmux object that will multiplex 2 protocols on the same port. From a6e99525aca8e32e1807f84017627e112b2e67ef Mon Sep 17 00:00:00 2001 From: Eugen Date: Wed, 1 Dec 2021 20:02:00 +0100 Subject: [PATCH 04/10] Add log_level to config, more ACL debug log --- .gitignore | 1 + acls.go | 7 +++++++ config-example.yaml | 2 ++ 3 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index ddec49c0..d047cbfd 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ config.json config.yaml derp.yaml +*.hujson *.key /db.sqlite *.sqlite3 diff --git a/acls.go b/acls.go index 1550c340..4017e28e 100644 --- a/acls.go +++ b/acls.go @@ -34,6 +34,11 @@ const ( // LoadACLPolicy loads the ACL policy from the specify path, and generates the ACL rules. func (h *Headscale) LoadACLPolicy(path string) error { + log.Debug(). + Str("func", "LoadACLPolicy"). + Str("path", path). + Msg("Loading ACL policy from path") + policyFile, err := os.Open(path) if err != nil { return err @@ -67,6 +72,8 @@ func (h *Headscale) LoadACLPolicy(path string) error { } h.aclRules = rules + log.Trace().Interface("ACL", rules).Msg("ACL rules generated") + return nil } diff --git a/config-example.yaml b/config-example.yaml index 692c605a..29b2f3ff 100644 --- a/config-example.yaml +++ b/config-example.yaml @@ -54,6 +54,8 @@ tls_letsencrypt_challenge_type: HTTP-01 tls_cert_path: "" tls_key_path: "" +log_level: info + # Path to a file containg ACL policies. acl_policy_path: "" From 0c13d9da156b03b4400c48a586a907c54d598ff9 Mon Sep 17 00:00:00 2001 From: "Michael Ko. Gajda" Date: Sat, 4 Dec 2021 18:51:09 +0100 Subject: [PATCH 05/10] Fix format with prettier --- .github/ISSUE_TEMPLATE/bug_report.md | 13 ++++++++----- .github/ISSUE_TEMPLATE/feature_request.md | 11 ++++++----- .github/ISSUE_TEMPLATE/other_issue.md | 13 ++++++++----- docs/README.md | 10 +++++----- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 2ca3ecfa..f0902132 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,20 +1,23 @@ --- -name: 'Bug report' -about: 'Create a bug report to help us improve' -title: '' -labels: [ 'bug' ] -assignees: '' +name: "Bug report" +about: "Create a bug report to help us improve" +title: "" +labels: ["bug"] +assignees: "" --- **Bug description** + **To Reproduce** + **Context info** + **Issue description** + **To Reproduce** + **Context info** +