From c380284d8f5be0e5a8d6d3cb7a1b9ba25a835425 Mon Sep 17 00:00:00 2001 From: Christopher Young Date: Fri, 7 Aug 2015 21:53:52 -0400 Subject: [PATCH] Startup scripts. --- image/dhcpd.conf | 118 ++++++++++++++++++++++++++++++++++++++++++ image/hostapd.conf | 7 +++ image/interfaces | 14 +++++ image/isc-dhcp-server | 21 ++++++++ image/sshd_config | 87 +++++++++++++++++++++++++++++++ init.d-stratux | 64 +++++++++++++++++++++++ 6 files changed, 311 insertions(+) create mode 100644 image/dhcpd.conf create mode 100644 image/hostapd.conf create mode 100644 image/interfaces create mode 100644 image/isc-dhcp-server create mode 100644 image/sshd_config create mode 100755 init.d-stratux diff --git a/image/dhcpd.conf b/image/dhcpd.conf new file mode 100644 index 00000000..bdf9dd6f --- /dev/null +++ b/image/dhcpd.conf @@ -0,0 +1,118 @@ +# +# Sample configuration file for ISC dhcpd for Debian +# +# + +# The ddns-updates-style parameter controls whether or not the server will +# attempt to do a DNS update when a lease is confirmed. We default to the +# behavior of the version 2 packages ('none', since DHCP v2 didn't +# have support for DDNS.) +ddns-update-style none; + + +# option definitions common to all supported networks... +#option domain-name "stratux.local"; +#option domain-name-servers ns1.example.org, ns2.example.org; + +default-lease-time 600; +max-lease-time 7200; + +# If this DHCP server is the official DHCP server for the local +# network, the authoritative directive should be uncommented. +authoritative; + +# Use this to send dhcp log messages to a different log file (you also +# have to hack syslog.conf to complete the redirection). +log-facility local7; + +# No service will be given on this subnet, but declaring it helps the +# DHCP server to understand the network topology. + +#subnet 10.152.187.0 netmask 255.255.255.0 { +#} + +# This is a very basic subnet declaration. + +#subnet 10.254.239.0 netmask 255.255.255.224 { +# range 10.254.239.10 10.254.239.20; +# option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; +#} + +# This declaration allows BOOTP clients to get dynamic addresses, +# which we don't really recommend. + +#subnet 10.254.239.32 netmask 255.255.255.224 { +# range dynamic-bootp 10.254.239.40 10.254.239.60; +# option broadcast-address 10.254.239.31; +# option routers rtr-239-32-1.example.org; +#} + +# A slightly different configuration for an internal subnet. +#subnet 10.5.5.0 netmask 255.255.255.224 { +# range 10.5.5.26 10.5.5.30; +# option domain-name-servers ns1.internal.example.org; +# option domain-name "internal.example.org"; +# option routers 10.5.5.1; +# option broadcast-address 10.5.5.31; +# default-lease-time 600; +# max-lease-time 7200; +#} + +# Hosts which require special configuration options can be listed in +# host statements. If no address is specified, the address will be +# allocated dynamically (if possible), but the host-specific information +# will still come from the host declaration. + +#host passacaglia { +# hardware ethernet 0:0:c0:5d:bd:95; +# filename "vmunix.passacaglia"; +# server-name "toccata.fugue.com"; +#} + +# Fixed IP addresses can also be specified for hosts. These addresses +# should not also be listed as being available for dynamic assignment. +# Hosts for which fixed IP addresses have been specified can boot using +# BOOTP or DHCP. Hosts for which no fixed address is specified can only +# be booted with DHCP, unless there is an address range on the subnet +# to which a BOOTP client is connected which has the dynamic-bootp flag +# set. +#host fantasia { +# hardware ethernet 08:00:07:26:c0:a5; +# fixed-address fantasia.fugue.com; +#} + +# You can declare a class of clients and then do address allocation +# based on that. The example below shows a case where all clients +# in a certain class get addresses on the 10.17.224/24 subnet, and all +# other clients get addresses on the 10.0.29/24 subnet. + +#class "foo" { +# match if substring (option vendor-class-identifier, 0, 4) = "SUNW"; +#} + +#shared-network 224-29 { +# subnet 10.17.224.0 netmask 255.255.255.0 { +# option routers rtr-224.example.org; +# } +# subnet 10.0.29.0 netmask 255.255.255.0 { +# option routers rtr-29.example.org; +# } +# pool { +# allow members of "foo"; +# range 10.17.224.10 10.17.224.250; +# } +# pool { +# deny members of "foo"; +# range 10.0.29.10 10.0.29.230; +# } +#} + +subnet 192.168.10.0 netmask 255.255.255.0 { + range 192.168.10.10 192.168.10.50; + option broadcast-address 192.168.10.255; + option routers 192.168.10.1; + default-lease-time 12000; + max-lease-time 12000; + option domain-name "stratux.local"; + option domain-name-servers 4.2.2.2; +} diff --git a/image/hostapd.conf b/image/hostapd.conf new file mode 100644 index 00000000..f3c10381 --- /dev/null +++ b/image/hostapd.conf @@ -0,0 +1,7 @@ +interface=wlan0 +driver=rtl871xdrv +ssid=stratux +hw_mode=g +channel=1 +wmm_enabled=0 +ignore_broadcast_ssid=0 diff --git a/image/interfaces b/image/interfaces new file mode 100644 index 00000000..6b449f00 --- /dev/null +++ b/image/interfaces @@ -0,0 +1,14 @@ +auto lo + +iface lo inet loopback +iface eth0 inet dhcp + +allow-hotplug wlan0 +#iface wlan0 inet manual +#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf +#iface default inet dhcp + + +iface wlan0 inet static + address 192.168.10.1 + netmask 255.255.255.0 diff --git a/image/isc-dhcp-server b/image/isc-dhcp-server new file mode 100644 index 00000000..ec7fb5a5 --- /dev/null +++ b/image/isc-dhcp-server @@ -0,0 +1,21 @@ +# Defaults for isc-dhcp-server initscript +# sourced by /etc/init.d/isc-dhcp-server +# installed at /etc/default/isc-dhcp-server by the maintainer scripts + +# +# This is a POSIX shell fragment +# + +# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf). +#DHCPD_CONF=/etc/dhcp/dhcpd.conf + +# Path to dhcpd's PID file (default: /var/run/dhcpd.pid). +#DHCPD_PID=/var/run/dhcpd.pid + +# Additional options to start dhcpd with. +# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead +#OPTIONS="" + +# On what interfaces should the DHCP server (dhcpd) serve DHCP requests? +# Separate multiple interfaces with spaces, e.g. "eth0 eth1". +INTERFACES="wlan0" diff --git a/image/sshd_config b/image/sshd_config new file mode 100644 index 00000000..a07e381e --- /dev/null +++ b/image/sshd_config @@ -0,0 +1,87 @@ +# Package generated configuration file +# See the sshd_config(5) manpage for details + +# What ports, IPs and protocols we listen for +Port 22 +# Use these options to restrict which interfaces/protocols sshd will bind to +#ListenAddress :: +#ListenAddress 0.0.0.0 +Protocol 2 +# HostKeys for protocol version 2 +HostKey /etc/ssh/ssh_host_rsa_key +HostKey /etc/ssh/ssh_host_dsa_key +HostKey /etc/ssh/ssh_host_ecdsa_key +#Privilege Separation is turned on for security +UsePrivilegeSeparation yes + +# Lifetime and size of ephemeral version 1 server key +KeyRegenerationInterval 3600 +ServerKeyBits 768 + +# Logging +SyslogFacility AUTH +LogLevel INFO + +# Authentication: +LoginGraceTime 120 +PermitRootLogin yes +StrictModes yes + +RSAAuthentication yes +PubkeyAuthentication yes +AuthorizedKeysFile /etc/ssh/authorized_keys/%u + +# Don't read the user's ~/.rhosts and ~/.shosts files +IgnoreRhosts yes +# For this to work you will also need host keys in /etc/ssh_known_hosts +RhostsRSAAuthentication no +# similar for protocol version 2 +HostbasedAuthentication no +# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication +#IgnoreUserKnownHosts yes + +# To enable empty passwords, change to yes (NOT RECOMMENDED) +PermitEmptyPasswords no + +# Change to yes to enable challenge-response passwords (beware issues with +# some PAM modules and threads) +ChallengeResponseAuthentication no + +# Change to no to disable tunnelled clear text passwords +#PasswordAuthentication yes + +# Kerberos options +#KerberosAuthentication no +#KerberosGetAFSToken no +#KerberosOrLocalPasswd yes +#KerberosTicketCleanup yes + +# GSSAPI options +#GSSAPIAuthentication no +#GSSAPICleanupCredentials yes + +X11Forwarding yes +X11DisplayOffset 10 +PrintMotd no +PrintLastLog yes +TCPKeepAlive yes +#UseLogin no + +#MaxStartups 10:30:60 +#Banner /etc/issue.net + +# Allow client to pass locale environment variables +AcceptEnv LANG LC_* + +Subsystem sftp /usr/lib/openssh/sftp-server + +# Set this to 'yes' to enable PAM authentication, account processing, +# and session processing. If this is enabled, PAM authentication will +# be allowed through the ChallengeResponseAuthentication and +# PasswordAuthentication. Depending on your PAM configuration, +# PAM authentication via ChallengeResponseAuthentication may bypass +# the setting of "PermitRootLogin without-password". +# If you just want the PAM account and session checks to run without +# PAM authentication, then enable this but set PasswordAuthentication +# and ChallengeResponseAuthentication to 'no'. +UsePAM yes diff --git a/init.d-stratux b/init.d-stratux new file mode 100755 index 00000000..d96d6ea7 --- /dev/null +++ b/init.d-stratux @@ -0,0 +1,64 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: stratux +# Required-Start: $network +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: 5 +# Default-Stop: 6 +# Short-Description: Stratux ADS-B Receiver +# Description: RTL-SDR ADS-B receiver +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +DAEMON_SBIN=/usr/sbin/stratux +DAEMON_DEFS= +DAEMON_CONF= +NAME=stratux +DESC="Stratux ADS-B Receiver" +PIDFILE=/var/run/stratux.pid + +[ -x "$DAEMON_SBIN" ] || exit 0 + +DAEMON_OPTS="-B -P $PIDFILE $DAEMON_OPTS $DAEMON_CONF" + +. /lib/lsb/init-functions + +case "$1" in + start) + log_daemon_msg "Starting $DESC" "$NAME" + start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_SBIN" \ + --pidfile "$PIDFILE" -- $DAEMON_OPTS >/dev/null + log_end_msg "$?" + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_SBIN" \ + --pidfile "$PIDFILE" + log_end_msg "$?" + ;; + reload) + log_daemon_msg "Reloading $DESC" "$NAME" + start-stop-daemon --stop --signal HUP --exec "$DAEMON_SBIN" \ + --pidfile "$PIDFILE" + log_end_msg "$?" + ;; + restart|force-reload) + $0 stop + sleep 8 + $0 start + ;; + status) + status_of_proc "$DAEMON_SBIN" "$NAME" + exit $? + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload|reload|status}" >&2 + exit 1 + ;; +esac + +exit 0