プログラミングとかLinuxとかの備忘録

プログラミング、Linuxでハマった箇所や環境構築のメモ

Debian Stretchインストール後の設定メモ

リポジトリの設定

リポジトリのリストからcdromを削除する。
sudoが使えないのでsuしてから作業する。

$ su

# sed -i -e 's/^deb cdrom/# deb cdrom/' /etc/apt/sources.list

一応アップデートしておく

# apt update
# apt -y upgrade

sudoの有効化

sudoのコマンドのインストール

$ su
# apt -y install sudo 

ユーザをsudoグループに追加し、sudoできるようにする。

# gpasswd -a ユーザ名 sudo

ログインし直すとsudoできるようになる。

IPの固定

staticに変更し、IPアドレス等を追加。

$ sudo vim /etc/network/interfaces
#iface eth0 inet dhcp
iface eth0 inet static
address         192.168.1.5
network         192.168.1.0
netmask         255.255.255.0
broadcast       192.168.1.255
gateway         192.168.1.1
dns-nameservers 192.168.1.1

$ sudo ifdown eth0 && sudo ifup eth0

Ubuntu18.04でソフトウェアRAIDを組む

Ubuntu18.04でmdadmソフトウェアRAIDを組んでデータストレージとして使う

構成

ディスクの確認

/dev/sdc~/dev/sdfまでのHDD4本でRAID10を作る。

$ sudo parted -l | grep /dev/sd
Disk /dev/sda: 2000GB
Disk /dev/sdb: 240GB
Disk /dev/sdc: 1000GB
Disk /dev/sdd: 1000GB
Disk /dev/sde: 1000GB
Disk /dev/sdf: 1000GB

ファイルシステムの作成

まずHDD4本に対してpartedでパーティションを作成する。
(参考: LinuxでHDDのパーティションテーブル作成とフォーマット方法
また、RAIDのフラグをオンにする。

$ sudo parted /dev/sdc
(parted) mklabel gpt Y
(parted) mkpart ext4 0% 100%
(parted) set 1 raid on

次に、ファイルシステムを作成する

$ sudo mkfs -t ext4 /dev/sdc1

これを/dev/sdc~/dev/sdfの4本に対して実行。

RAIDアレイの構築

下記コマンドで、RAID10を4本のHDDで構築できる。
ファイルシステムを作成していないとそのHDDが出力に出力されない

$ sudo mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/sd[cdef]1
mdadm: /dev/sdc1 appears to contain an ext2fs file system
       size=976760832K  mtime=Thu Jan  1 00:00:00 1970
mdadm: /dev/sdd1 appears to contain an ext2fs file system
       size=976760832K  mtime=Tue Feb 26 06:19:05 2019
mdadm: /dev/sde1 appears to contain an ext2fs file system
       size=976760832K  mtime=Thu Jan  1 00:00:00 1970
mdadm: /dev/sdf1 appears to contain an ext2fs file system
       size=976760832K  mtime=Thu Jan  1 00:00:00 1970
Continue creating array? (y/n) y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

構築経過は下のコマンドで確認できる。3時間ちょっとかかりそう。

$ cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid10 sdf1[3] sde1[2] sdd1[1] sdc1[0]
      1953257472 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]
      [>....................]  resync =  0.3% (5872256/1953257472) finish=197.5min speed=164280K/sec
      bitmap: 15/15 pages [60KB], 65536KB chunk

unused devices: <none>

mdadmを設定する

$ sudo bash -c  'mdadm -Es | grep md/0 >> /etc/mdadm/mdadm.conf'

RAIDアレイの初期化

RAIDアレイを確認する

$ sudo parted -l
Error: /dev/md0: unrecognised disk label
Model: Linux Software RAID Array (md)
Disk /dev/md0: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags:

パーティションを作成(不要?)

$ sudo parted /dev/md0
(parted) mklabel gpt
(parted) mkpart ext4 0% 100%
(parted) quit

フォーマット

$ sudo mkfs -t ext4 /dev/md0
mke2fs 1.44.1 (24-Mar-2018)
Found a gpt partition table in /dev/md0
Proceed anyway? (y,N) y
Creating filesystem with 488314368 4k blocks and 122085376 inodes
Filesystem UUID: ac9462a0-e789-475e-86a6-55e4abb4ffc6
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000, 214990848

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

マウント(テスト)

$ sudo mount /dev/md0 /mnt

自動マウント

UUIDを確認

$ sudo blkid | grep /dev/md0
/dev/md0: UUID="ac9462a0-e789-475e-86a6-55e4abb4ffc6" TYPE="ext4"

/etc/fstabを編集

$ sudo vim /etc/fstab
UUID=ac9462a0-e789-475e-86a6-55e4abb4ffc6   /mnt    ext4    defaults,noatime    0 0

LinuxでUUIDでHDDをマウントする

UbuntuCentOS上でのUUID確認と/etc/fstabでの自動マウント方法

UUIDの確認

CentOS7でもUbuntu18.04でも、blkidの出力をgrepすればUUIDを確認できる。

$ sudo blkid | grep /dev/sdd1

CentOSの場合はUUID="..."の部分が必要

$ sudo blkid | grep /dev/sda1
/dev/sda1: UUID="eda3624c-15a5-4871-931e-5fbcaedcdfac" TYPE="ext4"

Ubuntuの場合はPARTUUID="..."の部分が必要

$ sudo blkid | grep /dev/sdd1
/dev/sdd1: PARTLABEL="ext4" PARTUUID="dd120623-d167-43d5-a372-ba77b4b4f15c"

コマンドでマウントする

UUID="..."PARTUUID="..."の部分をそのまま使用して

$ sudo mount -t ext4 UUID="..." /mnt

とか

$ sudo mount -t ext4 PARTUUID="..." /mnt

でマウントできる

自動マウント

自動マウントする場合は/etc/fstabにUUID="..."PARTUUID="..."の部分をそのまま使って書く。

$ sudo vim /etc/fstab
UUID="..."     /mnt/hdd    ext4    defaults    0 0
PARTUUID="..." /mnt/hdd    ext4    defaults    0 0

Ubuntu18.04でnvidia-dockerを動かす

Ubuntu16.04でnvidia-dockerを動かすのUbuntu18.04版。

構成

初期設定

インストール時に
- IPの固定 - SSHサーバの自動起動 は設定済みなのでアップデートのみ行う。

$ sudo apt update
$ sudo apt -y upgrade

CUDA

確認

以下のコマンドで,何も出てこないことを確認する

$ sudo dpkg -l | grep nvidia
$ sudo dpkg -l | grep cuda

Nvidiaドライバのインストール

リポジトリ(Proprietary GPU Drivers : “Graphics Drivers” team)
を登録して,ドライバをインストールする
途中で,secure bootを無効にするかを聞かれたが,無効にせずに続行した

$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt update

$ sudo apt search nvidia | egrep '^nvidia-[0-9]+/'
nvidia-304/bionic 304.137-0ubuntu2 amd64
nvidia-331/bionic-updates 340.107-0ubuntu0.18.04.2 amd64
nvidia-340/bionic-updates 340.107-0ubuntu0.18.04.2 amd64
nvidia-346/bionic 352.63-0ubuntu3 amd64
nvidia-352/bionic 361.45.11-0ubuntu4 amd64
nvidia-361/bionic 367.57-0ubuntu5 amd64
nvidia-367/bionic 375.82-0ubuntu3 amd64
nvidia-375/bionic 384.111-0ubuntu1 amd64
nvidia-384/bionic 390.87-0ubuntu0~gpu18.04.2 amd64
nvidia-387/bionic 390.87-0ubuntu0~gpu18.04.2 amd64
nvidia-390/bionic 390.87-0ubuntu0~gpu18.04.2 amd64

$ sudo apt -y install nvidia-390

再起動し,GPUが認識されているかを確認

$ sudo reboot

$ nvidia-smi
Fri Feb 22 04:36:58 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.87                 Driver Version: 390.87                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:41:00.0 Off |                  N/A |
|  0%   38C    P5    27W / 250W |      0MiB / 11156MiB |      3%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

dockerのインストール

docker-engine, docker-ce, docker-eeのいずれかのパッケージが依存関係として必要なので、Ubuntu公式リポジトリdocker.ioではnvidia-dockerを実行できない。
Get Docker CE for Ubuntu | Docker Documentation の通りにインストールする

$ sudo apt -y remove docker docker-engine docker.io containerd runc

$ sudo apt -y install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt update

$ sudo apt -y install docker-ce docker-ce-cli containerd.io
$ sudo gpasswd -a <ユーザ名> docker

$ sudo systemctl start docker
$ sudo systemctl enable docker

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

nvidia-dockerのインストール

GitHub - NVIDIA/nvidia-docker: Build and run Docker containers leveraging NVIDIA GPUsの通りにインストールする

$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
$ curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu18.04/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
$ sudo apt update

$ sudo apt -y install nvidia-docker2
$ sudo pkill -SIGHUP dockerd

テスト

$ docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
Fri Feb 22 04:42:24 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.87                 Driver Version: 390.87                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:41:00.0 Off |                  N/A |
|  0%   37C    P5    34W / 250W |      0MiB / 11156MiB |      3%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Ubuntuで不要になったリポジトリを削除する

sudo apt updateするといろいろとエラーが出るようになったので、使っていないnvidia-dockerのリポジトリを削除する。
ついでに、Nvidiaのグラフィックドライバのリポジトリも削除する

nvidia-dockerの削除

まずnvidia-docker2自体を削除する

$ sudo apt remove --purge nvidia-docker2
$ sudo apt -y autoremove

リポジトリリストを削除する

$ cd /etc/apt/sources.list.d
$ ls 
graphics-drivers-ubuntu-ppa-xenial.list       nvidia-docker.list
graphics-drivers-ubuntu-ppa-xenial.list.save  nvidia-docker.list.save

$ sudo rm nvidia-docker.list nvidia-docker.list.save

GPGキーを削除する

$ sudo apt-key list
/etc/apt/trusted.gpg
--------------------
...
pub   4096R/F796ECB0 2017-09-28
uid                  NVIDIA CORPORATION (Open Source Projects) <cudatools@nvidia.com>
...

$ sudo apt-key del F796ECB0
OK

これでapt-key listNvidiaのキーが表示されなくなる

updateしてみてもエラーが出なくなるはず

$ sudo apt update
Hit:1 http://jp.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://jp.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]                            
Get:3 http://jp.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]                                                
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]                                                   
Hit:5 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu xenial InRelease       
Get:6 https://download.docker.com/linux/ubuntu xenial InRelease [66.2 kB]         
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [67.9 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [67.1 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [116 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [173 kB]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Fetched 818 kB in 2s (312 kB/s)     
Reading package lists... Done
Building dependency tree       
Reading state information... Done

graphics-driversの削除

追加時にコマンド

$ sudo add-apt-repository ppa:graphics-drivers/ppa

でppaを使って追加したので

$ sudo add-apt-repository --remove ppa:graphics-drivers/ppa

だけで削除できる。

updateしてもちゃんと消えている

$ sudo apt update
Hit:1 http://jp.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://jp.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]                           
Get:3 http://jp.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]                                   
Hit:4 https://download.docker.com/linux/ubuntu xenial InRelease                                                  
Hit:5 http://security.ubuntu.com/ubuntu xenial-security InRelease                                                
Fetched 216 kB in 0s (274 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done

OpenVPNの"No server certificate verification method has been enabled"を解決する

DockerでOpenVPNサーバを動かす で構築したOpenVPNサーバに接続する時に接続はできるが下の警告が出るので、出ないように設定したい。

警告内容

WARNING: No server certificate verification method has been enabled.
See http://openvpn.net/howto.html#mitm for more info.

解決方法

メッセージに出ていたURLのページ(2x HOW TO | OpenVPN)を見てみる

  • remote-cert-tls server
    • OpenVPN 2.0以下の場合はこの設定をクライアントファイルに追加する?
  • ns-cert-type server
    • それ以外のバージョン?ではこの設定をクライアントファイルに追加する?

特にサーバ側の設定は必要なさそう。

ns-cert-type server

OpenVPNサーバのバージョンが2.4.6なのでこっちを試してみる。

クライアントの*.ovpnファイルの適当な位置にns-cert-type serverを追加

client
dev tun
proto udp
ns-cert-type server
...省略

接続してみると

WARNING: -ns-cert-type is DEPRECATED. Use --remote-cert-tls instead.

が表示されて接続できなくなった。

remote-cert-tls server

*.ovpnファイルの

ns-cert-type server

remote-cert-tls server

に書き換えて接続すると警告がなくなって接続できるようになった。

DockerでOpenVPNサーバを動かす

ホスト環境

$ cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

$ docker --version
Docker version 1.13.1, build 8633870/1.13.1
$ docker-compose --version
docker-compose version 1.18.0, build 8dd22a9

Dockerfile

公式のalpine3.9のイメージにopenvpnとeasyrsaをインストールするぐらい

FROM alpine:3.9

RUN apk --update --no-cache --no-progress add \
        openvpn \
        easy-rsa \
        && \
    rm -rf /var/cache/apk/*

COPY run.sh /
CMD [ "/run.sh" ]

サービス起動用のスクリプトrun.shを作成

下記のスクリプトrun.shとして作成する。
--push "route 192.168.1.0 255.255.255.0"OpenVPNサーバのネットワークに応じて変更する。

#!/bin/sh

# ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)が出ないようにするため
mkdir -p /dev/net
if [ ! -c /dev/net/tun ]; then
    mknod /dev/net/tun c 10 200
fi

# クライアント用のネットワーク
OVPN_SERVER=${OVPN_SERVER:-10.8.0.0}

# `ip addr`コマンドの結果からネットワークデバイス名を抽出する
OVPN_NATDEVICE=$(ip addr | awk 'match($0, /global [[:alnum:]]+/) {print substr($0, RSTART+7, RLENGTH)}')
if [ -z "${OVPN_NATDEVICE}" ]; then
    ip addr
    echo "Failed to extract OVPN_NATDEVICE."
    exit 1
fi

# iptablesの設定
iptables -t nat -C POSTROUTING -s ${OVPN_SERVER}/24 -o ${OVPN_NATDEVICE} -j MASQUERADE || {
    iptables -t nat -A POSTROUTING -s ${OVPN_SERVER}/24 -o ${OVPN_NATDEVICE} -j MASQUERADE
}

# OpenVPNサーバの起動
/usr/sbin/openvpn \
    --cd ${OVPN_DIR:-/etc/openvpn} \
    \
    --port  ${OVPN_PORT:-1194} \
    --proto ${OVPN_PROTO:-udp4} \
    --dev   ${OVPN_DEV:-tun} \
    \
    --ca    ${OVPN_CA:-"/opt/easy-rsa/pki/ca.crt"} \
    --cert  ${OVPN_CERT:-"/opt/easy-rsa/pki/issued/server.crt"} \
    --key   ${OVPN_KEY:-"/opt/easy-rsa/pki/private/server.key"} \
    --dh    ${OVPN_DH:-"/opt/easy-rsa/pki/dh.pem"} \
    --tls-auth /opt/easy-rsa/pki/ta.key 0 \
    \
    --server ${OVPN_SERVER} ${OVPN_SERVER_MASK:-255.255.255.0} \
    --ifconfig-pool-persist ipp.txt \
    --push "redirect-gateway def1" \
    --push "route ${OVPN_SERVER} 255.255.0.0" \
    --push "route 192.168.1.0 255.255.255.0" \
    --push "dhcp-option DNS 8.8.8.8" \
    \
    --keepalive 10 120 \
    --user nobody \
    --group nobody \
    --persist-key \
    --persist-tun \
    \
    --status openvpn-status.log \
    --verb ${OVPN_VERB:-3} \
    \
    --compress lz4 \
    --tun-mtu 1500 \
    --mssfix 1460

docker-compose.ymlの作成

  • WANには1194番ポートはさらさずに54321番ポートでアクセスするようにする
    • WAN → ルータ54321 → Dockerホスト54321 → Dockerコンテナ1194
  • ホスト再起動時に自動起動するようにする(restart: unless-stopped
version: '3.2'
services:
  openvpn:
    build: .
    image: openvpn
    cap_add:
      - NET_ADMIN
    ports:
      - "54321:1194/udp"
    volumes:
      - ./easy-rsa:/opt/easy-rsa
    working_dir: /opt/easy-rsa
    environment:
      - OVPN_PORT=1194
    restart: unless-stopped

OpenVPNサーバの設定

$ docker-compose build
$ docker-compose up -d

でコンテナを起動した状態で、マウントしている/opt/easy-rsa内でeasyrsaで証明書とかを生成する。

コンテナ内に入り、/opt/easy-rsa内に入り作業する。

$ docker-compose exec openvpn sh

# cd /opt/easy-rsa

PKIの初期化

# /usr/share/easy-rsa/easyrsa init-pki

Using SSL: openssl OpenSSL 1.1.1a  20 Nov 2018

init-pki complete; you may now create a CA or requests.
Your newly created PKI dir is: /opt/easy-rsa/pki

CA(認証局)構築

# /usr/share/easy-rsa/easyrsa build-ca nopass

Using SSL: openssl OpenSSL 1.1.1a  20 Nov 2018
Generating RSA private key, 2048 bit long modulus (2 primes)
...............+++++
.........................+++++
e is 65537 (0x010001)
Can't load /opt/easy-rsa/pki/.rnd into RNG
140591198460776:error:2406F079:random number generator:RAND_load_file:Cannot open file:crypto/rand/randfile.c:98:Filename=/opt/easy-rsa/pki/.rnd
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Common Name (eg: your user, host, or server name) [Easy-RSA CA]: .

CA creation complete and you may now import and sign cert requests.
Your new CA certificate file for publishing is at:
/opt/easy-rsa/pki/ca.crt

Diffie-Helllmanパラメータの生成

# /usr/share/easy-rsa/easyrsa gen-dh

Using SSL: openssl OpenSSL 1.1.1a  20 Nov 2018
Generating DH parameters, 2048 bit long safe prime, generator 2
This is going to take a long time
.............+.......
.....................
..........+..........
+....................
.....................
.......+.......+.....
DH parameters of size 2048 created at /opt/easy-rsa/pki/dh.pem

サーバー鍵の生成

# /usr/share/easy-rsa/easyrsa build-server-full server nopass

Using SSL: openssl OpenSSL 1.1.1a  20 Nov 2018
Generating a RSA private key
...+++++
....+++++
writing new private key to '/opt/easy-rsa/pki/private/server.key.XXXXjcFHin'
-----
Using configuration from /usr/share/easy-rsa//safessl-easyrsa.cnf
Can't open /opt/easy-rsa/pki/index.txt.attr for reading, No such file or directory
140106217700200:error:02001002:system library:fopen:No such file or directory:crypto/bio/bss_file.c:72:fopen('/opt/easy-rsa/pki/index.txt.attr','r')
140106217700200:error:2006D080:BIO routines:BIO_new_file:no such file:crypto/bio/bss_file.c:79:
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName            :ASN.1 12:'server'
Certificate is to be certified until Jan 29 14:12:50 2022 GMT (1080 days)

Write out database with 1 new entries
Data Base Updated

tls-auth用の鍵の生成

# openvpn --genkey --secret pki/ta.key

CRLファイルの生成

# /usr/share/easy-rsa/easyrsa gen-crl

Using SSL: openssl OpenSSL 1.1.1a  20 Nov 2018
Using configuration from /usr/share/easy-rsa//safessl-easyrsa.cnf

An updated CRL has been created.
CRL file: /opt/easy-rsa/pki/crl.pem

クライアント鍵・設定ファイルを生成

<CLIENT-NAME>の部分にクライアント名に入れて実行する。

$ /usr/share/easy-rsa/easyrsa build-client-full <CLIENT-NAME> nopass

Using SSL: openssl OpenSSL 1.1.1a  20 Nov 2018
Generating a RSA private key
.................................................................................................+++++
..............................................................................+++++
writing new private key to '/opt/easy-rsa/pki/private/<CLIENT-NAME>.key.XXXXeDaKmJ'
-----
Using configuration from /usr/share/easy-rsa//safessl-easyrsa.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName            :ASN.1 12:'<CLIENT-NAME>'
Certificate is to be certified until Jan 29 14:20:40 2022 GMT (1080 days)

Write out database with 1 new entries
Data Base Updated

下記の内容で<CLIENT-NAME>.ovpnを作成する。
<SERVER-IP>にはOpenVPNサーバのグローバルIPかホスト名を入れる。

client
dev tun
proto udp
remote <SERVER-IP> 54321
resolv-retry infinite
nobind
persist-key
persist-tun
auth-nocache
verb 3
key-direction 1
compress lz4
tun-mtu 1500
mssfix 1460
<ca>
  pki/ca.crtの内容をコピペ
</ca>
<cert>
  pki/issued/<CLIENT-NAME>.crtの内容をコピペ
</cert>
<key>
  pki/private/<CLIENT-NAME>.keyの内容をコピペ
</key>
<tls-auth>
  pki/ta.keyの内容をコピペ
</tls-auth>

作成したovpnをクライアントにインポートすれば接続できた。