ofosos / scratch

public scratchpad
http://ofosos.org
44 stars 8 forks source link

reMarkable / CUPS: Awesome! Plus SELinux #1

Closed pkgw closed 6 years ago

pkgw commented 6 years ago

I was just looking around for this and have gotten your reMarkable/CUPS integration working. It's great! Thanks for creating and posting this.

I did run into one problem: I run Fedora, which has SELinux enabled. It took me a long time to make it so that I could actually get CUPS to execute the driver without running into permissions problems.

I ended up doing a lot of hacky chowning, but it also ended up running this command:

semanage permissive -a cupsd_t

This is basically disabling SELinux security on the CUPS daemon. I am comfortable with that, and I didn't find a better workaround, but it's not something to recommend unilaterally. (Someone more familiar with SELinux could probably come up with a better modification that would narrowly target the remarkable driver, allowing it to run the rmapi executable and not other stuff.)

Thanks again! This is super neat.

ofosos commented 6 years ago

I suspect, you could try to put the backend into the same selinux context as that cups uses. At least that's the way it's supposed to work. But this would also entail adding rmapi to this context. For now I'll update the docs.

Anything else you found unclear from the docs?

pkgw commented 6 years ago

Hmmm ... I was skimming the docs relatively quickly and so at first I didn't fully appreciate the part where I needed to customize remarkable.sh with the path to my rmapi program, but that's pretty much on me. You could imagine writing an install.sh script that customized the script automatically, I suppose.

Other than that, I was also wondering about the question brought up in #2 ... I worked around it by just giving the lp user a copy of the rmapi program and my credentials file.

BTW, I noticed that you also have a script for updating your desktop to match APOD. If you happen to come up with any reMarkable/Astronomy hacks and remember to do so, I'd be happy if you'd ping me! I'm the Innovation Scientist of the American Astronomical Society and part of my job is staying abreast of the neat ways that people are interacting with astronomical imagery and data.

ofosos commented 6 years ago

One path to change this, is to remove the hardcoded path completely and rely on PATH. The second best option is to look into HOME/go/bin. I think both would work, and both are better then having my name in the path.

pkgw commented 6 years ago

Relying on $PATH seems dicey since the filter will likely be running as the lp user, presumabl with a very vanilla environment.

As I mentioned before, I think a small install.sh script might be helpful here. It could run the PPD compiler program, detect the correct full path to rmapi, insert it into the shell script, and maybe print out some hints to the user.