แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - golfreeze

Pages: 1 ... 7 8 [9] 10 11 ... 146
121
command , shell script ,tool , crontab / added routing in centos 8.x
« on: กรกฎาคม 22, 2020, 08:14:15 PM »
ถ้าต้องการทำ static route ใน centos 8.x เช่น
192.168.0.0/16 ให้วิ่งออก 192.168.1.254 สามารถทำได้ดังนี้
172.30.0.0/16 ให้วิ่งออก 192.168.1.254 สามารถทำได้ดังนี้

vi /etc/sysconfig/network-scripts/route-ens160
192.168.0.0/16 via 192.168.1.254
172.30.0.0/16 via 192.168.1.254


122
=== check status logstash
curl -XGET '10.2.8.123:9600/_node/stats/jvm?pretty'

=== test send curl post to logstash
curl -X GET "localhost:9600/?v"
curl -X GET "10.2.8.123:9600/?v"

=== test send stat to logstash server port 9600
curl -XGET '10.2.8.123:9600/_node/stats/events?pretty'

123
ทำการอัฟเกรด จาก zcoin 0.13 -> 0.14


1.ทำการ download ตาม os ที่ใช้งาน
https://github.com/zcoinofficial/zcoin/releases/tag/v0.14.0.1

2.แล้วทำการ backup wallet ก่อนจาก console version 0.13
File -> Backup Wallet

3. ปิดโปรแกรม zcoin console version 0.13

4. ทำการติดตั้ง zcoin console version 0.14

5. ทำการเปิดโปรแกรม zcoin version 0.14

6. ทำการ configure ตามลิ้ง
https://github.com/zcoinofficial/zcoin/wiki/Migrating-your-Legacy-Znodes-to-the-new-Deterministic-Znodes-system

Preparing for migration
Legacy Znodes can be registered as Deterministic Znodes with this command:

protx register collateralHash collateralIndex ipAndPort ownerAddress operatorPubKey votingAddress operatorReward payoutAddress feeSourceAddress

An example of how this would look like is as follows:

protx register 4950f88867b69760d3cd7c1f53531340f6723eb8f7d7f00730abfa12c5fe10e0 0 207.148.122.12:8168 TRVDAxJwaZYFfmti4aTeKCByz1jbMq8Jy4 995b3e1e2a65ce960a8cc7d305c5914b7f60e888c338c1f3317efbdcac58e82ecc110315ce03f49d9d387ff35c2796ad "" 0 TEZ8M8Fgp8h4HvUjXtjz3krYraRtySiXdw

This looks extremely complicated but don't worry! The guide will explain each field below.

125
all application on unix knowledges by golfreeze / rufus burn iso to boot disk usb on window 10
« on: มิถุนายน 23, 2020, 01:26:58 PM »
rufus burn iso to boot disk usb on window 10
https://github.com/pbatard/rufus/releases/download/v3.11/rufus-3.11.exe

หรือเข้าไป download จาก https://rufus.ie

126
ทำการ monitoring mysql_slave_status ติดตั้ง nrpe ที่เครื่อง mysql slave node แล้วทำการติดตั้ง script check_mysql_slavestatus.sh

===download script จาก
https://golfreeze.packetlove.com/check_mysql_slavestatus.sh
or
https://www.claudiokuenzler.com/monitoring-plugins/check_mysql_slavestatus.sh

ทำการเพิ่มใน nagios nrpe command
vi nrpe.cfg
### custom script by PKL ###
command[check_mysql_slavestatus]=/usr/local/nagios/libexec/check_mysql_slavestatus.sh -H 127.0.0.1 -P 3306 -u nagios -p checkstatus@

แล้วทำการ เพิ่มใน nagios ฝั่ง server
vi dbslave.cfg

define service{
        use                             local-service         ; Name of service template to use
        host_name                       dbslave.com
        service_description             Check_Mysql_Slave_Status
        check_command                   check_nrpe!check_mysql_slavestatus
        notifications_enabled           1
        }

ผลการแสดงจาก nagios จะแสดงเป็นดังนี้ พร้อมกับ ดูได้ว่า sync ตามหลัง master node อยู่กี่วินาที
OK: Slave SQL running: Yes Slave IO running: Yes / master: 192.168.1.9 / slave is 0 seconds behind master

special thank you for script from :
https://www.claudiokuenzler.com

127
/usr/local/etc/rc.d/pure-ftpd: WARNING: run_rc_command: cannot run /usr/local/sbin/pure-config.pl

=== re-build pureftpd & dovecot again.
cd /usr/local/directadmin/custombuild
Check versions.txt see pureftpd if found version then
./build pureftpd
./build dovecot

128
=== freebsd 11.x 64bit compile directadmin and failed on snail

