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

Define, implement and test a proper SailJail "profile" (plus evaluate its necessity) #236

Closed
Olf0 opened this issue Mar 18, 2022 · 42 comments
Labels
documentation Documentation, Wiki and related enhancement Is supposed to enhance something help wanted Support is needed to proceed

Comments

@Olf0
Copy link
Member

Olf0 commented Mar 18, 2022

See PR #235 for the improper way.

For a proper one, study and utilise these:

Please also thoroughly document research results, evaluations / considerations and decisions met here, besides an implementation ((s), because there are multiple aspects and locations to alter), which is working and well tested. This can be done step by step, while documenting progress here.

Edit (2022-06-04):

  • This tool might come very handy: https://github.com/nephros/sailjail_test
  • See also this comment, below: […] I would rather evaluate if it is feasible to call the "Org" harbour-storeman and leave the app name in the .desktop file at harbour-storeman, because that maps to the extant path ~/.local/share/harbour-storeman/harbour-storeman/config-files: No migration code, no copying of config files, all can stay the same! […] and this very similar alternative by rinigus@fso.
@Olf0 Olf0 added enhancement Is supposed to enhance something help wanted Support is needed to proceed documentation Documentation, Wiki and related labels Mar 18, 2022
@Olf0
Copy link
Member Author

Olf0 commented Mar 18, 2022

