-
Notifications
You must be signed in to change notification settings - Fork 15
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
Check that a user belongs to the correct SHM domain when registering with an SRE #2292
base: develop
Are you sure you want to change the base?
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, a suggestion and a couple of questions 👍.
logger.error( | ||
f"User [green]'{username}'[/green]'s principal domain name is [blue]'{user_domain}'[/blue].\n" | ||
f"SRE [yellow]'{sre}'[/yellow] belongs to SHM domain [blue]'{shm_config.shm.fqdn}'[/blue].\n" | ||
"The user's principal domain name must match the domain of the SRE to be registered." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we've had problems with multi-line log messages before (although we might strip those characters). Could you check the output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem there is we have lines in the log file which are not in the log format which will make it difficult to parse.
We could,
- Join the lines in the log file
- Make each of these a different message
- Put this output to stdout but a shorter summary to the log
Co-authored-by: Jim Madge <[email protected]>
f"Username '{username}' does not belong to this Data Safe Haven deployment.\n" | ||
"Please use 'dsh users add' to create this user." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here
…with SRE
✅ Checklist
Enable foobar integration
rather than515 foobar
).develop
.🚦 Depends on
Adds a check of the user's principal name when registering with an SRE. If the domain in the principal name does not match the FQDN of the SHM that the SRE is linked to, the user will not be added to the SRE's security group and an error will be printed explaining why.
Example output:
🌂 Related issues
Relates to #2275
Does not close #2275, as that also encompasses the
add
command, whereas this PR only handles registering users🔬 Tests
Tested locally