Skip to main content

Linux / Unix

Awesome linux

Kernel

unix based

Commandes Linux


Desktop environnement

https://github.com/Kazhnuz/awesome-gnome

Polybar

#TODEEPEN

Polybar est un utilitaire permettant de faire une barre de status dans le bureau de l'user, fonctionne avec des UNIX-based OS. 11k likes github

polybar repo

awesome polybar

X Desktop Environments

You cannot talk about a unified Linux look because there is no such thing.

https://camo.githubusercontent.com/3bd49105308380cc4a8211c0dd9c6396b29ad03987707fe4eba8653e0b24f0e5/687474703a2f2f696d67732e786b63642e636f6d2f636f6d6963732f7374616e64617264732e706e67

GNOME

GNOME 3 is an easy and elegant way to use your computer. It is designed to put you in control and bring freedom to everybody. GNOME 3 is developed by the GNOME community, a diverse, international group of contributors that is supported by an independent, non-profit foundation.

https://camo.githubusercontent.com/da099079c09948661a844cbc80535908fda81a96ed05b858ef26079dcfe030ce/68747470733a2f2f7777772e676e6f6d652e6f72672f77702d636f6e74656e742f75706c6f6164732f323031352f30332f616374697669746965732d6f766572766965772d332e31362d393430783532392e706e67

KDE

The KDE® Community is an international technology team dedicated to creating a free and user-friendly computing experience, offering an advanced graphical desktop, a wide variety of applications for communication, work, education and entertainment and a platform to easily build new applications upon. We have a strong focus on finding innovative solutions to old and new problems, creating a vibrant atmosphere open for experimentation.

https://camo.githubusercontent.com/335f2f21befc10b7ecdd963eebc09c226e4476b4ef0bac849cadd99faadaf295/68747470733a2f2f7777772e6b64652e6f72672f616e6e6f756e63656d656e74732f706c61736d61352e302f73637265656e73686f74732f6465736b746f702e706e67

Xfce

Xfce is a lightweight desktop environment for UNIX-like operating systems. It aims to be fast and low on system resources, while still being visually appealing and user friendly.

https://camo.githubusercontent.com/46760a304f1e5e101cd9bc5f303e0750949e131611e6c506b55af2bf5843393a/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f372f37312f586663652d342e342e706e67

LXDE

The "Lightweight X11 Desktop Environment" is an extremely fast-performing and energy-saving desktop environment. Maintained by an international community of developers, it comes with a beautiful interface, multi-language support, standard keyboard short cuts and additional features like tabbed file browsing. LXDE uses less CPU and less RAM than other environments. It is especially designed for cloud computers with low hardware specifications, such as netbooks, mobile devices (e.g. MIDs) or older computers. LXDE can be installed on many Linux distributions including Debian, Fedora, OpenSUSE and Ubuntu. It is the standard for Knoppix and lubuntu. LXDE also runs on OpenSolaris and BSD. LXDE provides a fast desktop experience; connecting easily with applications in the cloud. LXDE supports a wealth of programs that can be installed locally with Linux systems. The source code of LXDE is licensed partly under the terms of the GNU General Public License and partly under the LGPL.

https://camo.githubusercontent.com/69573d293e7f959c85408cdea9d2b87bbdc23007868a58b39b36d0f2bc0c7aff/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f342f34632f4c5844455f6465736b746f705f66756c6c2e706e67

Other Desktop Environments

  • Cinnamon - Strives to provide a traditional user experience.
  • EDE - Small desktop environment built to be responsive, light in resource usage and to have a familiar look and feel.
  • LXQt - Qt port and the upcoming version of LXDE, the Lightweight Desktop Environment. It is the product of the merge between the LXDE-Qt and the Razor-qt projects: A lightweight, modular, blazing-fast and user-friendly desktop environment.
  • MATE - Provides an intuitive and attractive desktop to Linux users using traditional metaphors. Fork of GNOME 2.
  • Pantheon - Pantheon is the default desktop environment originally created for the elementary OS distribution. The desktop has some similarities with GNOME Shell and macOS.

