2016年10月31日 星期一

電腦 Windows 2008 R2 的 Hyper-V Guest OS 超過4顆vCPU

舊主機上的Guest OS要移轉至新主機,才發現vCPU無法超過4顆。
參考 如何使Windows 2008 R2 Hyper-V中的Guest OS使用超過4顆vCPU 修改。

1.停止【Hyper-V虛擬機器管理】服務

2.到Guest OS的存放目錄下,修改Virtual Machines目錄中的XML檔

找<Processors>區塊中的<count type=”integer”>【CPU數量】</count>

3.啟動【Hyper-V虛擬機器管理】

可是最多只能到24個vCPU。
看來要換到Windows 2012 R2上了。





2016年10月30日 星期日

電腦 Linux 網站壓力測試-Siege-400 error code

使用Siege測試網站出現
HTTP/1.1 400     0.01 secs:     311 bytes ==> GET  /476
無法進行測試。

確認網站不支援gzip
修改

vim /root/.siege/siege.conf

accept-encoding = gzip;deflate

accept-encoding = deflate

即可測試

電腦 Linux 網站壓力測試-Siege


Centos 7 安裝 Siege

yum install zlib zlib-devel libssl-dev openssl-devel

wget http://download.joedog.org/siege/siege-latest.tar.gz

tar -zxvf siege-latest.tar.gz

cd siege-*/

./configure --with-ssl

make && make install

siege -v

Siege使用,可以新建一個url列表的文件,裡面放置相關測試鏈接。

siege -c 20 -r 2 -f www.url
參數說明:
-c 20並發20個用戶
-r 2 重複循環2次
-f www.url任務列表:URL列表

How To Install Siege On Centos 7
相關修改
limit = 255
parser = true

siege -c50 -d3 -t30M -i -f /usr/local/etc/sample_urls
This tells siege to send 50 concurrent users with a random access delay of 1-3 seconds for 30 minutes. -i means randomize url selection and -f tells it to read from the file specified.

Centos Siege測試使用
參數說明


結果說明

2016年10月27日 星期四

Windows IIS 設定檔備份與還原

Windows IIS 設定檔備份與還原

在windows 2008 r2中備份與還原 IIS設定。

在IIS管理員,選取主機中的共用設定。

備份
選取export configuration


Physical patch :指定備份檔路徑
Conect As :指定備份執行帳號
Encryption keys password:備份檔密碼 (密碼長度、複雜性有要求)

如果要還原,選取enable share conf iguration

輸入備份檔路徑、執行帳號、備份檔密碼即可

*如果有使用ssl憑證,請重新binding。

2016年10月26日 星期三

電腦 Dell Server DARC 設定




Press <F2> to enter System Setup Main Menu screen

Select iDRAC Settings from the System Setup Main Menu (F2 > iDRAC Settings).

Use the arrow keys to select Network.

Configure the user defined name,network details for IP, netmask, gateway, and DNS addresses.

After you make the changes to the iDRAC configuration, press the <Esc> key to display the Exit menu.

Select Save Changes and Exit and then press <Enter> to retain your changes.

Enter into the BIOS through iDRAC terminal. The default login credentials are:

Username: root Password: calvin

Configuring iDRAC Settings on Dell PowerEdge R720/Dell PowerEdge R820

電腦 Dell Server DARC 重啟


使用ssh 登入

racadm racreset
重啟idrac

reset System1
整台服務重新啟動

2016年10月23日 星期日

Windows IIS 安全性調整


Windows Registry Editor Version 5.00

#關閉 DES 、NULL、RC2 、RC4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\DES 56/56]
"Enabled"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\NULL]
"Enabled"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 128/128]
"Enabled"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 40/128]
"Enabled"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC2 56/128]
"Enabled"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 40/128]
"Enabled"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 56/128]
"Enabled"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 64/128]
"Enabled"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 128/128]
"Enabled"=dword:00000000

#關閉PCT 1.0
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\PCT 1.0\Server]
"Enabled"=dword:00000000

#關閉SSL v2
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server]
"Enabled"=dword:00000000

#關閉SSL v3
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000000

#啟用TLS 1.1
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001

#啟用TLS 1.2
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001



TLS/SSL Settings

Setup your IIS for SSL Perfect Forward Secrecy and TLS 1.2

如何停用 PCT 1.0、 SSL 2.0、 SSL 3.0 或在網際網路資訊服務中的 TLS 1.0

在 IIS 中停用低強度密碼組合

[IIS] 關閉SSL低強度加密演算法

How to disable SSLv3 and RC4 ciphers in IIS

