From: Elena Balakhonova Date: Sat, 5 Oct 2019 11:11:59 +0000 (+0300) Subject: Store passwords in file X-Git-Tag: v2.0.0~35 X-Git-Url: http://www.git.cypherpunks.ru/?p=gocheese.git;a=commitdiff_plain;h=bcbdb2f72f39589ebb4f8c4bddbe009380d9df8d Store passwords in file Other users can see the full command lines of the launched programs so passwords will be compromised on a multi-user system --- diff --git a/gocheese.go b/gocheese.go index 0942d3f..8188671 100644 --- a/gocheese.go +++ b/gocheese.go @@ -63,7 +63,7 @@ var ( norefreshURLPath = flag.String("norefresh", "/norefresh/", "Non-refreshing URL path") refreshURLPath = flag.String("refresh", "/simple/", "Auto-refreshing URL path") pypiURL = flag.String("pypi", "https://pypi.org/simple/", "Upstream PyPI URL") - auth = flag.String("auth", "spam:foo", "login:password,...") + auth = flag.String("auth", "passwd", "Path to file with login:passwd") fsck = flag.Bool("fsck", false, "Check integrity of all packages") version = flag.Bool("version", false, "Print version information") warranty = flag.Bool("warranty", false, "Print warranty information") @@ -425,7 +425,11 @@ func main() { } return } - for _, credentials := range strings.Split(*auth, ",") { + auth, err := ioutil.ReadFile(*auth) + if err != nil { + log.Fatal(err) + } + for _, credentials := range strings.Split(strings.TrimRight(string(auth), "\n"), "\n") { splitted := strings.Split(credentials, ":") if len(splitted) != 2 { log.Fatal("Wrong auth format")