To check the integrity of a hard drive in the Gaia/SecurePlatform OS:
Connect to the machine over console (serial).
Reboot the machine.
Press a key on the "Press any key to see the boot menu" screen. The Check Point Boot Menu now opens.
Select the "Start in maintenance mode".
Enter the Expert mode credentials.
Unmount the file system:
# umount -a
For the EXT3 file system, run the applicable 'fsck' commands (skip this step if you have a XFS file system):
Check and update the bad block list, but do NOT repair:
# fsck -f -n -c -v
Repair automatically:
# fsck -f -p -c -v
Note: If you detect inconsistencies, 'fsck' may require the user to remove the '-p' flag from the syntax. In such a case, use the 'fsck -f -y' command instead to assume 'yes' to all questions.
# fsck -f -c -v -y
# sync
# reboot
Check the hard drive integrity - firewall checkpoint 5800
Get the modified date with powershell
To get the modified date on a single file try:
$lastModifiedDate = (Get-Item "C:\foo.tmp").LastWriteTime
To compare with another:
$dateA= $lastModifiedDate
$dateB= (Get-Item "C:\other.tmp").LastWriteTime
if ($dateA -ge $dateB) {
Write-Host("C:\foo.tmp was modified at the same time or after C:\other.tmp")
} else {
Write-Host("C:\foo.tmp was modified before C:\other.tmp")
}
Get file version information from the command line
PS> (Get-Command C:\Path\To\Thing.dll).FileVersionInfo.FileVersion 3.1.0.2
The version number parts of the FileVersionInfo are
| Product Field | File Field | Meaning | Example |
|---|---|---|---|
| ProductVersion | FileVersion | String version | 3.1.0.2 (alpha) |
| ProductMajorPart | FileMajorPart | First number | 3 |
| ProductMinorPart | FileMinorPart | Second number | 1 |
| ProductBuildPart | FileBuildPart | Third number | 0 |
| ProductPrivatePart | FilePrivatePart | Fourth number | 2 |
JKS and Openssl commands
Java Keytool Command
These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. Any root or intermediate certificates will need to be imported before importing the primary certificate for your domain.
- Generate a Java keystore and key pair
keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048
- Generate a certificate signing request (CSR) for an existing Java keystore
keytool -certreq -alias mydomain -keystore keystore.jks -file 8gwifi.csr
- Import a root or intermediate CA certificate to an existing Java keystore
keytool -import -trustcacerts -alias root -file 8gwifiCA.crt -keystore keystore.jks
- Import a signed primary certificate to an existing Java keystore
keytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks
- Generate a keystore and self-signed certificate
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
- Check a stand-alone certificate
keytool -printcert -v -file 8gwifi.crt
- Check which certificates are in a Java keystore
keytool -list -v -keystore keystore.jks
- Check a particular keystore entry using an alias
keytool -list -v -keystore keystore.jks -alias mydomain
- Delete a certificate from a Java Keytool keystore
keytool -delete -alias 8gwifi -keystore keystore.jks
- Change a Java keystore password
keytool -storepasswd -new new_storepass -keystore keystore.jks
- Export a certificate from a keystore
keytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks
- List Trusted CA Certs
keytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts
- Import New CA into Trusted Certs
keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts
OpenSSL Commands
- Generate a new private key and Certificate Signing Request
openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privatekey.key
- Generate a self-signed certificate
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privatekey.key -out certificate.crt
- Generate a certificate signing request (CSR) for an existing private key
openssl req -out CSR.csr -key privatekey.key -new
- Generate a certificate signing request based on an existing certificate
openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privatekey.key
- Remove a passphrase from a private key
openssl rsa -in privateKey.pem -out newprivatekey.pem
- Convert a DER file (.crt .cer .der) to PEM
openssl x509 -inform der -in certificate.cer -out certificate.pem
- Convert a PEM file to DER
openssl x509 -outform der -in certificate.pem -out certificate.der
- Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM
openssl pkcs12 -in keyStore.pfx -out keystore.pem -nodes
You can add -nocerts to only output the private key or add -nokeys to only output the certificates.
- Convert a PEM certificate file and a private key to PKCS#12 (.pfx .p12)
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile
Importing a SSL certificate into a Java Keystore via a PKCS12 file
Here are the instructions on how to import a SSL certificate into the Java Keystore from a PKCS12 (pfx or p12) file.
- Create a new keystore
- Navigate to C:\Program Files\Java\jdk_xxxx\bin\ via command prompt
- Execute: keytool -genkey -alias mycertificate -keyalg RSA -keysize 2048 -keystore mykeystore
- Use password of: Use the same password/passphrase as the PKCS12 file
- What is your first and last name? (should be the dns you're going to use) [Unknown]: server.mydomain.com
What is the name of your organizational unit? [Unknown]: MyCompanysITDepartment
What is the name of your organization? [Unknown]: MyCompany
What is the name of your City or Locality? [Unknown]: CITY
What is the name of your State or Province? [Unknown]: STATE
What is the two-letter country code for this unit? [Unknown]: US
Is CN=...................................... correct? [no]: yes
Enter key password for <mycertificate>
(RETURN if same as keystore password): Hit Return/Enter
- Empty the keystore
- Execute via command prompt: keytool -delete -alias mycertificate -keystore mykeystore
- Ensure nothing is in the keystore by executing: keytool -v -list -keystore mykeystore
- Import the PKCS12 File
- Execute via command prompt: keytool -v -importkeystore -srckeystore whateverthefileis.p12 -srcstoretype PKCS12 -destkeystore mykeystore -deststoretype JKS
- Enter the PKCS12 password/passphrase for both the Source and Destination password.
source: https://jackstromberg.com/2013/05/importing-a-ssl-certificate-into-a-java-keystore-via-a-pkcs12-file/
Instalar certificados raíz
Dado um arquivo de certificado da CA 'foo.crt', siga estas etapas para instalá-lo no Ubuntu:
Primeiro, copie sua autoridade de certificação para dir /usr/local/share/ca-certificates/
sudo cp foo.crt /usr/local/share/ca-certificates/foo.crt
atualize o armazenamento da CA
sudo update-ca-certificates
Isso é tudo. Você deve obter esta saída:
Updating certificates in /etc/ssl/certs... 1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....
Adding debian:foo.pem
done.
done.fonte: https://qastack.com.br/ubuntu/73287/how-do-i-install-a-root-certificate
Robocopy - copy only folder structure
To use Robocopy to clone a directory without files, use the following syntax:
robocopy "C:\Your Folder" "C:\New Folder" /e /xf *
same as above but without displaying the status:
robocopy "C:\Your Folder" "C:\New Folder" /e /xf * >nul
same as first example and creates a log (overwrites existing log):
robocopy "C:\Your Folder" "C:\New Folder" /e /xf * /log:yourlogfile.log
same as first example and appends to log (appends to existing log):
robocopy "C:\Your Folder" "C:\New Folder" /e /xf * /log+:yourlogfile.log
Copy only the top level sub-folders (sub-folders in the source directory)
robocopy "C:\Your Folder" "C:\New Folder" /e /LEV:2 /xf *
/e = Copies subdirectories, including empty ones.
/LEV: n = Copy only the n LEVels of the source. For n=2, only the top level sub-folders will be copied
/xf = Excludes files matching the specified names or paths. Wildcards “*” and “?” are accepted
Adicionar registro DNS windows linha de comando
Usando o Prompt de Comando (dnscmd)Abra o Prompt de Comando como Administrador e utilize a seguinte estrutura para adicionar um registro do...
Mais vistos
-
Find Users Who Have Never Logged On Use the following PowerShell Command; Get-ADUser -Filter { LastLogonDate -notlike "*" -and En...
-
First you have to configure a wpad site in your IIS Open the proxypac.pac file you have previously created and save as wpad.dat. Copy wpa...
-
Java Keytool Command These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. A...