永遠のプログラマ☆

高齢者でもプログラマ(4x年)

IPv6 全く社内で使ってないんだが☆

こんにちは。

IT業界で40年。

IPv6 は、Winsock でTCP/IPのコードを書いた程度。

 

社内で使っているサーバーやPC は、IPv4 オンリーな世界。

IPv6 を意識したことはない。

 

国別のIPv6 現状を見てみる。

 

インターネットの現状 - IPv6 の普及状況の可視化 | Akamai JP

 

1位:60.3% インド

2位:56.8% ベルギー

。。。。。

11位:31.4% 日本

 

企業内ではIPv6 、ちっとも進んでいない印象。

IISからエクスポートしたSSL証明書をkeystore(JKS)形式に変更

こんにちは。

Windows IISにインストールしたSSL証明書

java環境で使えるSSL証明書に変換メモ・


JavaでのSSL証明書はkeystore(JKS)という
違った形式のものを使用するため変換が必要。
Windows 環境で作業。

1. opensslコマンドで秘密キーと証明書に分解

openssl pkcs12 -in your.ssl.com.pfx -out your.ssl.com.txt
Enter Import Password: [エクスポート時に指定したパスワードを入力]
Enter PEM pass phrase: [任意のパスワードを入力]
Verifying - Enter PEM pass phrase: [パスワードを再入力]


your.ssl.com.txtファイルをメモ帳で開き
-----BEGIN ENCRYPTED PRIVATE KEY-----
以下を
your.ssl.com.key
として保存。

-----BEGIN CERTIFICATE-----
以下を
your.ssl.com.cer
として保存。


別途、証明書入手先から中間証明書を入手。
・キー (your.ssl.com.key)
・証明書 (your.ssl.com.cer)
・中間証明書 (ca.crt)


your.ssl.com.cerファイルをメモ帳で開き
ca.crt 中間証明書を追加して保存。


2. openssl コマンドでp12形式に変換
openssl pkcs12 -export -in your.ssl.com.cer -inkey your.ssl.com.key -out your.ssl.com.p12


3.JDKのkeytoolコマンドでキーストアファイルを作成

"c:\Program Files\java\jdk1.7.0_03\bin\keytool" -importkeystore -srckeystore your.ssl.com.p12 -srcstoretype PKCS12 -destkeystore your.ssl.com.keystore -deststoretype JKS
出力先キーストアのパスワードを入力してください:yourpass
新規パスワードを再入力してください:yourpass
ソース・キーストアのパスワードを入力してください:yourpass
別名1のエントリのインポートに成功しました。
インポート・コマンドが完了しました: 1件のエントリのインポートが成功しました。


4.keytoolコマンドで証明書表示

"c:\Program Files\java\jdk1.7.0_03\bin\keytool" -list -v -keystore your.ssl.com.keystore
キーストアのパスワードを入力してください:

キーストアのタイプ: JKS
キーストア・プロバイダ: SUN

キーストアには1エントリが含まれます


5. tomcat への設定

server.xml ファイルに
keystoreFile にキーストアファイルパスを設定。


<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" maxHttpHeaderSize="16384" URIEncoding="UTF-8" compressableMimeType="text/html,text/xml,text/plain,text/javascript,application/javascript,text/css" compression="on" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
keystoreFile="/ssl/your.ssl.com.keystore"
keyAlias="1" keystorePass="yourpass" useBodyEncodingForURI="true"
clientAuth="false" sslProtocol="TLS" />

 

 

CentOS7 mysql 5.7.25 root パスワード不明でハマる☆

こんにちは。

久しぶりに、CentOS7.3 で mysql をセットアップ。

root パスワードがわからずハマッた。。。。

 

手順は、こちら。

まずインストール。

1. mariadbの削除

# yum remove mariadb-libs

2. MySQL 公式 yum リポジトリの追加
# yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

3.最新版インストール

MySQL5.7の最新バージョン

# yum --enablerepo=mysql57-community install mysql-community-server

 

4.mysqlサービス起動

# systemctl enable mysqld.service

 

5.  初期パスワードを MySQL のログファイルで探す

/var/log/mysqld.log は、サイズ 0 のまま。

ログインをトライしても同じ。

 

以前は、以下のようなログでパスワードが出てた。。。

2018-05-15T05:33:35.310243Z 1 [Note] A temporary password is generated for root@localhost: #7uYJ/c66:Mw

 

初期パスワードわからん。

パニック。

 

ググったら出てきました。
■パスワードを忘れた場合
# systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

# systemctl start mysqld.service

# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.25 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql> update mysql.user set authentication_string = PASSWORD('MyNewPassword') where user = 'root' and host = 'localhost';
Query OK, 1 row affected, 1 warning (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 1

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye

# systemctl stop mysqld.service

# systemctl unset-environment MYSQLD_OPTS
 

めでたしめでたし。