How to extract certs from apache ca-bundle.crt file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to extract certs from apache ca-bundle.crt file?
# 8  
Old 05-02-2014
An approach in ruby

Hello,
I know the thread is old, but if you want an approach in Ruby, this one works pretty well for versions post 1.9.1.

Code:
#!/usr/bin/env ruby

caFile = File.open( "ca-bundle.pem", "rb").read

outputIndex=0
output = File.open("certificate.#{outputIndex}.pem", "wb")

caFile.each_line do |aLine|
  if (aLine.strip == "-----END CERTIFICATE-----")
  	output.print "#{aLine}"
  	output.close
  	outputIndex = outputIndex + 1
	output = File.open("certificate.#{outputIndex}.pem", "wb")
  else
  	output.print "#{aLine}"
  end
end

Keep in mind this only extracts the certificate files and will not process ca-bundles that contain a CRL. Hope this helps someone Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to scp File from root user in one server to say crt user in another server and avoid password?

Can someone help in writing some script through which I can transfer file (scp) from root user in abc server to crt user in hfg server and can give the crt user password in script itself so that it doesn't prompt me every time for password (4 Replies)
Discussion started by: Moon1234
4 Replies

2. Emergency UNIX and Linux Support

Self signed ca-bundle.crt expired

Hi, I have an issue with openssl. Basically I have a ca certificate which has expired and I have regenerated a new ca.cert from the ca.key file and I have concatenated the output of the new ca.crt file and ca-bundle.crt to a new ca-bundle.crt. Have restarted apache, however I still get the... (1 Reply)
Discussion started by: maverick_here
1 Replies

3. Programming

Perl to extract ssl certs from xml file

HI Guys, I'm a newbie in perl. (4 Replies)
Discussion started by: jhamaks
4 Replies

4. Solaris

openssl installing certs

First, let me openly admit that I am a dummy when it comes to openssl. I've never used it before. I am running SunOS 5.10. I am trying to install the certs for openssl but have no idea how to do that. What I have done so far: 1. Created a CSR using the following command: openssl req... (2 Replies)
Discussion started by: MichaelInDC
2 Replies

5. Solaris

Blank screen on crt

Hello I'm new in sun and i have a liitle problem. I buy sun enterprise 420r and connect keyboard and monitor crt (non Sun). But when i start server i have blank screen on crt. I'm new in sun servers and i dont know why its doin this. (11 Replies)
Discussion started by: elmik
11 Replies

6. UNIX for Dummies Questions & Answers

novell certs ?

i want to be cne certified. how good are certmagic preps for novell exams ?. i have heared they r very close to real exams . any comments ? (0 Replies)
Discussion started by: unaiiim
0 Replies

7. UNIX for Dummies Questions & Answers

terminal sessions and certs

Hello a few Q's that if anyone knows the answer to i would be grateful: :confused: when exiting a terminal session run through a windows environment i can either type exit or use ctrl +D. I was wondering if one way was a 'cleaner' method to exit then the other or whether it is executed the... (2 Replies)
Discussion started by: hu$h
2 Replies

8. UNIX for Dummies Questions & Answers

Cannot backspace on my session in CRT

Hi, when I make a mistake and then try to backspace I am unable to do so . Can someone please suggest How I can correct this on my session For Eg: pwd^H^H^H Thanks rooh (2 Replies)
Discussion started by: rooh
2 Replies

9. UNIX for Advanced & Expert Users

ssl certs

Hi all can anyone tell me how i can discover the strength of encryption in an ssl cert. I have used various methods ie apps and verisign web page but they just give me general info. I need to know the encryption level. The cert in question is used in Weblogic application for Solaris 8 any... (1 Reply)
Discussion started by: silvaman
1 Replies

10. UNIX Desktop Questions & Answers

change CRT resolution

