Skip to content

Commit

Permalink
init: Beginning Repo and adding content
Browse files Browse the repository at this point in the history
I've had some of this around for a while, let's make sure it doesn't get
lost to the sands of time.
  • Loading branch information
brianredbeard committed May 5, 2017
1 parent 5d3ddf1 commit e8c0757
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Ignore vim files:
# swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags

# Ignore Linux home files:

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*


# Ignore MacOS home files:
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# EdgeOS Setup Scripts

## About

This repository is a set of scripts and other utilities to improve the overal
functioning of the Ubiquiti EdgeRouter series of devices. These scripts are not
maintained by Ubiquiti and are provided with no warranty expressed or implied.

Now, let's get down to bid'ness.

The Ubiquiti EdgeRouter series of devices (included in the EdgeMax line of
products) are Linux based routers with a number of features comparable to more
expensive networking gear. With a proper understanding of how the devices work,
this functionality can far exceed hardware available at 10x the price.

## Structure

```
Repo
├── Documentation - information on how the device operates
├── config_snippets - sets of configuration commands for various tasks
├── fs - files to be added to the filesystem where "fs" becomes "/"
│   └── config
│   └── scripts
│   └── post-config.d
└── scripts - scripts for day to day management
```

## Usage

To use this repository clone and then deploy desired files as follows:

```
$ scp -R fs/* router:/
```

## Contents

- `change_auth_loglevel.sh` - Fix some nits with logging on the device
- `decrease_sshguard_attack.sh` - Change the configuration of `sshguard`
- `install_packages.sh` - Persist additional packages across firmware upgrades

<!-- vim: ts=2 sw=2 expandtab tw=80 :
-->
16 changes: 16 additions & 0 deletions fs/config/scripts/post-config.d/change_auth_loglevel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

grep -q authpriv\.notice /etc/rsyslog.conf

if [ "$?" -eq "0" ]; then
sed -i 's/authpriv.notice/authpriv\.*/g' /etc/rsyslog.conf

cat <<-EOF> /etc/rsyslog.d/drop-vtysh.pl.conf
:msg, contains, "COMMAND=/usr/bin/vtysh.pl -c show ip route summary json" ~
:msg, contains, "pam_unix(sudo:session): session opened for user root by (uid=0)" ~
:msg, contains, "pam_unix(sudo:session): session closed for user root" ~
EOF
/etc/init.d/rsyslog restart
fi
exit 0
10 changes: 10 additions & 0 deletions fs/config/scripts/post-config.d/decrease_sshguard_attack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

grep -q "\-a 40" /etc/default/sshguard

if [ "$?" -eq "0" ]; then
sed -i '/ARGS/{s/-a 40/-a 30/}' /etc/default/sshguard
/etc/init.d/sshguard restart
fi

exit 0
18 changes: 18 additions & 0 deletions fs/config/scripts/post-config.d/install_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

doneit='/var/lib/my_packages'
packages='sshguard rsync iftop iptraf mtr-tiny bmon'

if [ -e $doneit ]; then
exit 0;
fi

apt-get update
apt-get install -y $packages
if [ $? == 0 ]; then
echo package install successful
touch $doneit
else
echo package install failed
fi
exit 0

0 comments on commit e8c0757

Please sign in to comment.