/usr/local/directadmin/custombuild/s-nail-14.9.19/src/mx/xtls.c:1937:20: warning: incompatible integer to pointer conversion assigning to 'const EVP_MD *'
      (aka 'const struct env_md_st *') from 'int' [-Wint-conversion]
         fprnt_mdp = a_XTLS_FINGERPRINT_DEFAULT_DIGEST();
                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/directadmin/custombuild/s-nail-14.9.19/src/mx/xtls.c:1942:27: warning: implicit declaration of function 'TLS_client_method' is invalid in C99
      [-Wimplicit-function-declaration]
   if((ctxp = SSL_CTX_new(mx_XTLS_CLIENT_METHOD())) == NULL){
                          ^
/usr/local/directadmin/custombuild/s-nail-14.9.19/include/mx/gen-config.h:379:31: note: expanded from macro 'mx_XTLS_CLIENT_METHOD'
#define mx_XTLS_CLIENT_METHOD TLS_client_method
                              ^
/usr/local/directadmin/custombuild/s-nail-14.9.19/src/mx/xtls.c:1942:27: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'const SSL_METHOD *'
      (aka 'const struct ssl_method_st *') [-Wint-conversion]
   if((ctxp = SSL_CTX_new(mx_XTLS_CLIENT_METHOD())) == NULL){
                          ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/directadmin/custombuild/s-nail-14.9.19/include/mx/gen-config.h:379:31: note: expanded from macro 'mx_XTLS_CLIENT_METHOD'
#define mx_XTLS_CLIENT_METHOD TLS_client_method
                              ^
/usr/include/openssl/ssl.h:2131:40: note: passing argument to parameter 'meth' here
SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
                                       ^
4 warnings and 7 errors generated.
gmake[1]: *** [mk-config.mk:421: mx-072.o] Error 1
gmake[1]: Leaving directory '/usr/local/directadmin/custombuild/s-nail-14.9.19/.obj'
gmake: *** [makefile:25: build] Error 2
Could not find /usr/local/directadmin/scripts/directadmin_cron or it is empty

====> how to fixed
snail is use your old openssl and not openssl 1.1.1

and also my problem in the past.

You may set 0 as the version in custom_versions.txt for it.
cd /usr/local/directadmin/custombuild
vi custom_versions.txt
s-nail:0

=== manually install s-nail package in freebsd
pkg install s-nail

===then run setup again.
./setup auto

129
[100%] Built target pfs_connect_attr-t
Make complete
Packaging mysql-5.7.27...
CPack: Create package using TGZ
CPack: Install projects
CPack: - Run preinstall target for: MySQL
CPack: - Install project: MySQL
CPack: Create package
CPack: - package: /usr/local/directadmin/custombuild/mysql-5.7.27/mysql-5.7.27-freebsd11.3-x86_64.tar.gz generated.
Moving mysql-5.7.27-*.tar.gz to /usr/local/directadmin/custombuild ...
Done.
Cannot find mysql-5.7.27-freebsd11-x86_64.tar.gz for installation

===> ทำการแก้ไขโดย
cd /usr/local/directadmin/custombuild
cp mysql-5.7.27-freebsd11.3-x86_64.tar.gz mysql-5.7.27-freebsd11-x86_64.tar.gz
แล้วทำการ
./setup auto

130
ถ้ายังมี error ssl อยู่อาจจะต้องเอา configure -ssl ออกลองดูนะครับ
cd /usr/local/directadmin/custombuild/custom/php
vi configure.php56

delete
 --with-openssl=/usr/local/openssl-unsafe \

แล้วทำการรัน compile เฉพาะ php5.6
./build php_expert 5.6 php-fpm

===> เปิดอีก session ทำการ copy patch ext/mbstring/php_mbregex.c เข้าไปทับตัวที่ download source php-5.6.40 ไปด้วยนะครับ =>
cd /usr/local/directadmin/custombuild
cp php_mbregex.c php-5.6.40/ext/mbstring/.

===สุดท้ายทำการรัน
./build rewrite_confs

===reference
https://forum.directadmin.com/threads/migrating-from-openssl-to-openssl-unsafe.60104/page-2

131
cd /usr/local/directadmin/custombuild
mkdir -p custom/php
cp -p configure/php/configure.php53 custom/php/configure.php53
mkdir -p custom/fpm/.custom_openssl
touch custom/fpm/.custom_openssl
perl -pi -e 's|with-openssl|with-openssl=/usr/local/lib_http2|g' custom/php/configure.php53
wget ftp://ftp.openssl.org/source/openssl-1.0.2s.tar.gz
tar xzf openssl-1.0.2s.tar.gz
cd openssl-1.0.2s
./config --prefix=/usr/local/lib_http2 no-ssl2 no-ssl3 zlib-dynamic -fPIC
make depend
make install
./build php_expert 5.3 php-fpm

===> เปิดอีก session ทำการ copy patch ext/mbstring/php_mbregex.c เข้าไปทับตัวที่ download source php-5.6.40 ไปด้วยนะครับ =>
cd /usr/local/directadmin/custombuild
cp php_mbregex.c php-5.6.40/ext/mbstring/.

===สุดท้ายทำการรัน 
./build rewrite_confs

132
วันนี้มีเทส compile php5.6.x บน freebsd 12.x ดูครับแล้วพบว่ามี error เกี่ยวกับ onig_get_encoding
คือจริงๆ ใน directadmin ก็มีออก patch มาเพื่อแก้ไขตัว php_mb_regex_t

cd /usr/local/da/custombuild/php5.6/ext/mbstring

==== Start of Patch ====
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -454,7 +454,7 @@ static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patlen, OnigOptionType options, OnigEncoding enc, OnigSyntaxType *syntax TSRMLS_DC)
   OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];

   found = zend_hash_find(&MBREX(ht_rc), (char *)pattern, patlen+1, (void **) &rc);
