mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-24 21:48:08 +00:00
Add firewall info settings page
This commit is contained in:
parent
a44c5574ca
commit
d5ea6b4e96
10
rootfs/standard/etc/ufw/ufw.conf
Normal file
10
rootfs/standard/etc/ufw/ufw.conf
Normal file
|
@ -0,0 +1,10 @@
|
|||
# /etc/ufw/ufw.conf
|
||||
#
|
||||
|
||||
# Set to yes to start on boot. If setting this remotely, be sure to add a rule
|
||||
# to allow your remote connection before starting ufw. Eg: 'ufw allow 22/tcp'
|
||||
ENABLED=yes
|
||||
|
||||
# Please use the 'ufw' command to set the loglevel. Eg: 'ufw logging medium'.
|
||||
# See 'man ufw' for details.
|
||||
LOGLEVEL=low
|
|
@ -50,7 +50,6 @@ ufw status
|
|||
# Reload firewall after some time to reset (fixes VPN)
|
||||
sleep 120s
|
||||
ufw reload
|
||||
ufw logging off
|
||||
|
||||
# Success
|
||||
exit 0
|
||||
|
|
|
@ -431,4 +431,18 @@ def enable_btc_lnd_tor():
|
|||
|
||||
def disable_btc_lnd_tor():
|
||||
os.system("rm -f mnt/hdd/mynode/settings/.btc_lnd_tor_enabled")
|
||||
os.system("sync")
|
||||
os.system("sync")
|
||||
|
||||
|
||||
#==================================
|
||||
# Firewall Functions
|
||||
#==================================
|
||||
def reload_firewall():
|
||||
os.system("ufw reload")
|
||||
|
||||
def get_firewall_rules():
|
||||
try:
|
||||
rules = subprocess.check_output("ufw status", shell=True).decode("utf8")
|
||||
except:
|
||||
rules = "ERROR"
|
||||
return rules
|
||||
|
|
|
@ -131,6 +131,9 @@ def page_settings():
|
|||
upload_rate = 100
|
||||
download_rate = 100
|
||||
|
||||
# Get Firewall Status
|
||||
firewall_status_log = get_journalctl_log("ufw")
|
||||
|
||||
|
||||
templateData = {
|
||||
"title": "myNode Settings",
|
||||
|
@ -175,6 +178,10 @@ def page_settings():
|
|||
"mempoolspace_status_log": get_journalctl_log("mempoolspace"),
|
||||
"mempoolspace_status": get_service_status_basic_text("mempoolspace"),
|
||||
"mempoolspace_status_color": get_service_status_color("mempoolspace"),
|
||||
"firewall_status_log": get_journalctl_log("ufw"),
|
||||
"firewall_status": get_service_status_basic_text("ufw"),
|
||||
"firewall_status_color": get_service_status_color("ufw"),
|
||||
"firewall_rules": get_firewall_rules(),
|
||||
"is_quicksync_disabled": not quicksync_enabled,
|
||||
"is_netdata_enabled": is_netdata_enabled(),
|
||||
"is_uploader_device": is_uploader(),
|
||||
|
@ -319,6 +326,14 @@ def reset_electrs_page():
|
|||
}
|
||||
return render_template('reboot.html', **templateData)
|
||||
|
||||
@mynode_settings.route("/settings/reset-firewall")
|
||||
def reset_firewall_page():
|
||||
check_logged_in()
|
||||
t = Timer(3.0, reload_firewall)
|
||||
t.start()
|
||||
flash("Firewall Reset", category="message")
|
||||
return redirect("/settings")
|
||||
|
||||
@mynode_settings.route("/settings/factory-reset", methods=['POST'])
|
||||
def factory_reset_page():
|
||||
check_logged_in()
|
||||
|
|
|
@ -326,8 +326,8 @@ a:active {
|
|||
}
|
||||
.divider {
|
||||
width: 100%;
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
margin-top: 12px;
|
||||
margin-bottom: 12px;
|
||||
border-bottom: 3px dashed orange;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
|
|
@ -229,6 +229,16 @@
|
|||
$("#upgrade_status").show();
|
||||
});
|
||||
|
||||
$("#show_firewall_status").on("click", function() {
|
||||
$("#show_firewall_status").hide(0);
|
||||
$("#firewall_status").show();
|
||||
});
|
||||
|
||||
$("#show_firewall_rules").on("click", function() {
|
||||
$("#show_firewall_rules").hide(0);
|
||||
$("#firewall_rules").show();
|
||||
});
|
||||
|
||||
$("#show_mynode_changelog").on("click", function() {
|
||||
if (showChangelog)
|
||||
{
|
||||
|
@ -529,7 +539,7 @@
|
|||
<div class="settings_block_subheader_status_icon {{ startup_status_color }}"></div>
|
||||
{{ startup_status }}
|
||||
</div>
|
||||
<button id="show_startup_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_startup_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="startup_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{startup_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -538,7 +548,7 @@
|
|||
<div class="settings_block_subheader_status_icon {{ quicksync_status_color }}"></div>
|
||||
{{ quicksync_status }}
|
||||
</div>
|
||||
<button id="show_quicksync_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_quicksync_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="quicksync_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{quicksync_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -547,7 +557,7 @@
|
|||
<div class="settings_block_subheader_status_icon {{ bitcoin_status_color }}"></div>
|
||||
{{ bitcoin_status }}
|
||||
</div>
|
||||
<button id="show_bitcoin_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_bitcoin_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="bitcoin_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{bitcoin_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -556,7 +566,7 @@
|
|||
<div class="settings_block_subheader_status_icon {{ lnd_status_color }}"></div>
|
||||
{{ lnd_status }}
|
||||
</div>
|
||||
<button id="show_lnd_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_lnd_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="lnd_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{lnd_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -565,7 +575,7 @@
|
|||
<div class="settings_block_subheader_status_icon {{ tor_status_color }}"></div>
|
||||
{{ tor_status }}
|
||||
</div>
|
||||
<button id="show_tor_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_tor_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="tor_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{tor_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -574,7 +584,7 @@
|
|||
<div class="settings_block_subheader_status_icon {{ electrs_status_color }}"></div>
|
||||
{{ electrs_status }}
|
||||
</div>
|
||||
<button id="show_electrs_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_electrs_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="electrs_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{electrs_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -583,7 +593,7 @@
|
|||
<div class="settings_block_subheader_status_icon {{ rtl_status_color }}"></div>
|
||||
{{ rtl_status }}
|
||||
</div>
|
||||
<button id="show_rtl_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_rtl_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="rtl_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{rtl_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -592,7 +602,7 @@
|
|||
<div class="settings_block_subheader_status_icon {{ docker_image_build_status_color }}"></div>
|
||||
{{ docker_image_build_status }}
|
||||
</div>
|
||||
<button id="show_docker_image_build_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_docker_image_build_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="docker_image_build_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{docker_image_build_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -601,7 +611,7 @@
|
|||
<div class="settings_block_subheader_status_icon {{ btcpayserver_status_color }}"></div>
|
||||
{{ btcpayserver_status }}
|
||||
</div>
|
||||
<button id="show_btcpayserver_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_btcpayserver_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="btcpayserver_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{btcpayserver_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -610,8 +620,17 @@
|
|||
<div class="settings_block_subheader_status_icon {{ mempoolspace_status_color }}"></div>
|
||||
{{ mempoolspace_status }}
|
||||
</div>
|
||||
<button id="show_mempoolspace_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<button id="show_mempoolspace_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="mempoolspace_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{mempoolspace_status_log}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Firewall Status</div>
|
||||
<div class="settings_block_subheader_status">
|
||||
<div class="settings_block_subheader_status_icon {{ firewall_status_color }}"></div>
|
||||
{{ firewall_status }}
|
||||
</div>
|
||||
<button id="show_firewall_status" class="ui-button ui-widget ui-corner-all settings_button_small">Show</button>
|
||||
<div id="firewall_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{firewall_status_log}}</pre></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
@ -659,6 +678,25 @@
|
|||
</div>
|
||||
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Firewall</div>
|
||||
|
||||
<div class="settings_block_subheader">Rules</div>
|
||||
Show the current firewall configuration.
|
||||
<br/>
|
||||
<button id="show_firewall_rules" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<div id="firewall_rules" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{firewall_rules}}</pre></div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Reset</div>
|
||||
Resetting the firewall will disable and re-enable the firewall and then reboot the device.
|
||||
<br/>
|
||||
<a href="/settings/reset-firewall" class="ui-button ui-widget ui-corner-all settings_button">Reset Firewall</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">QuickSync</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user