
리눅스 네임스페이스 및 seccomp-bpf 샌드박스
Firejail은 (잠재적으로 신뢰할 수 없는) 애플리케이션을 실행하기 위한 제한된 환경을 설정하여 Linux 시스템을 보호하도록 설계된 경량 보안 도구입니다.
보다 구체적으로, Linux 네임스페이스(namespaces), seccomp-bpf 및 Linux capabilities를 사용하여 보안 침해 위험을 줄이는 SUID 샌드박스 프로그램입니다. 프로세스와 그 모든 하위 프로세스가 네트워크 스택, 프로세스 테이블, 마운트 테이블과 같은 전역적으로 공유되는 커널 리소스를 각자의 전용 뷰(private view)로 가질 수 있게 합니다. Firejail은 SELinux 또는 AppArmor 환경에서 작동할 수 있으며 Linux Control Groups와 통합되어 있습니다.
사실상 의존성이 없이 C로 작성된 이 소프트웨어는 3.x 이상의 커널 버전을 사용하는 모든 Linux 컴퓨터에서 실행됩니다. 서버, 그래픽 애플리케이션, 심지어 사용자 로그인 세션까지 모든 유형의 프로세스를 샌드박싱할 수 있습니다. 또한 Mozilla Firefox, Chromium, VLC, Transmission 등과 같은 일반적인 Linux 프로그램 여러 개를 위한 샌드박스 프로파일을 포함합니다.
샌드박스는 경량이며 오버헤드가 낮습니다. 편집해야 할 복잡한 구성 파일도, 열려 있는 소켓 연결도, 백그라운드에서 실행되는 데몬도 없습니다. 모든 보안 기능은 Linux 커널에 직접 구현되어 있으며 모든 Linux 컴퓨터에서 사용할 수 있습니다.
SECURITY.md를 참조하십시오.
지원 버전에 대해서는 SECURITY.md를 참조하십시오.
참고: Debian stable 및 backports의 버전은 오래되었을 가능성이 높으므로, 현재는 최신 릴리스에서 .deb 패키지를 다운로드하여 설치하는 것을 권장합니다:
또는 소스에서 빌드하십시오.
Debian stable (bullseye): backports 패키지를 사용할 것을 권장합니다.
참고: 배포판 및 PPA의 버전은 오래되었을 가능성이 높으므로, 현재는 최신 릴리스에서 .deb 패키지를 다운로드하여 설치하는 것을 권장합니다:
또는 소스에서 빌드하십시오.
참고: PPA 권장 사항은 주로 firejail 자체에 대한 것입니다. firetools 및 firejail 관련 도구는 업데이트 빈도가 낮은 경향이 있으므로 PPA에 없다면 배포판에서 직접 설치해도 무방합니다.
Ubuntu 18.04+ 및 파생 배포판(예: Linux Mint) 사용자는 PPA 사용을 강력히 권장합니다.
PPA를 추가하고 설치하는 방법:
sudo add-apt-repository ppa:deki/firejail
sudo apt-get update
sudo apt-get install firejail firejail-profiles
이유: Ubuntu 20.04용 firejail 패키지는 Launchpad에 패치가 게시된 후 몇 달 동안 CVE-2021-26910에 취약한 상태로 방치되었습니다:
다음도 참조하십시오: https://wiki.ubuntu.com/SecurityTeam/FAQ:
Ubuntu 보안 팀은 어떤 소프트웨어를 지원하나요?
Ubuntu는 현재 main, restricted, universe 및 multiverse의 네 가지 구성 요소로 나뉩니다. main 및 restricted의 모든 바이너리 패키지는 Ubuntu 릴리스 수명 동안 Ubuntu 보안 팀이 지원하는 반면, universe 및 multiverse의 바이너리 패키지는 Ubuntu 커뮤니티가 지원합니다.
또한 PPA 버전이 더 최신이고 더 많은 프로파일 수정 사항을 포함할 가능성이 높습니다.
자세한 내용은 다음 토론을 참조하십시오:
Firejail은 여러 Linux 배포판에서 사용할 수 있습니다:
앞서 언급한 예외를 제외하면, 배포판이 지원되는 버전의 firejail을 제공하는 한 일반적으로 배포판에서 설치하는 것이 좋습니다.
설치 후 firejail --version으로 버전을 확인할 수 있습니다.
또한 릴리스된 패키지 중 하나를 설치할 수도 있습니다.
소스에서 현재 개발 버전을 빌드하고 설치하는 방법입니다.
해당되는 경우 아래의 배포판별 지침을 사용하는 것이 좋습니다. 네이티브 패키지를 생성하므로 시스템의 나머지 부분 및 패키지 관리와의 통합이 더 쉬워집니다.
다른 배포판의 경우 일반 지침을 참조하십시오.
CI에서 배포판별 빌드가 수행되는 방식은 .gitlab-ci.yml도 참조하십시오.
참고: AUR 패키지는 우리가 유지 관리하지 않습니다.
AUR에서 firejail-git을 설치하십시오.
예:
yay -S firejail-git
Debian, Ubuntu 및 파생 배포판의 경우:
참고: 모든 ./configure 플래그는 mkdeb.sh에 전달해야 합니다 (예: ./mkdeb.sh --enable-foo).
sudo apt-get update -qy
sudo apt-get install -qy \
git build-essential fakeroot lintian libapparmor-dev pkg-config gawk
git clone 'https://github.com/netblue30/firejail.git' &&
cd firejail &&
./configure &&
make dist &&
./mkdeb.sh &&
sudo dpkg -i ./*.deb &&
make installcheck
Fedora 및 파생 배포판의 경우:
참고: 모든 ./configure 플래그는 mkrpm.sh에 전달해야 합니다 (예: ./platform/rpm/mkrpm.sh --enable-foo).
sudo dnf update -y
sudo dnf install -y rpm-build gcc make
git clone 'https://github.com/netblue30/firejail.git' &&
cd firejail &&
./configure &&
make dist &&
./platform/rpm/mkrpm.sh &&
sudo rpm -i ./*.rpm &&
make installcheck
일반 빌드/설치 지침:
git clone 'https://github.com/netblue30/firejail.git' &&
cd firejail &&
./configure &&
make -j "$(nproc)" &&
sudo make install-strip &&
make installcheck
Debian/Ubuntu에서는 git과 gcc를 설치해야 합니다.
AppArmor 지원으로 빌드하려면 (일반적으로 Debian, Ubuntu, openSUSE 및 파생 배포판에서 사용), AppArmor 개발 라이브러리와 pkg-config를 설치하고 --enable-apparmor ./configure 옵션을 사용하십시오:
sudo apt-get install git build-essential libapparmor-dev pkg-config gawk
SELinux 지원으로 빌드하려면 (일반적으로 Fedora, RHEL 및 파생 배포판에서 사용), libselinux1-dev (Fedora에서는 libselinux-devel)를 설치하고 --enable-selinux ./configure 옵션을 사용하십시오.
git에서 firejail을 사용하는 방법에 대한 자세한 정보는 wiki에서 확인할 수 있습니다.
참고: 잠재적인 firejail-in-firejail 문제를 피하려면 프로그램의 전체 경로를 사용하십시오 (예: firejail firefox 대신 firejail /usr/bin/firefox) (#2877 참조).
샌드박스를 시작하려면 명령 앞에 firejail을 붙이십시오:
firejail /usr/bin/firefox # starting Mozilla Firefox
firejail /usr/bin/transmission-gtk # starting Transmission BitTorrent
firejail /usr/bin/vlc # starting VideoLAN Client
sudo firejail /etc/init.d/nginx start
터미널에서 firejail --list를 실행하면 모든 활성 샌드박스가 나열됩니다. 예:
$ firejail --list
1617:netblue:/usr/bin/firejail /usr/bin/firefox-esr
7719:netblue:/usr/bin/firejail /usr/bin/transmission-qt
7779:netblue:/usr/bin/firejail /usr/bin/galculator
7874:netblue:/usr/bin/firejail /usr/bin/vlc --started-from-file file:///home/netblue/firejail-whitelist.mp4
7916:netblue:firejail --list
다음 두 명령을 실행하여 샌드박스를 데스크톱에 통합하십시오:
firecfg --fix-sound
sudo firecfg
첫 번째 명령은 버전 9 이전 PulseAudio 소프트웨어의 일부 공유 메모리/PID 네임스페이스 버그를 해결합니다. 두 번째 명령은 Firejail을 데스크톱에 통합합니다. PulseAudio 변경 사항을 적용하려면 로그아웃 후 다시 로그인해야 합니다.
데스크톱 관리자 메뉴, 파일 관리자, 데스크톱 런처 등 익숙한 방식으로 프로그램을 시작하십시오.
이 통합은 Firejail이 기본적으로 지원하는 모든 프로그램에 적용됩니다. 현재 Firejail 버전에는 900개 이상의 기본 애플리케이션이 있으며, 그 수는 새 릴리스마다 늘어납니다.
애플리케이션 목록은 src/firecfg/firecfg.config에 유지 관리합니다 (설치 시 /etc/firejail/firecfg.config).
대부분의 Firejail 명령줄 옵션은 프로파일 파일을 사용하여 샌드박스에 전달할 수 있습니다.
지원되는 모든 애플리케이션의 프로파일은 etc/에서 찾을 수 있습니다 (설치 시 /etc/firejail/).
또한 이전 릴리스 버전에 대한 프로파일 수정 목록을 etc-fixes/에 유지 관리합니다.
추가 Firejail 보안 프로파일을 공개 저장소에 유지 관리한다면 링크를 알려주십시오:
새 프로파일을 요청하려면 이 이슈를 사용하십시오:
프로그램에 필요한 syscalls 목록을 얻으려면 이 도구를 사용할 수도 있습니다:
firecfg는 /usr/local/bin에 심볼릭 링크를 생성하므로 firejail을 완전히 제거하려면 제거 전에 다음을 실행하십시오:
sudo firecfg --clean
자세한 내용은 man firecfg를 참조하십시오.
참고: $PATH에서 실행 파일을 검색할 때 끊어진 심볼릭 링크는 무시되므로 위 작업 없이 제거해도 문제가 발생하지 않습니다.
LANDLOCK
Landlock is a Linux security module first introduced in version 5.13 of
the Linux kernel. It allows unprivileged processes to restrict their
access to the filesystem. Once imposed, these restrictions can never
be removed, and all child processes created by a Landlock-restricted
processes inherit these restrictions. Firejail supports Landlock as an
additional sandboxing feature. It can be used to ensure that a sand‐
boxed application can only access files and directories that it was ex‐
plicitly allowed to access. Firejail supports populating the ruleset
with both a basic set of rules (see --landlock) and with a custom set
of rules.
Important notes:
- A process can install a Landlock ruleset only if it has either
CAP_SYS_ADMIN in its effective capability set, or the "No New
Privileges" restriction enabled. Because of this, enabling the
Landlock feature will also cause Firejail to enable the "No New
Privileges" restriction, regardless of the profile or the
--nonewprivs command line option.
- Access to the /proc directory is managed through the --land‐
lock.proc command line option.
- Access to the /etc directory is automatically allowed. To
override this, use the --writable-etc command line option. You
can also use the --private-etc option to restrict access to the
/etc directory.
To enable Landlock self-restriction on top of your current Firejail se‐
curity features, pass --landlock flag to Firejail command line. You
can also use --landlock.read, --landlock.write, --landlock.special and
--landlock.execute options together with --landlock or instead of it.
Example:
$ firejail --landlock --landlock.read=/media --landlock.proc=ro /usr/bin/mc
프로파일 통계를 출력하는 작은 도구입니다. 평소와 같이 컴파일하고 설치하십시오. 이 도구는 /usr/lib/firejail 디렉터리에 설치됩니다.
/etc/profiles의 프로파일에 대해 실행하십시오:
$ /usr/lib/firejail/profstats /etc/firejail/*.profile
No include .local found in /etc/firejail/noprofile.profile
Warning: multiple caps in /etc/firejail/tidal-hifi.profile
Warning: multiple caps in /etc/firejail/tqemu.profile
Warning: multiple caps in /etc/firejail/transmission-daemon.profile
Warning: multiple caps in /etc/firejail/trivalent.profile
Stats:
profiles 1342
include local profile 1341 (include profile-name.local)
include globals 1307 (include globals.local)
blacklist ~/.ssh 1201 (include disable-common.inc)
seccomp 1213
capabilities 1335
noexec 1214 (include disable-exec.inc)
noroot 1105
memory-deny-write-execute 320
restrict-namespaces 1048
apparmor 869
private-bin 817
private-dev 1172
private-etc 842
private-cache 865
private-lib 86
private-tmp 1036
whitelist home directory 662
whitelist var 975 (include whitelist-var-common.inc)
whitelist run/user 1305 (include whitelist-runuser-common.inc
or blacklist ${RUNUSER})
whitelist usr/share 760 (include whitelist-usr-share-common.inc
net none 452
dbus-user none 766
dbus-user filter 206
dbus-system none 970
dbus-system filter 13
빠른 시작 |
고급 브라우저 보안 |
Tor 브라우저 보안 |