如何修補網站上SSL的相關漏洞!

Microsoft 資訊安全諮詢:停用 RC4 的更新

How to Enable TLS 1.1, TLS 1.2 on Windows Server 2008 R2 and IIS 7.5

How to Disable SSL 2.0 and SSL 3.0 in IIS 7

沒那麼安全的 SSL – 移除弱 SSL 加密方式 (Cipher)

提到:我看很多台灣人還是在使用 Windows XP ,這些人既使安裝了 XP 能支援到的 IE8,其 TLS 也只支援到 TLS 1.0 的版本,連 TLS 1.1 都不支援,更遑論 TLS 1.2 了。而 Windows 7 上的 IE 則是需要到 IE 11 才支援 TLS 1.2,若你的 Windows 7 上安裝的是 IE 10 ,那也只支援到 TLS 1.1。那表示既使是伺服器已經可以支援到 TLS 1.2 ,瀏覽器沒有支援到位的話,他們之間還是會以較低的加密方式來處理 SSL。所以你說可不可以從伺服器端把 TLS 1.0 禁用?那表示你不打算讓 Windows XP 的 IE 使用者連上來了。

Linux openvas


Setup and Start OpenVAS

免費的弱點偵測工具 OpenVAS

安裝 OpenVAS 8

OpenVAS 續探(一)

大學霸Kali Linux 安全滲透教程

linux kail下安裝openvas


apt-get install openvas
openvas-setup


netstat –antp
openvas-start

openvasmd --user=admin --new-password=<New Password>
https://127.0.0.1:9392
gsad --listen=10.15.0.92
https://10.15.0.92:9392

OpenVAS 的好朋友 "Kali Linux"
kali之openvas安裝啟用
啟用Kali 裡的 OpenVas
Installing OpenVAS on Kali Linux
OpenVAS 8.0 Vulnerability Scanning

2016年10月19日 星期三

Windows SQL Server 最大連接數


微軟在MSDN上對最大連接數的定義是:“默認是0,代表不限制,但最大連接數是32767”。


SQL Server 預設可同時連接的使用者(user connections)數目上限是:32,767
http://sharedderrick.blogspot.tw/2013/03/sql-server-32767.html

亲测SQLServer的最大连接数
http://www.cnblogs.com/wlb/archive/2012/04/08/2437617.html

.NET Connection Pool 與連線相關問題整理
http://huan-lin.blogspot.com/2012/05/net-connection-pool.html

當SQL Server連線數滿且被咬住,踢人大法
http://blog.xuite.net/ron825/enjoy/65772619-%E7%95%B6SQL+Server%E9%80%A3%E7%B7%9A%E6%95%B8%E6%BB%BF%E4%B8%94%E8%A2%AB%E5%92%AC%E4%BD%8F%EF%BC%8C%E8%B8%A2%E4%BA%BA%E5%A4%A7%E6%B3%95

電腦-CentOS 安裝 Docker


CentOS 7 安裝 Docker CE

2022/05/25 更新

作業環境:
CentOS 7.x
Docer CE 2x.x

要在 CentOS 上開始使用 Docker Engine,請確認以下條件,

您需要 CentOS 7, CentOS 8 (stream), or CentOS 9 (stream) 的維護版本。

安裝需要使用 centos-extras repository。此存儲庫默認啟用,但如果您已禁用它,則需要重新啟用。

推薦使用 overlay2 storage driver。


增加Docker Repository及相關套件

安裝yum-utils包(提供yum-config-manager 實用程序), 並增加Docker stable repository。

yum install -y yum-utils

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo


Install Docker CE
裝最新版本的 Docker Engine、containerd 和 Docker Compose

yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

如果提示 GPG 密鑰,請驗證指紋是否匹配 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35。


啟動Docker
systemctl start docker


安裝特定版本的 Docker Engine
如果要安裝特定版本的 Docker Engine,請在 repo 中列出可用版本,然後選擇並安裝:

yum list docker-ce --showduplicates | sort -r

yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-compose-plugin


卸載舊版本
舊版本的 Docker 被稱為docker或docker-engine. 如果安裝了這些,請卸載它們以及相關的依賴項。

移除舊版本
Uninstall old versions
yum remove docker \
           docker-client \
           docker-client-latest \
           docker-common \
           docker-latest \
           docker-latest-logrotate \
           docker-logrotate \
           docker-selinux \
           docker-engine-selinux \
           docker-engine
   

參考資料


2016年10月18日 星期二

Linux 釋放 cache 記憶體


echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:

echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.

2016年10月17日 星期一

Apache-mod_remoteip (2.4)

