Skip to content

Commit 9eb3c1d

Browse files
committed
Added changing certificate in FTP service
1 parent 65dbe3b commit 9eb3c1d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

deploy_freenas.py

+18
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,21 @@
131131
)
132132
except requests.exceptions.ConnectionError:
133133
pass # This is expected when restarting the web server
134+
135+
# Set our cert as active for FTP plugin
136+
r = requests.put(
137+
PROTOCOL + FREENAS_ADDRESS + ':' + PORT + '/api/v1.0/services/ftp/',
138+
verify=VERIFY,
139+
auth=(USER, PASSWORD),
140+
headers={'Content-Type': 'application/json'},
141+
data=json.dumps({
142+
"ftp_ssltls_certfile": cert,
143+
}),
144+
)
145+
146+
if r.status_code == 200:
147+
print ("Setting active certificate successful")
148+
else:
149+
print ("Error setting active certificate!")
150+
print (r)
151+
sys.exit(1)

0 commit comments

Comments
 (0)