しかし、orapkiを使った作業が煩雑だったため、自己署名証明書の生成はOpenSSLを使うように作業を変えました。概ねChatGPTまたはClaudeに聞いて作業を進めています。
name: uc-local-apex-dev
services:
26ai:
ports:
- 1521:1521
- 1522:1522 <--- この行を追加する
env_file:
- ./.env
Oracle Walletの作成
tlsdb % docker exec -it local-26ai bash
bash-4.4$
sh setup_selfsigned_cert.sh ホスト名
bash-4.4$ sh setup_selfsigned_cert.sh apex
Generating self-signed certificate for: apex
1. Generating Root CA...
Generating a RSA private key
..................................................................................++++
................................................................................................................................................................................................................................................++++
writing new private key to 'rootCA.key'
-----
2. Generating server key...
Generating RSA private key, 2048 bit long modulus (2 primes)
.....................+++++
..............................+++++
e is 65537 (0x010001)
3. Generating CSR...
4. Signing certificate...
Signature ok
subject=CN = apex
Getting CA Private Key
5. Verifying certificate...
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
66:4b:35:ae:60:36:9e:af:29:5d:74:34:f4:11:53:f6:10:63:aa:3c
Signature Algorithm: sha256WithRSAEncryption
Issuer: C = JP, O = Development, CN = My Root CA
Validity
Not Before: Feb 17 04:01:49 2026 GMT
Not After : Mar 21 04:01:49 2027 GMT
Subject: CN = apex
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (2048 bit)
Modulus:
00:dc:c7:70:0a:4c:f0:8f:ae:0f:c9:96:2f:a1:95:
80:fa:23:05:2e:8e:19:af:0b:1b:c5:d1:97:fb:6a:
2d:4c:b9:68:f2:66:2c:57:80:3e:ec:90:6d:03:7c:
ef:0c:ad:80:f2:2d:f3:80:6d:46:60:3f:23:5b:35:
aa:86:bf:31:b5:10:ea:84:24:57:ff:2f:db:43:3b:
1d:0c:a7:06:08:98:45:c0:71:6e:d3:67:44:1c:50:
f2:79:cf:78:67:d9:99:d5:a5:4a:85:a6:e4:07:4c:
09:02:ec:8a:a7:7a:f3:aa:64:63:32:ff:3b:8a:b4:
d3:93:16:8e:28:3d:62:e7:7d:ff:dc:72:19:08:ed:
b5:5c:3c:6c:08:e5:84:12:f6:fe:80:22:01:57:fa:
ce:25:88:de:f3:5a:db:cd:b0:8e:43:0e:eb:01:08:
34:97:cd:04:62:39:14:ef:13:b7:c7:7b:76:7e:07:
5d:a4:05:4a:cd:82:fe:18:b1:1d:4f:34:f2:9a:85:
0f:bf:41:ff:af:e4:66:a2:6c:b8:d3:b3:84:b6:ba:
38:1d:05:4d:a6:74:db:e5:e9:4c:bd:9b:40:f6:58:
97:35:d0:4c:3e:43:cc:c4:56:e0:86:30:00:c7:b1:
28:76:cc:ed:c9:73:92:54:ea:9e:46:fd:7b:17:fd:
9f:77
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Digital Signature, Key Encipherment
X509v3 Extended Key Usage:
TLS Web Server Authentication
X509v3 Subject Alternative Name:
DNS:apex, DNS:localhost, IP Address:127.0.0.1
Signature Algorithm: sha256WithRSAEncryption
68:b3:ce:db:a4:06:12:55:56:a7:c6:cc:00:df:36:70:16:a6:
60:f9:40:ff:cf:b7:59:50:18:32:66:d4:7d:da:40:90:93:e2:
0b:29:0f:a5:10:8f:43:ec:af:87:46:e0:5c:b0:1f:50:f6:f1:
12:4c:89:3a:a6:d3:87:3f:1b:b0:07:dd:6b:85:84:9d:e3:e5:
fc:be:f3:7f:cc:e2:74:05:46:c5:31:38:c1:3f:5f:20:a3:cb:
10:de:7e:5b:c8:d7:40:08:a6:89:11:41:4d:8e:88:03:d1:3e:
89:26:08:6b:38:1e:7c:10:fc:3f:ae:39:16:8e:18:16:2e:ee:
b9:40:cb:eb:0f:8b:7a:11:94:83:e6:6e:15:c0:39:e5:a1:7c:
96:48:ad:4f:2c:01:ec:07:03:f6:12:89:ab:12:ba:57:d8:5a:
ed:ec:9d:8b:b3:9a:14:bd:3c:c3:3b:b9:af:4d:e6:a5:64:e2:
46:9a:c6:a0:68:35:83:e7:29:e5:90:34:ad:dd:5a:d0:71:e4:
f2:9b:bf:6f:3b:cb:9a:5e:28:d9:44:a3:6e:49:75:20:03:a8:
1d:0a:7d:2a:57:b4:7c:20:c5:1e:14:34:87:22:15:d6:04:9b:
15:0a:9d:27:59:96:07:8f:af:bf:ee:30:a9:3d:7f:c4:e6:60:
22:f9:ee:4c:18:ff:16:fc:41:70:a2:02:44:ca:18:5a:a2:fe:
b8:a0:1c:d1:85:f9:02:72:c2:e5:7f:26:99:54:86:cd:38:64:
be:61:e1:b9:aa:26:51:0d:6e:a4:08:e0:2e:d8:e3:3f:2e:fb:
e4:c2:8c:8f:d1:d7:e1:22:b8:71:17:fb:57:44:c4:f8:17:e6:
fe:cc:df:89:90:42:4e:01:14:e8:1f:4c:27:04:95:b7:79:a9:
6e:9c:52:0c:fe:6d:98:18:80:ac:64:5e:2d:11:b5:e8:d4:7a:
e9:43:42:27:0b:bb:91:9e:c6:79:5d:5a:36:53:f5:22:fb:f4:
b4:19:c6:cc:4f:84:80:4a:07:c5:8b:53:47:b7:9c:a8:85:da:
89:05:88:c6:a8:49:21:dd:19:fc:d6:a6:2c:3a:b1:42:b2:7b:
21:b1:aa:50:d1:ba:93:70:81:b5:96:e5:ae:95:bd:70:58:96:
bb:bd:d2:53:6d:28:7c:69:09:b1:37:74:94:3f:dd:b7:cd:92:
63:23:25:92:3b:d3:98:ea:fb:01:75:e3:a0:16:96:88:1e:19:
34:a4:00:c5:a0:2d:2e:6f:76:c7:ee:9c:ad:f2:8d:77:e1:4b:
55:7c:40:93:fe:92:5a:92:71:cf:b4:f7:ad:1c:7e:a4:9e:67:
49:f0:5e:4d:3e:20:54:fb
6. Creating PKCS12 bundle...
Done! Generated files:
- rootCA.crt / rootCA.key (Root CA - import rootCA.crt to your browser/system)
- server.p12 (PKCS12 bundle)
bash-4.4$
bash-4.4$ sh setup_oracle_wallet.sh ********
Oracle PKI Tool Release 23.0.0.0.0 - Production
Version 23.0.0.0.0
Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
Operation is successfully completed.
Oracle PKI Tool Release 23.0.0.0.0 - Production
Version 23.0.0.0.0
Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
Operation is successfully completed.
Oracle PKI Tool Release 23.0.0.0.0 - Production
Version 23.0.0.0.0
Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
orapki command import_pkcs12 executed successfully.
Oracle PKI Tool Release 23.0.0.0.0 - Production
Version 23.0.0.0.0
Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
Requested Certificates:
User Certificates:
Subject: CN=apex
Trusted Certificates:
Subject: CN=My Root CA,O=Development,C=JP
bash-4.4$
TNSリスナーの更新
bash-4.4$ cd $ORACLE_HOME/network/admin
bash-4.4$
DEFAULT_SERVICE_LISTENER = FREE
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SSL_CLIENT_AUTHENTICATION = FALSE
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /opt/oracle/admin/FREE/wallet)
)
)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)
DISABLE_OOB=ON
SQLNET.EXPIRE_TIME=3
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /opt/oracle/admin/FREE/wallet)
)
)
FREEPDB1_TLS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = FREEPDB1)
)
(SECURITY =
(SSL_SERVER_DN_MATCH=TRUE)
(SSL_SERVER_CERT_DN="CN=apex")
)
)
bash-4.4$ lsnrctl stop
LSNRCTL for Linux: Version 23.26.0.0.0 - Production on 17-FEB-2026 04:16:14
Copyright (c) 1991, 2025, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))
The command completed successfully
bash-4.4$ lsnrctl start
LSNRCTL for Linux: Version 23.26.0.0.0 - Production on 17-FEB-2026 04:16:17
Copyright (c) 1991, 2025, Oracle. All rights reserved.
Starting /opt/oracle/product/26ai/dbhomeFree/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 23.26.0.0.0 - Production
System parameter file is /opt/oracle/product/26ai/dbhomeFree/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/ff5da9bf1d25/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=0.0.0.0)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 23.26.0.0.0 - Production
Start Date 17-FEB-2026 04:16:17
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service FREE
Listener Parameter File /opt/oracle/product/26ai/dbhomeFree/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/ff5da9bf1d25/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=0.0.0.0)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
bash-4.4$
sqlplus / as sysdba
alter system register;
bash-4.4$ sqlplus / as sysdba
SQL*Plus: Release 23.26.0.0.0 - Production on Tue Feb 17 04:17:01 2026
Version 23.26.0.0.0
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Connected to:
Oracle AI Database 26ai Free Release 23.26.0.0.0 - Develop, Learn, and Run for Free
Version 23.26.0.0.0
SQL> alter system register;
System altered.
SQL> exit
Disconnected from Oracle AI Database 26ai Free Release 23.26.0.0.0 - Develop, Learn, and Run for Free
Version 23.26.0.0.0
bash-4.4$
select sys_context('userenv','network_protocol');
bash-4.4$ sqlplus system@freepdb1_tls
SQL*Plus: Release 23.26.0.0.0 - Production on Tue Feb 17 04:18:01 2026
Version 23.26.0.0.0
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Enter password: ********
Last Successful login time: Tue Feb 17 2026 03:22:05 +00:00
Connected to:
Oracle AI Database 26ai Free Release 23.26.0.0.0 - Develop, Learn, and Run for Free
Version 23.26.0.0.0
SQL> select sys_context('userenv','network_protocol');
SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
--------------------------------------------------------------------------------
tcps
SQL> exit
Disconnected from Oracle AI Database 26ai Free Release 23.26.0.0.0 - Develop, Learn, and Run for Free
Version 23.26.0.0.0
bash-4.4$
コンテナ外から接続
cd tlsdb
% cd tlsdb
tlsdb %
tlsdb % docker cp local-26ai:/opt/oracle/admin/FREE/wallet .
Successfully copied 12.8kB to /Users/________/Documents/tlsdb/.
tlsdb % ls wallet
cwallet.sso cwallet.sso.lck ewallet.p12 ewallet.p12.lck
tlsdb %
SSL_CLIENT_AUTHENTICATION = FALSE
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /Users/**********/Documents/tlsdb/wallet)
)
)
tlsdb % docker cp local-26ai:/opt/oracle/oradata/dbconfig/FREE/tnsnames.ora .
Successfully copied 2.56kB to /Users/ynakakoshi/Documents/tlsdb/.
tlsdb %
oracle.net.wallet_location=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=${TNS_ADMIN}/wallet)))
export TNS_ADMIN=$PWD
sql system@freepdb1_tls
select sys_context('userenv','network_protocol');
tlsdb % sql system@freepdb1_tls
SQLcl: 火 2月 17 13:32:51 2026のリリース25.4 Production
Copyright (c) 1982, 2026, Oracle. All rights reserved.
パスワード (**********?) ****************
Last Successful login time: 火 2月 17 2026 13:32:55 +09:00
接続先:
Oracle AI Database 26ai Free Release 23.26.0.0.0 - Develop, Learn, and Run for Free
Version 23.26.0.0.0
SQL> select sys_context('userenv','network_protocol');
SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
____________________________________________
tcps
SQL>
SQL> exit
Oracle AI Database 26ai Free Release 23.26.0.0.0 - Develop, Learn, and Run for Free
Version 23.26.0.0.0から切断されました
ynakakoshi@Ns-Macbook tlsdb %