Giter Club home page Giter Club logo

localias's People

Contributors

peterldowns avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

localias's Issues

Unify logging format

Logs are emitted via manual printing, via caddy, etc. They look really ugly. Figure out a way to redirect and format the caddy logs, and unify with the log prints in the rest of the app. Allow json support and colorization. Clean up some of the noise.

Certificate validity length

I find that I often have to localias stop and localias start to trigger a renewal of my certificates. Is there an intended auto-refresh mechanism that isn't working, or is this just a feature request?

Create a bug report issue template

Makes everything easier if there's a template that prompts for:

  • operating system and version
  • hostname (hostname)
  • localias version (localias version)
  • how it was installed (brew? nix? binary download?)
  • rules (localias list / localias debug config / localias debug config --print)
  • logs when running (localias run)

Direct integrations with npm (pnpm specifically) to automatically create a local domain when a server is run

Example - localias serve frontend.test -- pnpm dev. Ideally it would be awesome if localias could grab the port on which the server is starting and assign the local domain but alternatively specifying the port also should work. After the command exits/is interrupted, the local domain can be removed

I can give this a try but the last time I touched Go was 2 years back so gonna need some help lol

insecure default

In config file example and readme

insecure2.test: 9002

But it actually redirect to https. For me is preferred to have HTTP default.

Password input doesn't work on Warp

Tried with localias run and localias daemon start, the password input wouldn't work (clicking enter after entering the password would do nothing) on Warp. Entering the password from the default macOS terminal worked for me

Automatically start the deamon during boot

Hi,

I've been using Hotel for a very long time and I'm glad that finally there is a great replacement. Would it be possible to add support for starting localias during boot (using plist on Mac and systemd unit on linux) or at least some instructions on how to do it?

Example for mac (I guess it should be stored in ~/Library/LaunchAgents/com.peterldowns.localias.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
  <key>Label</key>
  <string>com.peterldowns.localias</string>
  <key>ProgramArguments</key>
  <array>
    <string>/opt/homebrew/bin/localias</string>
    <string>start</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>StandardOutPath</key>
  <string>/Library/Logs/com.peterldowns.localias.out.log</string>
  <key>StandardErrorPath</key>
  <string>/Library/Logs/com.peterldowns.localias.err.log</string>
  <key>KeepAlive</key>
  <dict>
    <key>SuccessfulExit</key>
    <false/>
  </dict>
  <key>ThrottleInterval</key>
  <integer>5</integer>
  </dict>
</plist>

User Feedback #2

On Linux, installed via go install

  • Localias asked for a password when I followed the quickstart, then failed with error: loading new config: http app module: start: listening on :443: listen tcp :443: bind: permission denied. I looked this up and used stackoverflow to fix it instead of the Readme since the quickstart didn't mention this issue. It would be nice if Localias could catch this error and point users to the correct fix / link to the README for further explanation.
  • I use Firefox and all of the certificate stuff worked out of the box even though the about:config was default. Why was that? (Answer: because caddy will install its certs to firefox, and also java, if it can.

User Feedback #1

On MacOS, installed via brew

  • Explicit install/uninstall certificates commands would be nice
  • Documentation should explain that the root certificate being installed is generated on-device and is not shared. It should explain how to view it and how to remove it.
  • Documentation should explain when/how/why modifications are made to /etc/hosts. It should be clear that quitting the Localias process will leave the alias entries in /etc/hosts.
  • If the daemon isn't running, calling localias daemon stop and localias daemon reload should print nice error messages instead of complicated HTTP-related failures.
  • There should be a command for clearing entries from /etc/hosts.
  • Documentation should explain that we call sudo but do not capture your password ourselves. Running localias with sudo localias or authing to sudo in your shell session, then running localias, should prevent you from getting prompted.

User Feedback #3

On MacOS, installed via brew

  • User set up docs.local: 3000 as an address, but when visiting in browser, it (a) showed a cert warning, (b) sent the request to somewhere that wasn't localhost:3000. This was determined to be some kind of strange Bonjour problem. Advised
    • warn MacOS users if they add a .local alias if they're on a Mac
    • update quickstart / docs to explicitly recommend .test and .localhost
    • also warn against .dev (all environments)
  • User saw a strange TLS warning in the localias logs when starting up, but was not related to the above problem and could not reproduce. Most likely transient caddy warning? Look into this just in case it's something we can deal with.
  • localias run should warn if the daemon is known to be running.
  • debug command for creating github issues, making it easier to reproduce problems. What kind of dns/lookup commands should someone run if they hit this issue?

👋 You — yes, you — what do you think?

Hello, recently this repository has gotten a lot of attention, which is great! Unfortunately I cannot tell if anyone is actually using the software or if they find it useful.

If you're here checking out Localias, please consider leaving a comment, filing an issue, sending me a tweet, or emailing me to let me know what you think!

I'm happy to make improvements, so any and all suggestions or complaints would be deeply appreciated.

Thank you for considering Localias,

Peter

🙇‍♂️

Root cert not installed in local store with `localias start`

Happy to provide more context here but we found that unless we ran localias run, we wouldn't get the root cert installed in the local store. Running it as a daemon did prompt for sudo but for some reason it wasn't the same as running it in the foreground. I wanted to report it in case other people ran into it, or if the documentation should be updated or if it's something that can actually be worked around.

fails to server over https://test

daemon is running

via CLI i setup alias for "test: 8080"

localias debug config --print
# localias config file syntax
#
#       alias: port
#
# for example,
#
#   https://secure.test: 9000
#   http://insecure.test: 9001
#   insecure2.test: 9002
#   bareTLD: 9003
#
test: 8080

my little test server:
go run .

package main

import (
	"fmt"
	"net/http"
)

func main() {
	fmt.Print("starting on port: 8080")

	http.HandleFunc("/", HelloServer)
	http.ListenAndServe(":8080", nil)
}

func HelloServer(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello, %s!", r.URL.Path[1:])
}

```

test it:

```sh
url  http://localhost:8080/
Hello, !%                                          

test is via localias caddy proxy:

curl  https://test:443
curl: (6) Could not resolve host: test
curl  https://test 
curl: (6) Could not resolve host: test

subdomains not redirecting

Hi,
I was able to configure and successfully use localias in was wsl env (ubuntu 22.04). Everything works fine when i use my SLD (xxxx.test) but if I add my subdomain to my yaml file (admin.xxxx.test), it doesn't redirect properly

If you have any recommendations to get subdomains working, I'd greatly appreciate it

Drew

Certificate errors in the iOS simulator

Hi - curious if you have advice on how to get a native iOS app to accept the localias certificate in the simulator. I'm receiving the following error when I try to connect to https://server.local from within my app:

Task <731C070D-A88C-4699-89D6-CB17360CD660>.<6> finished with error [-1202] Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “server.local” which could put your confidential information at risk." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
    "<cert(0x10c6b3e00) s: server.local i: Localias Intermediate>",
    "<cert(0x10c6b4400) s: Localias Intermediate i: Localias Root>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https://server.local/api/graphql, NSErrorFailingURLStringKey=https://server.local/api/graphql, NSUnderlyingError=0x600000df9c50 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x600003470780>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9807, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9807, kCFStreamPropertySSLPeerCertificates=(
    "<cert(0x10c6b3e00) s: server.local i: Localias Intermediate>",
    "<cert(0x10c6b4400) s: Localias Intermediate i: Localias Root>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <731C070D-A88C-4699-89D6-CB17360CD660>.<6>"
), _kCFStreamErrorCodeKey=-9807, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <731C070D-A88C-4699-89D6-CB17360CD660>.<6>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x600003470780>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “server.local” which could put your confidential information at risk.}

