Rules Related To 'apt'

Component overview

Relevant packages:

Relevant groups:

Changelog:

No changes recorded.

Relevant rules:

Rule details

Disable unauthenticated repositories in APT configuration

apt_conf_disallow_unauthenticated

Description

Unauthenticated repositories should not be used for updates.

Rationale

Repositories hosts all packages that will be installed on the system during update. If a repository is not authenticated, the associated packages can't be trusted, and then should not be installed locally.

Disable APT Weak Dependencies

apt_disable_weak_dependencies

Description

APT should be configured to avoid installing packages listed only as Recommends or Suggests dependencies.

Rationale

Unless a system specifically requires the additional capabilities provided by weak dependencies, those packages should not be installed in order to reduce the potential attack surface.

Ensure that official distribution repositories are used

apt_sources_list_official

Description

Check that official Debian repositories, including security repository, are configured in apt.

Rationale

The Debian distribution deliver DSA (Debian Security Announce), through the official Debian security repository, to correct various vulnerabilities impacting the Debian packages. Using the official repositories is the best way to ensure that the Debian updates are integrated soon enough.

Verify Group Owner on /etc/apt/auth.conf.d Directory

directory_groupowner_apt_auth_conf_d

Description

To properly set the group owner of /etc/apt/auth.conf.d, run the command:

$ sudo chgrp root /etc/apt/auth.conf.d

Rationale

The /etc/apt/auth.conf.d directory should be group-owned by root to prevent unauthorized changes to APT authentication configuration.

Verify Group Owner on /etc/apt/sources.list.d Directory

directory_groupowner_apt_sources_list_d

Description

To properly set the group owner of /etc/apt/sources.list.d, run the command:

$ sudo chgrp root /etc/apt/sources.list.d

Rationale

The /etc/apt/sources.list.d directory should be group-owned by root to prevent unauthorized changes to APT repository configuration.

Verify Group Owner on /etc/apt/trusted.gpg.d Directory

directory_groupowner_apt_trusted_gpg_d

Description

To properly set the group owner of /etc/apt/trusted.gpg.d, run the command:

$ sudo chgrp root /etc/apt/trusted.gpg.d

Rationale

The /etc/apt/trusted.gpg.d directory should be group-owned by root to prevent unauthorized changes to APT trusted keys.

Verify Group Owner on /usr/share/keyrings Directory

directory_groupowner_usr_share_keyrings

Description

To properly set the group owner of /usr/share/keyrings, run the command:

$ sudo chgrp root /usr/share/keyrings

Rationale

The /usr/share/keyrings directory should be group-owned by root to prevent unauthorized changes to package repository keys.

Verify Owner on /etc/apt/auth.conf.d Directory

directory_owner_apt_auth_conf_d

Description

To properly set the owner of /etc/apt/auth.conf.d, run the command:

$ sudo chown root /etc/apt/auth.conf.d 

Rationale

The /etc/apt/auth.conf.d directory should be owned by root to prevent unauthorized changes to APT authentication configuration.

Verify Owner on /etc/apt/sources.list.d Directory

directory_owner_apt_sources_list_d

Description

To properly set the owner of /etc/apt/sources.list.d, run the command:

$ sudo chown root /etc/apt/sources.list.d 

Rationale

The /etc/apt/sources.list.d directory should be owned by root to prevent unauthorized changes to APT repository configuration.

Verify Owner on /etc/apt/trusted.gpg.d Directory

directory_owner_apt_trusted_gpg_d

Description

To properly set the owner of /etc/apt/trusted.gpg.d, run the command:

$ sudo chown root /etc/apt/trusted.gpg.d 

Rationale

The /etc/apt/trusted.gpg.d directory should be owned by root to prevent unauthorized changes to APT trusted keys.

Verify Owner on /usr/share/keyrings Directory

directory_owner_usr_share_keyrings

Description

To properly set the owner of /usr/share/keyrings, run the command:

$ sudo chown root /usr/share/keyrings 

Rationale

The /usr/share/keyrings directory should be owned by root to prevent unauthorized changes to package repository keys.

Verify Permissions on /etc/apt/auth.conf.d Directory

directory_permissions_apt_auth_conf_d

Description

To properly set the permissions of /etc/apt/auth.conf.d, run the command:

$ sudo chmod 0755 /etc/apt/auth.conf.d

Rationale

The /etc/apt/auth.conf.d directory contains configuration that may include repository credentials. Its permissions should prevent unauthorized changes.

Verify Permissions on /etc/apt/sources.list.d Directory

directory_permissions_apt_sources_list_d

Description

To properly set the permissions of /etc/apt/sources.list.d, run the command:

