#!/bin/bash
username='bjylsw'
apiKey='abc@123#@!'
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
echo -e "password: $password\n"
curl -i --url "https://api.cucdn.net/api/spider/ip-forbid" \
-X "POST" \
-H "X-Time-Zone:GMT+08:00" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '{
"domainList":[
"test-japro.bjpos.com",
"test-japro2.bjpos.com"
],
"ipList":[
"208.115.243.59",
"199.71.214.201"
],
"forbidTime":100,
"operationType":1
}'