mysql;
use sentora_postfix;
update mailbox set quota = 3000 where username like "email@domain.com";
poniedziałek, 27 marca 2017
piątek, 10 marca 2017
atop cheat sheet
Cron
58 23 * * * killall atop
05 0 * * * rm -f /var/log/atop.log
07 0 * * * atop -w /var/log/atop.log 5
To read the log:
# atop -r /var/log/atop.log
Press t to move forward to the next 5 seconds, and press shift+t to move backwards.
To read only a certain time range from the log (b for beginning, e for end):
# atop -r atop.log -b 10:00 -e 11:00
To change the view:
g - Show generic output (default)
m - Show memory related output
s - Show scheduling characteristics
c - Show the command line of the process
58 23 * * * killall atop
05 0 * * * rm -f /var/log/atop.log
07 0 * * * atop -w /var/log/atop.log 5
To read the log:
# atop -r /var/log/atop.log
Press t to move forward to the next 5 seconds, and press shift+t to move backwards.
To read only a certain time range from the log (b for beginning, e for end):
# atop -r atop.log -b 10:00 -e 11:00
To change the view:
g - Show generic output (default)
m - Show memory related output
s - Show scheduling characteristics
c - Show the command line of the process
poniedziałek, 20 lutego 2017
niedziela, 19 lutego 2017
poniedziałek, 13 lutego 2017
wtorek, 7 lutego 2017
openssh ciphers
Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
piątek, 3 lutego 2017
niedziela, 29 stycznia 2017
haproxy
nazwa backendu: appX-backend, roundrobin
backend appX-backend
balance roundrobin
server appX_01 192.168.2.2:8080 check
server appX_02 192.168.2.3:8080 check
jesli request zawiera appX np http://example.com/appX to przekieruj do appX-backend, domyslnie do appZ-backend
frontend http-in
bind *:80
acl url_appX path_beg -i /appX/
use_backend appX-backend if url_appX
default_backend appZ-backend
przekieruj ruch na serwer backupowy tylko wtedy kiedy pierwszy bedzie niedostepny
backend appZ-backend
server appZ_01 192.168.2.2:8080 check
server appZ_02 192.168.2.3:8080 check backup
backend appX-backend
balance roundrobin
server appX_01 192.168.2.2:8080 check
server appX_02 192.168.2.3:8080 check
jesli request zawiera appX np http://example.com/appX to przekieruj do appX-backend, domyslnie do appZ-backend
frontend http-in
bind *:80
acl url_appX path_beg -i /appX/
use_backend appX-backend if url_appX
default_backend appZ-backend
przekieruj ruch na serwer backupowy tylko wtedy kiedy pierwszy bedzie niedostepny
backend appZ-backend
server appZ_01 192.168.2.2:8080 check
server appZ_02 192.168.2.3:8080 check backup
środa, 25 stycznia 2017
ssh mail login
#!/bin/bash
mail=user@domain.tld
monitored_user=root
monitored_ip=x.x.x.x
hostname=$(hostname)
# add a welcome message:
printf >&2 "\nWelcome on $hostname $USER\n"
read -d " " ip <<< $SSH_CONNECTION
[[ $ip == $monitored_ip && $USER == $monitored_user ]] || exit 0
date=$(date "+%d.%m.%Y %Hh%M")
reverse=$(dig -x $ip +short)
mail -s "Connexion of $USER on $hostname" $mail <<EOF
IP: $ip
Reverse: $reverse
Date: $date
EOF
mail=user@domain.tld
monitored_user=root
monitored_ip=x.x.x.x
hostname=$(hostname)
# add a welcome message:
printf >&2 "\nWelcome on $hostname $USER\n"
read -d " " ip <<< $SSH_CONNECTION
[[ $ip == $monitored_ip && $USER == $monitored_user ]] || exit 0
date=$(date "+%d.%m.%Y %Hh%M")
reverse=$(dig -x $ip +short)
mail -s "Connexion of $USER on $hostname" $mail <<EOF
IP: $ip
Reverse: $reverse
Date: $date
EOF
wtorek, 24 stycznia 2017
BIND9 master + slave + sec
named.conf.options
acl dnsy { $IP;
127.0.0.1;
};
options {
directory "/var/cache/bind";
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
allow-recursion { dnsy; };
allow-transfer { dnsy; };
recursion yes;
version "DNS";
listen-on-v6 { none; };
};
named.conf MASTER
zone "test.net" { type master; file "/etc/bind/test.net.db"; also-notify { $IP; }; allow-transfer { $IP; }; notify yes; };
named.conf SLAVE
zone "test.net" { type slave; masters { $IP; }; file "test.net.db"; };
acl dnsy { $IP;
127.0.0.1;
};
options {
directory "/var/cache/bind";
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
allow-recursion { dnsy; };
allow-transfer { dnsy; };
recursion yes;
version "DNS";
listen-on-v6 { none; };
};
named.conf MASTER
zone "test.net" { type master; file "/etc/bind/test.net.db"; also-notify { $IP; }; allow-transfer { $IP; }; notify yes; };
named.conf SLAVE
zone "test.net" { type slave; masters { $IP; }; file "test.net.db"; };
Subskrybuj:
Posty (Atom)