Q: Which branch to submit the SailJail stuff to?
A: As the paths for the configuration files are not backward compatible (hence the "migration" stuff above), it seems to be appropriate to only merge this into the sfos4.2 branch a new sfos4.2 branch, after reverting the PR with the temporary workaround (#250) from the sfos4.2 branch.

Q: Which "Organisation" name to pick?
A: org.storeman, just storeman, org.storeman-developers? → Mind it is a path element for configuration files, see above. → harbour-storeman as "Org"-name and keeping harbour-storeman as app-name seems to allow for keeping the extant config-directory structure in ~/.local/share.
ToDo: Check this first impression thoroughly.

@poetaster
Copy link

I would suggest a new branch since < 4.4 and it's 'optional' up to 4.4. Or in sfos4.2 branch:

[X-Sailjail]
Sandboxing=Disabled

storeman is obviously always going to require rights outside of the normal confines of the jail.

Sorry I can't help much currently. Thanks!

@poetaster
Copy link

Q: whioch org. name to pick?
A: org.storeman, storeman org.storeman-developers -> mimd it is a path element

I'm partial to 'real' domains since this is a continuation of java like namespaces. Perhaps a github page and use that domain? io.github.storeman-developer or the like?

@poetaster
Copy link

I would suggest a new branch since < 4.4 and it's 'optional' up to 4.4.

Disregard that. Sailjail 4.2 branch, Sandboxing disabled for the time being accomplishes that the app can be used with >4.3.

@Olf0
Copy link
Member Author

Olf0 commented Mar 18, 2022

I would suggest […]

If only you would read, before you write:

See PR #235 for the improper way.

So much futile chatter. 😒

This issue has the goal to »Define, implement and test a proper SailJail "profile"«.

Sorry I can't help much currently. Thanks!

Actually I was hoping that you might take care about this issue, because it is not temporally critical and it provides lot of synergy with your other projects for SailfishOS.

@Olf0
Copy link
Member Author

Olf0 commented Mar 18, 2022

Q: Which "Organisation" name to pick?
A: org.storeman, just storeman, org.storeman-developers -> Mind it is a path element for configuration files, see above.

I'm partial to 'real' domains since this is a continuation of java like namespaces. Perhaps a github page and use that domain? io.github.storeman-developer or the like?

Do you really think that is worth the effort, to achieve ~/.local/share/io.github.storeman-developers/storeman/config-files as path?

I would rather evaluate if it is feasible to call the "Org" harbour-storeman and leave the app name in the .desktop file at harbour-storeman, because that maps to the extant path ~/.local/share/harbour-storeman/harbour-storeman/config-files: No migration code, no copying of config files, all can stay the same!
Mind that we are not strictly bound to the harbour-rules, they rather provide some guidance for us, because Storeman never will be accepted for the Jolla Store.

P.S.: Another, very similar option discovered by rinigus seems to be https://forum.sailfishos.org/t/migrating-configuration-and-data-files-for-sandboxed-apps/8866/37

@Olf0
Copy link
Member Author

Olf0 commented Mar 20, 2022

For now I will merge #235 to the sfos4.2 branch.

But for a proper SailJail configuration, it looks like an new sfos4.4 branch is needed, due to https://forum.sailfishos.org/t/release-notes-vanha-rauma-4-4-0/10656/131 / https://forum.sailfishos.org/t/contextkit-not-working-when-sailjail-is-activated/9047 , correct?

Additionally the new sharing API (once again) in SFOS 4.4.0 https://forum.sailfishos.org/t/sailjail-how-will-it-work-with-sharing-plugins/8655/16 / sailfishos/transfer-engine#6 requires a sfos4.4 release branch in the long run any way, see issue #246.

Olf0 added a commit that referenced this issue Mar 20, 2022
… for `sfos4.2` branch only.  Supersedes #235.  Must be reverted when `sfos4.4` branch is created, see issues #236 & #246.
Olf0 added a commit that referenced this issue Mar 20, 2022
… for `sfos4.2` branch only.  Supersedes #235.  Must be reverted when `sfos4.4` branch is created, see issues #236 & #246.
@attah
Copy link

attah commented Jul 15, 2022

I took a cursory look at this.
And neither with the default profile, or selected non-default things added will Storeman start to work.
One hurdle that looks fatal to me would be that /home/.zypp-cache/solv/@System/solv isn't available from any permission as far as i can tell.
So that makes me inclined to think no sandboxing is the correct solution here.

nephros pushed a commit to nephros/harbour-storeman that referenced this issue Jul 15, 2022
 - registering dbus service succeeds with this.

Contributes-To: storeman-developers#236
Contributes-To: storeman-developers#236
@Olf0
Copy link
Member Author

Olf0 commented Jul 16, 2022

@attah,

So that makes me inclined to think no sandboxing is the correct solution here.

Does that mean "leave it as it is", with [X-Sailjail] Sandboxing=Disabled in the .desktop file?

I am afraid that Jolla plans to make Sandboxing mandatory in the long run.

@attah
Copy link

attah commented Jul 16, 2022

Yes.

I have heard nothing to that effect. It wouldn't make sense.

@Olf0
Copy link
Member Author

Olf0 commented Jul 16, 2022

Yes.

Currently and for a while, that is sure fine & was my plan.

I have heard nothing to that effect.

Me neither, but …

It wouldn't make sense.

exactly the contrary, IMO: What sense does a confinement make, if it is optional and any app author can switch it off for her / his apps? SailfishOS is positioned by Jolla as a "secure" and "privacy enhancing", mobile OS alternative, but on Android and iOS such measures are enforced for long, hence they are much more "secure" and "privacy enhancing" in this regard.

I would appreciate very much, if you ask Jolla (at FSO or an IRC community meeting) what their ultimate goal for SailJail is: To enforce it or to keep it optional forever.

One hurdle that looks fatal to me would be that /home/.zypp-cache/solv/@System/solv isn't available from any permission as far as i can tell.

Sailors have been quite positive when missing (or too coarse) SailJail permissions have been indicated by app developers and already promised to adopt / adapt a few. Hence this might be something to ask for, too. In addition to Storeman, the SailfishOS:Chum GUI application and other GUI RPM-management tools may utilise an "package management" permission, which allows for accessing ~/.zypp-cache/ and its subdirectories among other package management related things.

@attah
Copy link

attah commented Jul 17, 2022

Confinement makes good sense even when you have only most apps confined IMO, and if you are Harbour-only you can know that's all of them. "Untrusted apps" is not such a first class citizen that it must necessarily have all the privileges and responsibilities. Honestly i still barely use OpenRepos at all.
So i think you are over-interpreting where this will go.
For example the discussion on sharing plugins, where they ended up not being jailed whatsoever, revealed no plans to change that.

I see it has having to strike a compromise between being real Linux in the pocket, and "hardened", and believe the current level is close to the at least an interim goal.

Ideally user should be alerted to when an app is not sandboxed though...

I would appreciate very much, if you ask Jolla (at FSO or an IRC community meeting) what their ultimate goal for SailJail is: To enforce it or to keep it optional forever.

I'll see what i can do... i guess the spin here should be if users will start getting alerted to apps having opted out of sandboxing which is genuinely useful.

@Olf0
Copy link
Member Author

Olf0 commented Jul 17, 2022

Confinement makes good sense even when you have only most apps confined IMO,

IMO not really, because a single "bad" app can access all privacy relevant data on a device or may disturb other apps: Both aspects are addressed by confining apps.

and if you are Harbour-only you can know that's all of them.

This may be a strategy Jolla has in mind.

So i think you are over-interpreting where this will go. [... . Jolla] revealed no plans to change that.

Jolla always has been very reluctant to reveal any long-term plans, because they may (have to) decide to alter them. IMO you are over-interpreting the lack of information.

I see it has having to strike a compromise between being real Linux in the pocket, and "hardened",

Luckily not really, because as root at the command line, "anything goes". Hence one still "owns" a SailfishOS device and is able to be in full control of a SailfishOS installation, in contrast to stock-Android and iOS.

and believe the current level is close to the at least an interim goal.

The current state is always close to some interim goal. 😜 And then the next "interim goal" is set, and so on. This is how engineering of large projects works.

Ideally user should be alerted to when an app is not sandboxed though...

This may be something Jolla considers or already plans. And something I am concerned about. Because I do not want users to be alerted when installing Storeman, because that would be detrimental for OpenRepos and all the SalfishOS software hosted there.

I would appreciate very much, if you ask Jolla (at FSO or an IRC community meeting) what their ultimate goal for SailJail is: To enforce it or to keep it optional forever.

I'll see what i can do...

Thank you!

i guess the spin here should be if users will start getting alerted to apps having opted out of sandboxing which is genuinely useful.

Well, it is Jolla, so it might make sense to design a question not being evaded so easily. Your first take can be easily dismissed by a "No, not currently" without providing any information. This is why my first take offers two options, which are the extremes; IMO it does make sense to add your question as a third option and design a first sentence providing context.
What about:
What are Jolla's long term goals for GUI apps in the Jolla Store ("harbour") and outside of it (e.g., at OpenRepos or SailfishOS:Chum) WRT SailJail: Do you plan to either enforce a proper SailJail configuration sooner or later, or to keep it optional forever (by simply deploying a [X-Sailjail] Sandboxing=Disabled in an app's .desktop file), or to take an intermediate route, e.g., by alerting users when installing apps which have opted out of sandboxing?

