This script automates the setup of a CAC/PIV (Common Access Card / Personal Identity Verification) card on Arch Linux. It ensures that all necessary dependencies are installed, configures the environment, and sets up browser integration for CAC functionality. This script is specifically designed for users working with US government CACs, and it provides compatibility with both Firefox and Chromium-based browsers.
- Updates system and installs necessary dependencies for CAC operation.
- Configures the
pcscd
service to interact with the smart card reader. - Configures OpenSC to handle CAC cards effectively.
- Downloads and installs the latest DoD certificates for browser integration.
- Sets up Firefox and Chromium-based browsers to use CAC certificates for secure access.
- An Arch Linux distribution (e.g., Arch Linux, EndeavourOS, Archo Linux).
- Root or sudo access to install and configure packages.
- A USB smart card reader.
- Clone the Repository
git clone https://github.com/large-farva/cac-arch.git
cd cac-arch
- Make the Script Executable
chmod +x cac-arch.sh
- Run the Script
sudo ./cac-arch.sh
The script will guide you through each step, displaying messages about what is currently being configured or installed. Please ensure that you have a stable internet connection as the script will download dependencies and certificates.
- Update System: Ensures your system is up to date with the latest package versions.
- Install Dependencies: Installs all necessary dependencies, including
pcsc-tools
,opensc
, andccid
. - Enable and Start pcscd Daemon: Enables and starts the smart card service (
pcscd
) to detect the CAC reader. - Check pcscd Status: Verifies that the
pcscd
daemon is running properly. - Configure OpenSC: Adds required configurations to
/etc/opensc/opensc.conf
to support CAC cards. - Download DoD Certificates: Downloads the latest DoD certificates required for authentication.
- Import DoD Certificates to Firefox: Imports downloaded certificates to Firefox to enable secure access using CAC.
- Add CAC Module to NSS DB for Chromium-Based Browsers: Configures Chromium-based browsers to use the OpenSC PKCS11 module.
- Import DoD Certificates to Chromium-Based Browsers: Adds certificates to the NSS database for Chromium-based browsers.
- Import DoD Certificates to System Certificate Store: Installs DoD certificates into the system-wide certificate store.
- Update Certificate Store: Updates the certificate store to recognize newly imported certificates.
-
PCSC Daemon Issues: If the script fails to detect the card, ensure the
pcscd
service is running:sudo systemctl status pcscd
Restart the service if necessary:
sudo systemctl restart pcscd
-
Browser Not Recognizing CAC: Verify that the security module is loaded in Firefox or Chromium, and that the DoD certificates are properly imported.
- This script is optimized for CAC cards but may work with PIV cards as well.
- The installation path for
onepin-opensc-pkcs11.so
may vary depending on the OpenSC package version. Adjust the paths in the script if necessary.
This script is provided "as is" without warranty of any kind. Use it at your own risk. Ensure you have backups and understand the changes being made to your system before executing the script.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to submit pull requests or open issues if you encounter any problems or have suggestions for improvement. Any and all feedback is welcomed!
- Sebastian (GitHub: large-farva)