The first time you add a domain name to Web Application Firewall (WAF), you must verify your ownership of the domain name. After you pass the verification, you can add subdomains of the domain name without the need to verify the ownership of the subdomains. This topic describes how to verify the ownership of a domain name.
Scenarios
The first time you add a domain name to WAF by using one of the following methods, you must verify your ownership of the domain name:
Add the domain name to WAF in CNAME record mode. For more information, see Add a domain name to WAF 3.0 and Add a domain name to WAF 2.0.
Add the domain name to WAF by using the asset center feature. For more information, see Asset center of WAF 3.0.
Verification methods
Method 1: DNS verification (recommended)
If you use the Domain Name System (DNS) verification method, you must use the record value displayed in the WAF console to add a DNS TXT record to the system of your DNS service provider.
Prerequisites
You have permissions to modify the DNS records of your domain name.
Procedure
Go to the verification page.
Scenario 1: Add a domain name to WAF 3.0 in CNAME record mode.
On the CNAME Record tab of the Website Configuration page, click Add.
Scenario 2: Add a domain name to WAF 3.0 by using the asset center feature.
Go to the Asset Center page. On the Overview tab, click the icon.
Scenario 3: Add a domain name to WAF 2.0 in CNAME record mode.
On the Add Domain Name page, select CNAME Record for Access Mode.
Enter the domain name that you want to add to WAF and click on an empty area.
In the verification section, click the Method 1: DNS Record tab.
ImportantIn several cases, verification may fail. Do not close the Add Domain Name panel before your verification is complete. If the verification fails, you can use the file verification method to verify the ownership of your domain name. For more information, see Method 2: File verification.
Add a TXT record to the system of your DNS service provider based on the values of the Record Type, Hostname, and Record Value parameters in the WAF console.
In this example, a TXT record is added to Alibaba Cloud DNS. If you use a different DNS service provider, you can perform similar operations to add a TXT record.
Log on to the Alibaba Cloud DNS console.
Wait for the TXT record to take effect.
If the verification fails, check whether the TXT record is correctly configured.
The following codes provide sample success responses in different operating systems.
NoteIf you add a TXT record, it immediately takes effect. If you modify a TXT record, the amount of time that is required for the modification to take effect varies based on the TTL value. The default TTL value is 10 minutes.
If the dig program is not installed in your Linux operating system, you can run the
yum install bind-utils
command to install the program.
Go back to the WAF console and click Verify.
If the The verification succeeds. message appears, the domain name passes the ownership verification. If the verification fails, modify the related settings based on the cause of the failure that is displayed in the console. Then, verify your ownership of the domain name again. For more information about how to handle verification failures, see FAQ.
Method 2: File verification
If you use the file verification method, you must upload the verification file provided by WAF to the root directory of the origin server for your domain name.
Go to the verification page.
Scenario 1: Add a domain name to WAF 3.0 in CNAME record mode.
On the CNAME Record tab of the Website Configuration page, click Add.
Scenario 2: Add a domain name to WAF 3.0 by using the asset center feature.
Go to the Asset Center page. On the Overview tab, click the icon.
Scenario 3: Add a domain name to WAF 2.0 in CNAME record mode.
On the Add Domain Name page, select CNAME Record for Access Mode.
Enter the domain name that you want to add to WAF and click on an empty area.
In the verification section, click the Method 2: Verification File tab.
ImportantDo not close the Add Domain Name panel before your verification is complete.
Click the link to the right of Download Verification File to download the verification file.
ImportantThe verification file is valid only for three days after it is downloaded. If your verification is not complete within three days, you must download the verification file again.
Do not perform operations on the verification file, such as opening, modifying, or renaming the file.
Upload the verification file to the root directory of the origin server for your domain name. The origin server can be an Elastic Compute Service (ECS) instance, an Object Storage Service (OSS) bucket, a Cloud Virtual Machine (CVM) instance, a Cloud Object Storage (COS) instance, or an Elastic Compute Cloud (EC2) instance.
NoteIf you want to add a wildcard domain name, such as
*.aliyun.com
, upload the verification file to the root directory of the origin server for the primary domain name, such asaliyun.com
.WAF accesses your origin server over the protocol type that you select to obtain the verification file and checks whether you uploaded the verification file as required. Make sure that the verification file is accessible.
Go back to the WAF console and click Verify.
If the The verification succeeds. message appears, the domain name passes the ownership verification. If the verification fails, modify the related settings based on the cause of the failure that is displayed in the console. Then, verify your ownership of the domain name again. For more information about how to handle verification failures, see FAQ.
FAQ
Verification method | Problem | Description | Solution |
DNS verification | Empty TXT record value | The verification result shows that the TXT record value of the domain name is empty. | After you add a DNS record, the record does not immediately take effect. The DNS record takes effect after the TTL of the record ends. The default TTL is 10 minutes. We recommend that you perform the verification after 10 minutes. If the verification fails, re-add a DNS record for the domain name. For more information, see Method 1: DNS verification (recommended). |
Inconsistent TXT record values | The verification result shows that the TXT record value is inconsistent with the specified record value. | Delete the TXT record from the system of your DNS service provider and re-add a TXT record for your domain name. Procedure:
| |
File verification | Inaccessible domain name | The verification result shows that the domain name cannot be accessed. |
|
No verification file | The verification result shows that the verification file does not exist. | You did not upload the verification file to the root directory of the origin server or the upload operation failed. Re-download the verification file and upload it to the origin server. For more information, see Method 2: File verification. | |
Incorrect file content | The verification result shows that the file content is incorrect. |
|
References
For more information about how to add a domain name to WAF, see Add a domain name (WAF 3.0).
For more information about how to identify domain names in and outside Alibaba Cloud, assess risks based on the attack status of the domain names in the cloud, and enable protection for high-risk domain names, see Asset center of WAF 3.0.