Tuesday, July 16, 2024

How to install SSL on CWP hostname?



1 - Check that you should have an A record for the hostname. For example if your server hostname is cp.hostinpk.com, then you should have an A record for "cp" pointing to server IP


2 - Login to CWP Admin Panel>> Server Settings>>Change Hostname and then hit "Change Hostname" button after putting your desired hostname (in my case cp.hostinpk.com). This will only generate a valid LE SSL for your hostname when an A record is present against hostname


3 - Perform following command from shell

service cwpsrv reload

Saturday, June 15, 2024

How to merge a branch to main branch in Github.


In Terminal or Command Prompt: 

git checkout main [switch to main branch]

git pull origin main
 [grab latest updates from main branch]

git merge master merge [master branch to your main branch]

git push origin main [push your changes to main]

Sunday, April 21, 2024

Exim configuration & Filter

 There are two things that need to be configured. The system filter and the specific transport. If you only want to forward emails and not save them to the filesystem, the transport section is not needed.

Edit your exim configuration and add these lines at the top:

# /etc/exim.conf top

system_filter = /etc/system_filter.exim

system_filter_directory_transport = local_copy_outgoing

Add these lines lower in the configuration, in your transports section:


# /etc/exim.conf transpors section

local_copy_outgoing:

  driver = appendfile

  delivery_date_add

  envelope_to_add

  return_path_add

  group = mail

  user = mail

  mode = 0660

  maildir_format = true

  create_directory = true

Change the mail user to the specific user account on your system exim runs at. It could be named exim. You can check that with the getent passwd command.


To configure the actual saving and filtering create or edit the /etc/system_filter.exim file. The below snippets should be placed in that file, according to what you're trying to acomplish.


To save all outgoing mail from a specific domain to a maildir folder in /var/mail/:


if $sender_address_domain is example.tld

then

unseen save /var/mail/example.tld/mailarchive/.${tr{$sender_address}{.}{_}}.outgoing/

endif

Forward all outgoing from specific domain to specific email address:


if $sender_address_domain is example.tld

then

unseen deliver othermailbox@otherdomain.com

endif

Forward ALL outgoing mail to email address:


unseen deliver othermailbox@otherdomain.com

Save ALL outgoing email to maildir folder:


unseen save /var/mail/${tr{$sender_address_domain}{.}{_}}/mailarchive/${tr{$sender_address}{.}{_}}.outgoing/

The files are saved in a maildir structure:


ls -la /var/mail/example.tld/mailarchive/example\@example.tld.outgoing/new/

total 16

-rw-rw---- 1 mail mail 1632 Dec 15 20:31 1450207897.H829447P10443.example.tld

drwx------ 5 mail mail 4096 Dec 15 20:31 ..

-rw-rw---- 1 mail mail 1747 Dec 15 20:33 1450207983.H51962P10484.example.tld

drwx------ 2 mail mail 4096 Dec 15 20:33 .


Ref: Exim Documentation

Wednesday, April 17, 2024

Sunday, April 7, 2024

How to forward all outbound mail sent from an email account on your centOS server

 

Filters and forwarders that can be managed directly within a cPanel account are only applied to incoming messages. They do not affect outbound messages. To forward outbound messages, you need to create a system filter. This article provides an example of how you can use an Exim system filter in cPanel to forward all outbound mail from an email account. 

Please note that cPanel is not able to provide support for customizing the specific contents of your Exim filters. If you need help crafting a custom filter, you should reach out to a systems administrator with the skills, training, and expertise required to do so for you.

 

Procedure

1.      Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.

2.      Create the filter file.

touch /usr/local/cpanel/etc/exim/sysfilter/options/fowardOutbound.conf

3.      Open the newly created filter file in your preferred text editor.

4.      Add the following to the file.

if ("$h_from:" contains "from@domain.tld")
then
   ## The following will make it so that the original recipient is skipped and
   ## and only recipient@domain.tld will recieve the message
   deliver "recipient@domain.tld"
   ## If you add the word unseen in front, the message will be forwarded to
   ## recipient@domain.tld as well as delivered to the original recipient.
   ## For example, you would remove the above deliver line and replace it with:
   ## unseen deliver "recipient@domain.tld"
endif

For multiple :
if $h_from: contains "user1@domain.com"
or $h_from: contains "user2@domain.com""
or $h_from: contains "user3@domain.com""
then
unseen deliver "user@domain.com"
endif

Please note that 'from@domain.tld' and 'recipient@domain.tld' must be replaced with the sender and recipient email addresses, respectively.

5.      Rebuild the Exim configuration.

/scripts/buildeximconf

Please note that cPanel will copy your custom filter into the system filter file, /etc/cpanel_exim_system_filter.

6.      Restart Exim.

/scripts/restartsrv_exim

 

Toshiba e studio 2829a print using lan cable without router

 To set up a Toshiba e-STUDIO 2829A printer to print using a LAN cable without a router, you'll need to directly connect the printer to ...