개인 저장용 블로그

Renew Expired OPSS DemoIdentity 본문

Oracle Fusion Middleware/FMW

Renew Expired OPSS DemoIdentity

우엉잇 2022. 10. 11. 17:18

H 사 에서 OPSS DemoIdentity 기간 만료로 인한 갱신 요청이 들어왔다. 

 

Oracle Enterprise Manager 제품은 전문적으로 하지 않아 잘 모르는데 이번 기회에 경험을 쌓을 수 있었다. 

 

1. 인증서 생성 

 

[weblogic@localhost base_domain]$ cd bin
[weblogic@localhost bin]$ . ./setDomainEnv.sh 
[weblogic@localhost base_domain]$ 
[weblogic@localhost base_domain]$ cd 20221011certi/

 

문법) 

------------------------------------------------------------------------------------------------------------------------------------------------
java utils.CertGen -keyfilepass DemoIdentityPassPhrase -certfile democert -keyfile demokey -strength 1024 -cn DemoCertFor_<DOMAIN_NAME>

------------------------------------------------------------------------------------------------------------------------------------------------

[weblogic@localhost 20221011certi]$ java utils.CertGen -keyfilepass DemoIdentityPassPhrase -certfile democert -keyfile demokey -strength 1024 -cn DemoCertFor_base_domain
Generating a certificate with common name DemoCertFor_base_domain and key strength 1024
issued by CA with certificate from /product/fmw/ofm12c/wlserver/server/lib/CertGenCA.der file and key from /product/fmw/ofm12c/wlserver/server/lib/CertGenCAKey.der file

[weblogic@localhost 20221011certi]$ java utils.ImportPrivateKey -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase -keyfile demokey.pem -keyfilepass DemoIdentityPassPhrase -certfile democert.pem -alias demoidentity
No password was specified for the key entry
Key file password will be used
<2022. 10. 11 오후 3시 12분 12초 KST> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.> 
<2022. 10. 11 오후 3시 12분 12초 KST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG128 to HMACDRBG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.> 

Imported private key demokey.pem and certificate democert.pem
into a new keystore DemoIdentity.jks of type jks under alias demoidentity

 

[weblogic@localhost 20221011certi]$ keytool -list -v -keystore DemoIdentity.jks
키 저장소 비밀번호 입력:  

*****************  WARNING WARNING WARNING  *****************
* 키 저장소에 저장된 정보의 무결성이  *
* 확인되지 않았습니다! 무결성을 확인하려면, *
* 키 저장소 비밀번호를 제공해야 합니다.                  *
*****************  WARNING WARNING WARNING  *****************

키 저장소 유형: jks
키 저장소 제공자: SUN

키 저장소에 1개의 항목이 포함되어 있습니다.

별칭 이름: demoidentity
생성 날짜: 2022. 10. 11
항목 유형: PrivateKeyEntry
인증서 체인 길이: 1
인증서[1]:
소유자: CN=DemoCertFor_base_domain, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
발행자: CN=CertGenCA, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
일련 번호: 36ab164ea9d57f68af2ba18e2528164c
적합한 시작 날짜: Mon Oct 10 15:11:56 KST 2022 종료 날짜: Sun Oct 11 15:11:56 KST 2037

.

.

.

[weblogic@localhost 20221011certi]$ keytool -importcert -trustcacerts -alias wlscertgencab -keystore DemoTrust.jks -storepass DemoTrustKeyStorePassPhrase -file /product/fmw/ofm12c/wlserver/server/lib/CertGenCA.der
인증서가 <wlscertgenca> 별칭 아래에 있는 시스템 차원의 CA 키 저장소에 존재합니다.
고유한 키 저장소에 추가하겠습니까? [아니오]:  
인증서가 키 저장소에 추가되었습니다.
[weblogic@localhost 20221011certi]$ ls -arlt
합계 28
drwxrwxr-x 23 weblogic weblogic 4096 10월 11 10:18 ..
-rw-rw-r--  1 weblogic weblogic  676 10월 11 15:11 demokey.der
-rw-rw-r--  1 weblogic weblogic  993 10월 11 15:11 demokey.pem
-rw-rw-r--  1 weblogic weblogic  843 10월 11 15:11 democert.der
-rw-rw-r--  1 weblogic weblogic 1196 10월 11 15:11 democert.pem
-rw-rw-r--  1 weblogic weblogic 1618 10월 11 15:12 DemoIdentity.jks
-rw-rw-r--  1 weblogic weblogic 1033 10월 11 15:14 DemoTrust.jks

[weblogic@localhost 20221011certi]$ keytool -list -v -keystore DemoTrust.jks 
키 저장소 비밀번호 입력:  
키 저장소 유형: jks
키 저장소 제공자: SUN

키 저장소에 1개의 항목이 포함되어 있습니다.

별칭 이름: wlscertgencab
생성 날짜: 2022. 10. 11
항목 유형: trustedCertEntry

소유자: CN=CertGenCA, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
발행자: CN=CertGenCA, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
일련 번호: 40044886c441ef3b643a8066409afca0
적합한 시작 날짜: Sat Dec 01 12:07:51 KST 2012 종료 날짜: Thu Dec 02 12:07:51 KST 2032

