Changeset 16332


Ignore:
Timestamp:
Jul 18, 2016, 11:48:17 AM (3 years ago)
Author:
dcorreia
Message:

Added pam_pkcs11 configuration file creation.
Updated crl wget feature to avoid duplicate files.

Location:
internals/2016/linuxloginsmartcardwizard/trunk/project1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • internals/2016/linuxloginsmartcardwizard/trunk/project1/configpkcs11.py

    r16330 r16332  
    99HASHLINK_COMMAND = "pkcs11_make_hash_link"
    1010WGET_COMMAND = "wget "
     11GUNZIP_COMMAND = "gunzip "
     12MV_COMMAND = "mv "
    1113
    1214
     
    9597    executeCommand(WGET_COMMAND+crlWebLink)
    9698    os.chdir(currentDirectoryPath)
     99
     100
     101def makeConfigFile(configZipPath, configPath, directoryPath):
     102    copyFileToDirectory(configZipPath, directoryPath)
     103    os.chdir(directoryPath)
     104    executeCommand(GUNZIP_COMMAND+"pam_pkcs11.conf.example.gz")
     105    executeCommand(MV_COMMAND+"pam_pkcs11.conf.example "+configPath)
  • internals/2016/linuxloginsmartcardwizard/trunk/project1/main.py

    r16327 r16332  
    11#!/usr/bin/python3
    22import configpkcs11
    3 
     3import os
    44PAMPKCS11_PACKAGE = "libpam-pkcs11"
    55PAMPKCS11_DIRPATH = "/etc/pampkcs11"
    66CACERTS_DIRPATH = "/etc/pampkcs11/cacerts"
    77CRLS_DIRPATH = "/etc/pampkcs11/crls"
     8CRL_FILENAME = "cc_ec_cidadao_crl001_crl.crl"
    89ECRAIZ_CERT = "/usr/local/share/certs/ECRaizEstado_novo_assinado_GTE.der"
    910CC001_CERT = "/usr/local/share/certs/CartaodeCidadao001.der"
    1011CC_CRL_HTTP = "https://pki.cartaodecidadao.pt/publico/lrc/cc_ec_cidadao_crl001_crl.crl"
     12GUNZIP_DIRPATH = "/usr/share/doc/libpam-pkcs11/examples/pam_pkcs11.conf.example.gz"
     13PAMPKCS11_CONFIG = "/etc/pampkcs11/pampkcs11.conf"
    1114
    1215
     
    1922configpkcs11.makeDirectory(CRLS_DIRPATH)
    2023
    21 # TODO Copy certificate files to cacerts directory and make hash links
     24# Copy certificate files to cacerts directory and make hash links
    2225configpkcs11.copyFileToDirectory(ECRAIZ_CERT, CACERTS_DIRPATH)
    2326configpkcs11.copyFileToDirectory(CC001_CERT, CACERTS_DIRPATH)
     
    2528
    2629
    27 # TODO Get crl file from web link
    28 configpkcs11.getCRLFile(CC_CRL_HTTP, CRLS_DIRPATH)
     30# Get crl file from web link
     31if not os.path.exists(os.path.join(CRLS_DIRPATH,CRL_FILENAME)):
     32    configpkcs11.getCRLFile(CC_CRL_HTTP, CRLS_DIRPATH)
    2933
    30 # TODO Generate pam_pkcs11.conf file
    31 
     34# Generate pam_pkcs11.conf file
     35configpkcs11.makeConfigFile(GUNZIP_DIRPATH, PAMPKCS11_CONFIG, PAMPKCS11_DIRPATH)
    3236
    3337# TODO Add portuguese CC module to pam_pkcs11.conf file
Note: See TracChangeset for help on using the changeset viewer.