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

New profile: device-flasher.linux #6616

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucasmz-dev
Copy link
Contributor

The CalyxOS CLI device flasher. Has to be run under certain exceptions but works fine regardless.

The CalyxOS CLI device flasher. Has to be run under certain exceptions but works fine regardless.
include allow-bin-sh.inc

blacklist /opt
blacklist /srv
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this only because of rusty-snake's kyst, works fine so might as well keep it?
I'm not entirely sure what /opt and /srv are for.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this only because of rusty-snake's kyst, works fine so might as well
keep it?

Seems fine.

I'm not entirely sure what /opt and /srv are for.

/opt is sometimes used for putting the entire installation files of third-party
programs into (as with Program Files in Windows).

/srv is used by things like HTTP servers.

Comment on lines +1 to +18
# Firejail profile for device-flasher.linux
# Description: CalyxOS' device flasher
# This file is overwritten after every install/update

# Usage: run firejail ./device-flasher.linux in the folder with it and your factory image.

# Warning!
# ADB does not work under this sandbox, this is not a problem however, it just means you need to
# reboot the device into bootloader mode first. To do this, hold Volume Down + Power until you get
# into a screen with an Android robot being repaired. You'll need OEM Unlocking beforehand.

# Fedora: you may need to manually install a third-party resource for udev rules, as Fedora ships broken ones on android-tools.

quiet
include device-flasher.linux.local
# Persistent local customizations
include globals.local
# Persistent global definitions
Copy link
Collaborator

@kmk3 kmk3 Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Firejail profile for device-flasher.linux
# Description: CalyxOS' device flasher
# This file is overwritten after every install/update
# Usage: run firejail ./device-flasher.linux in the folder with it and your factory image.
# Warning!
# ADB does not work under this sandbox, this is not a problem however, it just means you need to
# reboot the device into bootloader mode first. To do this, hold Volume Down + Power until you get
# into a screen with an Android robot being repaired. You'll need OEM Unlocking beforehand.
# Fedora: you may need to manually install a third-party resource for udev rules, as Fedora ships broken ones on android-tools.
quiet
include device-flasher.linux.local
# Persistent local customizations
include globals.local
# Persistent global definitions
# Firejail profile for device-flasher.linux
# Description: CalyxOS' device flasher
# This file is overwritten after every install/update
quiet
# Persistent local customizations
include device-flasher.linux.local
# Persistent global definitions
include globals.local
# Usage: Run firejail ./device-flasher.linux in the folder with it and your
# factory image.
# Warning: ADB does not work with this profile, so you need to reboot the
# device into bootloader mode first. To do this, hold Volume Down + Power until
# you get into a screen with an Android robot being repaired. You'll need OEM
# Unlocking beforehand.
# Fedora: You may need to manually install a third-party resource for udev
# rules, as Fedora ships broken ones on android-tools.

Sort/format/reword.


ignore noexec ${HOME}

include allow-bin-sh.inc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
include allow-bin-sh.inc
# Allow /bin/sh (blacklisted by disable-shell.inc)
include allow-bin-sh.inc

Comment on lines +24 to +27
blacklist /opt
blacklist /srv
blacklist ${RUNUSER}
blacklist /usr/libexec
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
blacklist /opt
blacklist /srv
blacklist ${RUNUSER}
blacklist /usr/libexec
blacklist ${RUNUSER}
blacklist /opt
blacklist /srv
blacklist /usr/libexec

Sort.

Comment on lines +39 to +43
whitelist ${DOWNLOADS}
# The Downloads folder is the only folder available to the flasher, use it or manually whitelist another.
# Preferably use a sub-folder such as Downloads/CalyxOS/ to prevent issues.

include whitelist-run-common.inc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
whitelist ${DOWNLOADS}
# The Downloads folder is the only folder available to the flasher, use it or manually whitelist another.
# Preferably use a sub-folder such as Downloads/CalyxOS/ to prevent issues.
include whitelist-run-common.inc
whitelist ${DOWNLOADS}
include whitelist-common.inc
include whitelist-run-common.inc

The comment is kind of redundant, as it generally applies to any profile with
whitelist ${DOWNLOADS} (or another XDG user directory).

Usually whitelist-common.inc is included when whitelist ${HOME}/... is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see much reason to use whitelist-common.inc, it isn't needed at all, especially being a CLI tool.

(I'll go ahead soon enough and apply the changes requested, I'd like to confirm flashing works, this is the only one I don't see why use whitelist-common in specific, removing the comments is fine)

Comment on lines +47 to +48

include landlock-common.inc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
include landlock-common.inc

Not currently used.

disable-mnt
private-bin bash,cut,grep,ls,sed,sh,sleep,which
private-cache
private-etc alternatives,ca-certificates,crypto-policies,host.conf,hostname,hosts,ld.so.cache,ld.so.conf,ld.so.conf.d,ld.so.preload,locale,locale.alias,locale.conf,localtime,mime.types,nsswitch.conf,pki,protocols,resolv.conf,rpc,services,ssl,xdg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private-etc alternatives,ca-certificates,crypto-policies,host.conf,hostname,hosts,ld.so.cache,ld.so.conf,ld.so.conf.d,ld.so.preload,locale,locale.alias,locale.conf,localtime,mime.types,nsswitch.conf,pki,protocols,resolv.conf,rpc,services,ssl,xdg
private-etc @network,@tls-ca,host.conf,mime.types,rpc,services,xdg

Use new private-etc groups (see #6400).

private-etc alternatives,ca-certificates,crypto-policies,host.conf,hostname,hosts,ld.so.cache,ld.so.conf,ld.so.conf.d,ld.so.preload,locale,locale.alias,locale.conf,localtime,mime.types,nsswitch.conf,pki,protocols,resolv.conf,rpc,services,ssl,xdg
private-tmp

dbus-system none
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dbus-system none
dbus-user none

private-tmp

dbus-system none
dbus-user none
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dbus-user none
dbus-system none

@kmk3 kmk3 marked this pull request as draft January 20, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants