Friend asks: I would like to make an app to ask for authentication before launching. I can do that on MacOS via creating an encrypted disc image and put the app in there, and windows has robust third party tools for it. But how would you go about it on Linux, especially since it’s a .deb (that gets auto-updated all the time via its repo) and not an appimage/flatpak? Others need access to the user account, but I want to restrict that one app. Creating a different user account for it is out of the question btw, since you can still change the password for that user via the primary admin account. Also, I don’t want to be running full VMs that take forever to boot to use that one app. Is there any simple way to lock an app under Linux?

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    3 hours ago

    Same as you would on MacOS :

    • ditch the .deb package because it’s the wrong tool for the job here.
    • Squashfs image with encryption
    • Set keyring entries and a wrapper script to manage lock/unlock. If you already know the hardware platform of all users, this can even be improved upon

    I have no idea why someone would be using Debian packages to distribute something like this though, if that’s the question. Absolutely not going to work well.

  • db2@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    4 hours ago

    Creating a different user account for it is out of the question btw, since you can still change the password for that user via the primary admin account

    If they can su(do) they can open it. They’ve already authenticated.

    You can do it with groups but since there’s no barrier to admin access it’s already undermined.

  • ∟⊔⊤∦∣≶@lemmy.nz
    link
    fedilink
    arrow-up
    4
    ·
    4 hours ago

    It depends on how smart the users are. But if an account has admin then… that account can already do everything. You could zip the binary and password the zip?

  • owenfromcanada@lemmy.ca
    link
    fedilink
    arrow-up
    4
    ·
    4 hours ago

    You might be able to use something like distrobox instead of a full VM. That would at least put it in a container that you could either run from an encrypted partition or something.

    Different users would be the “simple” way you’d normally do something like this under Linux. But if your regular users have sudo access, you can’t really lock anything down.

  • chgxvjh [he/him, comrade/them]@hexbear.net
    link
    fedilink
    English
    arrow-up
    4
    ·
    5 hours ago

    Creating a different user account for it is out of the question btw, since you can still change the password for that user via the primary admin account.

    It’s Linux, on the local machine the root account is always going to be able to do things.

    • Eugenia@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      5 hours ago

      Not if you have an encypted folder etc, with a different password than the user account. That way, is safe even from the root account. The problem here is that the app is a .deb, it doesn’t come as an appimage, and it needs constant updating too. So it’s the main system executable file that I want to make user-authenticating, with a different password than that of the user account.

  • Goingdown@sopuli.xyz
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    5 hours ago

    Creating a different user account for it is out of the question btw, since you can still change the password for that user via the primary admin account.

    First of all, if users have admin rights, nothing really prevents them to run that app. Even if you encrypt the app itself, they can just reinstall/replace it from standard repository.

    Few ways this can be done:

    1. If app needs internet connection, you may use firewall rules to block said connections, or even application firewall (Opensnitch). Create script which unloads said rules via su (create diffrent accounts with passwords the user must know) then runs app, and after closing app loads rules again. Users must not have admin rights or they can just unload fw rules.

    2. Create encrypted container/directory, protected by password, and manually install said app under there (probably needs manual recompile of the app). Create script which asks password, unlocks the encrypted location, runs app, and locks container after use. Again, no admin rights for users or they just install same app from repositories.

    3. Use apparmor or selinux to block said app. And again create script which by using su (create diffrent accounts with passwords the user must know) allows app via selinux/apparmor policies and runs app, and blocks it again afterwards. I repeat, users must not have admin rights or they can just unload those blocks.

    What app it is?

    EDIT: Clarification for su usage

    To have user asked password before app can be done via su + sudo like this

    • create user demouser
    • give password of that user to end user
    • give demouser sudo rights to run particular command as root without password (to unload fw rules, unload apparmor/selinux policy etc).