Hello I want change my CRT resolution from 1152x900x** to 1280x1024x75 on a Solaris platform but I try "/usr/sbin/m64config" and "/usr/sbin/ffbconfig" command, the both commands failed :-( In the /dev/fbs/ directory there is juste one file : cgsix0 have you got a solution to my customer... (1 Reply)
Discussion started by: ggenevrier
1 Replies
Login or Register to Ask a Question
lprng_certs(1)                                                  lprng_certs command                                                 lprng_certs(1)

NAME
lprng_certs - lprng SSL certificate management SYNOPSIS
lprng_certs option Options: init - make directory structure newca - make new root CA defaults - set new default values for certs gen - generate user, server, or signing cert index [dir] - index cert files verify [cert] - verify cert file encrypt keyfile - set or change keyfile password DESCRIPTION
The lprng_certs program is used to manage SSL certificates for the LPRng software. There SSL certificate structure consists of a hierarchy of certificates. The LPRng software assumes that the following types of certificates will be used: CA or root A top level or self-signed certificate. signing A certificate that can be used to sign other certificates. This is signed by the root CA or another signing certificate. user A certificate used by a user to identify themselves to the lpd server. server A certificate used by the lpd server to identify themselves to the user or other lpd servers. Signing Certificates All of the signing certificates, including the root certificate (root CA), /etc/lprng/ssl.ca/ca.crt, are in the same directory as the root CA file. Alternately, all of the signing certs can be concatenated and put into a single file, which by convention is assumed to have the same name as the root CA file, /etc/lprng/ssl.ca/ca.crt. The ssl_ca_file, ssl_ca_path, and ssl_ca_key printcap and configuration options can be used to specify the locations of the root CA files, a directory containing the signing certificate files, and the private key file for the root CA file respectively. The root certificate (root CA file) /etc/lprng/ssl.ca/ca.crt has a private key file /etc/lprng/ssl.ca/ca.key as well. By convention, the private keys for the other signing certificate files are stored in the certificate file. The OpenSSL software requires that this directory also contain a set of hash files which are, in effect, links to these files. By default, all signing certificates are assumed to be in the same directory as the root certificate. Server Certificates The certificate used by the lpd server are kept in another directory. These files do not need to have hash links to them. By convention, the private keys for these certificate files are stored in the certificate file. The server certificate file is specified by the ssl_server_cert and has the default value /etc/lprng/ssl.server/server.crt. This file contains the cert and private key. The server cer- tificate password file is specified by the ssl_server_password option with the default value and contains the password used to decrypt the servers private key and use it for authentication. This key file should be read only by the lpd server. User Certificates The certificates used by users are kept in a separate directory in the users home directory. By convention, the private keys for these certificate files are stored in the certificate file. The user certificate file is specified by the LPR_SSL_FILE environment variable, otherwise the ${HOME}/.lpr/client.crt is used. The pass- word is taken from the file specified by the LPR_SSL_PASSWORD environment variable, otherwise the ${HOME}/.lpr/client.pwd file is read. USING LPRNG_CERTS The organization of the SSL certificates used by LPRng is similar to that used by other programs such as the Apache mod_ssl support. The lprng_certs program is used to create the directory structure, create certificates for the root CA, signing, user and servers. In order to make management simple, the following support is provided. lprng_certs init This command creates the directories used by the lpd server. It is useful when setting up a new lpd server. lprng_certs newca This command creates a self-signed certificate, suitable for use as a root CA certificate. It also sets up a set of default values for other certificate creation. lprng_certs defaults This command is used to modify the set of default values. The default values are listed and should be self-explanatory, except for the value of the signer certificate. By default, the root CA can be used to sign certificates. However, a signing certificate can be used as well. This allows delegation of signing authority without compromising the security of the root CA. lprng_certs gen This is used to generate a user, server, or signing certificate. lprng_certs index This is used to create the indexes for the signing certificates. lprng_certs verify [cert] This checks the certificate file using the Openssl openssl verify command. lprng_certs encrypt keyfile This removes all key information from the key file, reencrypts the key information, and the puts the encrypted key information in the file. LPRng OPTIONS Option Purpose ssl_ca_path directory holding the SSL signing certs ssl_ca_file file holding the root CA or all SSL signing certs ssl_server_cert cert file for the server ssl_server_password file containing password for server server ${HOME}/.lpr/client.crt client certificate file ${HOME}/.lpr/client.pwd client certificate private key password ENVIRONMENT VARIABLES
LPR_SSL_FILE client certificate file LPR_SSL_PASSWORD client certificate private key password EXIT STATUS
The following exit values are returned: zero (0) Successful completion. non-zero (!=0) An error occurred. SEE ALSO
lpd.conf(5), lpc(8), lpd(8), checkpc(8), lpr(1), lpq(1), lprm(1), printcap(5), lpd.conf(5), pr(1), lprng_certs(1), lprng_index_certs(1). AUTHOR
Patrick Powell <papowell@lprng.com>. HISTORY
LPRng is a enhanced printer spooler system with functionality similar to the Berkeley LPR software. The LPRng developer mailing list is lprng-devel@lists.sourceforge.net; subscribe by visiting https://lists.sourceforge.net/lists/listinfo/lprng-devel or sending mail to lprng- request@lists.sourceforge.net with the word subscribe in the body. The software is available via http://lprng.sourceforge.net LPRng 2006-12-09 lprng_certs(1)