Recent Posts

Pages: 1 ... 5 6 [7] 8 9 10
61
หลังจากทำการ extend disk ผ่าน vcenter ต้องทำการรัน eagerzeroedthick ด้วยสำหรับ disk ที่มีการ share กันระหว่าง clustering เนื่องจากมีการปรับค่ากลับไปเป็น lazy ในตอนแรกต้องทำกลับมาเป้น eagerzeroedthick
เปิด ssh service on esx-i แล้วใช้ putty login เข้าไปที่ console
 
vmkfstools --eagerzero /vmfs/volumes/myVMFS/VMName/disk.vmdk

รอการปรับ disk ระยะเวลาที่ใช้ประมาณ 30-60 นาทีสำหรับ 500GB ขึ้นอยู่กับขนาดที่ปรับ
https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.storage.doc/GUID-60B9C89A-6638-43FA-A8E3-4DACAC85FC29.html
62
All Security via cyber space relate golfreeze task. / ubuntu20.04 setup proxy with username password authenticated.
« Last post by golfreeze on กุมภาพันธ์ 01, 2022, 11:46:45 PM »
===install squid on ubuntu20.04
apt update
apt install squid
systemctl status squid.service
systemctl enable squid.service
vi /etc/squid/squid.conf

===start of squid.conf===
# Deny requests to certain unsafe ports
http_access deny !Safe_ports
 # Deny CONNECT to other than secure SSL ports
 http_access deny CONNECT !SSL_ports
 # Only allow cachemgr access from localhost
 http_access allow localhost manager
 http_access deny manager
 # We strongly recommend the following be uncommented to protect innocent
 # web applications running on the proxy server who think the only
 # one who can access services on "localhost" is a local user
 #http_access deny to_localhost
 #
 # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
 #
 include /etc/squid/conf.d/*
 ##allow user pass authen via proxy
 auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/passwords
 auth_param basic realm proxy
 acl authenticated proxy_auth REQUIRED
 ##add from golf ip whois current ip check via https://whatismyipaddress.com/
 acl localnet src 49.228.38.136
 # Example rule allowing access from your local networks.
 # Adapt localnet in the ACL section to list your (internal) IP networks
 # from where browsing should be allowed
 #http_access allow localnet
 #http_access allow localhost
 http_access allow authenticated
 # And finally deny all other access to this proxy
 http_access deny all
===end of squid.conf===

===after that last step need to install for htaccess password user
apt install apache2-utils
htpasswd -c /etc/squid/passwords axpkl2
systemctl restart squid.service
ufw allow 3128

=====Ip: 116.204.180.2
=====setup proxy user and password
htpasswd  /etc/squid/passwords axpkl3


==test from pc or Macbook (49.228.38.136)
curl -v -x http://axpkl2:pklpkl2@116.204.180.2:3128 http://www.google.com/

=====show log could connect via proxy normally
===tail -f /var/log/squid/access.log
==DENIED
1643733370.341      0 49.228.38.136 TCP_DENIED/407 4051 CONNECT www.google.com:443 axpkl HIER_NONE/- text/html
==CONNECTED
1643733378.519    291 49.228.38.136 TCP_TUNNEL/200 26450 CONNECT www.google.com:443 axpkl2 HIER_DIRECT/142.250.199.36
64
=== ถ้าต้องการ ส่งจำนวนอีเมลมากๆ ไปหา gmail ต้องทำการขออนุญาตในลิ้งนี้
https://support.google.com/mail/contact/bulk_send_new?rd=1
65
migrate and export redis on prem and restore to AWS elasticache

======Example: Redis Backup ==> https://www.w3resource.com/redis/redis-backup.php
The example given below creates the backup of the current database.
127.0.0.1:6379> SAVE
OK
This command will create the dump.rdb file in your redis directory.

Restore:
CONFIG GET
To restore redis data just move redis backup file (dump.rdb) into your redis directory and start the server. To get your redis directory use CONFIG command can be used. The CONFIG GET command is used to read the configuration parameters of a running Redis server.
127.0.0.1:6379> CONFIG get dir
1) “dir"
2) "/var/lib/redis/6379”
In the output of above command "/var/lib/redis/6379" is the directory, where redis server is installed.

==== restore .rdb to AWS elastic ache  https://github.com/leonchen83/redis-rdb-cli
apt-get install openjdk-8-jdk
wget https://github.com/leonchen83/redis-rdb-cli/releases/download/v0.7.4/redis-rdb-cli-release.zip
unzip redis-rdb-cli-release.zip
cd ./redis-rdb-cli/bin
./rmt -h

==connect via stunnel4 need to connect via stunnel
./rmt -s dump.rdb -m redis://172.31.20.105:6374 -r
get golf2
or
./rmt -s dump.rdb -m redis://172.31.20.105:6374 -t list -d 0
 \[    5 B|    3 B/s]
66
##centos 8.x สามารถใช้งานตามนี้ได้เลย ต้องใช้เป็น nrpe 3.2.1 นะครับ จะได้ไม่เจอปัญหาเรื่อง
CHECK_NRPE: (ssl_err != 5) Error - Could not complete SSL handshake with ip: 1

tar zxf nrpe3.2.1.tar.gz

cp init-script /etc/init.d/nrpe
chmod 755 /etc/init.d/nrpe
แก้เป็นตามนี้
#NrpeBin=${exec_prefix}/bin/nrpe
NrpeBin=/usr/local/nagios/bin/nrpe
#NrpeCfg=${prefix}/etc/nrpe.cfg
NrpeCfg=/usr/local/nagios/etc/nrpe.cfg

แล้วก็ systemctl daemon-reload

start nrpe
/etc/init.d/nrpe restart
67
upgrade php7.4 on directadmin

==== upgrade PHP7.4
cd /usr/local/directadmin/custombuild
./build update
./build set php1_release 7.4
./build set php1_mode php-fpm

./build php n
./build rewrite_confs

===If found error
Libjpeg not found

==fixed by install libjpeg-devel on centos
yum install libjpeg-devel
yum -y install krb5-devel

==fixed by install libjpeg-devel on Debian
apt install libjpeg-dev
apt install krb5-dev

==fixed by install on freebsd [checking whether to build with LIBXML support... yes
checking for libxml-2.0 >= 2.7.6... no
configure: error: in `/usr/local/directadmin/custombuild/php-7.4.2':
configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.]
=> fixed by
pkg install pkgconf krb5

===If found error
checking for icu-uc >= 50.1 icu-io icu-i18n… no
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
Requested 'icu-uc >= 50.1' but version of icu-uc is 4.8.1.1

===fixed by re-build icu
./build update
./build icu
==start compile php again.
./build php n

==or build only 7.4
./build php_expert 7.4 php-fpm
68
เจอ error #1264 Out of range value adjusted for column 'ID' at row 1 ID บน board smf
แก้ไขโดย
alter table smf_ads change HITS HITS BIGINT NOT NULL default '0';
69
===== send syslog to sensor node.  [normally syslog send to master node only]
https://docs.securityonion.net/en/2.3/firewall.html?highlight=syslog#allow-hosts-to-send-syslog-to-a-sensor-node

==step1 run on master
so-firewall addhostgroup syslogtosensor1

==step2 run on master
so-firewall includehost syslogtosensor1 ipของsyslog-ngที่จะส่งไปsensor

==step3 run on master “sensor_heavynode.sls” => /opt/so/saltstack/local/pillar/minions/<HOSTNAME>_<ROLE>.sls
/opt/so/saltstack/local/pillar/minions/sensor_heavynode.sls
firewall:
  assigned_hostgroups:
    chain:
      DOCKER-USER:
        hostgroups:
          syslogtosensor1:
            portgroups:
              - portgroups.syslog

==step4 run on master salt <HOSTNAME>_<ROLE> state.apply firewall
salt sensor_heavynode state.apply firewall

==step5 : run on sensor node
==check and view see connection establish for source_log send to sensor_ip
netstat -na | grep 514
70
Mail issue , problem , configuration / Re: config logrotate + syslog-ng + ntp support mail.log on debian
« Last post by golfreeze on สิงหาคม 31, 2021, 01:29:41 PM »
ในกรณีเจอเครื่อง centos ไม่ให้ใช้งาน port อื่นนอกจาก 514 เพื่อรับ log สามารถตรวจเชคได้ ติด selinux หรือเปล่านะครับ

semanage port --list | grep syslog
syslogd_port_t                 tcp      601, 20514
syslogd_port_t                 udp      514, 601, 20514

ถ้าขึ้นมาเป็น 20514 สามารถใช้ตัวนี้ได้นะครับผม
Pages: 1 ... 5 6 [7] 8 9 10