X Windows Managers

  • 9wm - Window manager that attempts to emulate the Plan 9 window manager 8-1/2 as far as possible within the constraints imposed by X.
  • awesome - Highly configurable window manager for X. Fast and extensible.
  • Blackbox - Lightweight window manager for the X window system, without library dependencies. Built using C++.
  • bspwm - Tiling window manager that represents windows as the leaves of a full binary tree.
  • Compiz - OpenGL compositing window manager. It has a plug-in system to be changed at runtime.
  • dwm - Dynamic window manager for X. It manages windows in tiled, monocle and floating layouts. All of the layouts can be applied dynamically, optimising the environment for the application and task performed.
  • Enlightenment - Window manager bundled with a whole suite of libraries to help you create beautiful user interfaces.
  • Fluxbox - Window manager for X, lightweight and easy to handle but full of features to make an easy and fast desktop experience. Built using C++.
  • FVWM - ICCCM-compliant multiple virtual desktop window manager for X. Extremely powerful.
  • i3 - Tiling window manager. BSD-licensed. Primarily targeted at advanced users and developers.
  • IceWM - Window manager with the goal of being fast, simple, and not getting in the user's way.
  • JWM - Lightweight window manager for X11. Good choice for older and/or less powerful systems, though perfectly capable of running on modern systems. Built using C.
  • Matchbox - Environment for X running on non-desktop embedded platforms such as handhelds, set-top boxes, kiosks and anything else for which screen space, input mechanisms or system resources are limited.
  • Mutter - Window manager for X. Default window manager in GNOME 3.
  • Openbox - Highly configurable window manager with extensive standards support.
  • ratpoison - A simple window manager with no library dependencies, no graphics, and no decorations. Modeled after GNU Screen.
  • Sawfish - Extensible window manager. Its aim is to manage windows in the most flexible and attractive manner possible. Built using Lisp-based scripting language.
  • wmii - Small, scriptable window manager, with a 9P filesystem interface and an acme-like layout.
  • xmonad - Dynamically tiling X11 window manager. Makes work easier by automating aligning and searching for windows. Built using Haskell.

Package managers

NIX

*Nix is a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible.*

awesome NIX


Packages linux ubuntu et debians usefull

Liste des paquets utiles pour debian et linux

Touchégg

Open source, ajoute l’utilisation des gestures pour la touchbar 3, 4, 5 doigts

https://github.com/JoseExposito/touchegg

Ajouter la reconnaissance d’empreinte digitale

sudo apt intall fprintd

toute l’explication disponible ci-dessous

fprint [Wiki ubuntu-fr]

Drive (google drive)

fonctionne comme un outil de versionning.

https://github.com/odeke-em/drive

flatpak install drive

INTERESTING OS

List d’OS qui me semblent intéressant, pour la cybersec, pour le design, l’accessibilité / / le dev

Burn des OS

permet de burn des os sur SD et USB

balenaEtcher - Flash OS images to SD cards & USB drives

Parrot OS

Parrot OS est un système de plus de 600 outils de cybersec, mais il existe aussi dans différentes versions pour la bureautique, les mini ordinateurs, l’IOT.

Parrot Security

Specs

Minimum 1.5 GO de RAM, un stockage à 20 go mini requis.


Kali Linux

Kali est un peu une des bases des OS destinés à la Cybersec.

Kali Linux | Penetration Testing and Ethical Hacking Linux Distribution

Specs

Minimum 1.5 GO de RAM, un stockage à 20 go mini requis.


Archlinux

Os kompliké archlinux wiki


Blackarch linux

Black arch est moins connu que les deux précédents et à la particularité de correpondre aux clichés du hacking dans le cinéma. Black arch est basé sur Arch linux.

BlackArch


Alipine linux

Alpine est réputé car ultra léger, donc ultra sécurisé car peu d’outils qui pourraient ajouter des vulnérabilités, très simple d’utilisation no GUI.

index | Alpine Linux

Specs

Minimum 1.5 GO de RAM, l’image fait 8 mo et nécessite en moyenne 130 mo de stockage.


Pop!_OS

Os open source, design attrayant.

https://pop.system76.com/


