The problem
- There are no way to protect a permission.
- There are no way to set multiple uris for the same permission.
- There are no clean way to manage multiple uris for the same application.
- https://github.com/YunoHost/issues/issues/1486
- https://forum.yunohost.org/t/yunohost-3-7-spooky-testing-call-for-feedback/9385/31?u=josue
- https://github.com/YunoHost/issues/issues/1420
- https://github.com/YunoHost/issues/issues/1534
Solution
- Add an attribute in LDAP to know if this permission is protected (solve ttps://github.com/YunoHost/issues/issues/1486)
- Add an attribute in LDAP to know if we need to set the auth HEADER or not to the application (solve https://github.com/YunoHost/issues/issues/1420)
- Add the possibility to have multiple uris for the same permission. Note that we will have one main uris for each permission an optionally we will have a list of additional uris.
- Add an attribute in LDAP to have the label for each permissions and add on other attribute to know if we will show a tile in the SSO for this permission (solve https://github.com/YunoHost/issues/issues/1534)
- Rework the ssowatconf.json to pass all this informations to SSOwat.
Here is an example of how will look like the new ssowatconf.json.
{
"additional_headers": {
"Auth-User": "uid",
"Email": "mail",
"Name": "cn",
"Remote-User": "uid"
},
"domains": [
"domainA.tld",
"domainB.tld"
],
"permissions": {
"sogo.main": { // Equals to actual protected_uris
"users": [
"alice",
"bob"
],
"label": "SOGo", // Mandatory
"show_tile": true,
"auth_header": true,
"protected": true,
"uris": [ // Not mandatory, note that the first entry will be the main uris, the others will be the additional uris.
"domainA.tld/SOGo",
"domainB.tld/something",
"domainA.tld/someotherthing"
]
},
"gitea.main": { // Equals to actual skipped_uris
"users": [
"alice",
"jack"
],
"label": "Gitea",
"show_tile": true,
"auth_header": false,
"protected": false,
"uris": [
"domainB.tld/gitea"
]
},
"gitea.admin": { // Equals to actual unprotected_uris
"users": [
"alice"
],
"label": "Gitea admin",
"show_tile": false,
"auth_header": true,
"protected": false,
"uris": [
"domainB.tld/gitea/admin"
]
},
"regex-example.main": { // Equals to actual unprotected_regex
"users": [
"alice"
],
"label": "Regex example",
"show_tile": true,
"auth_header": true,
"protected": false,
"uris": [
"re:domainB.tld/test[a-z]+/example"
]
},
"other-example.main": { // Equals to actual protected but with no auth header
"users": [
"alice"
],
"label": "Other example B",
"show_tile": false,
"auth_header": false,
"protected": true,
"uris": [
"re:domainB.tld/test[1-9]+/other-example"
]
},
"core": { // Core permission
"users": [], // Have no sens here, so just put nothing...
"label": "Core permissions",
"show_tile": false,
"auth_header": false,
"protected": false,
"uris": [
"^[^/]*/%.well%-known/acme%-challenge/.*$",
"^[^/]*/%.well%-known/autoconfig/mail/config%-v1%.1%.xml.*$"
]
}
},
"portal_domain": "domain.tld",
"portal_path": "/yunohost/sso/",
"redirected_regex": {
"domain.tld/yunohost[\\/]?$": "https://domain.tld/yunohost/sso/"
},
"redirected_urls": {},
}
PR Status
- [x] Implement a migration
- [x] Manage backup/restore
- [x] Implement the unit test
- [x] Test the code (done by the unit test)
- [x] Try to remove the big legacy code in
app_ssowatconf
. https://github.com/YunoHost/yunohost/pull/935
- [x] Update webadmin with new feature (attribute :
label
, show_tile
).
https://github.com/YunoHost/yunohost-admin/pull/297
- [x] Update documentation https://github.com/YunoHost/doc/pull/1263
- [x] Test everything :smile: Done with theses apps (maybe we need to test with some other tricky app, but I don't know which one):
- wordpress
- nextcloud
- gitea
- etherpad_mypads
- leed
- [ ] Fix the test (maybe we need to run the migration before to launch the test). Locally all test pass.
How to test
- Create a protected permission (in a app) or just use the mail permission (which should be protected).
- Try to add or remove the visitors group in this permission.
...
Note that to test this with the unit test you need this branch : https://github.com/YunoHost/test_apps/pull/5
Validation
- [ ] Principle agreement 0/2 :
- [ ] Quick review 0/1 :
- [ ] Simple test 0/1 :
- [ ] Deep review 0/1 :
app helpers tests needed