- Execute the following command:
ssh-keygen -t ed25519
- Distribute the public key using the following syntax:
ssh-copy-id -i ~/.ssh/id_ed25519.pub <USER>@<HOST>
Token Description USER A valid user on the host computer. HOST The host that has an active ssh service. If ssh-copy-id command doesn't work, you can directly append the content of the id_ed25519.pub file to the ~/.ssh/authorized_keys file (i.e. create this file if it doesn't exists) of the target <USER> on the target <HOST>.
Month: December 2019
Create a new alias for postfix service by updating the following file:
/etc/aliases
Each entry in the file must have the following syntax:
<ALIAS>: <USER1>[[, <USER2>], <USERn>]
Token | Description |
ALIAS | The desired email alias. |
USER1, USER2, USERn | USER1 is required and the rest are optional. Each user must be delimited by a comma.
The target user of the alias must be a valid user of the system with a home directory. |
Example:
postmaster: root
After updating the file, you must execute the following command:
sudo newaliases
- Add the following dependencies to your build.gradle file:
compile group: 'org.apache.derby', name: 'derby', version: '10.15.1.3' compile group: 'org.apache.derby', name: 'derbyshared', version: '10.15.1.3'
- Add the following entries to your module-info.java file:
requires org.apache.derby.engine; requires org.apache.derby.commons; requires java.sql;
- In your Java class, you can create a connection like the following:
final String DATABASE_NAME = "sample_table"; String connectionURL = String.format("jdbc:derby:%s;create=true", DATABASE_NAME); connection = DriverManager.getConnection(connectionURL);
- Do your needed database operations with the connection (e.g. create table, execute a query, or call a stored procedure.).
- When your done using the connection, close the connection and shutdown the Derby engine like the following:
connection.close(); boolean gotSQLExc = false; try { //shutdown all databases and the Derby engine DriverManager.getConnection("jdbc:derby:;shutdown=true"); } catch (SQLException se) { if ( se.getSQLState().equals("XJ015") ) { gotSQLExc = true; } } if (!gotSQLExc) { System.out.println("Database did not shut down normally"); }
A clean shutdown always throws SQL exception XJ015, which can be ignored.
Values can become a valid record source for select statement if the values has table alias and column names as follows:
SELECT dummy_table.* FROM (VALUES ('record1'), ('record2'), ('record3'), ('record4'), ('record5'), ('record6'), ('record7'), ('record8'), ('record9')) dummy_table (column1)
From the preceding select statement, the dummy_table is the table alias and the column name is column1.
Use the following command to create a detached ASCII signature:
gpg --armor --output <ASC_FILE> --detach-sig <FILE_TO_SIGN>
Import Keys from Keyserver
Run the following command:
gpg --receive-keys <KEY_ID>
Showing the Fingerprints
Run the following command:
gpg --fingerprint <KEY_ID>
Verifying a File with ASCII Key
- Download the detach asc <ASC_FILE> file associated to the file.
- Download the signed file <SIGNED_FILE> file.
- Use the following command for verification:
gpg --verify <ASC_FILE> <SIGNED_FILE>
Pre-requisite
- Gpg4win (i.e from https://www.gpg4win.org/).
Generating Keys
-
- Run the following command:
gpg --full-gen-key
- Type 1 and press enter for the following question:
Please select what kind of key you want: (1) RSA and RSA (default) (2) DSA and Elgamal (3) DSA (sign only) (4) RSA (sign only) Your selection?
- Press enter for the following question:
RSA keys may be between 1024 and 4096 bits long. What keysize do you want? (2048)
- Press enter for the following question:
Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0)
- Type y and press enter for the following question:
Key does not expire at all Is this correct? (y/N)
- Fill in the Real name appropriately and press enter.
- Fill in the Email address appropriately and press enter.
- The Comment is optional but don't forget to press enter.
- Type o and press enter for the following question:
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?
- Fill-in the passphrase appropriately.
- Run the following command:
The output will be ending with something like the following:
pub rsa2048 2019-11-27 [SC] 8C99E30527B112D1CB6D646FE86A4FE7189AADC9 uid Real Name <real_email@email.com> sub rsa2048 2019-11-27 [E]
The second line is the PGP key ID. Thus from the output above. The key id is:
8C99E30527B112D1CB6D646FE86A4FE7189AADC9
Exporting Your Private Key
The my-secret-key.pgp file generated by this command can be use for signing your binaries.
Run the following command:
gpg --export-secret-keys <KEY_ID> > my-secret-key.pgp
DO NOT SHARE THIS FILE OR COMMIT TO YOUR REPOSITORY.
Publishing Your Public Key
Run the following command:
gpg --send-key <EMAIL_ADDRESS>
Use the email address you've used from generating the key.
Alternative way of Publishing your Public Key
- Generate an ASCII-armored PGP key using the following command:
gpg --armor --export <EMAIL_ADDRESS>
Use the email address you've used from generating the key.
The preceding command is exporting your public key in ascii format.
- Copy and paste the generated public ID to the following address: http://hkps.pool.sks-keyservers.net/#submit
- Click the Submit this key to the keyserver! button.
Validating your Published Public Key
- You can validate the upload public key by placing your <EMAIL_ADDRESS> as a Search String from the following address: http://hkps.pool.sks-keyservers.net/#extract.
This will only work if you submit your keys using the preceding section.
- Click the Do the search! button.
Pre-requisites
- Create an account to sonatype.
- Request for a group id from sonatype by using Jira to create an issue.
- Generate PGP keys to be used for signing the binaries (e.g. jar file). For windows, you can follow the procedure here.
- Wait for the completion of the issue you've created from item 2.
Gradle Configuration
- Update your gradle.properties to include the following properties:
nexusUsername=<SONATYPE_USERNAME> nexusPassword=<SONATYPE_PASSWORD> signing.keyId=<PGP_PUBLIC_KEY_ID> signing.password=<PGP_PASS_PHRASE> signing.secretKeyRingFile=<PGP_EXPORTED_PRIVATE_KEY>
- In your build.gradle file, add the Gradle Sonatype Nexus Plugin like the following:
plugins { id "java" id "com.bmuschko.nexus" version "2.3.1" // Gradle Sonatype Nexus Plugin }
- Add the following plugin configurations:
modifyPom { project { name '<PROJECT_NAME>' description '<PROJECT_DESCRIPTION>' url '<PROJECT_WEBSITE>' inceptionYear '<PROJECT_INCEPTION_YEAR>' scm { url '<PROJECT_SCM_ADDRESS>' connection '<PROJECT_SCM_ADDRESS>' developerConnection '<PROJECT_SCM_ADDRESS>' } licenses { license { name '<PROJECT_LICENSE_NAME>' url '<PROJECT_LICENSE_ADDRESS>' distribution 'repo' } } developers { developer { id '<DEVELOPER_ID>' name '<DEVELOPER_NAME>' email '<DEVELOPER_EMAIL>' } } } } extraArchive { sources = true tests = true javadoc = true } nexus { sign = true repositoryUrl = '<SONATYPE_RELEASE_REPOSITORY>' snapshotRepositoryUrl = '<SONATYPE_SNAPSHOT_REPOSITORY>' }
- Add the Gradle Nexus Staging plugin like the following:
plugins { id 'java' id "com.bmuschko.nexus" version "2.3.1" // Gradle Sonatype Nexux Plugin id "io.codearte.nexus-staging" version "0.21.1" // Gradle Nexus Staging Plugin }
- After adding the plugin save the build.gradle file.
- Get the staging profile ID by running the following command:
gradlew getStagingProfile
- Add the following plugin configuration:
nexusStaging { stagingProfileId = "<STAGING_PROFILE_ID>" }
- Save the build.gradle file again.
Uploading to Sonatype Repository
Run the following command:
gradlew publishToSonatype
Publishing to Maven Central
Run the following command:
gradlew closeAndReleaseSonatypeStagingRepository
Errors in Publishing
If there are any errors after running the preceding command
- Sign in to the following address using your sonatype credentials: https://oss.sonatype.org/
- Click the Staging Repositories menu and investigate the error from there.
- Once the errors were identified and corrected locally, upload it again to sonatype repository before publishing it again.
Do this error correction process until all the errors were corrected.
Successful Publishing Validation
After around 10 minutes, navigate to your registered group id from sonatype, starting from the following address:
https://repo.maven.apache.org/maven2/
After around 2 hours, your artifact id may be searchable in maven central from the following address:
Recent Comments