---
title: Two-Factor Authentication using Smart Cards
slug: two-factor-authentication-using-smart-cards
createdAt: 2026-07-27T04:11:11.560Z
---

With growing digital world, effectively combating cybersecurity threats has become a major challenge. The scale and robustness of cyberattacks has been increasing rapidly. Sensitive and confidential information are getting comprised across the network due to such attacks. To combat this threat, enterprises are taking mitigating actions to strengthen device access across their critical IT infrastructure.

Two-factor authentication significantly reduces the risk of adversaries penetrating strategic networks and systems. This approach requires the use of a Personal Identity Verification (PIV) card or Common Access Card (CAC). In this document, we will detail the basic procedures required to enable two-factor authentication for the Secure Shell Protocol (SSH) using government-issued PIV or CAC cards.

::Image[]{src="https://api.archbee.com/api/optimize/wxZG1KsS4xNkVZYoiu_o9/5DXWD0czqLtKbHoftVUky_commonaccesscardoverview.png" position="flex-start" size="63" width="629" height="133" initialPath="images/common_access_card_overview.png" githubPath="images/common_access_card_overview.png" showCaption="false"}

The authentication process is described below:

1. User starts SecureCRT client, enters the Cisco switch IP address in the hostname and press Enter.
2. A dialog box pops up prompting for PIN. User enters the PIN associated with the smartcard credential and press OK.

::Image[]{src="https://api.archbee.com/api/optimize/wxZG1KsS4xNkVZYoiu_o9/jkFjBwMKepIAOWUZgQCoC_securecrtenterpin.png" position="flex-start" size="51" width="514" height="295" initialPath="images/secure_crt_enter_pin.png" githubPath="images/secure_crt_enter_pin.png" showCaption="false"}

SecureCRT forwards certificate to Cisco Switch which validates Certificate handshake.

4. Cisco switch sends TACACS+ authorization request to IPS with username set to "common name" received from certificate and "service=pki"
5. IPS fetches the role and device group based on username and realm information.
6. If a shell policy has same role, device group with mandatory attribute set to "cert-application=all", then it is considered a match. If action is set to Permit, then IPS sends successful response containing all configured attributes.
7. User gets logged in to Cisco switch.

### Pre-Requisites

- Cisco switch
- Ivanti Policy Secure Release 9.1R4 as TACACS+ Server
- SecureCRT (8.5.4) as the SSH client
- Smart Card Reader
- Common Access Card

### Summary of Configuration

### Configuring Ivanti Policy Secure

On IPS Server Administration UI, Admin configures:

- Admin Role
- Admin Realm
- TACACS Device group
- TACACS client
- Shell policy

To configure TACACS+ client and shell policy on IPS:

1. Select **Endpoint Policy > Network Device Management > TACACS+ client**, enable **Allow Authorization (w/o authentication)** under TACACS+ Advance Settings.:inlineImage[]{src="https://api.archbee.com/api/optimize/wxZG1KsS4xNkVZYoiu_o9/s4sgNoBkZOi52V2QerSYB_tacacsallowauthorizationwoauthentication.png" alt caption size="80" width="877" height="468"}
2. Select **Network Device Management > Shell Policies**.
3. Under **Custom attributes**, configure "cert-application=all" as mandatory attribute.
4. Click **Add**.
5. Click **Save Changes**.

::Image[]{src="https://api.archbee.com/api/optimize/wxZG1KsS4xNkVZYoiu_o9/p9L72rKaCMc3DdDxxwVkE_shellpoliciescustomattributes.png" position="flex-start" size="63" width="627" height="409" initialPath="images/shell_policies_custom_attributes.png" githubPath="images/shell_policies_custom_attributes.png" showCaption="false"}

### Cisco Switch Configuration

1. Set up Network Time Protocol (NTP) with the proper time zone for the device This step is critical for the operation of the public key infrastructure (PKI).

   ```bash
   service timestamps debug datetime msec localtime show-timezone
   ```

   ```bash
   service timestamps log datetime msec localtime show-timezone
   ```

   ```bash
   clock timezone EST -5 0
   ```

   ```bash
   clock summer-time EDT recurring
   ```

   ```bash
   ntp server <server ip>
   ```
2. Configure PKI trustpoint for the certificate authority (CA). Specify the field from the user certificate that will be used as the SSH username that will pass to the TACACS server for authorization. The example below uses the common name from the subnet field for the username. The user principal name (UPN) from the Subject-Alternative name can also be used as a username for SSH login.

   ```bash
   crypto pki trustpoint <trustpoint name>
   ```

   ```bash
   enrollment terminal
   ```

   ```bash
   revocation-check none
   ```

   ```bash
   authorization username subjectname commonname
   ```
3. Manually authenticate and install the root CA’s public certificate.

   ```bash
   crypto pki authenticate <trustpoint name>
   ```
4. Generate RSA signing and encryption keys for the SSH server.

   ```bash
   crypto key generate rsa modulus 2048 label SSH-RSA usage-keys
   ```
5. Enable the SSH server and specify the RSA keys to be used for signing and encryption.

   ```bash
   ip ssh rsa keypair-name SSH-RSA
   ```

   ```bash
   ip ssh version 2
   ```
6. Configure the Cisco IOS SSH server to verify the user’s X.509v3 digital credential for two-factor authentication.

   ```bash
   ip ssh server certificate profile
   ```

   ```bash
   user
   ```

   ```bash
   trustpoint verify <trustpoint name>
   ```

   ```bash
   ip ssh server algorithm hostkey ssh-rsa
   ```

   ```bash
   ip ssh server algorithm authentication publickey
   ```

   ```bash
   ip ssh server algorithm publickey x509v3-ssh-rsa
   ```
