neonmodem icon indicating copy to clipboard operation
neonmodem copied to clipboard

Add support for keyring password storage

Open tedwardd opened this issue 1 year ago • 7 comments

Add support for secure password storage in system keyring. Addresses #20

First pass just adds keyring support for Lemmy but it's a repeatable pattern. Might be better to consolidate in to a global method we can call to clean it up a little... might do that before merging...

tedwardd avatar Jun 16 '23 19:06 tedwardd

I encountered a merge conflict with go.mod and go.sum... I did my best to resolve the conflict but I fear I may have goofed. Please test and make sure you can still build using these new files.

tedwardd avatar Jun 16 '23 19:06 tedwardd

For what it's worth, I tested this branch locally (on MacOS) and worked great for me!

benonions avatar Jun 17 '23 00:06 benonions

That's excellent news, thank you! I need someone with Windows and someone with a Linux system (that has a keyring installed) to test it. I may be able to test a Linux keyring (I don't currently have one installed) but I do not have a Windows system available at this time.

tedwardd avatar Jun 17 '23 00:06 tedwardd

That's excellent news, thank you! I need someone with Windows and someone with a Linux system (that has a keyring installed) to test it. I may be able to test a Linux keyring (I don't currently have one installed) but I do not have a Windows system available at this time.

I might be able to test Ubuntu a little bit later, I've got it installed on a VM.

benonions avatar Jun 17 '23 00:06 benonions

Do not attempt to build https://github.com/mrusme/neonmodem/commit/df1594d2cdfe4b9f03d0d847d8ef1d77ef800a88, it is broken, pushed only to sync end-of-day changes (I'll rebase this whole mess before merging).

tedwardd avatar Jun 17 '23 01:06 tedwardd

Sadly didn't go as well on Ubuntu 23.04 with Gnome keyring.

Was able to log in and add the password to keyring, but starting neonmodem after that crashes.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x8f194c]

goroutine 1 [running]:
github.com/mrusme/neonmodem/cmd.loadSystems(0x40001880a0)
	/home/ben/neonmodem/cmd/root.go:105 +0x9c
github.com/mrusme/neonmodem/cmd.glob..func1(0x138f240?, {0xa6a043?, 0x0?, 0x0?})
	/home/ben/neonmodem/cmd/root.go:122 +0xb4
github.com/spf13/cobra.(*Command).execute(0x138f240, {0x4000032240, 0x0, 0x0})
	/home/ben/go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x5ac
github.com/spf13/cobra.(*Command).ExecuteC(0x138f240)
	/home/ben/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x340
github.com/spf13/cobra.(*Command).Execute(...)
	/home/ben/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/mrusme/neonmodem/cmd.Execute(0x95a980?)
	/home/ben/neonmodem/cmd/root.go:140 +0x4c
main.main()
	/home/ben/neonmodem/neonmodem.go:13 +0x24

Went over it with delve, looks like system.New() returns a nil system interface here

The error is that The specified item could not be found in the keyring. However, I looked at the keyring myself and it's there. So not sure what the dealio is.

benonions avatar Jun 17 '23 01:06 benonions

OK, after sleeping on it I have simpliefied the whole workflow with a fresh perspective. I've confirmed that it works on Linux without a keyring present and on MacOS with the MacOS keychain.

tedwardd avatar Jun 17 '23 15:06 tedwardd