Focus on RE and DEV.
post @ 2018-10-15

0x000 Intro

最近在玩Abp Zero.

但是发现下载下来的项目都是 MyCompanyName.AbpZeroTemplate.

于是需要一个项目重命名工具

经过一番百度之后,给我推荐了这个工具:

Download: SolutionRenamer.zip

GitHub: https://github.com/stulzq/SolutionRenamer

0x001 Usage

dotnet SolutionRenamer.dll

依次输入

MyCompanyName

AbpZeroTemplate

NewCompanyName

NewProjectName

PathToSolutionFolder

即可完成重命名。

被重命名的有:文件夹名称,以及Config.json中配置好的文件后缀的文件内容。

0x002 Follow Up

准备重写一下这个项目。emmmmmm

阅读此文
post @ 2017-10-27

0x01 系统更新

1
yum update -y

0x02 开启BBR

详见:CENTOS7开启BBR

0x04 安装MariaDB

1
2
3
4
yum -y install mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation

0x03 安装ANT

1
yum install -y wget unzip ant

0x04 安装jboss

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
wget https://blog.kidoplay.com/2017/10/27/Ejbca-On-Centos-7/jboss-eap-6.4.0-installer.jar

java -jar jboss-eap-6.4.0-installer.jar

/root/EAP-6.4.0/bin/standalone.sh

:8080


cd /root/EAP-6.4.0
mkdir -p modules/org/mariadb/main/
cd modules/org/mariadb/main/
wget https://blog.kidoplay.com/2017/10/27/Ejbca-On-Centos-7/mariadb-java-client-2.0.3.jar

wget https://blog.kidoplay.com/2017/10/27/Ejbca-On-Centos-7/mariadb-module.xml -O module.xml


/root/EAP-6.4.0/bin/jboss-cli.sh

connect

#注册驱动
/subsystem=datasources/jdbc-driver=org.mariadb.jdbc.Driver:add(driver-name=org.mariadb.jdbc.Driver,driver-module-name=org.mariadb,driver-xa-datasource-class-name=org.mariadb.jdbc.MySQLDataSource)

#重新加载
:reload

0x5 配置EJBCA

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
wget https://blog.kidoplay.com/2017/10/27/Ejbca-On-Centos-7/ejbca_ce_6_5.0.5.zip

unzip ejbca_ce_6_5.0.5.zip
cd ejbca_ce_6_5.0.5
cd conf

cp database.properties.sample database.properties
vim database.properties

database.name=mysql
database.url=jdbc:mysql://10.1.1.14:3306/ejbca?characterEncoding=UTF-8
database.driver=org.mariadb.jdbc.Driver
database.username=ejbca
database.password=ejbca

cp ejbca.properties.sample ejbca.properties
vim ejbca.properties

appserver.home=/root/EAP-6.4.0
appserver.type=jboss
approval.defaultrequestvalidity=28800
approval.defaultapprovalvalidity=28800
ejbca.passwordlogrounds=8

cp install.properties.sample install.properties
vim install.properties

ca.name=ManagementCA
ca.dn=CN=ManagementCA,O=EnginxNet,C=CN
ca.tokentype=soft
ca.tokenpassword=null
ca.keyspec=4096
ca.keytype=RSA
ca.signaturealgorithm=SHA256WithRSA
ca.validity=3650
ca.policy=null
ca.certificateprofile=ROOTCA

cp web.properties.sample web.properties
vim web.properties

java.trustpassword=changeit #默认即可
superadmin.cn=SuperAdmin #默认即可
superadmin.dn=CN=${superadmin.cn},O=EnginxNet,C=CN
superadmin.password=ejbca #默认即可
superadmin.batch=true
httpsserver.password=serverpwd #默认即可
httpsserver.hostname=ca.ejbca.t.com
httpsserver.dn=CN=${httpsserver.hostname},O=EnginxNet,C=CN
httpserver.pubhttp=8080
httpserver.pubhttps=8442
httpserver.privhttps=8443

0x06 部署EJBCA

1
2
3
4
cd /root/ejbca_ce_6_5.0.5
ant deploy