.

.

.

 

2. wlst tool 을 이용한 인증서 갱신 

 

인증서 갱신 전 config.xml 파일에 <use-kss-for-demo>true</use-kss-for-demo> 태그 false 로 변경 

 

[weblogic@localhost bin]$ ./wlst.sh

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> connect ('weblogic','welcome1','<IP>:7001')
Connecting to t3://192.168.56.242:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "base_domain".

Warning: An insecure protocol was used to connect to the server. 
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

wls:/base_domain/serverConfig/> svc = getOpssService(name='KeyStoreService')
wls:/base_domain/serverConfig/>  svc.listKeyStores(appStripe='*')
Location changed to domainRuntime tree. This is a read-only tree 
with DomainMBean as the root MBean. 
For more help, use help('domainRuntime')

system/trust
system/castore
system/publiccacerts
system/demoidentity
opss/trustservice_ts
opss/trustservice_ks
test/_dummy_keystore_
test/testidentity

 

wls:/base_domain/domainRuntime/> svc.listKeyStoreAliases(appStripe='system', name='demoidentity', password='DemoIdentityKeyStorePassPhrase', type='*')
Already in Domain Runtime Tree

DemoIdentity
wls:/base_domain/domainRuntime/> svc.getKeyStoreCertificates(appStripe='system', name='demoidentity', password='DemoIdentityKeyStorePassPhrase', alias='DemoIdentity')
Already in Domain Runtime Tree

