Skip to content

Overhaul tracker keys: option to disable auth key expiration #978

@josecelano

Description

@josecelano

Parent issue: #773

Discussed in #244

Originally posted by rakema01 May 23, 2022
Would be a neat thing to have when the focus of the site is to seed for long periods of time. Also especially helpful when you've got too many torrents and having to change the tracker URL to match the key is a pain. Of course, there's the option to change the expiry length to a random huge number but having an option to outright disable expiry checks is a bit cleaner in my opinion. In its place, we could have an option for the key be manually regenerated when needed.

I think we could add a config option like this:

[core]
private = true
check_keys_expiration = true     # The new option. It only makes sense when `private = true`
tracker_usage_statistics = true

When check_keys_expiration = false we don't call auth::verify(key) in this function:

pub async fn verify_auth_key(&self, key: &Key) -> Result<(), auth::Error> {
    // code-review: this function is public only because it's used in a test.
    // We should change the test and make it private.
    match self.keys.read().await.get(key) {
        None => Err(auth::Error::UnableToReadKey {
            location: Location::caller(),
            key: Box::new(key.clone()),
        }),
        Some(key) => auth::verify(key),
    }
}

cc @da2ce7

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions