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

fix(lk): correct cfg file permission check and bin name #385

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ GOBIN=$(shell go env GOBIN)
endif

cli: check_lfs
go build -ldflags "-w -s" -o bin/lk ./cmd/lk
GOOS=linux GOARCH=amd64 go build -o bin/lk-linux ./cmd/lk
GOOS=darwin GOARCH=arm64 go build -ldflags "-w -s" -o bin/lk ./cmd/lk
GOOS=linux GOARCH=amd64 go build -ldflags "-w -s" -o bin/lk-linux ./cmd/lk
GOOS=windows GOARCH=amd64 go build -ldflags "-w -s" -o bin/lk.exe ./cmd/lk


install: cli
cp bin/lk $(GOBIN)/
Expand Down
2 changes: 1 addition & 1 deletion cmd/lk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func main() {
}

func checkForLegacyName() {
if !strings.HasSuffix(os.Args[0], "lk") {
if !(strings.HasSuffix(os.Args[0], "lk") || strings.HasSuffix(os.Args[0], "lk.exe")) {
fmt.Fprintf(
os.Stderr,
"\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEPRECATION NOTICE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"+
Expand Down
4 changes: 3 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ func LoadOrCreate() (*CLIConfig, error) {
} else if err != nil {
return nil, err
} else if s.Mode().Perm()&0077 != 0 {
return nil, fmt.Errorf("config file %s should be 0600", configPath)
// because this file contains private keys, warn that
// only the owner should have permission to access it
fmt.Fprintf(os.Stderr, "WARNING: config file %s should have permissions %o\n", configPath, 0600)
}

content, err := os.ReadFile(configPath)
Expand Down
Loading