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

SLES remote support with authentication token #1729

Merged
merged 1 commit into from Jun 16, 2020

Conversation

pavelpicka
Copy link
Contributor

New remote type for Suse Enterprise Linux Server. If user provides his
repository authentication token it is possible to sync SLES official repository.

closes: #6729
https://pulp.plan.io/issues/6729

[nocoverage]

@pulpbot
Copy link
Member

pulpbot commented May 29, 2020

Attached issue: https://pulp.plan.io/issues/6729

@pavelpicka pavelpicka force-pushed the 6729-suse-auth-token branch 3 times, most recently from 9091957 to 61e153a Compare May 29, 2020 20:05
@pavelpicka pavelpicka force-pushed the 6729-suse-auth-token branch 4 times, most recently from 4f0893a to 59a482e Compare June 1, 2020 11:50
@pavelpicka pavelpicka changed the title [WIP] SLES remote support with authentication token SLES remote support with authentication token Jun 1, 2020
@jlsherrill
Copy link
Contributor

What was the reasoning to use a different remote rather than the existing remote? This is functionality identical, but just has a uniqe auth mechanism

@bmbouter
Copy link
Member

bmbouter commented Jun 9, 2020

I can think of two motivating reasons.

Another remote type is more explicit for both users and developers, especially as requirements diverge over time. Additionally, we want reduce user confusion by having all remote options to be meaningful in all cases; attaching the auth options to a Remote that uses them prevents users from configuring Suse-specific options for non-Suse Remotes.

@jlsherrill
Copy link
Contributor

Another remote type is more explicit for both users and developers, especially as requirements diverge over time.
I can't speak for future requirements that aren't defined yet, but i think today a new remote type is not more clear in this case. A specialized auth method seems pretty straight forward for a user or developer to understand if it is named correctly.