[
[
  Version: V3
  Subject: CN=DemoCertFor_base_domain, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
  Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11

  Key:  Sun RSA public key, 1024 bits
  params: null
  modulus: 150129571410459745098926143251784663021856037344528610239238505910808955471655858818984935309047854603993082905425594926151058476893454145954570158233851782137632607687905504405554833340487228381367447675659018361253621625253457756400139874554425729626863672718770232551708530959654681915399722288339574520201
  public exponent: 65537
  Validity: [From: Thu Oct 06 13:24:57 KST 2022,
               To: Tue Oct 05 13:24:57 KST 2027]     # 변경 전 
  Issuer: CN=CertGenCA, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
  SerialNumber: [    0183ab8a 194f]

 

wls:/base_domain/domainRuntime/> svc.listExpiringCertificates(days='9999', autorenew=true)
Already in Domain Runtime Tree

---------------------------------------------------
App Stripe = system
Keystore = publiccacerts
Alias = gtecybertrustglobalca [jdk]
Certificate status = Expired
Expiration Date = Tue Aug 14 08:59:00 KST 2018
---------------------------------------------------
---------------------------------------------------
App Stripe = system
Keystore = publiccacerts
Alias = utnuserfirstobjectca [jdk]
Certificate status = Expired
Expiration Date = Wed Jul 10 03:40:36 KST 2019
---------------------------------------------------

.

.

---------------------------------------------------
App Stripe = system
Keystore = publiccacerts
Alias = quovadisrootca3g3 [jdk]
Certificate status = Expiring
Expiration Date = Mon Jan 13 05:26:32 KST 2042
---------------------------------------------------

 

wls:/base_domain/domainRuntime/> svc.deleteKeyStoreEntry(appStripe='system', name='demoidentity', keypassword='DemoIdentityPassPhrase', alias='DemoIdentity',password='DemoIdentityKeyStorePassPhrase')
Already in Domain Runtime Tree

Keystore entry deleted.

 

문법 

--------------------------------------------------------------------------------------------------------------------------------------------------------------
svc.importKeyStore(appStripe='system', name='demoidentity', password='DemoIdentityKeyStorePassPhrase', aliases='DemoIdentity', keypasswords='DemoIdentityPassPhrase', type='JKS', permission=true, filepath='<PATH to 4th step Temporary folder>/DemoIdentity.jks')

--------------------------------------------------------------------------------------------------------------------------------------------------------------

wls:/base_domain/domainRuntime/> svc.importKeyStore(appStripe='system', name='demoidentity', password='DemoIdentityKeyStorePassPhrase', aliases='DemoIdentity', keypasswords='DemoIdentityPassPhrase', type='JKS', permission=true, filepath='/product/fmw/ofm12c/domains/base_domain/20221011certi/DemoIdentity.jks')
Already in Domain Runtime Tree

Keystore imported. Check the logs if any entry was skipped.

wls:/base_domain/domainRuntime/> svc.listKeyStoreAliases(appStripe='system', name='demoidentity', password='DemoIdentityKeyStorePassPhrase', type='Certificate')
Already in Domain Runtime Tree

DemoIdentity

 

wls:/base_domain/domainRuntime/> svc.getKeyStoreCertificates(appStripe='system', name='demoidentity', password='DemoIdentityKeyStorePassPhrase', alias='DemoIdentity')
Already in Domain Runtime Tree

[
[
  Version: V3
  Subject: CN=DemoCertFor_base_domain, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
  Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11

  Key:  Sun RSA public key, 1024 bits
  params: null
  modulus: 119436205473254345804101080154648358925355799908398963516053102513565618942850493789515373450590707061097647333690754961487725147420353107550545754690594302258759488540994279562388683488522570139794644213695060884399790041699015803018511955380900959111761377499272367819216019574433987848771092988964173299601
  public exponent: 65537
  Validity: [From: Mon Oct 10 15:11:56 KST 2022,
               To: Sun Oct 11 15:11:56 KST 2037]  # 변경된 인증서 기간 

 

문법

--------------------------------------------------------------------------------------------------------------------------------------------------------------

svc.exportKeyStoreCertificate(appStripe='system', name='demoidentity', password='DemoIdentityKeyStorePassPhrase', keypassword='DemoIdentityPassPhrase', alias='DemoIdentity', type='Certificate', filepath='<PATH to 4th step Temporary folder>/cert.txt')
--------------------------------------------------------------------------------------------------------------------------------------------------------------


wls:/base_domain/domainRuntime/> svc.exportKeyStoreCertificate(appStripe='system', name='demoidentity', password='DemoIdentityKeyStorePassPhrase', keypassword='DemoIdentityPassPhrase', alias='DemoIdentity', type='Certificate', filepath='/product/fmw/ofm12c/domains/base_domain/20221011certi/cert2.txt')
Already in Domain Runtime Tree

Certificate exported.

 

문법

--------------------------------------------------------------------------------------------------------------------------------------------------------------

svc.importKeyStoreCertificate(appStripe='system', name='trust', password='DemoTrustKeyStorePassPhrase', alias='wlscertgencab', keypassword='DemoTrustPassPhrase', type='TrustedCertificate', filepath='<PATH to 4th step Temporary folder>/cert.txt')

--------------------------------------------------------------------------------------------------------------------------------------------------------------

 

wls:/base_domain/domainRuntime/> svc.importKeyStoreCertificate(appStripe='system', name='trust', password='DemoTrustKeyStorePassPhrase', alias='wlscertgencab', keypassword='DemoTrustPassPhrase', type='TrustedCertificate', filepath='/product/fmw/ofm12c/domains/base_domain/20221011certi/cert2.txt')

Already in Domain Runtime Tree

Certificate imported.


wls:/base_domain/domainRuntime/> syncKeyStores(appStripe='system', keystoreFormat='KSS')
Already in Domain Runtime Tree

Keystore sync successful.

wls:/base_domain/domainRuntime/> exit()


Exiting WebLogic Scripting Tool.

 

* 참고로 아래 파일을 수정해야한다. 

DOMAIN_HOME/config/fmwconfig 의 jps-config.xml 및 jps-config-jse.xml

--------------------------------------------------------------------------------------------------------------------------------------------------------------

<serviceInstance name="keystore" provider="keystore.provider">
<description>Default JPS Keystore Service</description>
<property name="keystore.file.path" value="./"/>
<property name="ca.key.alias" value="wlscertgencab"/> <=== 이부분 추가 
</serviceInstance>

--------------------------------------------------------------------------------------------------------------------------------------------------------------

 

이후 config.xml의 false 를 true 로 변경하여 재 기동 한다. 

 

3. weblogic 기동 

 

웹로직 기동 시 아래 로그를 통해 갱신 된 인증서를 통해 기동되었다는걸 확인 할 수 있었다. 

<2022. 10. 11 오후 4시 38분 33,179초 KST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN.> 
<2022. 10. 11 오후 4시 38분 33,315초 KST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING.> 
<2022. 10. 11 오후 4시 38분 33,316초 KST> <Notice> <JMX> <BEA-149535> <JMX Resiliency Activity Server=All Servers : Resolving connection list DomainRuntimeServiceMBean> 
<2022. 10. 11 오후 4시 38분 34,129초 KST> <Notice> <Security> <BEA-090171> <Loading the identity certificate and private key stored under the alias DemoIdentity from the jks keystore file /product/fmw/ofm12c/domains/base_domain/security/DemoIdentity.jks.> 
<2022. 10. 11 오후 4시 38분 34,147초 KST> <Alert> <Security> <BEA-090153> <Demo identity certificate is used in production mode: [
[
  Version: V3
  Subject: CN=localhost.localdomain, OU=FOR TESTING ONLY, O=MyOrganization, L=MyTown, ST=MyState, C=US
  Signature Algorithm: SHA256withRSA, OID = 1.2.840.113549.1.1.11

  Key:  Sun RSA public key, 2048 bits
  params: null
  modulus: 26312572878514756532715174613557093961686144014185149464620309355815756273942002184452285108011316767330632889090340618589296372191049365110759219811963087547768015193369160194566577008063606952408579628760204687238958871947541659133402441958418765800234638003055168754626469176873823021892255318847004071954638889752608392787087786191114056261407235874611539549460473432170557454812531437071152127510606310163766710305069473291541119709411742513864310135638038813046333893210268142374754384167880210046264249689951585530600350042329089793804218686099699032257230396920354368421435073970732105684209727879524718819877
  public exponent: 65537
  Validity: [From: Wed Jul 13 11:18:25 KST 2022,
               To: Tue Jul 14 11:18:25 KST 2037]