gentoo linux

Os utilisé pour faire de la sec et de l'embarqué. gentoo wiki


JingOS

OS pour les tablettes.JingOS

Distributions

Distributions are organized into three different categories: for beginners, for intermediate users and for advanced users. In those categories, the distributions are organized in the alphabetical order.

Beginners

elementary OS

elementary OS is an Ubuntu-based desktop distribution. Some of its more interesting features include a custom desktop environment called Pantheon and many custom apps including Photos, Music, Videos, Calendar, Terminal, Files, and more. It also comes with some familiar apps like the Epiphany web browser and a fork of Geary mail.

Latest version: elementary OS Juno (5.0)

Default Desktop Environment: Pantheon

https://camo.githubusercontent.com/d35b49aa6bc395f91ecda49eb3f599ffc9d734f9434e0f416d19bbfc1d9d1479/68747470733a2f2f656c656d656e746172792e696f2f696d616765732f73637265656e73686f74732f6465736b746f702e6a7067

Fedora

Fedora (formerly Fedora Core) is a Linux distribution developed by the community-supported Fedora Project and owned by Red Hat. Fedora contains software distributed under a free and open-source license and aims to be on the leading edge of such technologies. Fedora has a reputation for focusing on innovation, integrating new technologies early on and working closely with upstream Linux communities. The default desktop in Fedora is the GNOME desktop environment and the default interface is the GNOME Shell. Other desktop environments, including KDE, Xfce, LXDE, MATE and Cinnamon, are available. Fedora Project also distributes custom variations of Fedora called Fedora spins. These are built with specific sets of software packages, offering alternative desktop environments or targeting specific interests such as gaming, security, design, scientific computing and robotics.

Latest version: Fedora Twenty Nine (29)

Default Desktop Environment: GNOME

https://camo.githubusercontent.com/5fb32d177642592032673b077ba36aebf7310cb0b01e52e54b72dbe45c27a058/68747470733a2f2f64697374726f77617463682e636f6d2f696d616765732f6367666a6f6577646c62632f6665646f72612e706e67

Linux Mint

Linux Mint is an Ubuntu-based distribution whose goal is to provide a more complete out-of-the-box experience by including browser plugins, support for DVD playback, Java and other components. It also adds a custom desktop and menus, several unique configuration tools, and a web-based package installation interface. Linux Mint is compatible with Ubuntu software repositories.

Latest version: Linux Mint Tessa (19.1)

Default Desktop Environment: Cinnamon and MATE

https://camo.githubusercontent.com/16e25bb3d0b431e2623b60c09a0d53f18fd4d2cf2b79f02e3f836fe94842b471/68747470733a2f2f64697374726f77617463682e636f6d2f696d616765732f6367666a6f6577646c62632f6d696e742e706e67

Ubuntu

Ubuntu is a complete desktop Linux operating system, freely available with both community and professional support. The Ubuntu community is built on the ideas enshrined in the Ubuntu Manifesto: that software should be available free of charge, that software tools should be usable by people in their local language and despite any disabilities, and that people should have the freedom to customise and alter their software in whatever way they see fit. "Ubuntu" is an ancient African word, meaning "humanity to others". The Ubuntu distribution brings the spirit of Ubuntu to the software world.

Latest version: Ubuntu 18.10

Default Desktop Environment: GNOME

https://camo.githubusercontent.com/45abb129d2016a24679c01dc9f4c54431a0894acc64139bc26ee5f07e2baca8a/68747470733a2f2f64697374726f77617463682e636f6d2f696d616765732f6367666a6f6577646c62632f7562756e74752e706e67

Intermediate

CentOS

CentOS as a group is a community of open source contributors and users. Typical CentOS users are organisations and individuals that do not need strong commercial support in order to achieve successful operation. CentOS is 100% compatible rebuild of the Red Hat Enterprise Linux, in full compliance with Red Hat's redistribution requirements. CentOS is for people who need an enterprise class operating system stability without the cost of certification and support.

Latest version: CentOS 7.1810

Default Desktop Environment: GNOME