I went to https://server.local in the Safari app inside the simulator and pressed the continue untrusted button, so I can now browse my local server just fine within Safari, but trusting this certificate this way does not seem to translate over into my app.

Error: failed to start mDNS server

When running localias with localias run, I'm getting an error that mDNS server cannot be started;

failed to start mDNS server:
could not determine host IP for .local domains: lookup Adrians-Macbook-Pro.local.local: no such host

When running $ hostname (on MacOS Sonoma 14.2.1), I'm getting in terminal: Adrians-Macbook-Pro.local.

I suspect the issue is from this line where it assumes that local is not already passed in:

baseIPs, err := net.LookupIP(baseHost + ".local")

I'd post a PR to only append .local if it doesn't already exist in the string but I'm not familiar with golang enough to contribute. Perhaps something like this could work:

userHost := baseHost

if strings.Contains(userHost, ".local") == false {
  userHost = userHost + ".local"
}

baseIPs, err := net.LookupIP(userHost)

Significant delay in request handling

All 7 or 8 of the applications I've added to localias so far are functioning, but have this weird quirk where certain requests take an extra 4-5 seconds to actually "start doing anything". The application receiving the request makes no acknowledgement of receiving the request until the very end, at which point the response happens in milliseconds, so it does seem like something in localias/caddy is getting hung up (or mDNS or something).

The extra detail that makes this a little more confusing is that the problem disappears temporarily when serving an app through a web browser. The initial request to the application has this large up-front delay, and then after the first page loads, things are as snappy as a direct connection. After a few minutes of inactivity, a subsequent request has the same up-front delay, then back to being quick.

I use a desktop application that sends queries to one of the services I have set up, and that service behaves as I describe above in a web browser, but when sending requests to it from this separate application, all requests have an up-front delay, and there is no "warm cache" effect happening. I suppose this would mean that the browser is doing something that the application is not. The application in question is actually an electron app, and I'm using a Chrome-based browser, so they are more similar than not.

Let me know if this is a clear explanation, my head is still not on straight this morning.

Other notes:

  • Pinging the localias domains correctly resolve to 127.0.0.1 and there is no delay
  • macOS Sonoma, M3 Pro Mac Mini
  • 2.0.1+commit.c358250

localias run: warning: "certutil" is not available, install "certutil" with "brew install nss" and try again

you can easily import mkcert to do all this, and not need any brew stuff

basically whenever a new domain is added, you run mkcert $(DOMAIN) and it will do all the trick cert trust stuff and gen the cert key and cert pem.

anyway here is the brew problem...

localias run


2023/07/21 11:11:34.192 INFO    admin   admin endpoint started  {"address": "unix//Users/apple/Library/Application Support/localias/caddy.sock", "enforce_origin": false, "origins": [""]}
2023/07/21 11:11:34.202 INFO    tls.cache.maintenance   started background certificate maintenance  {"cache": "0xc000118d20"}
2023/07/21 11:11:34.204 INFO    tls     cleaning storage unit   {"description": "FileStorage:/Users/apple/Library/Application Support/localias/caddy"}
2023/07/21 11:11:34.204 INFO    tls     finished cleaning storage units
2023/07/21 11:11:34.273 WARN    pki.ca.local    installing root certificate (you might be prompted for password)    {"path": "storage:pki/authorities/local/root.crt"}
2023/07/21 11:11:34.381 INFO    warning: "certutil" is not available, install "certutil" with "brew install nss" and try again

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.