Can you think of aspects not covered and possible "easy ways out", besides "We don't know, yet"? Do you thing the question is overloaded and we should drop the "Jolla Store" aspect of it?

@attah
Copy link

attah commented Jul 17, 2022

IMO not really, because a single "bad" app can access all privacy relevant data on a device or may disturb other apps: Both aspects are addressed by confining apps.

Well, the most sensitive data (e.g. accounts) is already protected from regular non-sandboxed apps.

I do not want users to be alerted when installing Storeman

Whereas I think that is perfectly fine.
I'd be quite surprised if Jolla wants to add and maintain permissions that they themselves don't use nor that are allowed in Harbour.
(Although this particular use case would perhaps be close enough to the Harbour client, which BTW is unjailed).

That question should be good enough to add to the community meeting (and now would be the time to). I probably won't be able to make the next one though, so i have added a reminder for $AFTER_VACATIONS to do something about this if it hasn't already happened.

nephros pushed a commit to nephros/harbour-storeman that referenced this issue Jul 18, 2022
nephros pushed a commit to nephros/harbour-storeman that referenced this issue Jul 18, 2022
nephros pushed a commit to nephros/harbour-storeman that referenced this issue Jul 18, 2022
Contributes-To: storeman-developers#236

This is a combination of 11 commits.

update spec: extra package

fix .desktop override installation

add subdir to pro

spec cleanup

add Documents permission

... for the Backup functionality

use no Orga/App names at all...

add PackageKit system permission

expand PackageKit dbus permissions

randomly fix up the rules

... but we can read ssu finally!!

some more cleanups
@nephros
Copy link
Collaborator

nephros commented Jul 18, 2022

Fooled around a bit:

I guess that is as far as I can take it.

This adds a subpackage called harbour-storeman-sailjail-config that you can install on top of any existing storeman install.
It only adds files in /etc/sailjail and /etc/firejail so after removing that package everything should be back at default.
(This subpackaging is for easy testing and quick updates of the config, if this ever gets merged the stuff will probably go elsewhere in the actual package).

There's a lot going on inside Storeman so I am sure there are some things missing in the sailjail config.