https://camo.githubusercontent.com/a722ea4221ca936b388a472240163701988dc50c9e8d60e50a5e9302321b0b76/687474703a2f2f64697374726f77617463682e636f6d2f696d616765732f6367666a6f6577646c62632f63656e746f732e706e67

Debian GNU/Linux

The Debian Project is an association of individuals who have made common cause to create a free operating system. This operating system is called Debian. Debian systems currently use the Linux kernel. Linux is a completely free piece of software started by Linus Torvalds and supported by thousands of programmers worldwide. Of course, the thing that people want is application software: programs to help them get what they want to do done, from editing documents to running a business to playing games to writing more software. Debian comes with over 50,000 packages (precompiled software that is bundled up in a nice format for easy installation on your machine) - all of it free. It's a bit like a tower. At the base is the kernel. On top of that are all the basic tools. Next is all the software that you run on the computer. At the top of the tower is Debian -- carefully organizing and fitting everything so it all works together.

Latest version: Debian Stretch (9.6)

Default Desktop Environment: GNOME

https://camo.githubusercontent.com/753ad6523b42cf705b82c3b2efac35c2dc9bc3fe1dc61293d432c8ac4ba14609/687474703a2f2f64697374726f77617463682e636f6d2f696d616765732f6367666a6f6577646c62632f64656269616e2e706e67

Mageia

Mageia is a fork of Mandriva Linux formed in September 2010 by former employees and contributors to the popular French Linux distribution. Unlike Mandriva, which is a commercial entity, the Mageia project is a community project and a non-profit organisation whose goal is to develop a free Linux-based operating system.

Latest version: Mageia 6.1

Default Desktop Environment: KDE

https://camo.githubusercontent.com/673cfab2a7d19f3d7ee9333424f1e7a03d5fd9682e39e54f955edd68b334a8c3/687474703a2f2f64697374726f77617463682e636f6d2f696d616765732f6367666a6f6577646c62632f6d61676569612e706e67

Manjaro

Manjaro Linux is a fast, user-friendly, desktop-oriented operating system based on Arch Linux. Key features include intuitive installation process, automatic hardware detection, stable rolling-release model, ability to install multiple kernels, special Bash scripts for managing graphics drivers and extensive desktop configurability. Manjaro Linux offers Xfce as the core desktop options, as well as a minimalist Net edition for more advanced users. Community-supported GNOME 3/Cinnamon and KDE flavours are available. Users also benefit from the supportive and vibrant Manjaro community forum.

Latest version: Manjaro 18.0.2

Default Desktop Environment: XFCE, KDE

https://camo.githubusercontent.com/d9fd35436fb20daebd2e0f3b9c22b1a4cc1887adcabc74d705ed5a318c2f2d8e/687474703a2f2f64697374726f77617463682e636f6d2f696d616765732f6367666a6f6577646c62632f6d616e6a61726f2e706e67

openSUSE

The openSUSE project is a community program sponsored by SUSE Linux and other companies. Promoting the use of Linux everywhere, this program provides free, easy access to openSUSE, a complete Linux distribution. The openSUSE project has three main goals: make openSUSE the easiest Linux for anyone to obtain and the most widely used Linux distribution; leverage open source collaboration to make openSUSE the world's most usable Linux distribution and desktop environment for new and experienced Linux users; dramatically simplify and open the development and packaging processes to make openSUSE the platform of choice for Linux developers and software vendors.

Latest version: openSUSE Leap 15.0 and openSUSE Tumbleweed (Rolling Release system)

Default Desktop Environment: KDE, GNOME, XFCE, LXDE (Choose on installation)

https://camo.githubusercontent.com/83993efc9a4fe47b5983cc0589987146b558b2369202e94591ee646036cd1039/687474703a2f2f64697374726f77617463682e636f6d2f696d616765732f6367666a6f6577646c62632f6f70656e737573652e706e67

Advanced

Arch Linux

Arch Linux is an independently developed, x86_64-optimised Linux distribution targeted at competent Linux users. It uses 'pacman', its home-grown package manager, to provide updates to the latest software applications with full dependency tracking. Operating on a rolling release system, Arch can be installed from a CD image or via an FTP server. The default install provides a solid base that enables users to create a custom installation. In addition, the Arch Build System (ABS) provides a way to easily build new packages, modify the configuration of stock packages, and share these packages with other users via the Arch Linux user repository.

