Thursday 27 May 2021

convert pfx to separate private key and cert files with openssl

n this article I’m going to show you the commands you need to convert your .PFX Certificate file to a seperate certificate and keyfile. This article can come in handy when you need to import your certificates on devices like Cisco routers/loadbalancers etc. where you probably need to import the certificates and keyfiles in plain text (unencrypted). My tool of choice (but there might be others) is OpenSSL for Windows, which can be downloaded here

So after you installed OpenSSL you can start it from it’s Bin folder. I’d like to put OpenSSL\Bin in my path so I can start it from any folder. Fire up a command prompt and cd to the folder that contains your .pfx file. First type the first command to extract the private key:

openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]

What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file.  This is the password that you used to protect your keypair when you created your .pfx file.  If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!.  Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.

Now let’s extract the certificate:

openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]

Just press enter and your certificate appears.

Now as I mentioned in the intro of this article you sometimes need to have an unencrypted .key file to import on some devices.  I probably don’t need to mention that you should be carefully. If you store your unencrypted keypair somewhere on an unsafe location anyone can have a go with it and impersonate for instance a website or a person of your company.  So always be extra careful when it comes to private keys! Just throw the unencrypted keyfile away when you’re done with it, saving just the encrypted one.

The command:

openssl rsa -in [keyfile-encrypted.key] -out [keyfile-decrypted.key]

Again you need to enter an import password. This time you need to enter the new password that you created in step 1.  After that you’re done. You decrypted your private key. In the folder you ran OpenSSL from you’ll find the certifcate (.crt) and the two private keys (encrypted and unencrypted).

Update 07-07-2014:

In some cases you might be forced to convert your private key to PEM format. You can do so with the following command:

openssl rsa -in [keyfile-encrypted.key] -outform PEM -out [keyfile-encrypted-pem.key]

From

https://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/




Wednesday 26 May 2021

cisco ASA FQDNs in a group

ASA needs to be configured to use DNS


dns server-group DefaultDNS

 name-server 8.8.8.8

 name-server 1.1.1.1

 domain-name rn.lgov


object network obj-thulleultinn.club

 fqdn thulleultinn.club


object-group network MALWARE-SOURCES

 network-object host 192.99.178.145

 network-object object obj-thulleultinn.club


Get firepower sensor (sfr) details from ASA CLI

Gives sensor IP and manager IP (FMC)

show modules sfr detail

Thursday 20 May 2021

cisco asa debug commands for S2S vpn

Set the debug on just your peer

debug crypto condition peer x.x.x.x


Ikev1 / ipsec

debug crypto ikev1 255

debug crypto ipsec 255

ikev2


debug crypto ikev2 protocol 127
debug crypto ikev2 platform 127

Debug crypto ikev2 255

Debug crypto ikev2 platform 255

Debug crypto ikev2 protocol 255


If you need more detail you can enable more

Debug crypto ipsec 255

Debug crypto ike-common 10

Debug crypto engine 255 (causes too much output)


logging console debugging


https://www.cisco.com/c/en/us/support/docs/security/asa-5500-x-series-next-generation-firewalls/113574-tg-asa-ipsec-ike-debugs-main-00.html#anc6

IKEv2 Notes
IKEv1 had clear phase 1 (ikev1) and phase 2 (ipsec).
IKEv2 does it all in one phase but broken into 3 sections:

IKE_SA_INIT
IKE_AUTH
CHILD_SA


Monday 17 May 2021

track DNS requests

 

Login to DC

Open DNS

Right click DNS server

  1. Click the Debug Logging tab and check the Log packets for debugging checkbox
  2. To minimize the amount of data being logged, uncheck the following checkboxes:
    • Packet direction - Outgoing
    • Transport protocol - TCP
    • Packet contents - Updates
    • Packet type - Response
  3. In the Log file section, type a path and file name for the log. Alter the Maximum size (bytes) value if necessary.
  4. Click OK.

From:

https://superuser.com/questions/1229515/windows-dns-server-how-to-find-out-who-made-a-query


Now you can search the log with something like this in powershell

get-content dns.log -wait | select-string 'domain1','domain2'


tracking DHCP

C\windows\system32\dhcp\DhcpSrvLog-Mon.log

get-content DhcpSrvLog-Mon.log - wait | select-string 'dell'

Wednesday 5 May 2021

backup on FMC

link below explaining the backup for FMC and FTD,

https://www.cisco.com/c/en/us/td/docs/security/firepower/60/configuration/guide/fpmc-config-guide-v60/Backup_and_Restore.html

http://www.network-node.com/blog/2019/3/27/150-copying-backing-up-and-restoring-ftd-device-configuration