Skip to content

Commit

Permalink
feat(Citrix ADC): add Citrix ADC node (#4274)
Browse files Browse the repository at this point in the history
* ✨ Citrix ADC node

* 🐛 Fix typo in codex file

* ⚡ Remove trailing slash if there is one

* ⚡ Add certificate resource

* 🐛 Fix merge conflict issue
  • Loading branch information
RicardoE105 authored Oct 7, 2022
1 parent 9b3f30d commit 7abc7e6
Show file tree
Hide file tree
Showing 8 changed files with 823 additions and 0 deletions.
55 changes: 55 additions & 0 deletions packages/nodes-base/credentials/CitrixAdcApi.credentials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';

export class CitrixAdcApi implements ICredentialType {
name = 'citrixAdcApi';
displayName = 'Citrix ADC API';
documentationUrl = 'citrix';
properties: INodeProperties[] = [
{
displayName: 'URL',
name: 'url',
type: 'string',
default: '',
required: true,
},
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
required: true,
},
{
displayName: 'Password',
name: 'password',
type: 'string',
default: '',
required: true,
typeOptions: {
password: true,
},
},
];

authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
'X-NITRO-USER': '={{$credentials.username}}',
'X-NITRO-PASS': '={{$credentials.password}}',
},
},
};

test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.url}}',
url: '/nitro/v1/config/nspartition?view=summary',
},
};
}
308 changes: 308 additions & 0 deletions packages/nodes-base/nodes/Citrix/ADC/CertificateDescription.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,308 @@
import { INodeProperties } from 'n8n-workflow';

