@@ -63,6 +63,7 @@ public class AcmeCaPlugin : IAnyCAPlugin
6363 {
6464 private static readonly ILogger _logger = LogHandler . GetClassLogger < AcmeCaPlugin > ( ) ;
6565 private IAnyCAPluginConfigProvider Config { get ; set ; }
66+ private AcmeClientConfig _config ;
6667
6768 // Constants for better maintainability
6869 private const string DEFAULT_PRODUCT_ID = "default" ;
@@ -77,6 +78,16 @@ public void Initialize(IAnyCAPluginConfigProvider configProvider, ICertificateDa
7778 {
7879 _logger . MethodEntry ( ) ;
7980 Config = configProvider ?? throw new ArgumentNullException ( nameof ( configProvider ) ) ;
81+ _config = GetConfig ( ) ;
82+ _logger . LogTrace ( "Enabled: {Enabled}" , _config . Enabled ) ;
83+
84+ if ( ! _config . Enabled )
85+ {
86+ _logger . LogWarning ( "The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping config validation..." ) ;
87+ _logger . MethodExit ( ) ;
88+ return ;
89+ }
90+
8091 _logger . MethodExit ( ) ;
8192 }
8293
@@ -89,6 +100,12 @@ public void Initialize(IAnyCAPluginConfigProvider configProvider, ICertificateDa
89100 public async Task Ping ( )
90101 {
91102 _logger . MethodEntry ( ) ;
103+ if ( ! _config . Enabled )
104+ {
105+ _logger . LogWarning ( "The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping connectivity test..." ) ;
106+ _logger . MethodExit ( ) ;
107+ return ;
108+ }
92109
93110 HttpClient httpClient = null ;
94111 try
@@ -166,6 +183,13 @@ public Task ValidateCAConnectionInfo(Dictionary<string, object> connectionInfo)
166183 var rawData = JsonConvert . SerializeObject ( connectionInfo ) ;
167184 var config = JsonConvert . DeserializeObject < AcmeClientConfig > ( rawData ) ;
168185
186+ if ( config != null && ! config . Enabled )
187+ {
188+ _logger . LogWarning ( "The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping config validation..." ) ;
189+ _logger . MethodExit ( ) ;
190+ return Task . CompletedTask ;
191+ }
192+
169193 // Validate required configuration fields
170194 var missingFields = new List < string > ( ) ;
171195 if ( string . IsNullOrWhiteSpace ( config ? . DirectoryUrl ) )
@@ -231,6 +255,17 @@ public async Task<EnrollmentResult> Enroll(
231255 {
232256 _logger . MethodEntry ( ) ;
233257
258+ if ( ! _config . Enabled )
259+ {
260+ _logger . LogWarning ( "The CA is currently in the Disabled state. It must be Enabled to perform operations. Enrollment rejected." ) ;
261+ _logger . MethodExit ( ) ;
262+ return new EnrollmentResult
263+ {
264+ Status = ( int ) EndEntityStatus . FAILED ,
265+ StatusMessage = "CA connector is disabled. Enable it in the CA configuration to perform enrollments."
266+ } ;
267+ }
268+
234269 if ( string . IsNullOrWhiteSpace ( csr ) )
235270 throw new ArgumentException ( "CSR cannot be null or empty" , nameof ( csr ) ) ;
236271 if ( string . IsNullOrWhiteSpace ( subject ) )
0 commit comments