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

Non-self IPNS names need republishing #3808

Closed
ghost opened this issue Mar 21, 2017 · 31 comments
Closed

Non-self IPNS names need republishing #3808

ghost opened this issue Mar 21, 2017 · 31 comments
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) topic/ipns Topic ipns
Milestone

Comments

@ghost
Copy link

ghost commented Mar 21, 2017

Version information: 0.4.7

Type:

Priority: P2

Description:

It doesn't look like names added by ipfs key gen ever get republished. I didn't actually test it, but I'm fairly certain there's no code for it.

It should:

  • at startup, call Republisher.AddName() for each key in the keystore.
  • same for every run of ipfs key gen, add the name to the republisher.

cc @edsilv I think this will affect you. You'll have to run ipfs name publish --key=<name> <hash> every 12 hours, for now.

@ghost ghost added kind/bug A bug in existing code (including security flaws) exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue topic/ipns Topic ipns labels Mar 21, 2017
@whyrusleeping
Copy link
Member

@lgierth correct. There is another issue open for this.

We were waiting on figuring out proper UX for this

@edsilv
Copy link

edsilv commented Mar 24, 2017

@lgierth I can confirm that republishing approx every 12 hours is necessary.

@whyrusleeping
Copy link
Member

@edsilv I'm trying to figure out a good UX for the automatic republishing. I don't want to automatically republish values for every single key in the keystore (I have over 1000 in my local keystore, for testing) but i want it to be easy for users to opt into republishing.

Would starting republishing on a key after you've published anything with it once feel like a good solution to you?

cc @Kubuxu @lgierth

@edsilv
Copy link

edsilv commented Mar 24, 2017

@whyrusleeping I think it feels like an opt-out thing where I would have assumed that the content would be permanently available at that key. Perhaps you could pass --republish=false if you want to opt out, and it defaults to true?

@whyrusleeping
Copy link
Member

@edsilv Hrm... maybe i should provide an example of what i mean:

$ ipfs key gen beepboop --type ed25519
QmXxaV486674p7N4TVRwwbic1rkHZVa5Jn3vmNH3BeiX9h
$ # at this point, nothing is being published or republished for this key
$ ipfs name publish --key=beepboop QmaFLV5q4Gs3x89evD4ZXZrjqUWnybU5Zb9iP5ymzfYvXE
Published to QmXxaV486674p7N4TVRwwbic1rkHZVa5Jn3vmNH3BeiX9h: /ipfs/QmaFLV5q4Gs3x89evD4ZXZrjqUWnybU5Zb9iP5ymzfYvXE
$ # Now the value is published to that key, and it will continue to be republished until you delete the key

@edsilv
Copy link

edsilv commented Mar 24, 2017

That's what I did, except I used --type rsa --size 2048

https://gist.github.com/edsilv/2c80b0d565352e5cd6b7ceba5fbc156a

@whyrusleeping
Copy link
Member

@edsilv My above comment was proposing a UX, not describing what is now. Would what i posted feel like 'correct' behaviour? (I think so )

@edsilv
Copy link

edsilv commented Mar 24, 2017

@whyrusleeping Yep, looks right. Potentially with an extra option to opt-out of republishing. Sorry for the misunderstanding...

@whyrusleeping
Copy link
Member

No worries, We will try and have this done for the 0.4.9 relelase :)

@matthewrobertbell
Copy link

If I am regularly resolving the value of an IPNS key, and the publishing node goes down for more than 12? hours, does that mean that resolving will fail, or are names I've looked up recently automatically republished?

If not, I think this would be great functionality, and it seems related to this issue. I feel this is especially important for being able to reliably get content on non-internet connected networks.

@ghost
Copy link
Author

ghost commented Mar 26, 2017

Hrm... maybe i should provide an example of what i mean:

[...]

LGTM 👍

@whyrusleeping
Copy link
Member

This one is pretty high priority, can someone help out and work on it?

@whyrusleeping whyrusleeping modified the milestones: Ipfs 0.4.10, Ipfs 0.4.9 May 8, 2017
@keremgocen
Copy link
Contributor

I'd like to have a go at it @whyrusleeping.

As I gather from comments, could you please review these action items?;

  • you're expecting every key in the keystore to be republished at startup unless the flag --republish=false is provided for a particular key during it's creation?
  • what would be a good option to retain a key's republish state to check when traversing through the found keys?

@whyrusleeping
Copy link
Member

@keremgocen Great!
The first thing i'd like to see, would be on daemon startup, adding any keys to the republisher that have had a value previously published for them (as evidenced by a locally stored value in the datastore for that key). The flag to opt out of publishing a particular key can come later.

@kevina
Copy link
Contributor

kevina commented May 27, 2017

@keremgocen, @whyrusleeping asked me to have a look at this, have you done anything with it yet?

@kevina kevina self-assigned this May 27, 2017
@keremgocen
Copy link
Contributor

keremgocen commented May 27, 2017

@kevina unfortunately I did not invest any time in implementing this yet but the action items have been laid out previously and it should be easy to take it from there, thanks!

@kevina
Copy link
Contributor

