delegateの設定

■環境
 ・FreeBSD11.0
①delegateのインストール
pkg install delegate
②起動スクリプトの作成
 ❒/etc/rc.d/delegate
#!/bin/sh
#
# $FreeBSD: DELEGATE 2016/10/26 Tejix Club $
#
# PROVIDE: delegated
# REQUIRE: DAEMON
# KEYWORD: FreeBSD
#
# Add the following line to /etc/rc.conf to enable delegated:
#
# delegated_enable="YES"
#

delegated_enable=${delegated_enable-"NO"}

. /etc/rc.subr

name="delegated"
rcvar=`set_rcvar`
dgroot="/usr/local/delegate"
dgconf="${dgroot}/conf/delegate.conf"
command="/usr/local/sbin/${name}" 
start_cmd="delegate_start"

delegate_start()
 {
    if [ -x ${command} -a -f ${dgconf} ]; then
        ${command} DGROOT=${dgroot} +=${dgconf}
        echo -n ' Start delegated '
    fi
 }

load_rc_config ${name}
run_rc_command "$1"
 ❒パーミッションの設定
chmod 755 /etc/rc.d/delegate
③delegateユーザの作成
# adduser
Username: delegate
Full name: Delegate User
Uid (Leave empty for default): 900
Login group [delegate]: 
Login group is delegate. Invite delegate into other groups? []: 
Login class [default]: 
Shell (sh csh tcsh nologin) [sh]: nologin
Home directory [/home/delegate]: /nonexistent
Home directory permissions (Leave empty for default): 
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]: no
Username   : delegate
Password   : 
Full Name  : Delegate User
Uid        : 900
Class      : 
Groups     : delegate 
Home       : /nonexistent
Home Mode  : 
Shell      : /usr/sbin/nologin
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (delegate) to the user database.
Add another user? (yes/no): no
Goodbye!
④コンフィグファイルの作成
 ❒/usr/local/delegate/conf/delegate.conf
# configuration for SOCKS Proxy

-P1080
SERVER=socks
MOUNT='/* sftp://*'
RELIABLE='192.168.1.0/24'
PERMIT='*:*:*'
DGROOT='/usr/local/delegate'
LOGDIR='${DGROOT}/log'
VARDIR='${DGROOT}/var'
ACTDIR='${DGROOT}/act'
LOGFILE='${LOGDIR}/${PORT}/delegate[date+%Y%W%D].log'
PROTOLOG='${LOGDIR}/${PORT}/${PROTO}[date+%Y%W%D].log'
ERRORLOG='${LOGDIR}/${PORT}/errors[date+%Y%W%D].log'
TRACELOG='${LOGDIR}/${PORT}/ptrace[date+%Y%W%D].log'
EXPIRELOG='${LOGDIR}/${PORT}/expire[date+%Y%W%D].log'
ADMIN=admin@example.com
OWNER=delegate
CRON='0 3 * * * -expire 7'
⑤必要なフォルダを作成
 ❒フォルダ作成
mkdir /usr/local/delegate
mkdir /usr/local/delegate/act
mkdir /usr/local/delegate/adm
mkdir /usr/local/delegate/conf
mkdir /usr/local/delegate/log
mkdir /usr/local/delegate/tmp
mkdir /usr/local/delegate/var
 ❒パーミッションの設定
chown -R delegate:delegate /usr/local/delegate
chmod -R 777 /usr/local/delegate
chmod 774 /usr/local/delegate/*
⑥自動起動設定
 ❒/etc/rc.conf
delegated_enable="YES"
⑦起動する
service delegate start

0 件のコメント:

コメントを投稿