Most notably, /etc/ssu/ssu.ini gets copied into the jail at launch and never updated (i.e. the sandbox will not notice if anything on the system proper changes). I don't think there is a way to do it differently.

Then there's the case of /home/.zypp-cache. I tried to give access and it appears to be working but I haven't tested thoroughly.

@Olf0
Copy link
Member Author

Olf0 commented Jul 18, 2022

There's a lot going on inside Storeman so I am sure there are some things missing in the sailjail config.

Most notably, /etc/ssu/ssu.ini gets copied into the jail at launch and never updated (i.e. the sandbox will not notice if anything on the system proper changes). I don't think there is a way to do it differently.

If "at launch" means "when then user starts Storeman", this may be O.K. for a start.

Then there's the case of /home/.zypp-cache. I tried to give access and it appears to be working but I haven't tested thoroughly.

Cool, kudos to you!

@Olf0 Olf0 changed the title Define, implement and test a proper SailJail "profile" Define, implement and test a proper SailJail "profile" (plus evaluate its necessity) Jul 19, 2022
@nephros
Copy link
Collaborator

nephros commented Jul 19, 2022

If "at launch" means "when then user starts Storeman", this may be O.K. for a start.

Yeah, launch is sandbox launch, so every time.

@nephros
Copy link
Collaborator

nephros commented Jul 19, 2022

Another thing: the user is now prompted for any "super user" actions (like refreshing repos) with the usual authorization popup.
I assume this is due to polkit rules on the corresponding dbus calls.

And IIRC this is new behaviour which is not present in a Sandboxing=Disabled session.

EDIT: I notice the popup when installing or updateing an app is talking about "this softwre is not from a trusted source, superuser auth required". Perhaps the jailed Storeman can not read the developermode/allow untrusted sources setting.

@Olf0
Copy link
Member Author

Olf0 commented Jul 19, 2022

Another thing: the user is now prompted for any "super user" actions (like refreshing repos) with the usual authorization popup. I assume this is due to polkit rules on the corresponding dbus calls.

Although it is not a beautiful solution, I see no issue in carefully loosening polkit rules; i.e., slightly loosening very specific rules for a specific Unix group.
Examples:
https://github.com/storeman-developers/harbour-storeman-installer/tree/devel/polkit-1/localauthority/50-local.d/
or
https://github.com/Olf0/crypto-sdcard/blob/master/polkit-1/localauthority/50-local.d/

And IIRC this is new behaviour which is not present in a Sandboxing=Disabled session.
EDIT: I notice the popup when installing or updating an app is talking about "this software is not from a trusted source, superuser auth required". Perhaps the jailed Storeman can not read the developermode/allow untrusted sources setting.

Just to check if I understood the gist of this part correctly: "The superuser-auth pop-up may not be suppress-able via polkit rules" is what it means right?

@nephros
Copy link
Collaborator

nephros commented Jul 19, 2022

Just to check if I understood the gist of this part correctly: "The superuser-auth pop-up may not be suppress-able via polkit rules" is what it means right?