kevina commented May 27, 2017

@whyrusleeping are you looking for something like this in setupIpnsRepublisher:

	for _, peer := range n.Peerstore.Peers() {
		n.IpnsRepub.AddName(peer)
	}

or is there something more I need to do? Sorry I'm not very familiar with that part of the codebase.

@whyrusleeping
Copy link
Member

@kevina you'll want to grab the keys to republish from the keystore, not the peerstore. Also make sure to only add keys to the republisher if they already have a value published for them (just check locally)

@kevina
Copy link
Contributor

kevina commented May 28, 2017

@whyrusleeping so how do I check locally? Where is that information stored.

@whyrusleeping
Copy link
Member

Oh, it looks like the republisher already does all that checking: https://github.com/ipfs/go-ipfs/blob/master/namesys/republisher/repub.go#L91

I think all you need to do then is add all the names (peer.IDs) from the keystore into the republisher on startup.

@whyrusleeping
Copy link
Member

@kevina so around here: https://github.com/ipfs/go-ipfs/blob/master/core/core.go#L376

For each item in n.Keystore.List() you'll have to call keystore.Get() and turn that private key into a peer ID and add that peer.ID to the republisher.

To test this, take a look at t0240. You'll want to have one node make a new key, and publish something with it, then run through those tests with the newly created key. This also reminds me that we probably want to add newly created keys to the republisher in ipfs key gen so they don't have to restart their daemon to get keys to auto-republish.

@kevina
Copy link
Contributor

kevina commented May 30, 2017

@whyrusleeping okay thanks, I think I can figure it out now, there where a few key points I wasn't getting.

@kevina
Copy link
Contributor

kevina commented May 31, 2017

@whyrusleeping does this look right?

	ks := n.Repo.Keystore()
	keys, err := ks.List()
	if err != nil {
		return err
	}
	for _, keyId := range keys {
		privKey, err := ks.Get(keyId)
		if err != nil {
			return err
		}
		peer, err := peer.IDFromPrivateKey(privKey)
		if err != nil {
			return err
		}
		n.IpnsRepub.AddName(peer)
	}

inserted at the place you suggested.

@whyrusleeping
Copy link
Member

Looks about right, yeah

@kevina
Copy link
Contributor

kevina commented Jun 1, 2017

@whyrusleeping based on the current implementation it seams to me it would be better to have the re-publisher just iterator thorough the keystore directory rather than have its own republish list, #3951 does exactly that, it won't try and republish keys without any local ipns names anyway so i'm not sure what purpose having a separate republish list is serving. This way we don't need to worry about populating the list on startup or added newly generated keys when after ipfs key gen

What do you think?

Note that the p.r. contains two checkpoint commits, the first one makes progress towards doing it the way you suggestion, and the second one reverts much of the first commit and does it the way I described above.

@whyrusleeping
Copy link
Member

@kevina that sounds good to me. As you said, it makes more sense to just have one list.

kevina added a commit that referenced this issue Jun 7, 2017
Iterate through all keys in the keystore so keys added with
"ipfs key gen" behave the same as the <self> key.  Don't maintain a
separate repub list as it does not really serve a purpose at this
point in time.  See #3808.

License: MIT
Signed-off-by: Kevin Atkinson <[email protected]>
kevina added a commit that referenced this issue Jun 7, 2017
Iterate through all keys in the keystore so keys added with
"ipfs key gen" behave the same as the <self> key.  Don't maintain a
separate repub list as it does not really serve a purpose at this
point in time.  See #3808.

License: MIT
Signed-off-by: Kevin Atkinson <[email protected]>
dgrisham pushed a commit to dgrisham/go-ipfs that referenced this issue Jun 15, 2017
Iterate through all keys in the keystore so keys added with
"ipfs key gen" behave the same as the <self> key.  Don't maintain a
separate repub list as it does not really serve a purpose at this
point in time.  See ipfs#3808.

License: MIT
Signed-off-by: Kevin Atkinson <[email protected]>
dgrisham pushed a commit to dgrisham/go-ipfs that referenced this issue Jun 16, 2017
Iterate through all keys in the keystore so keys added with
"ipfs key gen" behave the same as the <self> key.  Don't maintain a
separate repub list as it does not really serve a purpose at this
point in time.  See ipfs#3808.

License: MIT
Signed-off-by: Kevin Atkinson <[email protected]>
@skorokithakis
Copy link

Does anyone know which version this feature will be in? It's not visible in the CLI, so I can't tell...

@bonedaddy
Copy link
Contributor

Is this still a valid issue?

@magik6k
Copy link
Member

magik6k commented Feb 8, 2019

This should be fixed in #3951 (in v0.4.10)

@bonedaddy
Copy link
Contributor

strange, I'll have to do some testing since I don't think I've ever seen one of my nodes republish a record.

does the republishing require access to the same private key used to publish the record? ie if I remove the key from the keystore it won't get republished?

@Stebalien
Copy link
Member

Yes.

@kevina kevina removed their assignment Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) topic/ipns Topic ipns
Projects
None yet
Development

No branches or pull requests

9 participants