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

Reintroduce shell feature #6490

Open
ganeshjkale opened this issue Sep 27, 2024 · 15 comments
Open

Reintroduce shell feature #6490

ganeshjkale opened this issue Sep 27, 2024 · 15 comments
Labels
enhancement New feature request needinfo More information is needed from the issue author

Comments

@ganeshjkale
Copy link

ganeshjkale commented Sep 27, 2024

#OS : Redhat 9.4
#Firejail : v0.9.72
#Command
firejail --shell=/bin/rbash --profile=/etc/firejail/abc.profile /usr/bin/gedit
firejail --shell=/bin/rbash /usr/bin/gedit
firejail --shell=/bin/rbash --noprofile /usr/bin/gedit

shell feature enables to provide more security , not able to find its alternative and documentation.
please help

@rusty-snake
Copy link
Collaborator

What do you mean with shell feature?

Why does it provide more security?

@kmk3
Copy link
Collaborator

kmk3 commented Sep 27, 2024

Basic information is missing; please follow the feature request template:

@kmk3 kmk3 added needinfo More information is needed from the issue author enhancement New feature request labels Sep 27, 2024
@ganeshjkale
Copy link
Author

For eg. combine firejail with rbash or custom shell

@rusty-snake
Copy link
Collaborator

firejail rbash?

You need to explain in more detail.

@ganeshjkale
Copy link
Author

Firejail v0.9.70 below command.
firejail --shell=/bin/rbash application

@rusty-snake
Copy link
Collaborator

And why is a --shell required? Why not simply firejail /bin/rbash application?

@ganeshjkale
Copy link
Author

#not working getting cannot execute binary gedit.
firejail /bin/rbash gedit

#working
firejail gedit

@rusty-snake
Copy link
Collaborator

Maybe you should outline why you even need/want a rbash.

not working getting cannot execute binary gedit

firejail /bin/bash -r -c gedit

@luitzifa
Copy link

luitzifa commented Nov 19, 2024

IMHO this is a regression introduced in 0.9.72. The --shell feature was removed here: #5190
The feature is needed to use firejail directly as login shell.
This issue is somewhat related to #6206

@rusty-snake
Copy link
Collaborator

A small wrapper (e.g. firejail-sh) would fit this better IMHO.

@luitzifa
Copy link

luitzifa commented Nov 19, 2024

I cannot get a wrapper like

root@notebook:~# cat /usr/local/bin/firejail-login.sh
#!/bin/sh
/usr/bin/firejail --quiet --profile=/etc/firejail/myprofile.profile /bin/bash

to work with something like this:
ssh -o IdentityAgent=none [email protected] 'ls /dev'

I can login and execute the command, but i need to be able to execute the command directly over ssh in firejail.

@rusty-snake
Copy link
Collaborator

Passing arguments could help. Untested:

#!/bin/sh
exec /usr/bin/firejail --quiet --profile=/etc/firejail/myprofile.profile /bin/bash -- "$@"

@luitzifa
Copy link

luitzifa commented Nov 21, 2024

I tested your wrapper. Did not work :( , also the login is broken too.

❯ ssh -o IdentityAgent=none [email protected]
[email protected]'s password:
Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-49-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

Last login: Thu Nov 21 10:24:21 2024 from 127.0.0.1
/bin/bash: -c: No such file or directory
Connection to 127.0.0.1 closed.
❯ ssh -o IdentityAgent=none [email protected] 'ls /dev'
[email protected]'s password:
/bin/bash: -c: No such file or directory

@rusty-snake
Copy link
Collaborator

If passing non-file-arguments to bash is required, remove the --.

@luitzifa
Copy link

That did the trick. I will test it further:

❯ cat /usr/local/bin/firejail-login.sh
#!/bin/sh
/usr/bin/firejail --quiet --profile=/etc/firejail/myloginshell.profile /bin/bash "$@"
❯ grep testuser /etc/passwd
testuser:x:994:981::/home/testuser:/usr/local/bin/firejail-login.sh
testuser2:x:993:980::/home/testuser2:/usr/bin/firejail
❯ ssh -o IdentityAgent=none [email protected] 'ls -la /dev | grep random'
[email protected]'s password:
crw-rw-rw-   1 nobody nogroup   1, 8 Nov 21 10:35 random
crw-rw-rw-   1 nobody nogroup   1, 9 Nov 21 10:35 urandom

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request needinfo More information is needed from the issue author
Projects
None yet
Development

No branches or pull requests

4 participants