Thứ Năm, 24 tháng 6, 2021

Hướng dẫn kích hoạt bản quyền Windows 10 qua máy chủ KMS

 

Hướng dẫn kích hoạt bản quyền Windows 10 qua máy chủ KMS

– Khi cài mới tức bạn sử dụng file ISO và định dạng hoàn toàn phân vùng ổ đĩa cài Windows của mình. Lúc đó mọi thứ sẽ trở về nguyên thủy

– Ở đây chúng ta sẽ lấy bản quyền qua máy chủ KMS

– Mở cmd quyền Admin lên, bằng cách đơn giản nhất là bấm phím Windows + X, bấm A (hoặc chuột phải vào Start, chọn Command Prompt (Admin))

– Sử dụng các lệnh này theo thứ tự từ trên xuống, từng lệnh rồi enter nhé:

slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX
slmgr/skms kms.digiboy.ir
slmgr /ato

Trường hợp bạn sử dụng máy chủ trên bị lỗi thì thay bằng một máy chủ bên dưới này nhé (Mình sẽ cập nhật liên tục):

active.orientsoftware.asia

                 kms8.msguides.com

Danh Sách Key Windows cho các phiên bản:

Then enter DISM /online /Set-Edition:ServerStandard /ProductKey:ENTER-YOUR-SERIAL-FROM-TABLE /AcceptEula (use key from below table if this is a MAK/Volume license key)

Windows Server 2019
Product GVLK
Windows Server 2019 Datacenter WMDGN-G9PQG-XVVXX-R3X43-63DFG
Windows Server 2019 Standard N69G4-B89J2-4G8F4-WWYCC-J464C
Windows Server 2019 Essentials WVDHN-86M7X-466P6-VHXV7-YY726
Windows Server 2019 Azure Core FDNH6-VW9RW-BXPJ7-4XTYG-239TB
Windows Server 2019 Datacenter Semi-Annual Channel (v.1809) 6NMRW-2C8FM-D24W7-TQWMY-CWH2D
Windows Server 2019 Standard Semi-Annual Channel (v.1809) N2KJX-J94YW-TQVFB-DG9YT-724CC
Windows Server 2019 ARM64 GRFBW-QNDC4-6QBHG-CCK3B-2PR88
Windows Server 2016
Product GVLK
Windows Server 2016 Standard Semi-Annual Channel (v.1803) PTXN8-JFHJM-4WC78-MPCBR-9W4KR
Windows Server 2016 Datacenter Semi-Annual Channel (v.1803) 2HXDN-KRXHB-GPYC7-YCKFJ-7FVDG
Windows Server 2016 Datacenter Semi-Annual Channel (v.1709) 6Y6KB-N82V8-D8CQV-23MJW-BWTG6
Windows Server 2016 Standard Semi-Annual Channel (v.1709) DPCNP-XQFKJ-BJF7R-FRC8D-GF6G4
Windows Server 2016 ARM64 K9FYF-G6NCK-73M32-XMVPY-F9DRR
Windows Server 2016 Datacenter CB7KF-BWN84-R7R2Y-793K2-8XDDG
Windows Server 2016 Standard WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY
Windows Server 2016 Essentials JCKRF-N37P4-C2D82-9YXRT-4M63B
Windows Server 2016 Cloud Storage QN4C6-GBJD2-FB422-GHWJK-GJG2R
Windows Server 2016 Azure Core VP34G-4NPPG-79JTQ-864T4-R3MQX
WNCYY-GFBH2-M4WTT-XQ2FP-PG2K9

Windows Server 2019

Operating system editionKMS Client Setup Key
Windows Server 2019 DatacenterWMDGN-G9PQG-XVVXX-R3X43-63DFG
Windows Server 2019 StandardN69G4-B89J2-4G8F4-WWYCC-J464C
Windows Server 2019 EssentialsWVDHN-86M7X-466P6-VHXV7-YY726

Windows Server 2016

Operating system editionKMS Client Setup Key
Windows Server 2016 DatacenterCB7KF-BWN84-R7R2Y-793K2-8XDDG
Windows Server 2016 StandardWC2BQ-8NRM3-FDDYY-2BFGV-KHKQY
Windows Server 2016 EssentialsJCKRF-N37P4-C2D82-9YXRT-4M63B

Windows 10

