Move all misc files under misc directory

This commit is contained in:
Sunil Mohan Adapa committed 2014-08-30 09:38:24 +05:30
1 parent 091faf4eaa
commit e6dbcdccaa
7 files changed
+23

No files matched your search

@@ -0,0 +1,42 @@
<VirtualHost *:443>
## Enable SSL
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
## Use HTTP Strict Transport Security to force client to use secure connections only
Header always set Strict-Transport-Security "max-age=31536000"
## Shared options.
ProxyPreserveHost on
DocumentRoot /usr/share/plinth
## Use this rule to hang plinth off of plinth.(servername)
# ServerName plinth
# ServerAlias plinth.*
# ProxyPass / http://localhost:8000/
# ProxyPassReverse / http://localhost:8000/
# <Proxy *>
# Order Deny,Allow
# Deny from All
# Allow from 10.0.0.0/8
# Allow from 172.16.0.0/12
# Allow from 192.168.0.0/16
# </Proxy>
## Use this rule to hang plinth off a subdir.
## Make sure to provide plinth with a default directory: /plinth
<Location /plinth>
ProxyPass http://localhost:8000/plinth
ProxyPassReverse http://localhost:8000/plinth
Order Deny,Allow
Deny from All
Allow from 10.0.0.0/8
Allow from 172.16.0.0/12
Allow from 192.168.0.0/16
</Location>
ProxyPass /plinth/static !
</VirtualHost>
@@ -0,0 +1,16 @@
<VirtualHost *:80>
## Force SSL
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
ReWriteCond %{REQUEST_URI} ^/plinth
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
## Shared options.
DocumentRoot /dev/null
## Use this rule to hang plinth off of plinth.(servername)
# ServerName plinth
# ServerAlias plinth.*
</VirtualHost>
+54
View File
@@ -0,0 +1,54 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: plinth
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: plinth web frontend
# Description:
# Control the plinth web frontend.
### END INIT INFO
# This file is /etc/init.d/plinth
DESC="embedded web frontend"
NAME=plinth
DAEMON=/usr/bin/plinth
PID_FILE=/var/run/plinth.pid
SERVER_DIR=/plinth
PLINTH_USER=plinth
PLINTH_GROUP=plinth
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start_daemon -p $PID_FILE $DAEMON --pidfile=$PID_FILE \
--server_dir=$SERVER_DIR
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
killproc -p $PID_FILE $DAEMON
RETVAL=$?
[ $RETVAL -eq 0 ] && [ -e "$PID_FILE" ] && rm -f $PID_FILE
log_end_msg $RETVAL
;;
restart|force-reload)
$0 stop
$0 start
;;
status)
status_of_proc -p $PID_FILE "$DAEMON" plinth && exit 0 || exit $?
;;
*)
echo "Usage: $NAME {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
+23
View File
@@ -0,0 +1,23 @@
[Name]
product_name = Plinth
box_name = FreedomBox
[Path]
# directory locations
file_root = /usr/share/plinth/static
data_dir = /var/lib/plinth
log_dir = /var/log/plinth
pid_dir = /var/run
actions_dir = /usr/share/plinth/actions
server_dir = plinth/
# file locations
store_file = %(data_dir)s/store.sqlite3
user_db = %(data_dir)s/users.sqlite3
status_log_file = %(log_dir)s/status.log
access_log_file = %(log_dir)s/access.log
pidfile = %(pid_dir)s/pidfile.pid
[Network]
host = 127.0.0.1
port = 8000
+1
View File
@@ -0,0 +1 @@
plinth ALL=(ALL:ALL) NOPASSWD:/usr/share/plinth/actions/*
+97
View File
@@ -0,0 +1,97 @@
#!/bin/sh
# Enable tracing to see the commands in
# /var/log/freedombox-first-run.log
set -x
# Setup interfaces into appropriate zones. XXX: This is ideally done
# by network configuration as network configuration tool/scripts have
# better idea of what the interfaces are. There should also be a UI in
# Plinth to classify each interface as external or internal.
# If more than one interfaces is available, assume eth0 is external
# and rest are internal interfaces.
INTERFACES=$(interface-detect | grep wired | grep -v lo | cut -f1 -d,)
NO_OF_INTERFACES=$(echo $INTERFACES | wc --words)
if [ $NO_OF_INTERFACES -gt '1' ]
then
for INTERFACE in $INTERFACES
do
if [ $INTERFACE = 'eth0' ]
then
ZONE='external'
else
ZONE='internal'
fi
firewall-cmd --zone=$ZONE --permanent --add-interface=$INTERFACE
done
fi
# If only one interface is available, assume it to be internal so that
# services are available on this only possible interface. This means
# that all services which are meant to available only internally will
# be available externally if the interface is publicly accessible.
# XXX: To avoid this, FreedomBox should configure at least two
# interfaces. If only one network hardware device is available, an
# alias such as 'eth0:1' could be created and can act as internal
# interface.
if [ $NO_OF_INTERFACES -eq '1' ]
then
firewall-cmd --zone=internal --permanent --add-interface="$INTERFACES"
fi
# Setup firewall rules for all the services enabled by default.
# Ideally all non-essential services are enabled from Plinth which
# automatically takes care of enabling appropirate firewall ports. The
# following is then for essential services and services that are not
# yet configurable from Plinth.
# HTTP (JWChat, ownCloud)
firewall-cmd --zone=external --permanent --add-service=http
firewall-cmd --zone=internal --permanent --add-service=http
# HTTPS (Plinth, JWChat, ownCloud)
firewall-cmd --zone=external --permanent --add-service=https
firewall-cmd --zone=internal --permanent --add-service=https
# Tor
firewall-cmd --zone=internal --permanent --add-service=tor-socks
# NTP
firewall-cmd --zone=internal --permanent --add-service=ntp
# DNS
firewall-cmd --zone=internal --permanent --add-service=dns
# mDNS
firewall-cmd --zone=internal --permanent --add-service=mdns
# DHCP
firewall-cmd --zone=internal --permanent --add-service=dhcp
# Bootp Server and Client (not enabled)
#firewall-cmd --zone=internal --permanent --add-port=67/tcp
#firewall-cmd --zone=internal --permanent --add-port=67/udp
#firewall-cmd --zone=internal --permanent --add-port=68/tcp
#firewall-cmd --zone=internal --permanent --add-port=68/udp
# LDAP (not enabled)
#firewall-cmd --zone=internal --permanent --add-service=ldap
#firewall-cmd --zone=internal --permanent --add-service=ldaps
# OpenVPN (not enabled)
#firewall-cmd --zone=external --permanent --add-service=openvpn
#firewall-cmd --zone=internal --permanent --add-service=openvpn
# Privoxy
firewall-cmd --zone=internal --permanent --add-service=privoxy
# XMPP
firewall-cmd --zone=external --permanent --add-service=xmpp-server
firewall-cmd --zone=internal --permanent --add-service=xmpp-server
firewall-cmd --zone=external --permanent --add-service=xmpp-client
firewall-cmd --zone=internal --permanent --add-service=xmpp-client
firewall-cmd --zone=external --permanent --add-service=xmpp-bosh
firewall-cmd --zone=internal --permanent --add-service=xmpp-bosh
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
#
# Enable Apache modules required for Plinth.
echo "Configuring Apache for Plinth..."
make-ssl-cert generate-default-snakeoil
a2enmod headers
a2enmod proxy
a2enmod proxy_http
a2enmod rewrite
a2enmod ssl
a2dissite default
a2ensite plinth.conf
a2ensite plinth-ssl.conf
echo "Done configuring Apache for Plinth."