Compare commits
12 Commits
b2d188344e
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d821633ecb | |||
| a8d89c343d | |||
| 313ef038ee | |||
| 99aa330fbc | |||
| b0761222e1 | |||
| 4b03ce1b3d | |||
| b5866c3ef0 | |||
| 34aaf2e37a | |||
| f3e4e0f3fe | |||
| 46685dd18e | |||
| fd800adfd7 | |||
| ea3717a930 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,5 +1,4 @@
|
|||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
vim/bundle
|
config/.vim/autoload
|
||||||
vim/autoload
|
config/.vim/plugged
|
||||||
vim/plugged
|
|
||||||
|
|||||||
0
.gitmodules
vendored
0
.gitmodules
vendored
@@ -1,67 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
CD=cd
|
|
||||||
DATE=/bin/date
|
|
||||||
TAR=/bin/tar
|
|
||||||
BZIP2=/bin/bzip2
|
|
||||||
GIT=/usr/bin/git
|
|
||||||
GPG=/usr/bin/gpg
|
|
||||||
PASS=/home/vahagn/.gnupg/backup-passphrase
|
|
||||||
SRC=/home/vahagn/git
|
|
||||||
KEEP=5
|
|
||||||
BACKUP_DIR=/home/vahagn/gdrive/backup
|
|
||||||
|
|
||||||
TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z`
|
|
||||||
LOG=/mnt/hdd/backup/backup.git.$TIMESTAMP.log
|
|
||||||
BACKUP=$BACKUP_DIR/git.$TIMESTAMP.tar.bz2.gpg
|
|
||||||
SIGNATURE=$BACKUP_DIR/git.$TIMESTAMP.tar.bz2.sig
|
|
||||||
|
|
||||||
#
|
|
||||||
# debug
|
|
||||||
#
|
|
||||||
#LOG=/home/vahagn/devel/scripts/backup/log.log
|
|
||||||
#BACKUP=/home/vahagn/devel/scripts/backup/git.tar.bz2.gpg
|
|
||||||
#SRC=/home/vahagn/git/scripts.git
|
|
||||||
|
|
||||||
#
|
|
||||||
# Header
|
|
||||||
#
|
|
||||||
echo Starting $LOG | tee -a $LOG
|
|
||||||
echo start `$DATE` | tee -a $LOG
|
|
||||||
#
|
|
||||||
# Sync with BitBucket upstream repos.
|
|
||||||
#
|
|
||||||
$CD $SRC/scripts.git
|
|
||||||
$GIT fetch
|
|
||||||
$CD $SRC/test.git
|
|
||||||
$GIT fetch
|
|
||||||
#
|
|
||||||
# cd to git directory and then bzip2 all content and crypt it.
|
|
||||||
#
|
|
||||||
$CD $SRC
|
|
||||||
($TAR -cvp . | $BZIP2 -c | $GPG -c --passphrase-file $PASS --output $BACKUP --batch --quiet ) 2>&1| tee -a $LOG
|
|
||||||
#
|
|
||||||
# Remove old files
|
|
||||||
#
|
|
||||||
$CD $BACKUP_DIR
|
|
||||||
i=0
|
|
||||||
for FILE in `ls -t git.*.tar.bz2.gpg`; do
|
|
||||||
if [ $i -ge $KEEP ]; then
|
|
||||||
echo "$FILE is removed to meet keep number of backups $KEEP." | tee -a $LOG
|
|
||||||
rm $FILE 2>&1| tee -a $LOG
|
|
||||||
fi;
|
|
||||||
i=$(($i+1))
|
|
||||||
done
|
|
||||||
i=0
|
|
||||||
for FILE in `ls -t git.*.tar.bz2.sig`; do
|
|
||||||
if [ $i -ge $KEEP ]; then
|
|
||||||
echo "$FILE is removed to meet keep number of backups $KEEP." | tee -a $LOG
|
|
||||||
rm $FILE 2>&1| tee -a $LOG
|
|
||||||
fi;
|
|
||||||
i=$(($i+1))
|
|
||||||
done
|
|
||||||
#
|
|
||||||
# Footer
|
|
||||||
#
|
|
||||||
echo end `$DATE` | tee -a $LOG
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
DATE=/bin/date
|
|
||||||
SYNC="/usr/bin/rsync -auAX --delete"
|
|
||||||
TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z`
|
|
||||||
|
|
||||||
LOG=/mnt/hdd/backup/backup.mybook.vahagn.$TIMESTAMP.log
|
|
||||||
echo Starting $LOG | tee -a $LOG
|
|
||||||
echo start `$DATE` | tee -a $LOG
|
|
||||||
$SYNC /mnt/mybook/vahagn /mnt/hdd/backup | tee -a $LOG
|
|
||||||
echo end `$DATE` | tee -a $LOG
|
|
||||||
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#set -x
|
|
||||||
|
|
||||||
DATE=/bin/date
|
|
||||||
RSYNC=/usr/bin/rsync
|
|
||||||
TIMESTAMP=`$DATE +%Y%m%d-%H:%M%z`
|
|
||||||
|
|
||||||
LOGFILE=/mnt/hdd/backup/log/backup.$TIMESTAMP.log
|
|
||||||
LOG="/usr/bin/tee -a $LOGFILE"
|
|
||||||
|
|
||||||
function term() {
|
|
||||||
echo "Terminating." | $LOG
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
trap term INT
|
|
||||||
|
|
||||||
function backup() {
|
|
||||||
ORIG_DIR=$1
|
|
||||||
MIRROR_DIR=$2
|
|
||||||
shift 2
|
|
||||||
echo ""
|
|
||||||
echo "Sync $ORIG_DIR to $MIRROR_DIR"
|
|
||||||
echo "========================================================"
|
|
||||||
# Use --progress if interactive.
|
|
||||||
$RSYNC -aAXv --delete --force "$@" $ORIG_DIR $MIRROR_DIR 2>&1 | $LOG
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "There were errors while backing up $ORIG_DIR"
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
}
|
|
||||||
|
|
||||||
function backuphdd() {
|
|
||||||
HDD_ORIG=/mnt/hdd
|
|
||||||
HDD_MIRROR=/mnt/hdd2
|
|
||||||
ORIG_DIR=$HDD_ORIG/$1
|
|
||||||
MIRROR_DIR=$HDD_MIRROR/$(dirname $1)
|
|
||||||
backup $ORIG_DIR $MIRROR_DIR
|
|
||||||
}
|
|
||||||
|
|
||||||
function backupwd() {
|
|
||||||
ORIG_DIR=$1
|
|
||||||
MIRROR_DIR=192.168.0.6:/DataVolume/$2
|
|
||||||
backup $ORIG_DIR $MIRROR_DIR
|
|
||||||
}
|
|
||||||
|
|
||||||
function backuplusntag() {
|
|
||||||
ORIG_DIR="vahagn@192.168.0.3:$1"
|
|
||||||
MIRROR_DIR=$2
|
|
||||||
backup $ORIG_DIR $MIRROR_DIR -e "ssh -i /home/vahagn/.ssh/id_rsa"
|
|
||||||
}
|
|
||||||
|
|
||||||
function backupyerevak() {
|
|
||||||
ORIG_DIR="vahagn@yerevak.vostan.org:$1"
|
|
||||||
MIRROR_DIR=$2
|
|
||||||
backup $ORIG_DIR $MIRROR_DIR -e "ssh -i /home/vahagn/.ssh/id_rsa -p 24"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Log Header
|
|
||||||
#
|
|
||||||
echo Starting $LOGFILE | $LOG
|
|
||||||
echo start `$DATE` | $LOG
|
|
||||||
#
|
|
||||||
# Sync folders
|
|
||||||
#
|
|
||||||
backup "/srv/nextcloud" "/mnt/hdd/backup/docker"
|
|
||||||
backup "/var/lib/docker/volumes" "/mnt/hdd/backup/docker"
|
|
||||||
|
|
||||||
backup "/src/gerbera/music" "/mnt/hdd/public"
|
|
||||||
|
|
||||||
#backup "/srv/gitlab" "/mnt/hdd/backup/gitlab"
|
|
||||||
#backup "/srv/git" "/mnt/hdd/backup/git"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Backup Lusntag
|
|
||||||
#
|
|
||||||
backuplusntag "/home/vahagn/msdos" "/mnt/hdd/backup"
|
|
||||||
backuplusntag "/home/vahagn/devel" "/mnt/hdd/backup/lusntag"
|
|
||||||
backuplusntag "/var/www" "/mnt/hdd/backup/lusntag"
|
|
||||||
backuplusntag "/etc/nginx" "/mnt/hdd/backup/lusntag/etc"
|
|
||||||
#
|
|
||||||
# Backup Yerevak
|
|
||||||
#
|
|
||||||
backupyerevak "/home/vahagn/devel" "/mnt/hdd/backup/yerevak"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Backup hdd1 to hdd2
|
|
||||||
#
|
|
||||||
backuphdd "backup"
|
|
||||||
backuphdd "vahagn"
|
|
||||||
for i in $(ls /mnt/hdd/public); do
|
|
||||||
if [ $i != "movies" ]; then
|
|
||||||
backuphdd "public/$i"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
#
|
|
||||||
# Log Footer
|
|
||||||
#
|
|
||||||
echo end `$DATE` | $LOG
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
sudo docker create \
|
|
||||||
--name=calibre --restart=always \
|
|
||||||
-v /srv/calibre/books:/books \
|
|
||||||
-v /srv/calibre/config:/calibre-web/config \
|
|
||||||
-v /etc/localtime:/etc/localtime:ro \
|
|
||||||
-e PGID=33 -e PUID=33 -p 8095:8083 \
|
|
||||||
technosoft2000/calibre-web
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
docker run \
|
|
||||||
-d \
|
|
||||||
--net=host \
|
|
||||||
--name gerbera \
|
|
||||||
--hostname gerbera \
|
|
||||||
--restart always \
|
|
||||||
--volume /srv/gerbera/config:/root/.config \
|
|
||||||
--volume /srv/gerbera/music:/mnt/music \
|
|
||||||
--volume /srv/gerbera/video:/mnt/video \
|
|
||||||
--volume /mnt/hdd2/public/movies:/mnt/hdd_video \
|
|
||||||
--volume /mnt/hdd/public/music:/mnt/hdd_music \
|
|
||||||
gerbera/gerbera
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
sudo docker run --detach \
|
|
||||||
--name gitlab \
|
|
||||||
--hostname gitlab \
|
|
||||||
--env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.vostan.org/'; gitlab_rails['lfs_enabled'] = true; gitlab_rails['gitlab_signin_enabled'] = false;" \
|
|
||||||
--publish 8443:443 \
|
|
||||||
--publish 8080:80 \
|
|
||||||
--publish 8022:22 \
|
|
||||||
--restart always \
|
|
||||||
--volume /srv/gitlab/config:/etc/gitlab \
|
|
||||||
--volume /srv/gitlab/logs:/var/log/gitlab \
|
|
||||||
--volume /srv/gitlab/data:/var/opt/gitlab \
|
|
||||||
gitlab/gitlab-ce:latest
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
sudo docker run \
|
|
||||||
--name nextcloud \
|
|
||||||
-d \
|
|
||||||
--publish 8090:80 \
|
|
||||||
--restart always \
|
|
||||||
--volume /srv/nextcloud:/var/www/html \
|
|
||||||
nextcloud
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
rsync -av --progress --inplace --append-verify --remove-source-files -e "ssh -p 24" /mnt/ssd/deluge/done/$1 lusntag.vostan.org:/mnt/home/vahagn/tmp/tmp
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -x
|
|
||||||
if [ "$1" != "no-progress" ]; then
|
|
||||||
PROG=--progress
|
|
||||||
else
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
if [ ! -z "$*" ]; then
|
|
||||||
for i in "$@"; do
|
|
||||||
/usr/bin/rsync -av --inplace --progress --append-verify "/mnt/ssd/deluge/done/$i" "hrat:tmp/tmp/done/"
|
|
||||||
done
|
|
||||||
else
|
|
||||||
/usr/bin/rsync -av --inplace --append-verify $PROG /mnt/ssd/deluge/done hrat:tmp/tmp
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
@@ -1,9 +1,9 @@
|
|||||||
#
|
#
|
||||||
# Ctrl-a is the prefix.
|
# Ctrl-a is the prefix.
|
||||||
#
|
#
|
||||||
set -g prefix C-a
|
# unbind C-b
|
||||||
bind C-a send-prefix
|
# set-option -g prefix C-a
|
||||||
unbind C-b
|
# bind-key C-a send-prefix
|
||||||
|
|
||||||
# Start windows from #1 (default #0)
|
# Start windows from #1 (default #0)
|
||||||
set -g base-index 1
|
set -g base-index 1
|
||||||
@@ -16,8 +16,9 @@ set -g status-position top
|
|||||||
set -g history-limit 100000
|
set -g history-limit 100000
|
||||||
|
|
||||||
# 256color mode.
|
# 256color mode.
|
||||||
set -g default-terminal "tmux-256color"
|
#set -g default-terminal "tmux-256color"
|
||||||
setw -g xterm-keys on
|
set -g default-terminal "xterm-256color"
|
||||||
|
# setw -g xterm-keys on
|
||||||
|
|
||||||
# VI mode
|
# VI mode
|
||||||
set -g status-keys vi
|
set -g status-keys vi
|
||||||
@@ -51,12 +52,7 @@ bind -r M-j resize-pane -D
|
|||||||
bind -r M-k resize-pane -U
|
bind -r M-k resize-pane -U
|
||||||
bind -r M-l resize-pane -R
|
bind -r M-l resize-pane -R
|
||||||
|
|
||||||
#No mouse
|
# Mouse on/off
|
||||||
#set -g mode-mouse off
|
|
||||||
#set -g mouse-select-pane off
|
|
||||||
#set -g mouse-resize-pane off
|
|
||||||
#set -g mouse-select-window off
|
|
||||||
|
|
||||||
# bind m \
|
# bind m \
|
||||||
# set -g mode-mouse on \;\
|
# set -g mode-mouse on \;\
|
||||||
# set -g mouse-resize=pane on \;\
|
# set -g mouse-resize=pane on \;\
|
||||||
|
|||||||
2801
config/.vim/autoload/plug.vim
Normal file
2801
config/.vim/autoload/plug.vim
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,17 +0,0 @@
|
|||||||
version: '2'
|
|
||||||
|
|
||||||
|
|
||||||
services:
|
|
||||||
gerbera:
|
|
||||||
hostname: gerbera
|
|
||||||
image: gerbera/gerbera:latest
|
|
||||||
network_mode: host
|
|
||||||
volumes:
|
|
||||||
- /srv/nextcloud:/var/www/html
|
|
||||||
- gerbera:/root/.config
|
|
||||||
- /srv/gerbera/music:/music
|
|
||||||
- /mnt/hdd2_2/movies:/video
|
|
||||||
restart: always
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
gerbera:
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
|
|
||||||
networks:
|
|
||||||
gitea:
|
|
||||||
external: false
|
|
||||||
|
|
||||||
services:
|
|
||||||
server:
|
|
||||||
image: gitea/gitea:1.12.6
|
|
||||||
container_name: gitea
|
|
||||||
environment:
|
|
||||||
- USER_UID=1000
|
|
||||||
- USER_GID=1000
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
- gitea
|
|
||||||
volumes:
|
|
||||||
- gitea:/data
|
|
||||||
- /etc/timezone:/etc/timezone:ro
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
- "222:22"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
gitea:
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
version: '2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
nextcloud:
|
|
||||||
image: nextcloud:18
|
|
||||||
ports:
|
|
||||||
- 8090:80
|
|
||||||
volumes:
|
|
||||||
- /srv/nextcloud:/var/www/html
|
|
||||||
- nextcloud:/var/www/html2
|
|
||||||
restart: always
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
nextcloud:
|
|
||||||
13
install.sh
13
install.sh
@@ -6,7 +6,8 @@ else
|
|||||||
SCRIPTS=${HOME}/devel/scripts
|
SCRIPTS=${HOME}/devel/scripts
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find ${SCRIPTS}/config -name .\* -type f -exec ln \{\} . \;
|
find ${SCRIPTS}/config -maxdepth 1 -name .\* -type f -exec ln -i \{\} . \;
|
||||||
|
find ${SCRIPTS}/config -maxdepth 1 -name .\* -type d x ln -i -s \{\} . \;
|
||||||
|
|
||||||
#mkdir -p .vim/autoload .vim/bundle
|
#mkdir -p .vim/autoload .vim/bundle
|
||||||
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||||
@@ -15,4 +16,12 @@ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
|||||||
# git clone https://github.com/VundleVim/Vundle.vim.git .vim/bundle/Vundle.vim
|
# git clone https://github.com/VundleVim/Vundle.vim.git .vim/bundle/Vundle.vim
|
||||||
|
|
||||||
|
|
||||||
# [ -x ~/.bashrc.vahagn ] && source ~/.bashrc.vahagn
|
#
|
||||||
|
# Add .bashrc.vahagn to .bashrc
|
||||||
|
#
|
||||||
|
grep .bashrc.vahagn .bashrc
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
printf "# Load Vahagn's standard environment.\n"
|
||||||
|
printf "[ -f ~/.bashrc.vahagn ] && source ~/.bashrc.vahagn\n" >> .bashrc
|
||||||
|
printf "[ -f ~/.bashrc.local ] && source ~/.bashrc.local\n" >> .bashrc
|
||||||
|
fi
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
[user]
|
|
||||||
email = vahagn.khachatryan@gmail.com
|
|
||||||
name = Vahagn Khachatryan
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
# Note that value for 'User' must be 'git'.
|
|
||||||
|
|
||||||
Host lusntag
|
|
||||||
HostName lusntag.vostan.org
|
|
||||||
Port 8080
|
|
||||||
PreferredAuthentications publickey
|
|
||||||
IdentityFile ~/.ssh/id_rsa
|
|
||||||
User vahagn
|
|
||||||
|
|
||||||
Host yerevak
|
|
||||||
HostName yerevak.vostan.org
|
|
||||||
Port 24
|
|
||||||
PreferredAuthentications publickey
|
|
||||||
IdentityFile ~/.ssh/id_rsa
|
|
||||||
User vahagn
|
|
||||||
|
|
||||||
|
|
||||||
Host hrat
|
|
||||||
HostName 192.168.0.4
|
|
||||||
PreferredAuthentications publickey
|
|
||||||
IdentityFile ~/.ssh/id_rsa
|
|
||||||
User vahagn
|
|
||||||
ProxyCommand=ssh -W %h:%p lusntag
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
__
|
|
||||||
\ \ _____ _ _ _ _ ____
|
|
||||||
/ / / _ | | | | | | | / _ \
|
|
||||||
/ /___| | |_| |_| |_| | |_| | | |
|
|
||||||
(______| | \________/\_____/ |_|
|
|
||||||
|_|
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
_ _
|
|
||||||
| | ____ _ |_\_ ___ _ _ _ ___
|
|
||||||
| | / _ \ _ | | | | | __/ _ \| | | | | |/ _ \
|
|
||||||
| |__| | | | |_| |_| | |_) | |/) / |_| | | | (_) |_
|
|
||||||
\____|_| |_|___,\___/ \___/| |\_/\_________/\__ _|
|
|
||||||
|_| |_|
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
[96m
|
|
||||||
_ _ _
|
|
||||||
| |__ ____ | |_ _ _ _| |
|
|
||||||
| __|_/ _ \| _|_ _ | | | | | | | _
|
|
||||||
| |__| | | |_| |_| | |_| |_| |_| | |_| |
|
|
||||||
\____/| | \____/\___\_______ _/\__ |
|
|
||||||
|_| |_|
|
|
||||||
|
|
||||||
[0m
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# Automatically generated by systemd-sysv-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
#SourcePath=/etc/init.d/rpcbind
|
|
||||||
Description=SSH SOCKS5 to yerevak.vostan.org
|
|
||||||
#DefaultDependencies=no
|
|
||||||
Before=shutdown.target
|
|
||||||
After=network-online.target local-fs.target
|
|
||||||
Wants=network-online.target
|
|
||||||
Conflicts=shutdown.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=vahagn
|
|
||||||
Group=vahagn
|
|
||||||
Restart=always
|
|
||||||
RestartSec=2s
|
|
||||||
WorkingDirectory=/tmp
|
|
||||||
ExecStart=/usr/bin/ssh -N -D 0.0.0.0:1080 -i /home/vahagn/.ssh/id_rsa vahagn@yerevak.vostan.org
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# Automatically generated by systemd-sysv-generator
|
|
||||||
|
|
||||||
[Unit]
|
|
||||||
Description=tun0 to SOCKS5 tunel
|
|
||||||
Before=shutdown.target
|
|
||||||
After=network-online.target local-fs.target
|
|
||||||
Wants=network-online.target ssh_socks5.service
|
|
||||||
Conflicts=shutdown.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
Restart=always
|
|
||||||
GuessMainPID=no
|
|
||||||
RemainAfterExit=yes
|
|
||||||
WorkingDirectory=/tmp
|
|
||||||
ExecStartPre=/usr/local/sbin/tun2socks_pre.sh
|
|
||||||
ExecStart=/sbin/ip netns exec soghancq /usr/local/sbin/tun2socks --tundev tun0 --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 127.0.0.1:1080 --udpgw-remote-server-addr 127.0.0.1:7300
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
NETNS=soghancq
|
|
||||||
IP=/sbin/ip
|
|
||||||
NS="$IP netns exec $NETNS"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set ip forwarding.
|
|
||||||
# Do it from /ete/sysctl.conf
|
|
||||||
#sysctl -w net.ipv4.ip_forward=1
|
|
||||||
|
|
||||||
#
|
|
||||||
# Create network namesapce.
|
|
||||||
#
|
|
||||||
$IP netns add $NETNS
|
|
||||||
|
|
||||||
#
|
|
||||||
# Peer to peer to default namespace.
|
|
||||||
#
|
|
||||||
$IP link add veth0 type veth peer name veth1
|
|
||||||
$IP addr add 10.1.1.1/30 dev veth0
|
|
||||||
$IP link set veth0 up
|
|
||||||
|
|
||||||
$IP link set veth1 netns $NETNS
|
|
||||||
$NS $IP addr add 10.1.1.2/30 dev veth1
|
|
||||||
$NS $IP link set veth1 up
|
|
||||||
$NS $IP route add 127.0.0.0/24 via 10.1.1.1 metric 5
|
|
||||||
$NS $IP route add 192.168.0.0/24 via 10.1.1.1 metric 5
|
|
||||||
#$NS $IP route add 8.8.8.8 via 10.1.1.1 metric 5
|
|
||||||
|
|
||||||
#
|
|
||||||
# Configure tun0 which goes through socks5.
|
|
||||||
#
|
|
||||||
$NS $IP tuntap add dev tun0 mode tun user root
|
|
||||||
$IP link set tun0 netns $NETNS
|
|
||||||
$NS $IP addr add 10.0.0.1/24 dev tun0
|
|
||||||
$NS $IP link set dev tun0 up
|
|
||||||
$NS $IP route add default via 10.0.0.2 metric 6
|
|
||||||
#$NS /usr/local/sbin/tun2socks \
|
|
||||||
# --tundev tun0 \
|
|
||||||
# --netif-ipaddr 10.0.0.2 \
|
|
||||||
# --netif-netmask 255.255.255.0 \
|
|
||||||
# --socks-server-addr 127.0.0.1:1080 \
|
|
||||||
# --udpgw-remote-server-addr 127.0.0.1:7300 &
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user