Developers of the operating system , using the Rust language and microkernel concepts. new package manager . Within the project, a new format for packages is being developed, including a library for package management functions and a command-line toolkit for creating and extracting cryptographically verified collections of files. The pkgar code is written in Rust and is licensed under the MIT License.
The pkgar format does not claim universality and is optimized for the specifics of the Redox OS operating system. The package manager supports verification of the source via digital signatures and integrity checks. Checksums are calculated using the hash function . The verification-related functionality of pkgar can be accessed without actually saving the package archive, manipulating only the header part. Specifically, a package is formed by a header file (.pkgar_head) and a data file (.pkgar_data). A correctly signed complete summary package (.pkgar) can be obtained by simply concatenating the header file with the data file ("cat example.pkgar_head example.pkgar_data > example.pkgar").
The header file contains separate checksums for the header and structures with parameters from the data file, as well as a digital signature for package verification. The data file includes a sequential listing of all files and directories supplied in the package. Before each data element, there is a structure with metadata, which includes the checksum for the actual data, size, access permissions, the relative path of the installed file, and the offset of the next data element's parameters. If individual files have not changed during the update and the checksum matches, they are skipped and not downloaded.
The integrity of the source can be verified by obtaining only the header file, while the correctness of the selected data file can be validated by downloading only the structures with parameters of that file and ensuring they match the checksum verified in the header file. The actual data can be checked after downloading, using the checksum from the parameters structure preceding the data.
Packages are initially designed for repeatable assembly, meaning that creating a package for a specific directory always results in the formation of an identical package. After installation, only metadata is retained in the system, which is sufficient to reconstruct the package from the installed data (the package contents, checksums, paths, and access rights are included in the metadata).
Key goals of pkgar:
- Atomicity — updates are applied automatically whenever possible.
- Traffic savings — data is transmitted over the network only when the hash changes (only modified files are downloaded during an update).
- High performance, utilizing fast cryptographic algorithms (blake3 supports parallel processing when calculating the hash). If data from the repository has not been previously cached, the hash for the downloaded data can be computed during the download.
- Minimalism — unlike other formats, pkgar includes only the metadata necessary for package extraction.
- Independence from the installation directory — a package can be installed in any directory by any user (the user must have write permission for the chosen directory).
- Security — packages are always cryptographically verified, and verification is performed before any actual operations with the package (first, the header is downloaded, and if the digital signature is correct, the data is downloaded to a temporary directory, which is then moved to the target directory after verification).
Source: opennet.ru
