Project

General

Profile

« Previous | Next » 

Revision c443115a

Added by Steve Beaver over 5 years ago

Remove vestiges of legacy ACB system

(cherry picked from commit 8a6d9d7f82e7a992d2c48910fb4bb847b28f3f45)

View differences:

src/etc/inc/acb.inc
135 135
}
136 136

  
137 137
function test_connection($post) {
138
	global $savemsg, $config, $g, $legacy;
138
	global $savemsg, $config, $g;
139 139

  
140 140
	// Do nothing when booting or when not enabled
141 141
	if (platform_booting() || !acb_enabled()) {
......
158 158
	$hostname = $config['system']['hostname'] . "." . $config['system']['domain'];
159 159

  
160 160
	// URL to restore.php
161
	$get_url = $legacy ? "https://portal.pfsense.org/pfSconfigbackups/restore.php":"https://acb.netgate.com/getbkp";
161
	$get_url = "https://acb.netgate.com/getbkp";
162 162

  
163 163
	// Populate available backups
164 164
	$curl_session = curl_init();
165 165
	curl_setopt($curl_session, CURLOPT_URL, $get_url);
166

  
167
	if ($legacy) {
168
		curl_setopt($curl_session, CURLOPT_HTTPHEADER, array("Authorization: Basic " . base64_encode("{$username}:{$password}")));
169
	}
170

  
171 166
	curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 1);
172 167
	curl_setopt($curl_session, CURLOPT_POST, 1);
173 168
	curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1);
......
206 201
	}
207 202

  
208 203
	/*
209
	 * pfSense upload config to pfSense.org script
204
	 * pfSense upload config to acb.netgate.com script
210 205
	 * This file plugs into config.inc (/usr/local/pkg/parse_config)
211 206
	 * and runs every time the running firewall filter changes.
212 207
	 *
......
330 325

  
331 326
		} else {
332 327
			// Debugging
333
			//log_error("No https://portal.pfsense.org backup required.");
328
			//log_error("No https://acb.netgate.com backup required.");
334 329
		}
335 330
	}
336 331
}
src/usr/local/www/services_acb.php
40 40
$username = strtolower($config['system']['acb']['gold_username']);
41 41
$password = $config['system']['acb']['gold_password'];
42 42

  
43
// URL to restore.php
44
$get_url = "https://portal.pfsense.org/pfSconfigbackups/restore.php";
45

  
46
// URL to stats
47
$stats_url = "https://portal.pfsense.org/pfSconfigbackups/showstats.php";
48

  
49
// URL to delete.php
50
$del_url = "https://portal.pfsense.org/pfSconfigbackups/delete.php";
51

  
52 43
// Set hostname
53 44
if ($_REQUEST['hostname']) {
54 45
	$hostname = $_REQUEST['hostname'];
......
80 71

  
81 72
include("head.inc");
82 73

  
83
function get_hostnames() {
84
	global $stats_url, $username, $password, $oper_sep, $config, $g, $exp_sep;
85
	// Populate available backups
86
	$curl_session = curl_init();
87
	curl_setopt($curl_session, CURLOPT_URL, $stats_url);
88
	curl_setopt($curl_session, CURLOPT_HTTPHEADER, array("Authorization: Basic " . base64_encode("{$username}:{$password}")));
89
	curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 1);
90
	curl_setopt($curl_session, CURLOPT_POST, 1);
91
	curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1);
92
	curl_setopt($curl_session, CURLOPT_POSTFIELDS, "action=showstats");
93
	curl_setopt($curl_session, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version")));
94
	// Proxy
95
	curl_setopt_array($curl_session, configure_proxy());
96

  
97
	$data = curl_exec($curl_session);
98
	if (curl_errno($curl_session)) {
99
		$fd = fopen("/tmp/acb_statsdebug.txt", "w");
100
		fwrite($fd, $stats_url . "" . "action=showstats" . "\n\n");
101
		fwrite($fd, $data);
102
		fwrite($fd, curl_error($curl_session));
103
		fclose($fd);
104
	} else {
105
		curl_close($curl_session);
106
	}
107

  
108
	// Loop through and create new confvers
109
	$data_split = explode("\n", $data);
110
	$statvers = array();
111
	foreach ($data_split as $ds) {
112
		$ds_split = explode($exp_sep, $ds);
113
		if ($ds_split[0]) {
114
			$statvers[] = $ds_split[0];
115
		}
116
	}
117
	return $statvers;
118
}
119 74

  
120 75
if ($_REQUEST['rmver'] != "") {
121 76
	$curl_session = curl_init();
......
134 89
	$data = curl_exec($curl_session);
135 90
	if (curl_errno($curl_session)) {
136 91
		$fd = fopen("/tmp/acb_deletedebug.txt", "w");
137
		fwrite($fd, $get_url . "" . "action=delete&hostname=" . urlencode($hostname) . "&revision=" . urlencode($_REQUEST['rmver']) . "\n\n");
92
		fwrite($fd, "https://acb.netgate.com/rmbkp" . "" . "action=delete&hostname=" . urlencode($hostname) . "&revision=" . urlencode($_REQUEST['rmver']) . "\n\n");
138 93
		fwrite($fd, $data);
139 94
		fwrite($fd, curl_error($curl_session));
140 95
		fclose($fd);
141
		$savemsg = "An error occurred while trying to remove the item from portal.pfsense.org.";
96
		$savemsg = "An error occurred while trying to remove the item from acb.netgate.com.";
142 97
	} else {
143 98
		curl_close($curl_session);
144 99
		$budate = new DateTime($_REQUEST['rmver'], $acbtz);
......
195 150
	if (curl_errno($curl_session)) {
196 151
		/* If an error occured, log the error in /tmp/ */
197 152
		$fd = fopen("/tmp/acb_restoredebug.txt", "w");
198
		fwrite($fd, $get_url . "" . "action=restore&hostname={$hostname}&revision=" . urlencode($_REQUEST['newver']) . "\n\n");
153
		fwrite($fd, "https://acb.netgate.com/getbkp" . "" . "action=restore&hostname={$hostname}&revision=" . urlencode($_REQUEST['newver']) . "\n\n");
199 154
		fwrite($fd, $data);
200 155
		fwrite($fd, curl_error($curl_session));
201 156
		fclose($fd);
......
284 239

  
285 240
	if (curl_errno($curl_session)) {
286 241
		$fd = fopen("/tmp/acb_backupdebug.txt", "w");
287
		fwrite($fd, $get_url . "" . "action=showbackups" . "\n\n");
242
		fwrite($fd, "https://acb.netgate.com/list" . "" . "action=showbackups" . "\n\n");
288 243
		fwrite($fd, $data);
289 244
		fwrite($fd, curl_error($curl_session));
290 245
		fclose($fd);
......
339 294
$tab_array[] = array("Backup now", false, "/services_acb_backup.php");
340 295

  
341 296
display_top_tabs($tab_array);
342

  
343
$hostnames = get_hostnames();
344 297
?>
345 298

  
346 299
<div id="loading">

Also available in: Unified diff