7. Enable SSH for terminal line access, and enable X.509v3 validation.

   ```bash
   aaa new-model
   ```

   ```bash
   !
   ```

   ```bash
   line vty 0 4
   ```

   ```bash
   login authentication default
   ```

   ```bash
   transport input ssh
   ```
8. Add the TACACS+ server and provision the shared secret and IP address of the TACACS+ server.

   ```bash
   tacacs server IPS
   ```

   ```bash
   address ipv4 <server-ip>
   ```

   ```bash
   key <encryption key>
   ```
9. Configure TACACS+ for user authorization.

   ```bash
   aaa group server tacacs+ IPS
   ```

   ```bash
   server name IPS
   ```

   ```bash
   aaa authorization config-commands
   ```

   ```bash
   aaa authorization exec IPS group tacacs+
   ```

   ```bash
   aaa authorization commands 0 IPS group tacacs+ if-authenticated
   ```

   ```bash
   aaa authorization commands 1 IPS group tacacs+ if-authenticated
   ```

   ```bash
   aaa authorization commands 15 IPS group tacacs+ if-authenticated
   ```

   ```bash
   aaa authorization network IPS group tacacs+
   ```

   ```bash
   aaa authorization configuration IPS group tacacs+
   ```
10. Enable authorization on the PKI trustpoint CA for the user certificate.

    ```bash
    crypto pki trustpoint <trustpoint name>
    ```

    ```bash
    authorization list IPS
    ```

### Configuring SecureCRT Client for Two-Factor Smartcard Authentication

If your SSH2 server environment is properly configured for X.509 smartcard certificate authentication, then you can configure SecureCRT/SecureFX to authenticate using Two-Factor Authentication certificates on your smartcard.

To configure SecureCRT/SecureFX for Windows to accomplish authentication using your smartcard:

1. Start the SecureCRT client. Open **Global Options&#x20;**&#x61;nd select th&#x65;**&#x20;SSH2&#x20;**&#x63;ategory.
2. In the **Public key** section, enable **Use a certificate from your personal CAPI store or a PKCS #11** **provider DLL** option.
3. Insert your smartcard.
4. For the **Certificate to use** field, press th&#x65;**&#x20;\[...]&#x20;**&#x62;utton to the right and browse through the available certificates.
5. If your certificate contains the user account name that should be used for authentication, enable the **Get username from certificate&#x20;**&#x6F;ption. Then specify the certificate field which contains the account name required for smartcard authentication to your SSH2 servers (either **Principal Name** or **Common Name**).
6. Disable the **Add keys to agent&#x20;**&#x6F;ption in the **Advanced** section below the fingerprint viewing area.

::Image[]{src="https://api.archbee.com/api/optimize/wxZG1KsS4xNkVZYoiu_o9/GAvplzN_oGr1d-wviFwMN_securecrtglobaloptions.png" position="flex-start" size="39" width="388" height="330" initialPath="images/secure_crt_global_options.png" githubPath="images/secure_crt_global_options.png" showCaption="false"}

Click **OK** to save changes.

8. Choose **Options > Edit Default Session...**
9. Select th&#x65;**&#x20;SSH2** category. In the Authentication list, highlight the **PublicKey&#x20;**&#x61;uthentication method and move it to the top of the list.
10. With **PublicKey** selected, press **Properties...** button.

::Image[]{src="https://api.archbee.com/api/optimize/wxZG1KsS4xNkVZYoiu_o9/S5ntyQSW9Ax0ohr4XLJv9_securecrteditdefaultsession.png" position="flex-start" size="38" width="384" height="351" initialPath="images/secure_crt_edit_default_session.png" githubPath="images/secure_crt_edit_default_session.png" showCaption="false"}

In the Public Key Properties window, enable the Use global public key setting option. Information should match what was specified in the Global Options settings above.

::Image[]{src="https://api.archbee.com/api/optimize/wxZG1KsS4xNkVZYoiu_o9/DYWxc_EPmDNiZFYIoyLW8_securecrtpublickeyproperties.png" position="flex-start" size="40" width="403" height="295" initialPath="images/secure_crt_public_key_properties.png" githubPath="images/secure_crt_public_key_properties.png" showCaption="false"}

Press **OK** button to close the **Public Key Properties** window

13. Press **OK** button to close th&#x65;**&#x20;Session Options** window.
14. When prompted for selecting Apply default session changes, choose either of the option. If smartcard certificate will be authenticated for the majority of connections, then consider selecting Change ALL sessions (no undo).

::Image[]{src="https://api.archbee.com/api/optimize/wxZG1KsS4xNkVZYoiu_o9/pZrdZ6moAO7pcQTpREnBr_securecrtapplydefaultsessionchanges.png" position="flex-start" size="38" width="381" height="142" initialPath="images/secure_crt_apply_default_session_changes.png" githubPath="images/secure_crt_apply_default_session_changes.png" showCaption="false"}

:::hint{type="info"}
As configured above, SecureCRT do not cache smartcard PIN. The first time user authenticate with a certificate on the smartcard, user will be prompted for the PIN by MS CAPI or your smartcard's middleware provider. If subsequently user is not prompted for PIN when authenticating with the smartcard, it is because PIN has been cached by smartcard's middleware.
:::