Operating system editionKMS Client Setup Key
Windows 10 ProW269N-WFGWX-YVC9B-4J6C9-T83GX
Windows 10 Pro NMH37W-N47XK-V7XM9-C7227-GCQG9
Windows 10 Pro WorkstationsNRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J
Windows 10 Pro Workstations N9FNHH-K3HBT-3W4TD-6383H-6XYWF
Windows 10 Pro Education6TP4R-GNPTD-KYYHQ-7B7DP-J447Y
Windows 10 Pro Education NYVWGF-BXNMC-HTQYQ-CPQ99-66QFC
Windows 10 EducationNW6C2-QMPVW-D7KKK-3GKT6-VCFB2
Windows 10 Education N2WH4N-8QGBV-H22JP-CT43Q-MDWWJ
Windows 10 EnterpriseNPPR9-FWDCX-D2C8J-H872K-2YT43
Windows 10 Enterprise NDPH2V-TTNVB-4X9Q3-TJR4H-KHJW4
Windows 10 Enterprise GYYVX9-NTFWV-6MDM3-9PT4T-4M68B
Windows 10 Enterprise G N44RPN-FTY23-9VTTB-MP9BX-T84FV

Windows Server 2012 R2

Operating system editionKMS Client Setup Key
Windows Server 2012 R2 Server StandardD2N9P-3P6X9-2R39C-7RTCD-MDVJX
Windows Server 2012 R2 DatacenterW3GGN-FT8W3-Y4M27-J84CP-Q3VJ9
Windows Server 2012 R2 EssentialsKNC87-3J2TX-XB4WP-VCPJV-M4FWM

Windows 8.1

Operating system editionKMS Client Setup Key
Windows 8.1 ProGCRJD-8NW9H-F2CDX-CCM8D-9D6T9
Windows 8.1 Pro NHMCNV-VVBFX-7HMBH-CTY9B-B4FXY
Windows 8.1 EnterpriseMHF9N-XY6XB-WVXMC-BTDCT-MKKG7
Windows 8.1 Enterprise NTT4HM-HN7YT-62K67-RGRQJ-JFFXW

Windows 7

Operating system editionKMS Client Setup Key
Windows 7 ProfessionalFJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
Windows 7 Professional NMRPKT-YTG23-K7D7T-X2JMM-QY7MG
Windows 7 Professional EW82YF-2Q76Y-63HXB-FGJG9-GF7QX
Windows 7 Enterprise33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
Windows 7 Enterprise NYDRBP-3D83W-TY26F-D46B2-XCKRJ
Windows 7 Enterprise EC29WB-22CC8-VJ326-GHFJW-H9DH4
Read More

Thứ Ba, 15 tháng 6, 2021

How to change Priority and Weight values for SRV record on the Plesk server

 

Question

How to change "Priority" and "Weight" values for SRV record on the Plesk server?

Answer

Currently changing "Priority" and "Weight" values can be done via Command Line Interface (CLI) only.

In the example below described how to set the Priority to 100 and Weight to 1 for SRV record, change the command as per your needs.

  1. Connect to the server via SSH or RDP.

  2. Execute the following command:

    Note: For Plesk for Windows open cmd.exe as Administrator.

    plesk bin dns --add example.com -srv "" -srv-service sip -srv-target-host myserver.domain.tld. -srv-protocol tls -srv-port 5060 -srv-priority 100 -srv-weight 1

Read More

Nginx “Too many open files” Error Solution for Centos

Two ways to raise the nofile/max open files/file descriptors/file handles limit for Nginx in Centos 7. With Nginx running, checking current limit on master process

cat /proc/$(cat /var/run/nginx.pid)/limits|grep open.files

Max open files            1024                 4096                 files

And worker processes

ps --ppid $(cat /var/run/nginx.pid) -o %p|sed '1d'|xargs -I{} cat /proc/{}/limits|grep open.files

Max open files            1024                 4096                 files     
Max open files            1024                 4096                 files 

Trying with the worker_rlimit_nofile directive in /etc/nginx/nginx.conf fails as SELinux policy doesn't allow setrlimit. This is shown in /var/log/nginx/error.log

015/07/24 12:46:40 [alert] 12066#0: setrlimit(RLIMIT_NOFILE, 2342) failed (13: Permission denied)

And in /var/log/audit/audit.log

type=AVC msg=audit(1437731200.211:366): avc:  denied  { setrlimit } for  pid=12066 comm="nginx" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process

Raise the limit by extending nginx.service configuration.

This will set fd limits for both, master and worker processes. Remove the worker_rlimit_nofile from /etc/nginx/nginx.conf and create a directory for nginx.service configuration

