Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
all application on unix knowledges by golfreeze / rufus burn iso to boot disk usb on window 10
« Last post by golfreeze 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
22
ทำการ 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
23
/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
24
=== 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
25
[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
26
ถ้ายังมี 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
27
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
28
วันนี้มีเทส 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/

29
==== 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
30
[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
Pages: 1 2 [3] 4 5 ... 10