$ sudo chmod 0755 /etc/apt/sources.list.d

Rationale

A non-root user should not be able to add or remove APT repository configuration from /etc/apt/sources.list.d.

Verify Permissions on /etc/apt/trusted.gpg.d Directory

directory_permissions_apt_trusted_gpg_d

Description

To properly set the permissions of /etc/apt/trusted.gpg.d, run the command:

$ sudo chmod 0755 /etc/apt/trusted.gpg.d

Rationale

A non-privileged user with write access to /etc/apt/trusted.gpg.d can compromise the APT chain of trust by adding trusted keys.

Verify Permissions on /usr/share/keyrings Directory

directory_permissions_usr_share_keyrings

Description

To properly set the permissions of /usr/share/keyrings, run the command:

$ sudo chmod 0755 /usr/share/keyrings

Rationale

A non-root user should not be able to add or remove package repository keys from /usr/share/keyrings.

Verify Group Owner on Files in /etc/apt/auth.conf.d

file_groupowner_apt_auth_conf_d

Description

To properly set the group owner of /etc/apt/auth.conf.d/*.conf, run the command:

$ sudo chgrp root /etc/apt/auth.conf.d/*.conf

Rationale

Files in /etc/apt/auth.conf.d should be group-owned by root to prevent unauthorized changes to APT authentication configuration.

Verify Group Owner on APT GPG Key Files

file_groupowner_apt_gpg_keys

Description

To properly set the group owner of /usr/share/keyrings/*.gpg and /etc/apt/trusted.gpg.d/*.gpg, run the command:

$ sudo chgrp root /usr/share/keyrings/*.gpg and /etc/apt/trusted.gpg.d/*.gpg

Rationale

APT GPG key files should be group-owned by root to prevent unauthorized modification of package trust anchors.

Verify Group Owner on Files in /etc/apt/sources.list.d

file_groupowner_apt_sources_list_d

Description

To properly set the group owner of /etc/apt/sources.list.d/*, run the command:

$ sudo chgrp root /etc/apt/sources.list.d/*

Rationale

Files in /etc/apt/sources.list.d should be group-owned by root to prevent unauthorized changes to APT repository configuration.

Verify Owner on Files in /etc/apt/auth.conf.d

file_owner_apt_auth_conf_d

Description

To properly set the owner of /etc/apt/auth.conf.d/*.conf, run the command:

$ sudo chown root /etc/apt/auth.conf.d/*.conf 

Rationale

Files in /etc/apt/auth.conf.d should be owned by root to prevent unauthorized changes to APT authentication configuration.

Verify Owner on APT GPG Key Files

file_owner_apt_gpg_keys

Description

To properly set the owner of /usr/share/keyrings/*.gpg and /etc/apt/trusted.gpg.d/*.gpg, run the command:

$ sudo chown root /usr/share/keyrings/*.gpg and /etc/apt/trusted.gpg.d/*.gpg 

Rationale

APT GPG key files should be owned by root to prevent unauthorized modification of package trust anchors.

Verify Owner on Files in /etc/apt/sources.list.d

file_owner_apt_sources_list_d

Description

To properly set the owner of /etc/apt/sources.list.d/*, run the command:

$ sudo chown root /etc/apt/sources.list.d/* 

Rationale

Files in /etc/apt/sources.list.d should be owned by root to prevent unauthorized changes to APT repository configuration.

Verify Permissions on Files in /etc/apt/auth.conf.d

file_permissions_apt_auth_conf_d

Description

To properly set the permissions of /etc/apt/auth.conf.d/*.conf, run the command:

$ sudo chmod 0640 /etc/apt/auth.conf.d/*.conf

Rationale

Files in /etc/apt/auth.conf.d may contain credentials for private repositories or proxies and should not be readable by unauthorized users.

Verify Permissions on APT GPG Key Files

file_permissions_apt_gpg_keys

Description

To properly set the permissions of /usr/share/keyrings/*.gpg and /etc/apt/trusted.gpg.d/*.gpg, run the command:

$ sudo chmod 0644 /usr/share/keyrings/*.gpg and /etc/apt/trusted.gpg.d/*.gpg

Rationale

APT GPG key files are used to verify package authenticity. Restricting their permissions prevents unauthorized modification while keeping them readable by APT.

Verify Permissions on Files in /etc/apt/sources.list.d

file_permissions_apt_sources_list_d

Description

To properly set the permissions of /etc/apt/sources.list.d/*, run the command:

$ sudo chmod 0644 /etc/apt/sources.list.d/*

Rationale

Files in /etc/apt/sources.list.d contain APT repository configuration. They should not be writable by non-root users.