Sponsored Content
Top Forums Shell Programming and Scripting let curl output to stdout AND save to a file Post 302201181 by scarfake on Saturday 31st of May 2008 04:16:51 PM
Old 05-31-2008
wow thanks
 

10 More Discussions You Might Find Interesting

1. Solaris

terminal output - save to file?

I have a window open on my ultra 10 - a terminal window connecting to a server. Is there any way I can log all output to this window to a log file on my ultra 10 ? (2 Replies)
Discussion started by: frustrated1
2 Replies

2. Shell Programming and Scripting

Dual output (stdout and file)

Hello everybody, Is there a more elegant way to make dual output (display on standard output and append to a file) while I'm executing a shell script, besides duplicating the echo command for every string? echo "Message..." > 1 echo "Message..." >> myfile.out Thank you for your time,... (2 Replies)
Discussion started by: AdrianM
2 Replies

3. Shell Programming and Scripting

Getting cURL to output verbose to a file

This is about to drive me crazy. What I want to do is simple: output ALL the verbose information from curl to a file I have read the manual, tried several options and searched this forum but no salvation... I'm using curl -k -Q "command" --user user:passwd --ftp-pasv --ftp-ssl -v... (1 Reply)
Discussion started by: caramandi
1 Replies

4. Shell Programming and Scripting

Save cURL verbose output to file or do it like browser "save as.."

hi there ! i have exactly the same problem like this guy here https://www.unix.com/shell-programming-scripting/127668-getting-curl-output-verbose-file.html i am not able to save the curl verbose output.. the sollution in this thread (redirecting stderr to a file) does not work for me.... (0 Replies)
Discussion started by: crabmeat
0 Replies

5. UNIX for Dummies Questions & Answers

Using cURL to save online search results

Hi, I'm attacking this from ignorance because I am not sure how to even ask the question. Here is the mission: I have a list of about 4,000 telephone numbers for past customers. I need to determine how many of these customers are still in business. Obviously, I could call all the numbers.... (0 Replies)
Discussion started by: jccbin
0 Replies

6. Shell Programming and Scripting

File descriptors, redirecting output, and stdout

