Hero Image
Applying HTTPS Certificates for CDN

dehydrated letsencrypt-cloudflare-hook Since we cannot upload files to the CDN server, we cannot use file validation to apply for HTTPS certificates. Fortunately, Let’s Encrypt supports the dns-01 challenge via DNS validation. We use Dehydrated with the CloudFlare hook to apply for HTTPS certificates. # First clone the dehydrated repository git clone https://github.com/lukas2511/dehydrated # In the cloned dehydrated directory, create a config file. See the example config file: # https://github.com/dehydrated-io/dehydrated/blob/master/docs/examples/config # Append Cloudflare info to the end of the config file echo "export CF_EMAIL=user@example.com" >> config echo "export CF_KEY=K9uX2HyUjeWg5AhAb" >> config # Clone the Cloudflare hook mkdir hooks git clone https://github.com/kappataumu/letsencrypt-cloudflare-hook hooks/cloudflare # Install dependencies pip install -r hooks/cloudflare/requirements-python-2.txt # Create domains.txt, one domain per line [root@db-slave01 dehydrated]# cat domains.txt apk.kosungames.com sp-res.kosungames.com cpweb.kosungames.com # Request HTTPS certificates ./dehydrated -c -k hooks/cloudflare/hook.py # Use a Python script to upload the certificates. The script must be in the dehydrated directory. #!/usr/bin/env python from aliyunsdkcore import client from aliyunsdkcdn.request.v20141111 import SetDomainServerCertificateRequest import uuid def upload(domain): cli = client.AcsClient("LTAI7zSXga2D", "ed03Mt9xcNkRgmadx0XtpyDje", "cn-hongkong") request = SetDomainServerCertificateRequest.SetDomainServerCertificateRequest() request.set_accept_format("json") request.set_DomainName(domain) request.set_CertName(domain + str(uuid.uuid1())) #request.set_CertName(domain) #certificate = open("certs/" + domain + "/fullchain.pem").read() certificate = open("certs/" + domain + "/cert.pem").read() with open("certs/" + domain + "/chain.pem") as f: f.readline() f.readline() chain = f.read() certificate += chain key = open("certs/" + domain + "/privkey.pem").read() request.set_ServerCertificateStatus('on') request.set_ServerCertificate(certificate) request.set_PrivateKey(key) result = cli.do_action_with_exception(request) domain_file="domains.txt" with open(domain_file) as f: for line in f: domain = line.split()[0] upload(domain)

Hero Image
HA command

load merge relative terminal # On a brand-new device without HA enabled, you must define the cluster ID. # Cluster ID must be unique and cannot duplicate other SRX, because HA creates a virtual MAC address and this ID affects it. Duplicates may cause MAC duplication and unexpected errors. # request system zeroize # The following commands must be run in `>` mode. set chassis cluster cluster-id <ID range 0~255> node 0 # This is on node 0 set chassis cluster cluster-id <ID range 0~255> node 1 # This is on node 1 # On the secondary node, run this command. request chassis cluster configuration-synchronize # After reboot, you will see Hold or standby; check whether the cluster is up. show chassis cluster status # This appears only after RETH interfaces are created; you must configure first. show chassis cluster interfaces # The following commands are run in config mode; build the config first. --- # The backup-router is for the HA standby device management interface (fxp) so it can respond to routing; by default the standby does not enable the routing engine, so this is required. set groups node0 system host-name SRX-node0 set groups node0 system backup-router 10.10.0.254 set groups node0 system backup-router destination 0.0.0.0/0 set groups node0 interfaces fxp0 unit 0 family inet address 10.10.0.2/24 set groups node1 system host-name SRX-node1 set groups node1 system backup-router 10.10.0.254 set groups node1 system backup-router destination 0.0.0.0/0 set groups node1 interfaces fxp0 unit 0 family inet address 10.10.0.3/24 set apply-groups "${node}" set system time-zone Asia/Taipei set chassis cluster control-link-recovery set chassis cluster reth-count 10 set chassis cluster heartbeat-interval 2000 # It is recommended to enable IPv6 during setup using the following command, because enabling IPv6 later requires a reboot. set security forwarding-options family inet6 mode flow-based # Interface numbers vary by chassis model. # The easiest way is to check how many slots the device has. For example, SRX550HM has expansion 0-8, so HA starts at 9, hence ge-9/x/x. set chassis cluster redundancy-group 0 node 0 priority 150 set chassis cluster redundancy-group 0 node 1 priority 100 set chassis cluster redundancy-group 0 interface-monitor ge-0/0/3 weight 150 set chassis cluster redundancy-group 0 interface-monitor ge-0/0/5 weight 150 set chassis cluster redundancy-group 0 interface-monitor ge-9/0/3 weight 100 set chassis cluster redundancy-group 0 interface-monitor ge-9/0/5 weight 100 set chassis cluster redundancy-group 1 node 0 priority 150 set chassis cluster redundancy-group 1 node 1 priority 100 set chassis cluster redundancy-group 1 interface-monitor ge-0/0/3 weight 150 set chassis cluster redundancy-group 1 interface-monitor ge-0/0/5 weight 150 set chassis cluster redundancy-group 1 interface-monitor ge-9/0/3 weight 100 set chassis cluster redundancy-group 1 interface-monitor ge-9/0/5 weight 100 # This is the data sync setting for redundancy group 1; you must set it to enable the ge-0/0/2 heartbeat link. set interfaces fab0 fabric-options member-interfaces ge-0/0/2 set interfaces fab1 fabric-options member-interfaces ge-9/0/2 # Add interfaces to the reth group. set interfaces ge-0/0/3 gigether-options redundant-parent reth0 set interfaces ge-0/0/4 gigether-options redundant-parent reth0 set interfaces ge-9/0/3 gigether-options redundant-parent reth0 set interfaces ge-9/0/4 gigether-options redundant-parent reth0 set interfaces ge-0/0/5 gigether-options redundant-parent reth1 set interfaces ge-9/0/5 gigether-options redundant-parent reth1 set interfaces reth0 vlan-tagging # You must add RETH to the data sync group, otherwise it will not work. set interfaces reth0 redundant-ether-options redundancy-group 1 # Note: SRX uses LACP passive mode, but the switch must use LACP active mode. set interfaces reth0 redundant-ether-options lacp passive set interfaces reth0 redundant-ether-options lacp periodic slow set interfaces reth1 redundant-ether-options redundancy-group 1 set interfaces reth1 unit 0 family inet address 202.99.240.100/26