I have hosted Mosquitto broker(MQTT server) on Azure VM. I am trying to connect to MQTT broker through Azure WebJob. When I connect to broker from local machine using self signed server certificate(ssl/tls connection) it works fine but when I host the same application on Azure AppService it gives error : Invalid remote certificate according to certificate validation procedure. I have installed same pfx certificate file on Azure portal still I am getting the same error. How to install third party server's ssl certificate in Azure Trusted Root Store so that it can validate the certificate through Trusted Root Store.
答案 0 :(得分:0)
据我所知,我们没有权限在Azure受信任的根存储库中为WebApp安装第三方服务器的ssl证书。
我们只能从当前用户的商店加载第三方服务器的证书。
如果服务器支持使用个人商店的SSL连接,我建议你可以尝试在天蓝色门户中设置它。
有关如何在azure Web应用程序中加载证书的更多详细信息,请参阅以下步骤:
1.上传证书:
2.复制指纹。
3.在应用程序设置中添加指纹以在网站运行时加载证书。
4.将代码添加到webjobs函数以加载证书:
public function search() {
$data['countries'] = $this->CrudModel->get('countries');
if ($this->session->tempdata('search_param') !== NULL):
$prevSearchData = $this->session->tempdata('search_param');
$flight_type = $prevSearchData['flight_type'];
$pass_num = $prevSearchData['no_of_passengers'];
$this->form_validation->set_data($prevSearchData);
else:
$flight_type = $_POST['flight_type'];
$pass_num = $_POST['no_of_passengers'];
endif;
$testing = $this->session->set_userdata('pass_num', $pass_num);
$this->form_validation->set_error_delimiters('<div class="alert alert-danger" role="alert" style="padding:0px;" >', '</div>');
$this->form_validation->set_rules('flight_from', 'Select depature', 'required|trim');
$this->form_validation->set_rules('flight_to', 'Select Destination', 'required|trim');
if ($flight_type == 'round_trip') {
$this->form_validation->set_rules('depart', 'Date of flight', 'required|trim');
$this->form_validation->set_rules('return', 'Date of return', 'required|trim');
$this->form_validation->set_rules('no_of_passengers', 'Number of Passengers', 'required');
if ($this->form_validation->run() == FALSE) {
$this->index();
} else {
$search_result = array(
$flight_from = $_POST['flight_from'],
$flight_to = $_POST['flight_to'],
$depart = $_POST['depart'],
$return = $_POST['return'],
$no_of_passengers = $_POST['no_of_passengers']
);
$data['search_result'] = $this->CrudModel->search_round_trip('flight', $flight_from, $flight_to, $depart, $return, $no_of_passengers);
$this->session->tempdata($data['search_result']);
$this->session->tempdata();
$this->load->view('partials/header');
$this->load->view('partials/nav');
$this->load->view('result', $data);
}
} else {
$this->form_validation->set_rules('depart', 'Date of flight', 'required|trim');
$this->form_validation->set_rules('no_of_passengers', 'Number of Passengers', 'required');
if ($this->form_validation->run() == FALSE) {
$this->index();
} else {
$search_result = array(
$flight_from = $_POST['flight_from'],
$flight_to = $_POST['flight_to'],
$depart = $_POST['depart'],
$no_of_passengers = $_POST['no_of_passengers']
);
$data['search_result'] = $this->CrudModel->search_one_way('flight', $flight_from, $flight_to, $depart, $no_of_passengers);
$this->load->view('partials/header');
$this->load->view('partials/nav');
$this->load->view('result', $data);
}
}
}
结果: