Pages

Monday, August 31, 2020

Sentora Domain name change

 


You may want to change Sentora sub-domain if you installed Sentora without subdomain (usual error) or if, for any reason, you want to change the subdomain name.

This is an easy way from SSH console or local console.

1) Login to your console

2) Change Sentora subdomain

setso --set sentora_domain new_sentora_fulldomain

OR

  1. Log into phpMyAdmin as root user.
  2. Open table:sentora_core.x_settings
  3. Edit row 90 (Or search for the domain you entered when installing Sentora)
  4. In row 90 put your new or updated Sentora FQDN: new_sentora_fulldomain

Notes:

  • replace new_sentora_fulldomain by the FQDN that you want to use to access Sentora (only), something like mypanel.example.com
    It MUST NOT be your base "public" domain (example.com in the example above).
     
  • The subdomain you will use (mypanel in the example above) MUST also be setup in your DNS name-server !
    See also Setting up DNS ...

3) Tells Sentora daemon that the vhost file must be rewriten

setso --set apache_changed true

4) Wait until Sentora daemon run (each 5 min)

It is NOT ADVIDSED, but if you are really too much impatient (and if you understand what it implies) you can run the daemon manually with:

php -q /etc/sentora/panel/bin/daemon.php

Thursday, July 23, 2020

MikroTik Script for Link up down enable disable based on gateway timeout


** for example we have two separate links with two gateway IP,
we wants to disable or enable concern interface(ether1 or ether2) if gateway ping timeout
    * If we wants montior/ ping gateway three times and script will run Ones each 1 minute (interval = 00:01:00)

ether1 = lnik1 = Interface IP 192.168.1.2 and gateway IP 192.168.1.1
ether2 = link2 = Interface IP 172.16.1.2 and gateway IP 172.16.1.1

** GoTo Winbox -> and Click
#System -> Scheduler -> + Add
------------------------------
interval = 00:01:00

:if ([ /ping 192.168.1.1 src-address=192.168.1.2 count=3] = 0) do={
[/interface disable ether1]
:log info "gateway timeout, disabling link1 ether1 interface"
}
:if ([ /ping 192.168.1.1 src-address=192.168.1.2 count=3] = 3) do={
[/interface enable ether1]
:log info "Link1 is now up  enabling ether1 interface"
}

---------------------------
** script to check link2
----------------------------
System -> Scheduler -> + Add

interval = 00:01:00


:if ([ /ping 172.16.1.1 src-address=172.16.1.2 count=3] = 0) do={
[/interface disable ether2]
:log info "gateway timeout, disabling link2 ether2 interface"
}
:if ([ /ping 172.16.1.1 src-address=172.16.1.2 count=3] = 3) do={
[/interface enable ether2]
:log info "Link2 is now up  enabling ether2 interface"
}

------------------------------
#Enjoy## Tayab Khan ###

Sunday, June 21, 2020

IP reputation ad sender score check



Sender score:
https://www.senderscore.org/get-your-score/

IP reputaion:

https://talosintelligence.com/reputation_center


https://www.ers.trendmicro.com/reputations


https://ipremoval.sms.symantec.com/



### fail2ban unban
fail2ban-client set dovecot-iredmail unbanip 192.168.2.2




## Search any text from all files under a directory
* we wants to search a text/word named "Searching Text" from many files under location /var/www/html

find /var/www/html/ -type f -exec grep -H 'Searching Text' {} \;


Tuesday, June 16, 2020

Postfix outgoing mail limit per domain


 Limit outgoing mail 


Global configuration::

vi /etc/postfix/main.cf
smtp_destination_concurrency_limit = 2
smtp_destination_rate_delay = 1s
smtp_extra_recipient_limit = 10

  • default_destination_concurrency_limit: This means that postfix will up to two concurrent connections per receiving domains. The default value is 20.
  • default_destination_rate_delay: Postfix will add a delay between each message to the same receiving domain. It overrides the previous rule and in this example, it will send one email after another with a delay of 1 second. If you want to disable this rule, either delete it or set to 0.
  • default_extra_recipient_limit: Limit the number of recipients of each message. If a message had 20 recipients on the same domain, postfix will break it out to two different email messages instead of one.
Then restart your Postfix.

 Limit outgoing mail by domain

You can limit per domain if you want like this:
Configuration File vi /etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport
 
# Throttle limit policy mail (global)
smtp_destination_concurrency_limit = 4
smtp_extra_recipient_limit = 2
 
# Polite policy
polite_destination_concurrency_limit = 3
polite_destination_rate_delay = 2s
polite_destination_recipient_limit = 5
 
# Turtle policy
turtle_destination_concurrency_limit = 2
turtle_destination_rate_delay = 1s
turtle_destination_recipient_limit = 2

Then add domains with the wished policy:
Configuration File vi  /etc/postfix/transport
gmail.com polite:
yahoo.com polite:
hotmail.com turtle:
live.com turtle:
outlook.com turtle:

Edit master configuration to inform postfix of those config. Add those lines:
Configuration File vi /etc/postfix/master.cf
polite unix - - n - - smtp
turtle unix - - n - - smtp

Postmap and reload:
Command
postmap /etc/postfix/transport
service postfix reload

Now Send mail check log

Tuesday, January 14, 2020

Linux Script to collect server status



Linux Script to collect server status


[root@tayab]# cat stat.sh
#! /bin/bash
printf "Memory\t\tDisk\t\tCPU\t\tDATE\n"
end=$((SECONDS+36000000000))
while [ $SECONDS -lt $end ]; do
MEMORY=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }')
DISK=$(df -h | awk '$NF=="/"{printf "%s\t\t", $5}')
CPU=$(top -bn1 | grep load | awk '{printf "%.2f%%\t\t\n", $(NF-2)}')
DATE=$(date)
echo "$MEMORY$DISK$CPU$DATE"
sleep 60
done

[root@tayab]# nohup sh stat.sh >> load.txt &


** If CPU core 12 then run as bellow (100/12 = 8.333)

#! /bin/bash
printf "Memory\t\tDisk\t\tCPU\t\tDATE\n"
end=$((SECONDS+3600000))
while [ $SECONDS -lt $end ]; do
MEMORY=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }')
DISK=$(df -h | awk '$NF=="/"{printf "%s\t\t", $5}')

CPU=$(top -bn1 | grep load | awk '{printf "%.2f%%\t\t\n", $(NF-2)*8.333}')

DATE=$(date)
echo "$MEMORY$DISK$CPU$DATE"
sleep 60
done