Hello all. I've been lurking here for a year or two and finally decided to post. I need some assistance with file descriptors, stdout, and redirecting output. I've searched through a number of very helpful threads here (unfortunately I can't link to any of them yet due to my low post count...),... (2 Replies)
Discussion started by: Michael_K
2 Replies

7. Shell Programming and Scripting

Save output to file - inside a script ?

I'm using the following script to check cisco router health and I'd like to save output to a file, vty_runcmd.sh > /check/check-cisco-health script works and output is saved to a file. However using it in crontab file is created but output is not printed inside it. In crontab, */5 * * * *... (4 Replies)
Discussion started by: marmellata
4 Replies

8. Shell Programming and Scripting

Save output into file bash scripting

Hi there. i have created a program that in the end it will give output like this 1 2 3 4 5 10 9 8 7 6 11 12 13 14 15 .............. 17 i wonder how to save the output into a single string and into a file. i.e 1 10 11 12 9 2 3 8 13 14 7 4 5 6 15 17 (in this order,... (3 Replies)
Discussion started by: shdin271
3 Replies

9. Shell Programming and Scripting

Save value from output of Corestat and save in a list for each core

I am trying to modify the "corestat v1.1" code which is in Perl.The typical output of this code is below: Core Utilization CoreId %Usr %Sys %Total ------ ----- ----- ------ 5 4.91 0.01 4.92 6 0.06 ... (0 Replies)
Discussion started by: Zam_1234
0 Replies

10. UNIX for Beginners Questions & Answers

Output of until to file versus stdout

Why does this until false; do history | head -5; done result in a stdout infinite loop, yet until false; do history | head -5 > hist5; done only writes it once to file hist5? Furthermore, I can hear the hard drive working on the 2nd command until I end the process, but the history | head -5 is... (1 Reply)
Discussion started by: Xubuntu56
1 Replies
certtool(1)							   User Commands						       certtool(1)

NAME
certtool - GnuTLS certificate tool SYNOPSIS
certtool [-flag [value]]... [--opt-name[[=| ]value]]... All arguments must be options. DESCRIPTION
Tool to parse and generate X.509 certificates, requests and private keys. It can be used interactively or non interactively by specifying the template command line option. OPTIONS
-d number, --debug=number Enable debugging.. This option takes an integer number as its argument. The value of number is constrained to being: in the range 0 through 9999 Specifies the debug level. -V, --verbose More verbose output. This option may appear an unlimited number of times. --infile=file Input file. --outfile=string Output file. -s, --generate-self-signed Generate a self-signed certificate. -c, --generate-certificate Generate a signed certificate. --generate-proxy Generates a proxy certificate. --generate-crl Generate a CRL. -u, --update-certificate Update a signed certificate. -p, --generate-privkey Generate a private key. -q, --generate-request Generate a PKCS #10 certificate request. This option must not appear in combination with any of the following options: infile. Will generate a PKCS #10 certificate request. To specify a private key use --load-privkey. -e, --verify-chain Verify a PEM encoded certificate chain.. The last certificate in the chain must be a self signed one. --verify Verify a PEM encoded certificate chain using a trusted list.. This option must appear in combination with the following options: load-ca-certificate. The trusted certificate list must be loaded with --load-ca-certificate. --verify-crl Verify a CRL using a trusted list.. This option must appear in combination with the following options: load-ca-certificate. The trusted certificate list must be loaded with --load-ca-certificate. --generate-dh-params Generate PKCS #3 encoded Diffie-Hellman parameters.. --get-dh-params Get the included PKCS #3 encoded Diffie-Hellman parameters.. Returns stored DH parameters in GnuTLS. Those parameters are used in the SRP protocol. The parameters returned by fresh generation are more efficient since GnuTLS 3.0.9. --dh-info Print information PKCS #3 encoded Diffie-Hellman parameters. --load-privkey=string Loads a private key file. This can be either a file or a PKCS #11 URL --load-pubkey=string Loads a public key file. This can be either a file or a PKCS #11 URL --load-request=file Loads a certificate request file. --load-certificate=string Loads a certificate file. This can be either a file or a PKCS #11 URL --load-ca-privkey=string Loads the certificate authority's private key file. This can be either a file or a PKCS #11 URL --load-ca-certificate=string Loads the certificate authority's certificate file. This can be either a file or a PKCS #11 URL --password=string Password to use. --hex-numbers Print big number in an easier format to parse. --cprint In certain operations it prints the information is C-friendly format. In certain operations it prints the information is C-friendly format, suitable for including into C programs. --null-password Enforce a NULL password. This option enforces a NULL password. This may be different than the empty password in some schemas. -i, --certificate-info Print information on the given certificate. --certificate-pubkey Print certificate's public key. --pgp-certificate-info Print information on the given OpenPGP certificate. --pgp-ring-info Print information on the given OpenPGP keyring structure. -l, --crl-info Print information on the given CRL structure. --crq-info Print information on the given certificate request. --no-crq-extensions Do not use extensions in certificate requests. --p12-info Print information on a PKCS #12 structure. --p7-info Print information on a PKCS #7 structure. --smime-to-p7 Convert S/MIME to PKCS #7 structure. -k, --key-info Print information on a private key. --pgp-key-info Print information on an OpenPGP private key. --pubkey-info Print information on a public key. The option combined with --load-request, --load-pubkey, --load-privkey and --load-certificate will extract the public key of the object in question. --v1 Generate an X.509 version 1 certificate (with no extensions). --to-p12 Generate a PKCS #12 structure. This option must appear in combination with the following options: load-certificate. It requires a certificate, a private key and possibly a CA certificate to be specified. --to-p8 Generate a PKCS #8 structure. -8, --pkcs8 Use PKCS #8 format for private keys. --rsa Generate RSA key. When combined with --generate-privkey generates an RSA private key. --dsa Generate DSA key. When combined with --generate-privkey generates a DSA private key. --ecc Generate ECC (ECDSA) key. When combined with --generate-privkey generates an elliptic curve private key to be used with ECDSA. --ecdsa This is an alias for the --ecc option. --hash=string Hash algorithm to use for signing.. Available hash functions are SHA1, RMD160, SHA256, SHA384, SHA512. --inder, --no-inder Use DER format for input certificates and private keys.. The no-inder form will disable the option. The input files will be assumed to be in DER or RAW format. Unlike options that in PEM input would allow multiple input data (e.g. multiple certificates), when reading in DER format a single data structure is read. --inraw This is an alias for the --inder option. --outder, --no-outder Use DER format for output certificates and private keys. The no-outder form will disable the option. The output will be in DER or RAW format. --outraw This is an alias for the --outder option. --bits=number Specify the number of bits for key generate. This option takes an integer number as its argument. --sec-param=security parameter Specify the security level [low, legacy, normal, high, ultra].. This is alternative to the bits option. --disable-quick-random No effect. --template=file Template file to use for non-interactive operation. --pkcs-cipher=cipher Cipher to use for PKCS #8 and #12 operations. Cipher may be one of 3des, 3des-pkcs12, aes-128, aes-192, aes-256, rc2-40, arcfour. -h, --help Display usage information and exit. -!, --more-help Pass the extended usage information through a pager. -v [{v|c|n}], --version[={v|c|n}] Output version of program and exit. The default mode is `v', a simple version. The `c' mode will print copyright information and `n' will print the full copyright notice. FILES
Certtool's template file format A template file can be used to avoid the interactive questions of certtool. Initially create a file named 'cert.cfg' that contains the information about the certificate. The template can be used as below: $ certtool --generate-certificate cert.pem --load-privkey key.pem --template cert.cfg --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem An example certtool template file that can be used to generate a certificate request or a self signed certificate follows. # X.509 Certificate options # # DN options # The organization of the subject. organization = "Koko inc." # The organizational unit of the subject. unit = "sleeping dept." # The locality of the subject. # locality = # The state of the certificate owner. state = "Attiki" # The country of the subject. Two letter code. country = GR # The common name of the certificate owner. cn = "Cindy Lauper" # A user id of the certificate owner. #uid = "clauper" # Set domain components #dc = "name" #dc = "domain" # If the supported DN OIDs are not adequate you can set # any OID here. # For example set the X.520 Title and the X.520 Pseudonym # by using OID and string pairs. #dn_oid = 2.5.4.12 Dr. #dn_oid = 2.5.4.65 jackal # This is deprecated and should not be used in new # certificates. # pkcs9_email = "none@none.org" # An alternative way to set the certificate's distinguished name directly # is with the "dn" option. The attribute names allowed are: # C (country), street, O (organization), OU (unit), title, CN (common name), # L (locality), ST (state), placeOfBirth, gender, countryOfCitizenship, # countryOfResidence, serialNumber, telephoneNumber, surName, initials, # generationQualifier, givenName, pseudonym, dnQualifier, postalCode, name, # businessCategory, DC, UID, jurisdictionOfIncorporationLocalityName, # jurisdictionOfIncorporationStateOrProvinceName, # jurisdictionOfIncorporationCountryName, XmppAddr, and numeric OIDs. #dn = "cn=Nik,st=Attiki,C=GR,surName=Mavrogiannopoulos,2.5.4.9=Arkadias" # The serial number of the certificate serial = 007 # In how many days, counting from today, this certificate will expire. # Use -1 if there is no expiration date. expiration_days = 700 # X.509 v3 extensions # A dnsname in case of a WWW server. #dns_name = "www.none.org" #dns_name = "www.morethanone.org" # A subject alternative name URI #uri = "http://www.example.com" # An IP address in case of a server. #ip_address = "192.168.1.1" # An email in case of a person email = "none@none.org" # Challenge password used in certificate requests challenge_password = 123456 # Password when encrypting a private key #password = secret # An URL that has CRLs (certificate revocation lists) # available. Needed in CA certificates. #crl_dist_points = "http://www.getcrl.crl/getcrl/" # Whether this is a CA certificate or not #ca # for microsoft smart card logon # key_purpose_oid = 1.3.6.1.4.1.311.20.2.2 ### Other predefined key purpose OIDs # Whether this certificate will be used for a TLS client #tls_www_client # Whether this certificate will be used for a TLS server #tls_www_server # Whether this certificate will be used to sign data (needed # in TLS DHE ciphersuites). signing_key # Whether this certificate will be used to encrypt data (needed # in TLS RSA ciphersuites). Note that it is preferred to use different # keys for encryption and signing. encryption_key # Whether this key will be used to sign other certificates. #cert_signing_key # Whether this key will be used to sign CRLs. #crl_signing_key # Whether this key will be used to sign code. #code_signing_key # Whether this key will be used to sign OCSP data. #ocsp_signing_key # Whether this key will be used for time stamping. #time_stamping_key # Whether this key will be used for IPsec IKE operations. #ipsec_ike_key ### end of key purpose OIDs # When generating a certificate from a certificate # request, then honor the extensions stored in the request # and store them in the real certificate. #honor_crq_extensions # Path length contraint. Sets the maximum number of # certificates that can be used to certify this certificate. # (i.e. the certificate chain length) #path_len = -1 #path_len = 2 # OCSP URI # ocsp_uri = http://my.ocsp.server/ocsp # CA issuers URI # ca_issuers_uri = http://my.ca.issuer # Certificate policies # policy1 = 1.3.6.1.4.1.5484.1.10.99.1.0 # policy1_txt = "This is a long policy to summarize" # policy1_url = http://www.example.com/a-policy-to-read # policy2 = 1.3.6.1.4.1.5484.1.10.99.1.1 # policy2_txt = "This is a short policy" # policy2_url = http://www.example.com/another-policy-to-read # Options for proxy certificates # proxy_policy_language = 1.3.6.1.5.5.7.21.1 # Options for generating a CRL # next CRL update will be in 43 days (wow) #crl_next_update = 43 # this is the 5th CRL by this CA #crl_number = 5 EXAMPLES
Generating private keys To create an RSA private key, run: $ certtool --generate-privkey --outfile key.pem --rsa To create a DSA or elliptic curves (ECDSA) private key use the above command combined with 'dsa' or 'ecc' options. Generating certificate requests To create a certificate request (needed when the certificate is issued by another party), run: certtool --generate-request --load-privkey key.pem --outfile request.pem If the private key is stored in a smart card you can generate a request by specifying the private key object URL. $ ./certtool --generate-request --load-privkey "pkcs11:..." --load-pubkey "pkcs11:..." --outfile request.pem Generating a self-signed certificate To create a self signed certificate, use the command: $ certtool --generate-privkey --outfile ca-key.pem $ certtool --generate-self-signed --load-privkey ca-key.pem --outfile ca-cert.pem Note that a self-signed certificate usually belongs to a certificate authority, that signs other certificates. Generating a certificate To generate a certificate using the previous request, use the command: $ certtool --generate-certificate --load-request request.pem --outfile cert.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem To generate a certificate using the private key only, use the command: $ certtool --generate-certificate --load-privkey key.pem --outfile cert.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem Certificate information To view the certificate information, use: $ certtool --certificate-info --infile cert.pem PKCS #12 structure generation To generate a PKCS #12 structure using the previous key and certificate, use the command: $ certtool --load-certificate cert.pem --load-privkey key.pem --to-p12 --outder --outfile key.p12 Some tools (reportedly web browsers) have problems with that file because it does not contain the CA certificate for the certificate. To work around that problem in the tool, you can use the --load-ca-certificate parameter as follows: $ certtool --load-ca-certificate ca.pem --load-certificate cert.pem --load-privkey key.pem --to-p12 --outder --outfile key.p12 Diffie-Hellman parameter generation To generate parameters for Diffie-Hellman key exchange, use the command: $ certtool --generate-dh-params --outfile dh.pem --sec-param normal Proxy certificate generation Proxy certificate can be used to delegate your credential to a temporary, typically short-lived, certificate. To create one from the pre- viously created certificate, first create a temporary key and then generate a proxy certificate for it, using the commands: $ certtool --generate-privkey > proxy-key.pem $ certtool --generate-proxy --load-ca-privkey key.pem --load-privkey proxy-key.pem --load-certificate cert.pem --outfile proxy-cert.pem Certificate revocation list generation To create an empty Certificate Revocation List (CRL) do: $ certtool --generate-crl --load-ca-privkey x509-ca-key.pem --load-ca-certificate x509-ca.pem To create a CRL that contains some revoked certificates, place the certificates in a file and use --load-certificate as follows: $ certtool --generate-crl --load-ca-privkey x509-ca-key.pem --load-ca-certificate x509-ca.pem --load-certificate revoked-certs.pem To verify a Certificate Revocation List (CRL) do: $ certtool --verify-crl --load-ca-certificate x509-ca.pem < crl.pem EXIT STATUS
One of the following exit values will be returned: 0 (EXIT_SUCCESS) Successful program execution. 1 (EXIT_FAILURE) The operation failed or the command syntax was not valid. 70 (EX_SOFTWARE) libopts had an internal operational error. Please report it to autogen-users@lists.sourceforge.net. Thank you. SEE ALSO
p11tool (1) AUTHORS
Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list. COPYRIGHT
Copyright (C) 2000-2012 Free Software Foundation all rights reserved. This program is released under the terms of the GNU General Public License, version 3 or later. BUGS
Please send bug reports to: bugs@gnutls.org NOTES
This manual page was AutoGen-erated from the certtool option definitions. 3.1.18 20 Dec 2013 certtool(1)
All times are GMT -4. The time now is 03:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy