แสดงกระทู้

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 ... 8 9 [10] 11 12 ... 146
136
[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

137
จาก 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.

138
==exim 4.93.0.4 on directadmin could not send email , downgrade exim to 4.92.3
cd /usr/local/directadmin/custombuild
echo "exim:4.92.3:" > custom_versions.txt
./build exim


139
#pkg update and found error for wrong version and repo information
pkg: repository meta /var/db/pkg/FreeBSD.meta has wrong version 2

=== fixed by
#pkg bootstrap -f
#pkg update -f
#pkg upgrade

or
#pkg install rsync

== then update path
/usr/libexec/locate.updatedb

==rsync installed done.
# rsync --version
rsync  version 3.1.3  protocol version 31
Copyright (C) 1996-2018 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
    64-bit files, 32-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes, no prealloc, file-flags

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

140
  +-------------------------------------+        +---------------------------------+
  |                 IPMI                |        |          GAMING CONSOLES        |
  |-------------------------------------|        |---------------------------------|
  | Sun SSP                 | $100,000+ |        | Xbox ONE X (RCE)     | $75,000+ |
  | Dell DRAC               | $100,000+ |        | Playstation 4 (RCE)  | $75,000+ |
  | HP iLO                  | $100,000+ |        | Nintendo (RCE)       | $50,000+ |
  | Supermicro IPMI         | $100,000+ |        +---------------------------------+
  | Cisco CIMC              | $50,000+  |
  | VNC, Teamviewer, Radmin | $50,000+  |
  | Other                   | $20,000+  |
  +-------------------------------------+

141
What is PGP (Pretty Good Privacy)?
Pretty Good Privacy (PGP) is a data encryption and decryption computer program that provides cryptographic privacy and authentication for data communication. PGP is often used for signing, encrypting, and decrypting texts, emails, files, directories, and whole disk partitions and to increase the security of email communications.
For more information:  http://en.wikipedia.org/wiki/Pretty_Good_Privacy

What is GPG (GNU Privacy Guard)?
GNU Privacy Guard is a free alternative to the PGP suite (owned by Symantec).  It is interoperable with PGP and operates similarly.
For more information:  http://en.wikipedia.org/wiki/GNU_Privacy_Guard

Start Using PGP
Gnupg.org has many resources to help get you started.  The site provides a nice GUI (graphical user interface) for Windows and Mac users.  Windows users can download GPG4Win from http://www.gpg4win.org/.  Mac users can download GPG Tools Suite from https://gpgtools.org/

Public and Private Keys
Understanding public and private keys is the key to using PGP encryption.  The user on each end of the communication must have a PGP key. Each public key is bound to an email address.  The sender will encrypt the message with the recipient’s public PGP key and the sender’s signature. When the recipient receives the message, they must use their passphrase (private key) in order to decrypt the message. 

Obtaining Keys
The following will show how to obtain your private and public key with GNU Privacy Assistant (GPG4Win).  The process is essentially the same on Apple machines.  However, you are able to search public keys by email address on Apple machines (on Windows you have to have the Key ID or the public key text/file).​

142
command , shell script ,tool , crontab / cp and history command
« on: เมษายน 19, 2020, 08:52:54 PM »
===copy command with same name and added _bck end of file name
cp events.py{,_bck}
ls
events.py
events.py_bck

history
!789
Run command on line 789 again

143
ในการ transfer file ระหว่าง os window -> os linux หรือ unix
บางทีจะมีพวก อักขระพิเศษต่างๆที่เพิ่มไประหว่างทาง ช่วงที่มีการ scp , wget ก็เกิดขึ้นได้
หลังจากที่ไฟล์ ที่เราต้องการ download วิ่งมาถึง linux , unix แล้ว

ต้องทำการรัน command dos2unix เพื่อลบอักขระพิเศษเหล่านั้นออก เพื่อให้สามารถ execute ได้
ถ้าไม่ทำอาจจะขึ้น ": no file or directory found" or error on line อะไรประมาณนี้ครับ

วิธีการรันก็คือ ถ้าชื่อไฟล์ที่มีการ transfer มาเป็น file.sh
#dos2unix file.sh

เท่านี้เราก็จะสามารถ รัน shell script ได้อย่างไม่มี error เรื่องอักขระพิเศษแล้วครับ

 ;)

144
== check process http on sun solaris
 ps -ef | grep http

==check service on sun solaris
#svcs -a

===find command in sun
find . -name '*keystore*' -print
find . -name '* openssl*' -print
find . -name '* ssl-realm*' -print

===kill process id
kill -9 pid

=== download package via wget
/usr/sfw/bin/wget  http://ip/file

==pkgadd
# pkgadd -d /cdrom/cdrom0/Solaris_10/Product -s /var/spool/pkg SUNWman
https://docs.oracle.com/cd/E26505_01/html/E29492/ewbej.html

145
ในกรณีที่สงสัยว่าเครื่อง window os. โดนของ เราสามารถติดตั้ง tool process-explorer ช่วยในการค้นหา หรือ ช่วยในการ tracking process หาต้นตอปัญหา cpu,ram peak ได้ครับ

https://docs.microsoft.com/th-th/sysinternals/downloads/process-explorer

หรือจะใช้อีกตัวที่เป็น process hacker tool
https://processhacker.sourceforge.io/downloads.php

ลองดูนะครับ

146
วันนี้เจอโจทย์ว่า directadmin ทำการ block port หลังจาก client authentication เสร็จแล้ว  ทำให้ไม่สามารถ list file และ folder ขึ้นมาแสดงได้
จะเป็น port range Passive mode : 35000-35999
ซึ่งระบุใน pure-ftpd.conf
configure file