To me a remote should be defined by the technology that defines it, in this case Yum (i'd actually rename it to Yum Remote if i had a magic wand). Would/Could it be used for syncing 3rd party repos for Suse content? No Would/Could it be used for syncing SLES repos from some other source (like another pulp server)? No What other special logic would be in this remote that justifies its existence?

we want reduce user confusion by having all remote options to be meaningful in all cases; attaching the auth options to a Remote that uses them prevents users from configuring Suse-specific options for non-Suse Remotes.

Given my previous statements, does it actually help them? I would think a user would create a sles remote for some other sles repo and be confused why an auth token is required. If it was more clear that the user should always use SLES for SLES content (like a special content type) i could see needing a new remote, but for the user to know to select a Remote only if they are syncing SLES and only if they are syncing from one specific source of content seems more confusing than just having a SLES auth token option IMO.

@bmbouter
Copy link
Member

bmbouter commented Jun 9, 2020

The idea is that SLES content should always use the SLES remote even if it does not require the auth to work. This came up in the pulp_rpm discussion also. The explicit over implicit I mentioned in the design helps the user answer the question: which of these are for sles content? Without having a separate remote type that's not practical to answer. Maybe that's not valuable to katello (or users in general) but that's the idea that was discussed.

What I'm wondering is: what are the downsides of having a clearer separation with a new remote?

@jlsherrill
Copy link
Contributor

@bmbouter thanks for explaining a bit, i def. had some misunderstandings. So auth token isn't required?

I'm still trying to grok the vision, as that seems more of a labeling/tag mechanism than a remote type.
The only downside i can think is if you need to change the type to get the added functionality of some other remote (but i'm still trying to think through the reasons that someone would choose this remote if it existed). To change the 'type' you'd have to delete the remote and add a new one which is a tad cumbersome on the user and might have other implications.

To me it was more about the fact that I thought i knew what a remote was and what it meant to be a remote and this seemed to violate that. So its possible if the meaning is changing, or i'm wrong in my thinking, it may need some adjustment. However I think it should be clearly defined if this is the route to go, and it kinda feels like that hasn't been done yet?

@bmbouter
Copy link
Member

bmbouter commented Jun 9, 2020

I am having second thoughts about this. Despite a PR being available I'd like to discuss the design once more at the pulp_rpm meeting on June 11th. @pavelpicka @goosemania @dkliban

@goosemania
Copy link
Member

@bmbouter , +1 to discuss it.

FWIW, there was a broad agreement that if we create a new remote for SLES repos it will cover only cases with auth token. There was even a strong suggestion to call it AuthTokenRemote and we agreed to come up with the name on the PR. Otherwise, there is no difference from RpmRemote, users can randomly use any Remote, migration is not able to identify SLES repos without auth token, so it will be a messy user experience.

@pavelpicka pavelpicka changed the title SLES remote support with authentication token [WIP] SLES remote support with authentication token Jun 11, 2020
@abr1x
Copy link

abr1x commented Jun 15, 2020

What was the reasoning to use a different remote rather than the existing remote? This is functionality identical, but just has a uniqe auth mechanism

I totally agree on @jlsherrill

FWIW, there was a broad agreement that if we create a new remote for SLES repos it will cover only cases with auth token. There was even a strong suggestion to call it AuthTokenRemote and we agreed to come up with the name on the PR. Otherwise, there is no difference from RpmRemote, users can randomly use any Remote, migration is not able to identify SLES repos without auth token, so it will be a messy user experience.

As a user, I'm even more confused when I need to use an additional RpmRemote when I only want to use an auth_token especially when I have another 3rd party rpm repo which is not related SLES but needs an auth token.

@bmbouter thanks for explaining a bit, i def. had some misunderstandings. So auth token isn't required?

No, since SLES12 an auth token is always required for the official SLES repositories.

@pavelpicka
Copy link
Contributor Author

After another discussion, we decided to take the way with one RpmRemote and optional argument of auth token. As mainly targeting SLES its name is 'sles_auth_token'.

Copy link
Member

@bmbouter bmbouter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, but get another ack maybe from @goosemania or @ipanova before merging.

Copy link
Contributor

@dralley dralley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

docs/workflows/create_sync_publish.rst Outdated Show resolved Hide resolved
docs/workflows/create_sync_publish.rst Show resolved Hide resolved
Comment on lines 1 to 4
from logging import getLogger
from aiohttp.client_exceptions import ClientResponseError
from pulpcore.plugin.download import HttpDownloader
from urllib.parse import urljoin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check other files or pep https://www.python.org/dev/peps/pep-0008/#imports to sort imports appropriately.
We usually leave a newline between different categories.

pulp_rpm/app/downloaders.py Outdated Show resolved Hide resolved
Initialize the downloader.
"""
if 'sles_auth_token' in kwargs.keys():
self.sles_auth_token = kwargs.pop('sles_auth_token')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to remove sles_auth_token from the kwargs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to remove but still need to "transfer" to class variable, as another class method using it. In this case I think doesn't matter if kwargs.pop() or kwargs['sles...'] is used for assign it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I try not to change any incoming objects if I don't really need to.

pulp_rpm/app/downloaders.py Outdated Show resolved Hide resolved
pulp_rpm/app/models/repository.py Outdated Show resolved Hide resolved
pulp_rpm/app/models/repository.py Outdated Show resolved Hide resolved
@@ -148,6 +151,61 @@ class RpmRemote(Remote):
"""

TYPE = 'rpm'
sles_auth_token = models.CharField(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bmbouter , @dralley , should auth token be mutually exclusive with username/password or client cert/key?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These things aren't intended to be configured together, but allowing them to be is probably ok. For example multi-factor authentication promotes the idea that two types of authentication are used at once, so if any server side decides to do that, our helpful feature would prevent users from using it.

I don't have any strong feeling on this, ^ is just my general take in this situation.

Added support for SLES repository with use of authentication token.
Also updated docs how to use it.

closes: #6729
https://pulp.plan.io/issues/6729

[nocoverage]
@goosemania goosemania changed the title [WIP] SLES remote support with authentication token SLES remote support with authentication token Jun 16, 2020
@goosemania goosemania merged commit 546da71 into pulp:master Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants