Pages

Friday, July 3, 2020

How test S3 bucket connectivity with python

Use ipython to test S3 bucket connectivity


docker exec -it app bash # ipython [1]: import boto [2]: from common.storage import S3Storage [3]: s = S3Storage() [4]: s._get_s3_config() {'host': 's3.us-east-1.amazonaws.com', 'is_secure': True, 'port': 443 'validate_certs': True} [5]: c = s._get_boto_connection(boto) [6]: c.get_all_buckets() 

How to Disable IPv6

Disable IPv6


On the node in question, become root then:
1 2 3 4 5 6 7 vi /etc/sysctl.conf # At the end, add: net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 # Save and quit
To make this stick, execute:
1 sysctl -p

How to extract private key certificate from pfx file

Extracting .crt and .key files from .pfx file

PREREQUISITEEnsure OpenSSL is installed in the server that contains the SSL certificate.
  1. Start OpenSSL from the OpenSSL\bin folder.
  2. Open the command prompt and go to the folder that contains your .pfx file.
  3. Run the following command to extract the private key:
    openssl pkcs12 -in [yourfile.pfx] -nocerts -out [drlive.key]Copy code
    You will be prompted to type the import password. Type the password that you used to protect your keypair when you created the .pfx file. You will be prompted again to provide a new password to protect the .key file that you are creating. Store the password to your key file in a secure place to avoid misuse.
  4. Run the following command to extract the certificate:
    openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [drlive.crt]Copy code
  5. Run the following command to decrypt the private key:
    openssl rsa -in [drlive.key] -out [drlive-decrypted.key]Copy code
    Type the password that you created to protect the private key file in the previous step.
    The .crt file and the decrypted and encrypted .key files are available in the path, where you started OpenSSL.

Converting .pfx file to .pem format

There might be instances where you might have to convert the .pfx file into .pem format. Run the following command to convert it into PEM format.
openssl rsa -in [keyfile-encrypted.key] -outform PEM -out [keyfile-encrypted-pem.key]Copy code