mkdir /etc/systemd/system/nginx.service.d

Add following to /etc/systemd/system/nginx.service.d/nofile_limit.conf

[Service]
LimitNOFILE=7777

Reload systemd daemon configuration and restart nginx

systemctl daemon-reload
systemctl restart nginx.service

Or set SELinux boolean httpd_setrlimit to true

This will set fd limits for the worker processes. Leave the worker_rlimit_nofile directive in /etc/nginx/nginx.conf and run the following as root

setsebool -P httpd_setrlimit 1

Wrong ways suggested by someone somewhere

  • Adding LimitNOFILE to /usr/lib/systemd/system/nginx.service, instead you can extend or override it. RHEL 7 - Documentation
  • Editing /etc/security/limits.d/30-nginx.conf or similar. It has no effect as /etc/security/limits.conf only sets limits for users logged in via PAM.
Read More

Nginx “Too many open files” Error Solution for Ubuntu

 If you run an Nginx server, you may come across an issue where you’ve reached the limit of how many files Nginx can have open. System wide resources are controlled by ulimit. You can check the current limits on a process with cat proc/pid/limits where pid is the pid of the process you want to view limits on. We can change the maximum number of file descriptors a process can create by modifying the /etc/sysctl.conf file and adding the fs.file-max setting. Set fs.file-max=50000 to allow processes to create 50000 file descriptors.

We next need to set the Nginx limits by modifying/etc/security/limits.conf and adding a ‘sort’ and ‘hard’ limit. The soft limit may be changed later by the process running with these limits up to the hard limit value. Hard limit can only be lowered though and cannot be increased by the process itself. We can set these by adding two lines nginx soft nofile 10000 and nginx hard nofile 30000 . We can then run sysctl -p to verify our change.

Finally, we need to change some Nginx settings. Open up your /etx/nginx/nginx/conffile and add the worker_rlimit_nofile directive. This changes the limit on the maximum number of open files. This number is usually the product of your worker_connections and worker_processes directive settings. You can only really adjust worker_connections since worker_processes is based off the number of CPUs you have available.

Once this is all set, we need to completely shut down the Nginx server. Using kill pid is probably your best bet to make sure Nginx restarts as runningnginx -s reload will not reload the master process. You can read about CentOS solutions here.

Read More

Tuning Nginx

 For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

First, you will need to install nginx

yum install nginx
apt install nginx

Backup your original configs and you can start reconfigure your configs. You will need to open your nginx.conf at /etc/nginx/nginx.conf with your favorite editor.

# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
worker_processes auto; #some last versions calculate it automatically

# number of file descriptors used for nginx
# the limit for the maximum FDs on the server is usually set by the OS.
# if you don't set FD's then OS settings will be used which is by default 2000
worker_rlimit_nofile 100000;

# only log critical errors
error_log /var/log/nginx/error.log crit;

# provides the configuration file context in which the directives that affect connection processing are specified.
events {
    # determines how much clients will be served per worker
    # max clients = worker_connections * worker_processes
    # max clients is also limited by the number of socket connections available on the system (~64k)
    worker_connections 4000;

    # optimized to serve many clients with each thread, essential for linux -- for testing environment
    use epoll;

    # accept as many connections as possible, may flood worker connections if set too low -- for testing environment
    multi_accept on;
}

http {
    # cache informations about FDs, frequently accessed files
    # can boost performance, but you need to test those values
    open_file_cache max=200000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;

    # to boost I/O on HDD we can disable access logs
    access_log off;

    # copies data between one FD and other from within the kernel
    # faster than read() + write()
    sendfile on;

    # send headers in one piece, it is better than sending them one by one
    tcp_nopush on;

    # don't buffer data sent, good for small data bursts in real time
    tcp_nodelay on;

    # reduce the data that needs to be sent over network -- for testing environment
    gzip on;
    # gzip_static on;
    gzip_min_length 10240;
    gzip_comp_level 1;
    gzip_vary on;
    gzip_disable msie6;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types
        # text/html is always compressed by HttpGzipModule
        text/css
        text/javascript
        text/xml
        text/plain
        text/x-component
        application/javascript
        application/x-javascript
        application/json
        application/xml
        application/rss+xml
        application/atom+xml
        font/truetype
        font/opentype
        application/vnd.ms-fontobject
        image/svg+xml;

    # allow the server to close connection on non responding client, this will free up memory
    reset_timedout_connection on;

    # request timed out -- default 60
    client_body_timeout 10;

    # if client stop responding, free up memory -- default 60
    send_timeout 2;

    # server will close connection after this time -- default 75
    keepalive_timeout 30;

    # number of requests client can make over keep-alive -- for testing environment
    keepalive_requests 100000;
}