I'm not familiar enough with the Sailfish OS authentication system, or polkit, to answer that . There's D-Bus and PackageKit and libzypp and ssu and dsme involved (or maybe one of them isn't...).
I just know that dbus system services can optionally want authorization (and obviously many system services do), and AFAIK that is done via polkit. Which on (recent) Sailfish OS versions triggers the "give me password or fingerprint auth" popup dialog.

But yes, if you or someone can cook up a reasonable ruleset to overcome these annoyances that would probably be helpful. And from the looks of it, the one from Storeman-Installer might just be enough as-is.

My preferred solution would be for the app to trigger the popup "TOFU", so when the first privileged operation is done by the user, and then remember that authorization until app exit (or a timeout/screen lock event/...). But I have no idea if something like this is possible.

@nephros
Copy link
Collaborator

nephros commented Jul 20, 2022

Another round, with some simplifications and the polkit file:

https://github.com/nephros/harbour-storeman/tree/rc4
https://build.merproject.org/package/show/home:nephros:devel:storeman/storeman

@nephros
Copy link
Collaborator

nephros commented Jul 22, 2022

https://forum.sailfishos.org/t/migrating-configuration-and-data-files-for-sandboxed-apps/8866/46

Is seems a migration to a new config path is necessary after all.

@nephros
Copy link
Collaborator

nephros commented Jul 22, 2022

Right, so RC4 (plus one commit) seems to work fine.

WRT Polkit, I have seen the following permissions used and asking for user confirmation:

  1. org.freedesktop.packagekit.system-sources-configure: for managing repositories. This obviously should be in the .pkla file, otherwise the user gets a prompt for every repo Storeman tries to refresh, add, or remove. (This is to say you get a separate prompt per enabled repo if you hit "Refresh Cache".
  2. org.freedesktop.packagekit.package-install-untrusted: installing software: debatable of whether being prompted is actually a feature here. On the other hand, if you haven't configured a fingerprint for authentication, this is a bit of a nuisance.
  3. org.freedesktop.packagekit.package-remove: same as for install, one might consider prompting a feature

My first approach would be to ship it with YES-YES-NO and see if users complain. @Olf0 what do you think?

@Olf0
Copy link
Member Author

Olf0 commented Jul 30, 2022

https://forum.sailfishos.org/t/migrating-configuration-and-data-files-for-sandboxed-apps/8866/46

Is seems a migration to a new config path is necessary after all.

I am not sure yet, by reading the conversations at FSO and Jolla's SailJail documentation.

  1. Rinigus' suggestion was to leave the OrganizationName and ApplicationName in [the] X-Sailjail section [undefined], which does not really work / only seems to work on first sight, as dcaliste observed.
  2. But my suggestion was to […] evaluate if it is feasible to call the "Org" harbour-storeman and leave [/ set] the [SailJail] app name in the .desktop file at [/ to] harbour-storeman, because that maps to the extant path ~/.local/share/harbour-storeman/harbour-storeman/config-files: No migration code, no copying of config files, all can stay the same!
    But maybe I missed something, why this would not work; if not it might be worth a try in practice.

@Olf0
Copy link
Member Author

Olf0 commented Jul 30, 2022

Right, so RC4 (plus one commit) seems to work fine.

Cool & great! 😄

WRT Polkit, I have seen the following permissions used and asking for user confirmation:

[1., 2., 3.]

My first approach would be to ship it with YES-YES-NO and see if users complain. @Olf0 what do you think?

I prefer Yes-Yes-Yes, because that does not alter the extant behaviour: If a user clicks on "remove package", I think the intention is already properly expressed.
Plus, if "we" (i.e., Storeman) demand a confirmation, IMO it should be handled by Storeman's code, but not by SailfishOS' system mechanisms.

It seems that you already came to the same conclusion, looking at your approfile branch (I hope I picked the right one with the most recent commits after the RC4 tag).

P.S.: Note that I posed a minor beautification PR for this PKLA file.

P.P.S.: AFAICS by a pkaction | fgrep packagekit, there are no other packagekit policies which I deem as necessary to loosen; we still may have to watch out, if other ones my be needed (pkaction | less outputs a whole lot).

P.P.P.S.: And I have a few remarks and questions WRT your commits, see [1] and [2].

@Olf0
Copy link
Member Author

Olf0 commented Jul 30, 2022

What are Jolla's long term goals for GUI apps in the Jolla Store ("harbour") and outside of it (e.g., at OpenRepos or SailfishOS:Chum) WRT SailJail: Do you plan to either enforce a proper SailJail configuration sooner or later, or to keep it optional forever (by simply deploying a [X-Sailjail] Sandboxing=Disabled in an app's .desktop file), or to take an intermediate route, e.g., by alerting users when installing apps which have opted out of sandboxing?

That question should be good enough to add to the community meeting (and now would be the time to). I probably won't be able to make the next one though, so i have added a reminder for $AFTER_VACATIONS to do something about this if it hasn't already happened.

@attah, as the SailfishOS community meeting on IRC scheduled for the 21st July 2022 was cancelled, are you planning to pose the aforementioned question at the SailfishOS community meeting on IRC scheduled for the 4th August 2022?
To use your own words, "now would be the time to"; "three days in advance" times out Monday early morning.

@attah
Copy link

attah commented Jul 31, 2022

I was targeting the next one to be properly after vacations, and not to give minimum notice either.
But sure, why not... if they already know the question probably doesn't need that.

@Olf0
Copy link
Member Author

Olf0 commented Aug 2, 2022

Thank you for pos(t)ing the question.

I was targeting the next one to be properly after vacations, and not to give minimum notice either. But sure, why not... if they already know the question probably doesn't need that.

But unfortunately I fail to fully comprehend what these two sentences are meant to express (i.e., "parsing error"), especially the last part after the ellipsis ("…").
Does the first part mean, that you originally planned to pose the question for the IRC meeting after the upcoming one (i.e., in a fortnight)?

@Olf0
Copy link
Member Author

Olf0 commented Aug 2, 2022

BTW @attah,

olf: I am afraid that Jolla plans to make Sandboxing mandatory in the long run.

attah: I have heard nothing to that effect. It wouldn't make sense.

olf: … exactly the contrary, IMO: What sense does a confinement make, if it is optional …

attah: … So i think you are over-interpreting where this will go.

olf: … IMO you are over-interpreting the lack of information.

please take a look at the fourth sentence of the Sailjail README: "Target is to have application sandboxing enforced to all applications, starting from Sailfish OS 4.4.0."

I filed an issue, asking what "all" is supposed to mean: "all apps by Jolla", "all apps at harbour" or "every app installed". Please also ask that at the IRC community meeting, if the answer prepared by Jolla (to our prior, original question) does not already provide this information.

P.S.: Please try to avoid "jumping at conclusions", as you seem to have a tendency for that.

@attah
Copy link

attah commented Aug 2, 2022

Yes, i meant to ask it for 18 Aug, i.e. post this upcoming weekend.

(i.e., "parsing error"), especially the last part after the ellipsis ("…").

Expanded/fixed: "if they already know where they are going, more-than-minimum time ahead of deadline is not needed."

I just suspect that they could give a somewhat noncommittal answer if they feel done (which is what i believe), whereas concrete plans of additions gives a more concrete answer. So i wanted to give as much time as possible, thinking the answer might improve if more people see it beforehand.

"Target is to have application sandboxing enforced to all applications, starting from Sailfish OS 4.4.0."

Which shows the current set is good for some definition of all.
(Clarification: i disagree completely with that it implies the target was missed)

"all apps by Jolla", "all apps at harbour" or "every app installed". Please also ask that

Isn't the question already "all apps at harbour" or "every app installed"?
Why should we care much about Jolla's apps? We already have to trust everything else they do, so what difference is an app or two of theirs outside the sandbox?

Please hold your bashing of my understanding to an "i told you so" after the meeting. We already agreed that the question is worth asking - i.e. i respect your position enough to take it seriously. My track record is just fine.

Edit: And for the record i think (allowing) shipping a custom firejail profile is about as big of a hole as Sandboxing=Disabled (noblacklist is a thing for example) - and unless you somehow close both, neither makes sense to close.

@Olf0
Copy link
Member Author

Olf0 commented Aug 2, 2022

Yes, i meant to ask it for 18 Aug, i.e. post this upcoming weekend.

… again, if Jolla does not provide an answer without any of us being there, right?

(i.e., "parsing error"), especially the last part after the ellipsis ("…").

Expanded/fixed: "if they already know where they are going, more-than-minimum time ahead of deadline is not needed."

Ah, thank you for the clarification. But by definition, the deadline they set for themselves ought to be sufficient, otherwise they might have set a longer deadline.

I just suspect that they could give a somewhat noncommittal answer if they feel done (which is what i believe), whereas concrete plans of additions gives a more concrete answer. So i wanted to give as much time as possible, thinking the answer might improve if more people see it beforehand.

Jolla avoid non-committal answers like hell (correctly so), SailJail is not done at all (by looking at the gaps in the documentation, you mentioned that the Jolla Store app is not yet sailjailed etc.

"Target is to have application sandboxing enforced to all applications, starting from Sailfish OS 4.4.0."

Which shows the current set is good for some definition of all.

Not really, they wrote that 9 months ago.

Actually this probably just means really every application must ship a Sailjail profile with at least "Sailjail=Disabled", what we already know that it is coming.

"all apps by Jolla", "all apps at harbour" or "every app installed". Please also ask that

Isn't the question already "all apps at harbour" or "every app installed"? Why should we care much about Jolla's apps? We already have to trust everything else they do, so what difference is an app or two of theirs outside the sandbox?

Yes, agreed to all three questions. I forgot about the part of our question preceding the colon.

Please hold your bashing of my understanding to an "i told you so" after the meeting. We already agreed that the question is worth asking - i.e. i respect your position enough to take it seriously. My track record is just fine.

Sorry, I did not mean to bash. I simply wanted to clearly denote that I sense much interpretation ("I suspect, think, believe etc." and "Jolla could, might etc.", although I do see that you softened your occasional "will"), when there often simply is no information at all. To me the lack of information, which is the consequence of Jolla's information policy (which I do understand), just means "no information". And will try to avoid any "told you so", because I really have no idea what Jolla may answer.

WRT your "Edit": Yes I also think that the security level achievable by Sailjail is debatable; this reminds me of the whole AppArmor (versus SE-Linux) story. But in both cases the Linux distributor is pushing it (Jolla rsp. SuSE), hence it will come.

@attah
Copy link

attah commented Aug 2, 2022

… again, if Jolla does not provide an answer without any of us being there, right?

No, originally, since not everyone will be back yet. But since you asked that i do it now and i saw more likelihood of making this meeting, there was no point in insisting on sticking to my plan.

Not really, they wrote that 9 months ago.

Not 100% of course (could have been forgotten), but it doesn't indicate failure either (like an edit to another version or to more vague terms would have).

Actually this probably just means really every application must ship a Sailjail profile with at least "Sailjail=Disabled", what we already know that it is coming.

No profile is already equal to using the default set of permissions. I don't see that it would need to change.
Too much legacy breaking and no obvious gain.
So what do you mean is coming? And what is the source for that?

To me the lack of information, which is the consequence of Jolla's information policy (which I do understand), just means "no information".

I agree with this, but draw very different conclusions.
From path of least resistance, principle of least astonishment etc.:
I see a status quo that would pass as done (by my standards and perceived Jolla standards) - thus no need to worry.

Yes I also think that the security level achievable by Sailjail is debatable

As i said before, i think that if trusted-source apps can be trusted to be jailed with permissions presented to the user, that is as very reasonable and a good value. I see no evidence it will be pushed further.

Let's see what shakes out...

@attah
Copy link

attah commented Aug 5, 2022

I suggest to close this issue. Sailjail=Disabled seems to be here to stay.

@Olf0
Copy link
Member Author

Olf0 commented Aug 6, 2022

I cannot follow your assessment (and the source needs to be documented here):

07:36:09 <attah_work> Right, but Olf id worried that Sandboxing=Disabled would go away
07:36:35 oof no. there are system apps that need that. i don't think it'll go away
07:36:55 maybe one day there'll be a warning for apps that have sandboxing disabled
07:37:34 <attah_work> excellent

Andrew Branson's (abr) second statement was exactly one of the points I was concerned about Also note that "sailors" (i.e., Jolla employees) only call Jolla's own apps "system apps", while I would say Storeman and Patchmanager are system apps (in contrast to Jolla Mail or Jolla Browser); hence abr's statement that Sandboxing=Disabled will likely stay for some of Jolla's own apps is a weak assertion for other apps. Hence I do not concur with your exclamation "excellent" (i.e., I saw more positive answers among the possible set of answers). But that is O.K., if we carry on implementing a proper SailJail profile. What is achieved now, is a vaguely positive answer to the "(plus evaluate its necessity)" part of this issue. Another achievement is to know for sure that any change may come in "Jolla time" (i.e., much later or never), hence we do not have to rush things. Still I believe we should carry on pursuing this, because pausing implementation works underway often results in stalling it forever.

@attah
Copy link

attah commented Aug 6, 2022

"Excellent" primarily responds to the first statement by abr.
But as i stated before; i see the the warning as perfectly fine, and we'll just have to agree to disagree.
Shipping a custom firejail profile (harbour-storeman.profile) is no less warning-worthy than Sandboxing=Disabled, so i don't see how that helps at all.

@Olf0
Copy link
Member Author

Olf0 commented Jul 30, 2023

@nephros, as I am basically "done" with Storeman, finishing this (and the stalled "String rework" branch & PR #358) are two final steps left to execute (the "string rework" being my very own endeavour). The last message discussing this technically was the one on 2022-07-30 (i.e., exactly one year ago). As you did all the implementation work, I want to ask you first, if you would like to pick this up, again; it seems to be > 90% done. Note that I just posed a PR to your branch (please review, I hope it makes sense).

Side note: The recent tag naming scheme allows for {alpha,beta,rc,release} versions being tagged in an SFOS-OBS compatible manner. I can easily create a staging branch with your changes based on devel and create new SFOS-release specific branches from that in this repository, which can be utilised to set an {alpha,beta,rc} tag in.

@nephros
Copy link
Collaborator

nephros commented Jul 30, 2023

Thanks for the ping and PR.

I have to look through all of this so it may take a little time.

@nephros
Copy link
Collaborator

nephros commented Jul 30, 2023

IIRC my main concern with my branch is the polkit file.

As the version of PolKit on SFOS does not support fine-grained permissions (as the xml/javascript based variant on newer polkit does), adding those permissions for 'group ssu' has the effect of all package install actions by the default user go through without confirmation, not only those triggered through Storeman.

So that's a no-go.

@Olf0
Copy link
Member Author

Olf0 commented Jul 30, 2023

So that's a no-go.

Thank you very much for your research, despite the slightly unfortunate but absolutely reasonable outcome.
Yes, this was the approach Mentaljam (osetr / Petr T.) used for Storeman Installer 1.x, with which I was unhappy (although the pkla file is removed as soon Storeman is installed, which is the very purpose of Storeman Installer; but as Storeman Installer 1.x has to be started manually this timespan may be indefinite) and evaded this by letting the core script run in root context for Storeman Installer 2.x. Running in root context is O.K. for a non-interactive, single-purpose program (i.e., which runs "unattended"), but not for a large interactive one as Storeman.

Side note: Those YAML with JavaScript based "configuration files" of polkit ≥ 0.106 are a security issue on their own; there are good reasons to keep code and config apart. The situation is so foobared that I documented it (with the focus on SFOS). Unfortunately I fail to find the LWN.net article which analysed and criticised this move (from Policykit 0.105 to 0.106) thoroughly.

@Olf0 Olf0 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 30, 2023
@Olf0
Copy link
Member Author

Olf0 commented Jul 30, 2023

… adding those permissions for 'group ssu' has the effect of all package install actions by the default user go through without confirmation, not only those triggered through Storeman.

In theory one could create a separate user account for Storeman with its own access and polkit privileges. But that would complicate privilege matters further, e.g. Storeman would then have to export the list of installed RPMs to the primary user's home directory etc.

Nothing I am keen on addressing while SFOS is on its demise and Storeman in maintenance mode.

@Olf0
Copy link
Member Author

Olf0 commented Jul 30, 2023

IIRC my main concern with my branch is the polkit file.

Oh, a second thought (as I have them quite often):
What is the /usr/share/mapplauncherd/privileges.d/harbour-storeman file good for, then? Its content is supposed to explicitly grant the privilege to manage packages to Storeman only.

IOW, are you absolutely sure, that the pkla file is required to let Storeman work as usual? Another reason why I ask this, is because I always modelled Jolla's privilege escalation mechanisms (mapplauncherd config, SailJail config) to be weaker than polkit's, hence I wonder, why such a pkla config file was not needed in the first place. Furthermore, this somehow implies that Jolla's SailJail implementation does not respect configuration for Jolla's mapplauncherd, which would constitute a design- or implementation-flaw IMO; well it would not be the first time they shoot themselves in the foot by not having properly worked out something conceptionally.

P.S.: The more and longer I work with and ponder about the concept of "controlled privilege escalation" as implemented by Policykit, mapplauncherd and SailJail, I believe it is a fundamental misconception. As usual with DACs (discretionary access control systems), IMO one (person or running program) should be able to drop (i.e., release) privileges, but not gain any by some wormhole-like mechanism.

@Olf0
Copy link
Member Author

Olf0 commented Aug 10, 2023

Hello @nephros, I still would appreciate some feedback including your opinion on this (see my prior posting):

Oh, a second thought (as I have them quite often):
[…]

Background: Before I close this issue in its current, unresolved state for good, I want to be sure to have no "think'o" in our considerations. I think I have discovered a logical mismatch in our considerations (see prior posting for details), but this might as well just be caused by me being afraid to miss something relevant or my lack of deeper knowledge how these mechanisms play together (or not).

If you simply lack the time currently, that is fine, it is not at all urgent. In this case, please drop a terse line, e.g., "No time now.", "Outta time" etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation, Wiki and related enhancement Is supposed to enhance something help wanted Support is needed to proceed
Projects
None yet
Development

No branches or pull requests

4 participants