summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2014-01-29 17:36:08 +0100
committerJan Pokorný <jpokorny@redhat.com>2014-01-29 17:40:03 +0100
commita94b94789042c9ac0e0dd4c0e1afe41b445cb0e0 (patch)
treeb37f31b0229c4edbf14fddbca025c003b2ddfc4c
parent42c0d150c71259c8218fbf8104623992d960ba11 (diff)
downloaddotfiles-a94b94789042c9ac0e0dd4c0e1afe41b445cb0e0.tar.gz
dotfiles-a94b94789042c9ac0e0dd4c0e1afe41b445cb0e0.tar.xz
dotfiles-a94b94789042c9ac0e0dd4c0e1afe41b445cb0e0.zip
Firstrun cert scripts: teach them about offlineimap CA bundle
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--scripts/certs/cert-def1
-rwxr-xr-xscripts/certs/cert-import34
2 files changed, 23 insertions, 12 deletions
diff --git a/scripts/certs/cert-def b/scripts/certs/cert-def
index 30e1434..a7d6196 100644
--- a/scripts/certs/cert-def
+++ b/scripts/certs/cert-def
@@ -1,3 +1,4 @@
HOMEBUNDLE=${HOME}/.pki/tls/certs/ca-bundle.crt
CA_BUNDLE_MUTT=${HOME}/.pki/tls/certs/ca-bundle-mutt.crt
+CA_BUNDLE_OFFLINEIMAP=${HOME}/.pki/tls/certs/ca-bundle-offlineimap.crt
CA_BUNDLE_NPM=${HOME}/.pki/tls/certs/ca-bundle-npm.crt
diff --git a/scripts/certs/cert-import b/scripts/certs/cert-import
index 6fd1770..6540fbb 100755
--- a/scripts/certs/cert-import
+++ b/scripts/certs/cert-import
@@ -26,6 +26,14 @@ cert_import_mutt() {
cat >>${CA_BUNDLE_MUTT}
}
+cert_import_offlineimap() {
+ [ "$1" != "1" ] && return
+ echo "Adding to offlineimap bundle" >&2
+ mkdir -p "$(dirname "${CA_BUNDLE_OFFLINEIMAP}")"
+ cp ${CA_BUNDLE_OFFLINEIMAP}{,.$(date '+%y%m%d%H%M%s')}
+ cat >>${CA_BUNDLE_OFFLINEIMAP}
+}
+
cert_import_firefox() {
# XXX: stdin is consumed in the first profile found
# XXX: explore certificate to get a proper name (-n) for it
@@ -50,15 +58,16 @@ cert_import_npm() {
# CRL can only be appended to homebundle
cert_import() {
- local homebundle=0 firefox=0 mutt=0 npm=0 crl=1 spec=0
+ local homebundle=0 firefox=0 mutt=0 npm=0 offlineimap=0 crl=1 spec=0
while true; do
case $1 in
- homebundle) homebundle=1;;
- firefox) firefox=1;;
- mutt) mutt=1;;
- npm) npm=1;;
- all) homebundle=1; firefox=1; mutt=1;;
- --|*) break;;
+ homebundle) homebundle=1;;
+ firefox) firefox=1;;
+ mutt) mutt=1;;
+ npm) npm=1;;
+ offlineimap) offlineimap=1;;
+ all) homebundle=1; firefox=1; mutt=1;;
+ --|*) break;;
esac
spec=1
shift
@@ -69,11 +78,12 @@ cert_import() {
#| tee >(openssl x509 \
#| tee >(openssl crl \
cert_pick_check "$@" \
- | tee >(cert_import_homebundle $homebundle) \
- | tee >(cert_import_firefox $firefox) \
- | tee >(cert_import_mutt $mutt) \
- | tee >(cert_import_npm $npm) \
- | tee >(cert_import_homebundle $homebundle)
+ | tee >(cert_import_homebundle $homebundle) \
+ | tee >(cert_import_firefox $firefox) \
+ | tee >(cert_import_mutt $mutt) \
+ | tee >(cert_import_npm $npm) \
+ | tee >(cert_import_offlineimap $offlineimap) \
+ | tee >(cert_import_homebundle $homebundle)
) |& colorize 1
}