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

Server: add and support unix listener (UDS) #18227

Merged
merged 1 commit into from Dec 9, 2022

Conversation

shaj13
Copy link
Contributor

@shaj13 shaj13 commented Dec 5, 2022

Fix #5491

hcl config

listener "unix" {}

listener "tcp" {
  address       = "127.0.0.1:8300"
  tls_cert_file = ""
  tls_key_file  = ""
  tls_disable   = 1
}

api_addr     = "http://127.0.0.1:8300"
cluster_addr = "http://127.0.0.1:8300"

storage "file" {
  path           = "/tmp/vault/storage"
  connection_url = ""
  ha_enabled     = false
}

Vault server logs:

==> Vault server configuration:

             Api Address: http://127.0.0.1:8300
                     Cgo: disabled
         Cluster Address: https://127.0.0.1:8301
   Environment Variables: DBUS_SESSION_BUS_ADDRESS, HOME, LANG, LC_CTYPE, LOGNAME, MOTD_SHOWN, OLDPWD, PATH, PWD, SHELL, SHLVL, SSH_CLIENT, SSH_CONNECTION, SSH_TTY, TERM, USER, XDG_DATA_DIRS, XDG_RUNTIME_DIR, XDG_SESSION_CLASS, XDG_SESSION_ID, XDG_SESSION_TYPE, _
              Go Version: go1.19.3
              Listener 1: unix (max_request_duration: "1m30s", max_request_size: "33554432")
              Listener 2: tcp (addr: "127.0.0.1:8300", cluster address: "127.0.0.1:8301", max_request_duration: "1m30s", max_request_size: "33554432", tls: "disabled")
               Log Level: info
                   Mlock: supported: true, enabled: false
           Recovery Mode: false
                 Storage: file
                 Version: Vault v1.13.0-dev1, built 2022-12-02T16:02:28Z
             Version Sha: 12b2fab87559d6da9ff38247902a540992867827+CHANGES

==> Vault server started! Log data will stream in below:

2022-12-05T18:20:16.511+0200 [INFO]  vault: proxy environment: http_proxy="" https_proxy="" no_proxy=""
2022-12-05T18:20:16.512+0200 [INFO]  vault.core: Initializing version history cache for core

Curl Example

curl --silent -XGET --unix-socket /run/vault.sock http://localhost/v1/sys/health | jq
{
  "initialized": false,
  "sealed": true,
  "standby": true,
  "performance_standby": false,
  "replication_performance_mode": "unknown",
  "replication_dr_mode": "unknown",
  "server_time_utc": 1670257271,
  "version": "1.13.0-dev1"
}

@hashicorp-cla
Copy link

hashicorp-cla commented Dec 5, 2022

CLA assistant check
All committers have signed the CLA.

@shaj13
Copy link
Contributor Author

shaj13 commented Dec 6, 2022

@raskchanky PTAL,
TestBackend_StaticRole_LockRegression fail, can re-run the job ?.

Copy link
Contributor

@raskchanky raskchanky left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! I think it looks great and would love to get it merged. Before doing so though, I think we need some documentation. Would you be up for writing some docs for this change? Specifically:

If you've never written Vault docs before, the website README has docs that show how to run the site locally via docker.

changelog/18227.txt Outdated Show resolved Hide resolved
@vercel
Copy link

vercel bot commented Dec 7, 2022

Someone is attempting to deploy a commit to the HashiCorp Team on Vercel.

A member of the Team first needs to authorize it.

@shaj13
Copy link
Contributor Author

shaj13 commented Dec 7, 2022

Thanks for working on this! I think it looks great and would love to get it merged. Before doing so though, I think we need some documentation. Would you be up for writing some docs for this change? Specifically:

* https://developer.hashicorp.com/vault/docs/configuration/listener should mention there's now multiple listener types and should link to a new page for the UDS listener, similar to the TCP one.

* A new page, similar to https://developer.hashicorp.com/vault/docs/configuration/listener/tcp but obviously less involved, mentioning what a Unix domain socket is, the available listener parameters that can be configured, and a few code examples. I also think your example showing how to connect to Vault over a UDS with curl would be an excellent addition.

If you've never written Vault docs before, the website README has docs that show how to run the site locally via docker.

@raskchanky Website and docs have been updated as well

image

Copy link
Contributor

@raskchanky raskchanky left a comment

Choose a reason for hiding this comment

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

The documentation looks great! Thanks for writing it up. I left a bunch of minor copy edits.

website/content/docs/configuration/listener/index.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/index.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
@shaj13
Copy link
Contributor Author

shaj13 commented Dec 8, 2022

The documentation looks great! Thanks for writing it up. I left a bunch of minor copy edits.

@raskchanky fantastic, the typo removed and docs updated per your suggestion 👍

Copy link
Contributor

@tjperry07 tjperry07 left a comment

Choose a reason for hiding this comment

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

Minor feedback.

website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
website/content/docs/configuration/listener/unix.mdx Outdated Show resolved Hide resolved
Copy link
Contributor

@tjperry07 tjperry07 left a comment

Choose a reason for hiding this comment

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

Just merge the unix and definition changes and it's good to go

@shaj13
Copy link
Contributor Author

shaj13 commented Dec 9, 2022

@raskchanky @tjperry07 PTAL, docs updated

Copy link
Contributor

@raskchanky raskchanky left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for your great contribution!

@shaj13 shaj13 requested a review from tjperry07 December 9, 2022 19:28
@raskchanky raskchanky merged commit 835e3ed into hashicorp:main Dec 9, 2022
@mladlow mladlow added this to the 1.13.0-rc1 milestone Dec 9, 2022
AnPucel pushed a commit that referenced this pull request Jan 14, 2023
Co-authored-by: shaj13 <hajsanad@gamil.com>
jayant07-yb pushed a commit to jayant07-yb/hashicorp-vault-integrations that referenced this pull request Mar 15, 2023
Co-authored-by: shaj13 <hajsanad@gamil.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support UDS (unix domain sockets) as listeners
6 participants