เราสามารถ ระบุ port range ลงใน csf firewall ได้ดังนี้
#vi /etc/csf/csf.conf

TCP_IN="35000:35999"

systemctl restart pure-ftpd
systemctl restart csf

เท่านี้ user ก็จะสามารถ list file & folder ได้ละครับผม
: )  ;)

147
command , shell script ,tool , crontab / basic command for xargs by golfreeze
« on: เมษายน 05, 2020, 04:15:41 PM »
=== Basic command xargs เป็นการส่งผ่าน command echo เพื่อนำค่านั้นไปรันงานต่อ

=== -t = verbose
echo  "file1 file2 file3" | xargs -t touch
=result
touch file1 file2 file3

=== -p = prompt interactive
echo  "file1 file2 file3" | xargs -p touch
=result
touch file1 file2 file3 ?...y

=== -n show 1 column with touch
echo  "file1 file2 file3" |  xargs -n 1 -t touch
As you can see from the verbose output below, the touch command is executed separately for each argument:
=result
touch file1
touch file2
touch file3

=== -n show number string
echo a b c d e f | xargs -n 3
a b c
d e f

=== read value from file ips.txt
== ips.txt
8.8.8.8
1.1.1.1
xargs -t -L 1 -a ips.txt ping -c 1
=result
ping -c 1 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=50 time=68.1 ms

...
ping -c 1 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=59 time=21.4 ms

===Combine find command and Xargs with Grep command
find . -name '*.c' | xargs grep ‘stdlib.h’

==== Combind find command with rm file with space file name
find . -name "*.c" -print0 | xargs -0 rm -rf


148
ถ้าเครื่องไหนใช้งาน csf (configServer and Firewall) ที่ลงมากับ redhat 8 / Debian 8.x
สามารถเข้าไปปรับ TCP_IN ให้ allow port ที่ต้องการได้ครับ

TCP_IN="sshxxx"

#systemctl restart csf

แล้วทำการเปลี่ยน port ssh ใน /etc/ssh/sshd_config

แล้วทำการ reload ssh 1 รอบ
#systemctl reload sshd

เท่านี้ก็หนีการโจมตี แบบ bruteforce ได้ละครับผม  ;)

149
วิธีการเพิ่ม policy ingress และลบ policy in security group aws-cli
ก่อนอื่นต้องทำการติดตั้ง awscli version 2 ก่อนนะครับ

====CentOS/Redhat8 install awscli2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip”
unzip awscliv2.zip
sudo ./aws/install

#export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
#aws --version

== ทำการ export AWS_PROFILE ก่อนเพื่อให้เรียกใช้งาน aws-cli
== และมีสิทธิ์ในการเข้าถึง ec2 ได้ แต่ต้องผูก role EC2FullAccess เพื่อให้เข้าถึง ec2 security group ได้ด้วยนะครับ
export AWS_PROFILE=default
aws configure list

###check descibe-instances
#aws ec2 describe-instances --output table --region ap-southeast-1

###check instance-attribute and
#aws ec2 describe-instance-attribute --instance-id i-01ec81abpacketlove2 --attribute groupSet

###check authorize-security-group-ingress
#aws ec2 authorize-security-group-ingress help
#aws ec2 authorize-security-group-ingress --group-id sg-0b4d3fpacketlove2 --protocol tcp --port 8000 --cidr $ip/32
aws ec2 authorize-security-group-ingress --group-id sg-0b4d3fpacketlove2 --ip-permissions IpProtocol=tcp,FromPort=8000,ToPort=8000,IpRanges='[{CidrIp=103.246.17.148/32,Description="Allow-from-pkl-nw"}]'

## check command to revoke-security-group-ingress
#aws ec2 revoke-security-group-ingress --group-name MySecurityGroup --protocol tcp --port 22 --cidr 203.0.113.0/24
aws ec2 revoke-security-group-ingress --group-id sg-0b4d3fpacketlove2 --ip-permissions '[{"IpProtocol": "icmp", "FromPort": 3, "ToPort": 4, "IpRanges": [{"CidrIp": "0.0.0.0/0"}]}]'
aws ec2 revoke-security-group-ingress --group-id sg-0b4d3fpacketlove2 --ip-permissions IpProtocol=tcp,FromPort=8000,ToPort=8000,IpRanges='[{CidrIp=103.246.17.148/32,Description="Allow-from-pkl-nw"}]'

## check policy security-group for ingress(inbound)+egress(outbound) rule
aws ec2 describe-security-groups --group-id sg-0b4d3fpacketlove2

150
เช่นถ้ามีโจทย์ว่าต้องการให้สร้าง list domain : *.hosting.pkl.com
ต้องทำการเพิ่ม โดเมนนี้ใน allowed_sub_domains.list ก่อน
/usr/local/directadmin/data/admin/allowed_sub_domains.list

vi allowed_sub_domains.list
ทำการเพิ่ม hosting.pkl.com ลงในไฟล์

chown diradmin:diradmin /usr/local/directadmin/data/admin/allowed_sub_domains.list

แล้วทำการเพิ่ม ลงไปใน directadmin.conf
check_subdomain_owner=1

for this domain, in case you want to use this domain for subdomain hosting (as full domains)

Ensure you chown the file to diradmin:diradmin.


If there is a match (starting from the top domain.com down, to sub.domain.com), then DA will check the subdomain.list file for domain.com (under the true owner, if that's on the box) and if a subdomain already  matches that name, the creation will abort.
The true domain's subdomains have priority if they already exists.

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