Latest version: Not applicable (Rolling Release system)

Default Desktop Environment: Not applicable (there's no default Desktop environment)

Special Purpose

CoreOS

Specialty: Clusters

CoreOS is a Linux-based operating system for servers. Built from the ground up and designed primarily for the modern data centre, CoreOS provides specialist tools for making the system secure, reliable and up-to-date. Some of the more interesting features of the distribution include reliable updates and patches via FastPatch, a dashboard for managing rolling updates via CoreUpdate, a docker for packaging applications, as well as support for bare metal and many cloud providers.

Kali Linux

Specialty: Penetration testing

Kali Linux (formerly known as BackTrack) is a Debian-based distribution with a collection of security and forensics tools. It features timely security updates, support for the ARM architecture, a choice of four popular desktop environments, and seamless upgrades to newer versions.

Puppy Linux

Specialty: Low system requirements

Puppy Linux is yet another Linux distribution. What's different here is that Puppy is extraordinarily small, yet quite full-featured. Puppy boots into a ramdisk and, unlike live CD distributions that have to keep pulling stuff off the CD, it loads into RAM. This means that all applications start in the blink of an eye and respond to user input instantly. Puppy Linux has the ability to boot off a flash card or any USB memory device, CDROM, Zip disk or LS/120/240 Superdisk, floppy disks, internal hard drive. It can even use a multisession formatted CD-RW/DVD-RW to save everything back to the CD/DVD with no hard drive required at all.

Ubuntu Studio

Specialty: Multimedia creation

Ubuntu Studio is a variant of Ubuntu aimed at the GNU/Linux audio, video and graphic enthusiast as well as professional. The distribution provides a collection of open-source applications available for multimedia creation.

Tails

Specialty: Incognito live system

Tails is a live system that aims to preserve your privacy and anonymity. It helps you to use the Internet anonymously and circumvent censorship almost anywhere you go and on any computer but leaving no trace unless you ask it to explicitly. It is a complete operating system designed to be used from a USB stick or a DVD independently of the computer's original operating system. It is Free Software and based on Debian GNU/Linux. Tails comes with several built-in applications pre-configured with security in mind: web browser, instant messaging client, email client, office suite, image and sound editor, etc.

a checker

#TODO

awesome os

https://github.com/Awesome-HarmonyOS/HarmonyOS




LINUX BASICS

https://github.com/Forty-Bot/linux-checklist

Notes

If a command errors or fails, try it again with sudo (or sudo !! to save typing)

Google anything and everything. If you don't know or understand something, google it

When you see the syntax $word, do not type it verbatim, but instead substitute the appropriate word (usually referenced in a previous command).

When the order of steps does not matter, bullet points have been used instead of ordinals.

To edit files, run gedit, a graphical editor akin to notepad; nano, a simple command-line editor; or vim, a powerful but less intuitive command-line editor. Note that vim may need to be installed with apt-get install vim.

Checklist

  1. Read the readme

    Note down which ports/users are allowed.

  2. Do Forensics Questions

    You may destroy the requisite information if you work on the checklist!

  3. Secure root

    set PermitRootLogin no in /etc/ssh/sshd_config

  4. Secure Users

    1. Disable the guest user.

      Go to /etc/lightdm/lightdm.conf and add the line

      allow-guest=false

      Then restart your session with sudo restart lightdm. This will log you out, so make sure you are not executing anything important.

    2. Open up /etc/passwd and check which users

      • Are uid 0
      • Can login
      • Are allowed in the readme
    3. Delete unauthorized users:

      sudo userdel -r $user

      sudo groupdel $user

    4. Check /etc/sudoers.d and make sure only members of group sudo can sudo.

    5. Check /etc/group and remove non-admins from sudo and admin groups.

    6. Check user directories.

      1. cd /home
      2. sudo ls -Ra *
      3. Look in any directories which show up for media files/tools and/or "hacking tools."
    7. Enforce Password Requirements.

      1. Add or change password expiration requirements to /etc/login.defs.

        PASS_MIN_DAYS 7
        PASS_MAX_DAYS 90
        PASS_WARN_AGE 14

      2. Add a minimum password length, password history, and add complexity requirements.

        1. Open /etc/pam.d/common-password with sudo.
        2. Add minlen=8 to the end of the line that has pam_unix.so in it.
        3. Add remember=5 to the end of the line that has pam_unix.so in it.
        4. Locate the line that has pam.cracklib.so in it. If you cannot find that line, install cracklib with sudo apt-get install libpam-cracklib.
        5. Add ucredit=-1 lcredit=-1 dcredit=-1 ocredit=- to the end of that line.
      3. Implement an account lockout policy.

        1. Open /etc/pam.d/common-auth.
        2. Add deny=5 unlock_time=1800 to the end of the line with pam_tally2.so in it.
      4. Change all passwords to satisfy these requirements.

        chpasswd is very useful for this purpose.

  5. Enable automatic updates

    In the GUI set Update Manager->Settings->Updates->Check for updates:->Daily.

  6. Secure ports

    1. sudo ss -ln
    2. If a port has 127.0.0.1:$port in its line, that means it's connected to loopback and isn't exposed. Otherwise, there should only be ports which are specified in the readme open (but there probably will be tons more).
    3. For each open port which should be closed:
      1. sudo lsof -i :$port
      2. Copy the program which is listening on the port. whereis $program
      3. Copy where the program is (if there is more than one location, just copy the first one). dpkg -S $location
      4. This shows which package provides the file (If there is no package, that means you can probably delete it with rm $location; killall -9 $program). sudo apt-get purge $package
      5. Check to make sure you aren't accidentally removing critical packages before hitting "y".
      6. sudo ss -l to make sure the port actually closed.
  7. Secure network

    1. Enable the firewall

      sudo ufw enable

    2. Enable syn cookie protection

      sysctl -n net.ipv4.tcp_syncookies

    3. Disable IPv6 (Potentially harmful)

      echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf

    4. Disable IP Forwarding

      echo 0 | sudo tee /proc/sys/net/ipv4/ip_forward

    5. Prevent IP Spoofing

      echo "nospoof on" | sudo tee -a /etc/host.conf

  8. Install Updates

    Start this before half-way.

    • Do general updates.
      1. sudo apt-get update.
      2. sudo apt-get upgrade.
    • Update services specified in readme.
      1. Google to find what the latest stable version is.
      2. Google "ubuntu install service version".
      3. Follow the instructions.
    • Ensure that you have points for upgrading the kernel, each service specified in the readme, and bash if it is vulnerable to shellshock.
  9. Configure services

    1. Check service configuration files for required services. Usually a wrong setting in a config file for sql, apache, etc. will be a point.

    2. Ensure all services are legitimate.

      service --status-all

  10. Check the installed packages for "hacking tools," such as password crackers.

  11. Run other (more comprehensive) checklists. This is checklist designed to get most of the common points, but it may not catch everything.

Tips

  • Netcat is installed by default in ubuntu. You will most likely not get points for removing this version.
  • Some services (such as ssh) may be required even if they are not mentioned in the readme. Others may be points even if they are explicitly mentioned in the readme

nslookup command because it’s another command line tool that is usually available. This tool looks up IP addresses assigned to website domain names.

tracert tool, which sends packets to each router along the path between your computer and the destination you  want your traffic to reach.




AppArmor

AppArmor is an effective and easy-to-use Linux application security system. AppArmor proactively protects the operating system and applications from external or internal threats, even zero-day attacks, by enforcing good behavior and preventing even unknown application flaws from being exploited.

AppArmor security policies completely define what system resources individual applications can access, and with what privileges. Several default policies are included with AppArmor, and using a combination of advanced static analysis and learning-based tools, AppArmor policies for even very complex applications can be deployed successfully in a matter of hours.

Check if AppArmor is installed

AppArmor and it's profiles should already be enabled and running on Parrot OS. To check if AppArmor is active do:

sudo aa-status --enabled; echo $?

The output should return 0. Alternatively run the following command to see the loaded AppArmor profiles:

sudo aa-status

https://www.parrotsec.org/docs/images/apparmor/0.png

If for any reason AppArmor is not pre-installed, continue reading below.

Install AppArmor

sudo apt install apparmor apparmor-utils auditd

apparmor = main package apparmor-utils = utilities for controlling apparmor profiles auditd = automatic profile generation tools

To enable AppArmor run the followng commands:

sudo mkdir -p /etc/default/grub.d

echo 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT apparmor=1 security=apparmor"' | sudo tee /etc/default/grub.d/apparmor.cfg

sudo update-grub

sudo reboot

Then run the following command to inspect the current state:

sudo aa-status

This will list all loaded AppArmor profiles for applications, processes and detail their status (enforced, complain, unconfined).

For example, to check what is enforce mode, run the following command:

ps auxZ | grep -v '^unconfined'

To install profile, run the following command:

sudo apt install apparmor-profiles apparmor-profiles-extra

AppArmor profiles live in /etc/apparmor.d/. You can use apparmor_parser(8) to insert them into the kernel. This is done automatically when installing packages that drop policy in /etc/apparmor.d/.

For example, to set all "extra" profiles (provided in the apparmor-profiles package) to complain mode (except deny rules that are silently enforced, security policy is not enforced and access violations are logged), do the following:

cd /usr/share/doc/apparmor-profiles/extras

cp -i *.* /etc/apparmor.d/

for f in *.*;
do aa-complain /etc/apparmor.d/$f;
done

To set these profiles to enforce mode, use aa-enforce instead of aa-complain. Beware though: many of these profiles are not up-to-date and will break functionality in enforce mode (and possibly even in complain mode); enforce them only if you're ready to improve them upstream.

Disable AppArmor

First, you can disable individual profiles with aa-disable. But if you want to entirely disable AppArmor on your system, run:

sudo mkdir -p /etc/default/grub.d

echo 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT apparmor=0"' | sudo tee /etc/default/grub.d/apparmor.cfg

sudo update-grub

sudo reboot

Debug AppArmor

The aa-notify command, from the apparmor-notify package, is able to provide a desktop notification whenever a program causes a DENIED message in /var/log/kern.log. Grant yourself read permissions for /var/log/kern.log by joining the adm group:

sudo adduser "$USER" adm

Then aa-notify should automatically start the next time you login (using /etc/xdg/autostart/apparmor-notify.desktop). If it doesn't, start it manually:

aa-notify -p

If you use auditd, you should start aa-notify in this way:

sudo aa-notify -p -f /var/log/audit/audit.log

Diagnose if a bug might have been caused by AppArmor

The apparmor-utils package provides many useful commands to debug AppArmor. Find out if AppArmor is enabled through cat command:

cat /sys/module/apparmor/parameters/enabled

This will return Y if true.

Find out which profiles are enabled

sudo aa-status

The command above will list all loaded AppArmor profiles for applications and processes and detail their status (enforced, complain, unconfined). And,

ps auxZ | grep -v '^unconfined'

will list running executables which are currently confined by an AppArmor profile. Sometimes, it's useful to disable a profile and to test again if the bug persists:

sudo aa-disable /etc/apparmor.d/$profile

e.g. sudo aa-disable /etc/apparmor.d/usr.bin.pidgin.

You can re-enable the profile in this way:

sudo aa-enforce /etc/apparmor.d/$profile

Verify the logs

sudo tail -f /var/log/syslog | grep 'DENIED'

or (if auditd is installed):

sudo tail -f /var/log/auditd/auditd.log | grep 'DENIED'

The "DENIED" lines should provide more information on what concrete process or access to the file system has been denied. Output a list of processes with tcp or udp ports that do not have AppArmor profiles loaded:

sudo aa-unconfined

also possible with the --paranoid parameter.

Profiles in complain mode will send ALLOWED lines in the logs for entries that would normally be DENIED in enforce mode. You can use this to tweak configurations before turning them on in enforce mode.