Command Line

Configure Sendmail with Sendgrid for SmartHost Mail Relay

Technologies: 

Set the authorization credentials in /etc/mail/access

AuthInfo:smtp.sendgrid.net "U:apikey" "P:<yourAPIKey>" "M:PLAIN"

Define the Smart Host in /etc/mail/sendmail.mc.
You should add these lines just after the commented \#dnl define('SMART_HOST', 'smtp.your.provider')dnl  line in the file. In Ubuntu these would be the last lines added to the file.

Useful DB Queries for Drupal Applications

Show grouped node counts based on OG group ids for nodes created after a particular time stamp

select gid, count(*) from og_membership inner join node on og_membership.etid = node.nid and node.created >=  1678127400 group by gid;

Show node type specific node count list

select type,count(*) from node group by type;

Show group membership wise node counts

Perform Penetrative testing in Ubuntu

Penetrative testing in Ubuntu can be done using the oscap tool.

Download the latest vulnerability list using the command

wget https://security-metadata.canonical.com/oval/com.ubuntu.$(lsb_release -cs).usn.oval.xml.bz2

Evaluate the vulnerability using the oscap command

oscap oval eval --report report.html com.ubuntu.$(lsb_release -cs).usn.oval.xml

--

Handling Issues in Migration

Fix "non-existent config entity name returned by FieldStorageConfigInterface::getBundles()"
Normally it will show that a field belongs to a non existing bundle for a node, comment etcetra in log post migration.
Solving a field that does not belong to non existent bundle in a node, example, field_agenda present in a non existent bundle makemeeting of node type

Optimizing Images using command line

The images uploaded by users may not be of ideal size and may require compression to manage server space. There are some tools available for compressing JPG and PNG files.
Please note that the owner changes to the current username for the file after compression. Please remember to change ownership if required of the file or per folder post compression.

jpegoptim :
Optimize a jpg image with the same name

jpegoptim image.jpg

Optimize all jpg images in a folder

SSL Certificate Using Let's Encrypt for Ubuntu

Automated creation, renewing of certificates is provided by software called certbot.

To view a list of the certificates Certbot knows about, run the certificates subcommand:

$> certbot certificates

Deleting certificates

$> certbot delete --cert-name example.com

Install Certificates Using Apache