Nginx  reverse proxy Apache real IP

yum install httpd-devel

mkdir ~/mod_realip2
cd ~/mod_realip2
wget -O mod_realip2.zip https://github.com/discont/mod_realip2/archive/master.zip
unzip mod_realip2.zip
cd mod_realip2-master
apxs -c -i mod_realip2.c
cp ./centos/realip2.conf /etc/httpd/conf.d

/usr/lib64/httpd/modules/mod_realip2.so

cp ./centos/realip2.conf /etc/httpd/conf.d
/etc/httpd/conf.d/realip2.conf
LoadModule realip2_module modules/mod_realip2.so

RealIP On
RealIPProxy 127.0.0.1 xxx.xxx.xxx.xxx
RealIPHeader X-Real-IP


/etc/nginx/nginx.conf
location / {
    proxy_set_header X-Real-IP $remote_addr;
}

https://httpd.apache.org/docs/current/mod/mod_remoteip.html

log 設定

httpd.conf
Change:
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

To:
LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

http://blog.somsip.com/2013/12/apache-2-4-mod_remoteip/


apxs:Error: Command failed with rc=65536

replace remote_ip client_ip -- mod_realip2.c
replace remote_addr client_addr -- mod_realip2.c

apxs -i -c -n mod_realip2.so mod_realip2.c

http://wiki.iphoster.ru/wiki/Apache_-_mod_realip2_%D0%BE%D1%88%D0%B8%D0%B1%D0%BA%D0%B0_has_no_member_named_'remote_addr'_and_'remote_ip'

2016年10月12日 星期三

Linux-NTP Server


Server
vim /etc/ntp.conf

增加國家時間與頻率標準實驗室主機

server tick.stdtime.gov.tw
server tock.stdtime.gov.tw
server clock.stdtime.gov.tw
server watch.stdtime.gov.tw
server time.stdtime.gov.tw
server ntp.ntu.edu.tw



增加log
logfile /var/log/ntpd.log

Server狀況檢查
tail -f /var/log/ntpd.log
ntpstat
ntpq -p

client
 vim /etc/crontab
0 0-23 * * * root (/usr/sbin/ntpdate tock.stdtime.gov.tw && /sbin/hwclock -w) &> /dev/null

修改 /etc/rsyslog.conf ,校正時的 Log

ntp.info /var/log/ntpd.log

新增ntpd.log

touch /var/log/ntpd.log


參考網址:
http://linux.vbird.org/linux_server/0440ntp.php
http://www.geego.com.tw/technical-discussion-forum/tech-tips-centos-ntp-server-%E6%9E%B6%E8%A8%AD%E5%BF%83%E5%BE%97
http://www.stdtime.gov.tw/chinese/bulletin/NTP%20promo.txt

2016年10月5日 星期三

2016年10月4日 星期二

CentOS-Nginx安裝-yum

CentOS-Nginx安裝-yum

vim /etc/yum.repos.d/nginx.repo

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

yum install nginx
systemctl start nginx.service

版本確認
nginx -v

編譯檔確認
nginx -V
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --add-dynamic-module=njs-91543c86f412/nginx --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --with-ld-opt=-Wl,-E

CentOS-安裝EPEL擴充資源庫

CentOS-安裝EPEL擴充資源庫

CentOS 指令

yum install epel-release

or

//CentOS and Red Hat Enterprise Linux 7.x
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh epel-release-latest-7.noarch.rpm


cat /etc/redhat-release //查詢你的Centos版本

Linux-Server-Squid 不暫存特定網站

Squid 不暫存特定網站

1.不綏存特定網站網頁
acl DIRCET url_regex -i ^http://www\.yahoo\.com.*
no_cache deny DIRECT

-i 區分大小寫

2.禁止下載 .exe、.rar、.mp3、.mp4、rm等文件(注意文件!沒有空格便失效)
acl NO urlpath_regex -i \.mp3$ \.mp4$ \.rm$ \.wma$ \.rmvb$ \.avi$
http_access deny NO

電腦-網路-瀏覽器更改暫存資料夾位置之方法

1.Firefox
在網址列輸入 about:config
按右鍵搜尋或新增字串其名稱為 browser.cache.disk.parent_directory
輸入字串 "值" 為 Z:\

2.Google Chrome
關閉所有Chrome
刪除Chrome Cache,其預設位置為:C:\Users\使用者名稱\AppData\Local\Google\Chrome\User Data\Default
建立cache 捷徑
mklink /d "C:\Users\使用者名稱\AppData\Local\Google\Chrome\User Data\Default\Cache\" "Z:\"