-   if (found == FAILURE || (*rc)->options != options || (*rc)->enc != enc || (*rc)->syntax != syntax) {
+   if (found == FAILURE || onig_get_options(*rc) != options || onig_get_encoding(*rc) != enc || onig_get_syntax(*rc) != syntax) {
      if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) {
         onig_error_code_to_str(err_str, err_code, err_info);
         php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex compile err: %s", err_str);

==== End of Patch ====

OpenSSL version
It is known fact that PHP 5.x versions have issues to compile against OpenSSL 1.1.1. So first we need to install an alternative OpenSSL version. In FreeBSD ports we can find openssl-unsafe, which offers OpenSSL 1.0.2. So we install it

=== install portsnap on freebsd12.x
#portsnap fetch
#portsnap extract

cd /usr/ports/security/openssl-unsafe
make && make install

# /usr/local/openssl-unsafe/bin/openssl version
OpenSSL 1.0.2-chacha (1.0.2k-dev)

cd /usr/local/directadmin/custombuild
mkdir -p custom/php/
cp -p configure/php/configure.php5* custom/php/
mkdir -p custom/fpm/.custom_openssl
touch custom/fpm/.custom_openssl

perl -pi -e 's|with-openssl|with-openssl=/usr/local/openssl-unsafe|g' custom/php/configure.php5*

cd /usr/local/directadmin/custombuild
./build update
./build php

===> เปิดอีก session ทำการ copy patch ext/mbstring/php_mbregex.c เข้าไปทับตัวที่ download source php-5.6.40 ไปด้วยนะครับ =>
cd /usr/local/directadmin/custombuild
cp php_mbregex.c php-5.6.40/ext/mbstring/.

./build rewrite_confs

https://forum.directadmin.com/threads/migrating-from-openssl-to-openssl-unsafe.60104/


133
==== For FreeBSD 11.x , 12.x
wget --no-check-certificate https://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz

tar zxf nagios-plugins-2.1.1.tar.gz
cd nagios-plugins-2.1.1
useradd nagios
passwd nagios

./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-redhat-pthread-workaround && make && make install
chown nagios:nagios /usr/local/nagios
chown -R nagios:nagios /usr/local/nagios/libexec/

cd ..
tar zxf nrpe-2.15.tar.gz
cd nrpe-2.15

./configure
make all
make install-plugin
make install-daemon
make install-daemon-config

cp init-script /usr/local/etc/rc.d/nrpe
chmod 755 /usr/local/etc/rc.d/nrpe

/usr/local/etc/rc.d/nrpe restart

134
[Tue May 14 14:57:17.838720 2020] [proxy:error] [pid 20668:tid 140271263479552] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /usr/local/php72/sockets/web.sock (*) failed
[Tue May 14 14:57:17.838746 2020] [proxy_fcgi:error] [pid 20668:tid 140271263479552] [client 1.2.3.4:51451] AH01079: failed to make connection to backend: httpd-UDS

ทำการแก้ไขโดยทำการ restart php-fpm72 services 1 ครั้ง แล้วเข้าใช้งานอีกรอบก็จะทำให้ใช้งานได้ปกติครับ
สาเหตุน่าจะเกิดจากตอนทำการ compile php-fpm module แล้ว service ค้างค่า configure module เก่าไว้ครับ

==centos / ubuntu
systemctl restart php-fpm72

==freebsd
/usr/local/etc/rc.d/php-fpm72 restart

135
จาก error exim version 4.93.0.4 จะเป็น
2020-03-16 19:13:34 1jDvB8-000Hpr-8r attempt to expand tainted string '$originator_uid'
2020-03-16 19:13:34 1jDvB8-000Hpr-8r failed to expand condition "${perl{check_limits}}" for lookuphost router: syntax error in Exim::expand_string argument: attempt to expand tainted string '$originator_uid' at /etc/exim.pl line 479.

Pages: 1 ... 7 8 [9] 10 11 ... 146