Verified Exec (Veriexec) File Signing and Verification for Junos OS
Learn about Veriexec file-signing and verification, benefits and how to use it.
To protect the Junos operating system (OS) from unauthorized software and activities that could compromise device integrity, Verified Exec (Veriexec) provides a file-signing and verification framework that ensures only authorized and trusted software is executed. Junos OS adapts the Veriexec framework, originally developed for NetBSD, and enables it by default to help ensure software integrity through file verification.
Veriexec uses a fingerprint associated with each authorized Junos OS file to verify its integrity and determine whether the file can be opened or executed.
Veriexec helps protect critical software components by verifying their integrity before they are used by the system, including:
- The kernel
- Kernel modules
- Executable files
- Shared libraries
- Software packages
- Other protected system files
How Veriexec Works
Veriexec uses a digitally signed manifest that contains fingerprints for executables and other files that must remain immutable.
The verification process typically follows these steps:
- The Veriexec loader verifies the digital signatures associated with the manifest.
- After successful verification, the loader provides the manifest contents to the kernel.
- The system verifies the kernel during startup.
- The system verifies kernel modules when they are loaded, either during startup or during system operation.
- The kernel verifies that files match their expected fingerprints before allowing them to be used.
Veriexec requires the kernel, root file system image, and kernel modules to pass verification before the system can use them.
If Veriexec enforcement is enabled, only executables with verified fingerprints can run. In addition, protected files cannot be written to, modified, or changed.
Verification Scope
Veriexec verifies software integrity at multiple stages:
| Component | Verification Stage |
| Kernel | During system startup |
| Root file system image | During system startup |
| Kernel modules | When loaded during startup or runtime |
| Software packages | Before installation |
| Protected files | During runtime before use |
Before installation, the Veriexec framework verifies that a software package has not been altered and can be trusted. Package verification and runtime verification use the same Veriexec framework and support the same hashing algorithms.
Script Execution Considerations
-
Veriexec blocks a verified shell script from executing an unsigned script that is not listed in the manifest.
-
You can use the /bin/sh file to run arbitrary scripts. From a security perspective, these scripts are treated similarly to interactive commands because execution is controlled through user authentication and permissions.
Verification Failures
If a fingerprint is missing or incorrect, the loader or kernel rejects the file. The impact depends on the file type and its role in the system.
When verification fails:
- The loader or kernel rejects the affected file.
- The impact varies depending on the importance of the file.
- By default, the loader skips files that fail verification.
- Optionally, you can configure the loader to halt the boot process when it encounters an incorrect hash.
Manifest and Hashing Algorithms
Each installation image contains a read-only manifest that stores fingerprints and related attributes for protected files.
The fingerprint examples in this topic use SHA-1 hashes for illustration purposes only. Veriexec supports SHA-1, SHA-256, SHA-384, and SHA-512 hashing algorithms. The Junos OS release and platform determine which hashing algorithm Veriexec uses for verification.
The manifest identifies each protected file and stores its expected fingerprint and associated attributes. The manifest contains entries such as the following:
etc/rc sha1=478eeda6750c455fbfc18eeb06093e32a341911b uid=0 gid=0 mode=644 etc/rc.verify sha1=15566bb2731abee890fabd0ae8799e02071e006c uid=0 gid=0 mode=644 usr/libexec/veriexec-ext.so.1 sha1=8929292d008d12cd5beb2b9d9537458d4974dd22 uid=0 gid=0 mode=550 no_fips sbin/verify-sig sha1=cd3ffd45f30f1f9441e1d4a366955d8e2c284834 uid=0 gid=0 mode=555 no_ptrace sbin/veriexec sha1=7b40c1eae9658f4a450eb1aa3df74506be701baf uid=0 gid=0 mode=555 no_ptrace jail/usr/bin/php sha1=c444144fef5d65f7bbc376dc3ebb24373f1433a2 uid=0 gid=0 mode=555 indirect no_fips usr/sbin/chassisd sha1=61b82b36da9c6fb7eeb413d809ae2764a8a3cebc uid=0 gid=0 mode=555 trusted
Fingerprint Mismatch and Log Messages
When the calculated fingerprint of a file does not match the fingerprint stored in the manifest, Veriexec generates a log message.
The log message is in the following format:
/kernel:veriexec:fingerprint for dev <deviceid>, file <fileid><calculatedfingerprint>!= <fingerprintinthemanifest>
If a file has been modified and the resulting fingerprint differs from the one in the manifest, you see a log message similar to the following:
/kernel:veriexec:fingerprint for dev 100728577, file 70750 64ea873ed0ca43b113f87fa25fb30f9f60030cec!= 0d9457c041bb3646eb4b9708ba605facb84a2cd0
A fingerprint mismatch indicates that the file contents do not match the trusted fingerprint stored in the manifest. This mismatch can occur because of file corruption, storage issues, or unauthorized modification.
Critical files that fail verification cannot be trusted. Contact JTAC for guidance.
Benefits of Veriexec
-
Secure systems—Safeguard Juniper Networks routers, switches, and firewalls from security breaches.
-
Prevent unauthorized access—Block threat actors from gaining persistent, unauthorized access or causing system failure.
-
Prevent malware execution—Block unauthorized modifications and malware through prevention of unsigned binary execution.
-
Support authorized code—Add signed, authorized code to Junos OS with Veriexec enforcement using the JET SDK. For more information about the SDK solution, see Juniper Extension Toolkit Developer Guide.
Check Veriexec Enforcement Status
On supported platforms, Junos OS offers an optional version with Veriexec enforcement disabled. For details about this feature and its use cases, see Junos Enhanced Automation.
To verify whether Veriexec is enforced, run the following commands from the Junos OS CLI shell:
Start the shell.
username@hostname> start shell %
Use the
sysctl security.mac.veriexec.statecommand.% sysctl security.mac.veriexec.state security.mac.veriexec.state: loaded active enforce %
If Veriexec is enforced, the output is
security.mac.veriexec.state: loaded active enforce. If Veriexec is not enforced, the output issecurity.mac.veriexec.state: loaded active.
Validate Veriexec File Enforcement
To verify that Veriexec enforcement is active, copy an authorized file to an
unprotected location outside the manifest scope (for example,
/usr/bin/id) to a new location as shown below. Veriexec
prevents the copied file from running because the manifest contains a valid entry
for /usr/bin/id but not for /tmp/id. Although
copying does not change the file contents, Veriexec validates the file against the
manifest entry, including its path and associated metadata. As a result, Veriexec
blocks the copied file because it does not match any protected manifest entry.
Start the shell.
username@hostname> start shell #
Change directories and then copy an authorized file, for example, /usr/bin/id, to a new location.
# /usr/bin/id uid=928(username) gid=20 groups=20,0(wheel),10(field) # cp /usr/bin/id /tmp
Results
If Veriexec is enforced, the system generates an authentication error. If Veriexec is not enforced, the file runs normally:
Output generated when Veriexec is not enforced, showing the copied file runs successfully:
# /tmp/id /bin/sh: /tmp/id: Authentication error #
Output generated when Veriexec is not enforced, showing the file is copied
# /tmp/id #
Install Veriexec Loader
The Veriexec-capable loader (veloader) is used on BSDX-based Junos platforms beginning with Junos OS Release 19.2. The loader validates Junos OS images before they are trusted for booting. The Veriexec loader validates the Junos OS image that you install from a Trivial File Transfer Protocol (TFTP) server or a USB storage device.
-
To install a Junos OS image from a TFTP server, use the following command:
loader> install tftp://[host]/package
-
To install a Junos OS image from a USB storage device, use the following command:
loader> install file:///package
The loader boots only
Junos OS images that contain fingerprints and does not boot images that do not
contain fingerprints or a valid kernel. You can use the nextboot
function to check the current boot
device.
username@hostname# nextboot
Platform: srx-sword
eUSB
usb
current bootdev is: eUSB
Bootupgrade is a tool
available in the Junos OS package to support BIOS firmware upgrading. You can use
the bootupgrade shell command to upgrade, check U-Boot, manually
load, and install the Veriexec-capable loader. The bootupgrade -c
loader command prints the version string for the current loader.
Before you install the Veriexec-capable loader, the system verifies that both dual-root partitions contain Junos OS fingerprints.
Install the Veriexec-capable loader from the Junos OS CLI shell:
Start the shell.
username@hostname> start shell %
-
Use the
bootupgrade -l /boot/veloadercommand to install the Veriexec-capable loader.% bootupgrade -l /boot/veloader Checking Loader CRC... veloader size 1251641 OK
You can see different scenarios here:
Use
request system software add /var/tmp/xxx.tgz no-copy no-validatecommand to install Junos OS with fingerprints. Theno-validateoption does not disable package signature verification, and the system continues to reject invalid packages.username@hostname> request system software add /var/tmp/junos-srxsme-20.4I-20200810_dev_common.0.0833.tgz no-copy no-validate Formatting alternate root (/dev/ad0s2a)... /dev/ad0s2a: 600.0MB (1228732 sectors) block size 16384, fragment size 2048 using 4 cylinder groups of 150.00MB, 9600 blks, 19200 inodes. super-block backups (for fsck -b #) at: 32, 307232, 614432, 921632 Installing package '/altroot/cf/packages/install-tmp/junos-20.4I-20200810_dev_common.0.0833' ... Verified junos-boot-srxsme.tgz signed by PackageDevelopmentECP256_2020 method ECDSA256+SHA256 Verified junos-srxsme-domestic signed by PackageDevelopmentECP256_2020 method ECDSA256+SHA256 Verified manifest signed by PackageDevelopmentECP256_2020 method ECDSA256+SHA256 WARNING: The software that is being installed has limited support. WARNING: Run 'file show /etc/notices/unsupported.txt' for details. JUNOS 20.4I-20200810_dev_common.0.0833 will become active at next reboot WARNING: A reboot is required to load this software correctly WARNING: Use the 'request system reboot' command WARNING: when software installation is complete Saving state for rollback ...- If the Veriexec-capable loader does not support a target Junos OS image
from an earlier release, you can downgrade the loader to a version that
is compatible with that release. Use the
request system software add /var/tmp/xxx.tgz no-copy no-validatecommand to automatically downgrade to an earlier version of the loader.username@hostname> request system software add /var/tmp/junos-srxsme-19.4R1.3.tgz no-copy no-validate WARNING: Package junos-19.4R1.3 version 19.4R1.3 is not compatible with current loader WARNING: Automatic recovering loader, please wait ... Upgrading Loader... ##################################### Verifying the loader image... OK WARNING: The new boot firmware will take effect when the system is rebooted. WARNING: Loader recover finish. Formatting alternate root (/dev/ad0s1a)... /dev/ad0s1a: 598.5MB (1225692 sectors) block size 16384, fragment size 2048 using 4 cylinder groups of 149.62MB, 9576 blks, 19200 inodes. super-block backups (for fsck -b #) at: 32, 306464, 612896, 919328 Installing package '/altroot/cf/packages/install-tmp/junos-19.4R1.3' ... Verified junos-boot-srxsme-19.4R1.3.tgz signed by PackageProductionEc_2019 method ECDSA256+SHA256 Verified junos-srxsme-19.4R1.3-domestic signed by PackageProductionEc_2019 method ECDSA256+SHA256 Verified junos-boot-srxsme-19.4R1.3.tgz signed by PackageProductionEc_2019 method ECDSA256+SHA256 Verified junos-srxsme-19.4R1.3-domestic signed by PackageProductionEc_2019 method ECDSA256+SHA256 JUNOS 19.4R1.3 will become active at next reboot WARNING: A reboot is required to load this software correctly WARNING: Use the 'request system reboot' command WARNING: when software installation is complete Saving state for rollback ... -
Use the
request system software add /var/tmp/xxxcommand to check whether the Junos OS package is compatible with the Veriexec loader.username@hostname> request system software add /var/tmp/junos-srxsme-19.4R2.3.tgz WARNING: Package junos-19.4R2.3 version 19.4R2.3 is not compatible with this system. WARNING: Please install a package with veloader support, 20.3 or higher.
In this example, the system terminates the installation because the Veriexec loader does not support Junos OS releases earlier than 20.3R1.