export const certificateDescription: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Create',
value: 'create',
action: 'Create a certificate',
},
],
default: 'create',
displayOptions: {
show: {
resource: ['certificate'],
},
},
},
{
displayName: 'Certificate File Name',
name: 'certificateFileName',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
},
},
default: '',
description:
'Name for and, optionally, path to the generated certificate file. /nsconfig/ssl/ is the default path.',
},
{
displayName: 'Certificate Format',
name: 'certificateFormat',
type: 'options',
options: [
{
name: 'PEM',
value: 'PEM',
},
{
name: 'DER',
value: 'DER',
},
],
required: true,
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
},
},
default: 'PEM',
description: 'Format in which the certificate is stored on the appliance',
},
{
displayName: 'Certificate Type',
name: 'certificateType',
type: 'options',
options: [
{
name: 'Root-CA',
value: 'ROOT_CERT',
description:
'You must specify the key file name. The generated Root-CA certificate can be used for signing end-user client or server certificates or to create Intermediate-CA certificates.',
},
{
name: 'Intermediate-CA',
value: 'INTM_CERT',
description: 'Intermediate-CA certificate',
},
{
name: 'Server',
value: 'SRVR_CERT',
description: 'SSL server certificate used on SSL servers for end-to-end encryption',
},
{
name: 'Client',
value: 'CLNT_CERT',
description: 'End-user client certificate used for client authentication',
},
],
required: true,
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
},
},
default: 'ROOT_CERT',
},
{
displayName: 'Certificate Request File Name',
name: 'certificateRequestFileName',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['certificate'],
},
},
description:
'Name for and, optionally, path to the certificate-signing request (CSR). /nsconfig/ssl/ is the default path.',
},
{
displayName: 'CA Certificate File Name',
name: 'caCertificateFileName',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
certificateType: ['INTM_CERT', 'SRVR_CERT', 'CLNT_CERT'],
},
},
default: '',
description:
'Name of the CA certificate file that issues and signs the Intermediate-CA certificate or the end-user client and server certificates',
},
{
displayName: 'CA Certificate File Format',
name: 'caCertificateFileFormat',
type: 'options',
options: [
{
name: 'PEM',
value: 'PEM',
},
{
name: 'DER',
value: 'DER',
},
],
required: true,
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
certificateType: ['INTM_CERT', 'SRVR_CERT', 'CLNT_CERT'],
},
},
default: 'PEM',
description: 'Format of the CA certificate',
},
{
displayName: 'CA Private Key File Name',
name: 'caPrivateKeyFileName',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
certificateType: ['INTM_CERT', 'SRVR_CERT', 'CLNT_CERT'],
},
},
default: '',
description:
'Private key, associated with the CA certificate that is used to sign the Intermediate-CA certificate or the end-user client and server certificate. If the CA key file is password protected, the user is prompted to enter the pass phrase that was used to encrypt the key.',
},
{
displayName: 'CA Private Key File Format',
name: 'caPrivateKeyFileFormat',
type: 'options',
options: [
{
name: 'PEM',
value: 'PEM',
},
{
name: 'DER',
value: 'DER',
},
],
required: true,
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
certificateType: ['INTM_CERT', 'SRVR_CERT', 'CLNT_CERT'],
},
},
default: 'PEM',
description: 'Format of the CA certificate',
},
{
displayName: 'Private Key File Name',
name: 'privateKeyFileName',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: ['create'],
resource: ['certificate'],
certificateType: ['ROOT_CERT'],
},
},
description:
'Name for and, optionally, path to the private key. You can either use an existing RSA or DSA key that you own or create a new private key on the Citrix ADC. This file is required only when creating a self-signed Root-CA certificate. The key file is stored in the /nsconfig/ssl directory by default.',
},
{
displayName: 'CA Serial File Number',
name: 'caSerialFileNumber',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
certificateType: ['INTM_CERT', 'SRVR_CERT', 'CLNT_CERT'],
},
},
default: '',
description: 'Serial number file maintained for the CA certificate. This file contains the serial number of the next certificate to be issued or signed by the CA.',
},
{
displayName: 'Private Key Format',
name: 'privateKeyFormat',
type: 'options',
options: [
{
name: 'PEM',
value: 'PEM',
},
{
name: 'DER',
value: 'DER',
},
],
required: true,
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
certificateType: ['ROOT_CERT'],
},
},
default: 'PEM',
description: 'Format in which the key is stored on the appliance',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['certificate'],
operation: ['create'],
},
},
options: [
{
displayName: 'PEM Passphrase (For Encrypted Key)',
name: 'pempassphrase',
type: 'string',
displayOptions: {
show: {
'/certificateType': ['ROOT_CERT'],
},
},
default: '',
description:
'Name for and, optionally, path to the private key. You can either use an existing RSA or DSA key that you own or create a new private key on the Citrix ADC. This file is required only when creating a self-signed Root-CA certificate. The key file is stored in the /nsconfig/ssl directory by default.',
},
{
displayName: 'PEM Passphrase (For Encrypted CA Key)',
name: 'pempassphrase',
type: 'string',
displayOptions: {
hide: {
'/certificateType': ['ROOT_CERT'],
},
},
default: '',
description:
'Name for and, optionally, path to the private key. You can either use an existing RSA or DSA key that you own or create a new private key on the Citrix ADC. This file is required only when creating a self-signed Root-CA certificate. The key file is stored in the /nsconfig/ssl directory by default.',
},
{
displayName: 'Subject Alternative Name',
name: 'subjectaltname',
type: 'string',
default: '',
description:
'Subject Alternative Name (SAN) is an extension to X.509 that allows various values to be associated with a security certificate using a subjectAltName field',
},
{
displayName: 'Validity Period (Number of Days)',
name: 'days',
type: 'string',
default: '',
description:
'Number of days for which the certificate will be valid, beginning with the time and day (system time) of creation',
},
],
},
];
18 changes: 18 additions & 0 deletions packages/nodes-base/nodes/Citrix/ADC/CitrixAdc.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.citrixAdc",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Development"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/credentials/citrixAdc"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/nodes/n8n-nodes-base.citrixAdc/"
}
]
}
}
Loading

0 comments on commit 7abc7e6

Please sign in to comment.