This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add account | |
$Password = ConvertTo-SecureString -string "PlaintextPassword" -AsPlainText -Force | |
New-LocalUser "jal" -Password $Password -FullName "jal.tw" -Description "jal.tw" | |
# Add User from csv to group | |
Import-Csv .\Desktop\test.csv | %{ Add-ADGroupMember "GroupName" -members $_.samaccountname } | |
# Export group member to csv (user,email,samaccountname) | |
Get-ADGroupMember -identity "Domain Users" -recursive | select samaccountname | Export-csv -path .\Desktop\test.csv -NoTypeInformation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Backup local to remote | |
rsync -vaHzP -e "ssh -p 11122" etc/ root@remote.server:/home/jal/backup.site/etc | |
#Download remote to local | |
rsync -vaHzp -e "ssh -p 11122" root@remote.server:/home/jal/backup.side/home/jal/ /home/jal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is bundle in curl source code | |
# download scritp from https://github.com/curl/curl/tree/master/lib | |
wget https://raw.githubusercontent.com/curl/curl/master/lib/mk-ca-bundle.pl | |
chmod 700 mk-ca-bundle.pl | |
# Make sure system have perl | |
./mk-ca-bundle.pl | |
# You will get ca-bundle.crt that content all Root CA in pem format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Convert PEM to PKCS12 | |
openssl pkcs12 -export -out jal.tw.pfx -name tomcat -inkey jal.tw.key -in jal.tw.crt -CAfile jal.tw.CA.bundle -caname root | |
2. Import private key and certificate into keystore | |
# "changeit" is the password, you can modify it as your wish and make sure server.xml also too. | |
# keystoreFile="jal.tw.jks" keystorePass="changeit" | |
# deststorepass and destkeypass must be same. | |
# On Tomcat/Coyote don't chanege alias(tomcat), let tomcat can find it correctly. | |
keytool -importkeystore -deststorepass changeit -destkeypass changeit -destkeystore jal.tw.pkcs12.jks -srckeystore jal.tw.pfx -srcstoretype PKCS12 -srcstorepass changeit -alias tomcat -deststoretype PKCS12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Apache process size 1 | |
ps -ylC httpd --sort:rss | awk '{sum+=$8; ++n} END {print "Tot="sum"("n")";print "Avg="sum"/"n"="sum/n/1024"MB"}' | |
Apache process size 2 | |
wget https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py | |
sudo python ps_mem.py | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DATE=`/bin/date +%Y%m%d` | |
TIME=`/bin/date "+%Y-%m-%d %H:%M:%S"` | |
SDIR="/usr/local/etc" | |
DDIR="namedb" | |
BDIR="/home/backup" | |
PASS="IWISHYOUCANTELLME" | |
TITLE="jal.tw dns" | |
EMAIL="jal@jal" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DATE=`/bin/date +%Y%m%d` | |
TIME=`/bin/date "+%Y-%m-%d %H:%M:%S"` | |
DDIR=`/usr/bin/readlink /home/hosts/www/jal.tw/html` | |
SDIR="/home/hosts/www/jal.tw" | |
BDIR="/root/shell/dump" | |
PASS="PleaseTellMe" | |
TITLE="jal.tw" | |
EMAIL="jal@jal" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This document showing how to upgrade some really old version's FreeBSD to latest via Internet. | |
// ================================================ | |
// Part 0: Before you start anything | |
// ================================================ | |
# reboot | |
// Make sure your server's OS and hardware are both fine. | |
// ================================================ | |
// Part 1: Reversion from stable to release version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jal.180308 */ | |
參考資料: https://www.cloudflare.com/dns/dnssec/ecdsa-and-dnssec/ | |
curl -s http://www.internic.net/domain/root.zone | awk '$4 == "DS" { print $6}' | sort -n | uniq -c | |
63 5 (RSA/SHA-1) | |
525 7 (RSASHA1-NSEC3-SHA1) | |
2150 8 (RSA/SHA-256) | |
38 10 (RSA/SHA-512) | |
curl -s http://www.internic.net/domain/root.zone | awk '$4 == "DS" { print $1, $5, $6}' | uniq | awk '{print $3}' | sort | uniq -c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Suite for nginx, apache2.4, dovecot, postfix | |
Tips: | |
Understand Cipher String Format | |
https://msdn.microsoft.com/en-us/library/windows/desktop/aa374757%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 | |
ALL:!DH:!kRSA:!SRP:!kDHd:!DSS:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@STRENGTH | |
Apache 2.4 |
NewerOlder