ant install

0x07 下载证书 并 重启JBOSS

1
2
3
4
5
/root/ejbca_ce_6_5.0.5/p12

https://domain:8443/ejbca/adminweb

nohup /root/EAP-6.4.0/bin/standalone.sh > /dev/null 2>&1 &
阅读此文

0x001 环境初始化

1. 系统更新

1
yum update -y

2. 开启BBR

详见:

3. 安装系统常见工具

1
yum install -y wget bzip2 gcc git

4. 安装MariaDB

1
2
3
4
5
6
7
8
9
10
11
12
yum -y install mariadb mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation

mysql -u root -p

CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'user_pass';
GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'localhost' WITH GRANT OPTION;
CREATE USER 'user_name'@'%' IDENTIFIED BY 'user_pass';
GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

5. 创建redis环境

1
2
3
4
5
6
7
8
9
# 安装EPEL 
yum install -y epel-release
# 安装redis
yum install -y redis
# 修改配置
vim /etc/redis.conf
# daemonize yes
# bind address
service redis restart

6. 安装Python环境 Anaconda

1
2
3
4
5
6
7
wget https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh -O /root/anaconda.sh
chmod +x /root/anaconda.sh
/root/anaconda.sh
# 一路确认

echo PATH=$PATH:/root/anaconda3/bin >> /etc/profile
source /etc/profile

6. 创建PySpider环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
conda create -n spider python=3.*

source activate spider

git clone https://github.com/binux/pyspider
pip install ./pyspider

pip install wsgidav

yum install -y fontconfig
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar xjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local
mv /usr/local/phantomjs-2.1.1-linux-x86_64 /usr/local/phantomjs
ln -s /usr/local/phantomjs/bin/phantomjs /usr/bin

# 配置PySpider配置文件

{
"taskdb": "mysql+taskdb://username:password@host:port/taskdb",
"projectdb": "mysql+projectdb://username:password@host:port/projectdb",
"resultdb": "mysql+resultdb://username:password@host:port/resultdb",
"message_queue": "redis://host:port/db",
"webui": {
"username": "some_name",
"password": "some_passwd",
"need-auth": true
}
}



# 启动"唯一"的调度器实例
nohup pyspider -c config.json scheduler > scheduler.log &

# 启动phantomjs
nohup pyspider -c config.json phantomjs > phantomjs.log &

# 启动 fetcher / processor / result_worker 实例,并根据需要可添加启动多个或在多台主机上启动形成分布式
nohup pyspider -c config.json --phantomjs-proxy="localhost:25555" fetcher > fetcher.log &
nohup pyspider -c config.json processor > processor.log &
nohup pyspider -c config.json result_worker > result_worker.log &

# 启动webui, 如果webui和scheduler没在同一台主机上,需要添加参数 `--scheduler-rpc`来指定scheduler
nohup pyspider -c config.json webui > webui.log &
阅读此文
post @ 2017-10-19

0x001 起由

最近博客迁移,到香港的一台服务器上。
速度还可以,不过会有一点点丢包,就配置了一下谷歌的黑科技 BBR。
效果还是有所提升的。

0x002 SMTC

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 导入ELREPO
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

# 安装最新内核
yum --enablerepo=elrepo-kernel install kernel-ml -y

# 列出所有GRUB支持的内核
cat /boot/grub2/grub.cfg |grep menuentry

# 替换GRUB 默认选项为支持BBR的内核 (4.9+)
grub2-set-default 'CentOS Linux (4.13.6-1.el7.elrepo.x86_64) 7 (Core)'

#重启
reboot

# 输出当前版本号
uname -r

# 添加配置文件内容
echo 'net.core.default_qdisc=fq' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a /etc/sysctl.conf
sysctl -p
sysctl net.ipv4.tcp_available_congestion_control
sysctl -n net.ipv4.tcp_congestion_control

# 检测是否开启 tcp_bbr这个模块
lsmod | grep bbr

0x003 后续

用了这几天,感觉都还算稳定。
不愧是黑科技。。。
阅读此文
⬆︎TOP