Now you can save config and run bottom command

nginx -s reload
/etc/init.d/nginx start|restart

If you wish to test config first you can run

nginx -t
/etc/init.d/nginx configtest

Just For Security Reason

server_tokens off;

NGINX Simple DDoS Defense

This is far away from secure DDoS defense but can slow down some small DDoS. Those configs are also in test environment and you should do your values.

# limit the number of connections per single IP
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;

# limit the number of requests for a given session
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=5r/s;

# zone which we want to limit by upper values, we want limit whole server
server {
    limit_conn conn_limit_per_ip 10;
    limit_req zone=req_limit_per_ip burst=10 nodelay;
}

# if the request body size is more than the buffer size, then the entire (or partial)
# request body is written into a temporary file
client_body_buffer_size  128k;

# buffer size for reading client request header -- for testing environment
client_header_buffer_size 3m;

# maximum number and size of buffers for large headers to read from client request
large_client_header_buffers 4 256k;

# read timeout for the request body from client -- for testing environment
client_body_timeout   3m;

# how long to wait for the client to send a request header -- for testing environment
client_header_timeout 3m;

Now you can do again test config

nginx -t # /etc/init.d/nginx configtest

And then reload or restart your nginx

nginx -s reload
/etc/init.d/nginx reload|restart

You can test this configuration with tsung and when you are satisfied with result you can hit Ctrl+C because it can run for hours.

Increase The Maximum Number Of Open Files (nofile limit) – Linux

Two ways to raise the nofile/max open files/file descriptors/file handles limit for NGINX in RHEL/CentOS 7+. With NGINX running, checking current limit on master process

$ cat /proc/$(cat /var/run/nginx.pid)/limits | grep open.files
Max open files            1024                 4096                 files

And worker processes

ps --ppid $(cat /var/run/nginx.pid) -o %p|sed '1d'|xargs -I{} cat /proc/{}/limits|grep open.files

Max open files            1024                 4096                 files
Max open files            1024                 4096                 files

Trying with the worker_rlimit_nofile directive in {,/usr/local}/etc/nginx/nginx.conf fails as SELinux policy doesn’t allow setrlimit. This is shown in /var/log/nginx/error.log

015/07/24 12:46:40 [alert] 12066#0: setrlimit(RLIMIT_NOFILE, 2342) failed (13: Permission denied)

And in /var/log/audit/audit.log

type=AVC msg=audit(1437731200.211:366): avc:  denied  { setrlimit } for  pid=12066 comm="nginx" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process

nolimit without Systemd

# /etc/security/limits.conf
# /etc/default/nginx (ULIMIT)
$ nano /etc/security/limits.d/nginx.conf
nginx   soft    nofile  65536
nginx   hard    nofile  65536
$ sysctl -p

nolimit with Systemd

$ mkdir -p /etc/systemd/system/nginx.service.d
$ nano /etc/systemd/system/nginx.service.d/nginx.conf
[Service]
LimitNOFILE=30000
$ systemctl daemon-reload
$ systemctl restart nginx.service

SELinux boolean httpd_setrlimit to true(1)

This will set fd limits for the worker processes. Leave the worker_rlimit_nofile directive in {,/usr/local}/etc/nginx/nginx.conf and run the following as root

setsebool -P httpd_setrlimit 1

DoS HTTP/1.1 and above: Range Requests

By default max_ranges is not limited. DoS attacks can many Range-Requests (Impact on stability I/O).

Socket Sharding in NGINX 1.9.1+ (DragonFly BSD and Linux 3.9+)

Socket typeLatency (ms)Latency stdev (ms)CPU Load
Default15.6526.590.3
accept_mutex off15.5926.4810
reuseport12.353.150.3

Thread Pools in NGINX Boost Performance 9x! (Linux)

Multi-threaded sending of files is currently supported only Linux. Without sendfile_max_chunk limit, one fast connection may seize the worker process entirely.

Selecting an upstream based on SSL protocol version

map $ssl_preread_protocol $upstream {
    ""        ssh.example.com:22;
    "TLSv1.2" new.example.com:443;
    default   tls.example.com:443;
}

# ssh and https on the same port
server {
    listen      192.168.0.1:443;
    proxy_pass  $upstream;
    ssl_preread on;
}
Read More