summaryrefslogtreecommitdiff
path: root/rapid-tunneling.spec
blob: 20047d54093766c9eec6772c7b5b4612c8120863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Summary: Xorcom RapidTunneling (tm)
Name: rapid-tunneling
Version: 1.01
Release: 1
License: GPLv2
Group: Applications/Internet
URL: http://www.xorcom.com/
Source: rapid-tunneling-%{version}.tar.gz
Requires: openssh-clients busybox gnupg

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%define webroot /var/www/html/support

%description
RapidTunneling (tm) allows remote access to machines behind firewalls
and NAT routers via SSH port forwarding.

%package server
Summary: Server part of RapidTunneling
Group: Applications/Internet
Requires: openssh-server

%description server
This package contains the server files needed to run RapidTunneling Server.

%package gui
Summary: Xorcom RapidTunneling (tm) web GUI
Group: Applications/Internet
Requires: rapid-tunneling, sudo

%description gui
RapidTunneling (tm) allows remote access to machines behind firewalls
and NAT routers via SSH port forwarding.

This package contains the web-based user interface to initiate and 
control tunnels to the server.

%prep
%setup -q

%build

%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}
%{__install} -m 755 -d %{buildroot}/etc/init.d
%{__install} -m 755 sshd_support %{buildroot}/etc/init.d

%clean
%{__rm} -rf %{buildroot}

%post
# add a user with uid=gid=0
useradd -d /var/lib/rapid-tunneling/home -m -u 0 -g 0 -o rapid-tunneling 2>/dev/null || true

%preun
if [ "$1" = 0 ]; then
	userdel -r rapid-tunneling || :
fi

%post server
HOME_DIR=/var/lib/rapid-tunneling/support
NEW_USER=support
useradd -d $HOME_DIR -m $NEW_USER 2>/dev/null || :
LINE='. /usr/share/rapid-tunneling/support_env'
PROFILE=$HOME_DIR/.bash_profile
if ! fgrep -q "$LINE" $PROFILE 2>/dev/null; then 
	echo "$LINE" >> $PROFILE 
fi
/sbin/chkconfig --add sshd_support

%preun server
if [ "$1" = 0 ]; then
	/sbin/service sshd_support stop > /dev/null 2>&1 || :
	/sbin/chkconfig --del sshd_support
	userdel support || :
fi

%postun server
/sbin/service sshd_support condrestart > /dev/null 2>&1 || :

%post gui
SUDOERS=/etc/sudoers
LINE="asterisk ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling"
LINE2="asterisk ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling-status"
if ! fgrep -q "$LINE" $SUDOERS; then echo "$LINE" >> $SUDOERS; fi
if ! fgrep -q "$LINE2" $SUDOERS; then echo "$LINE2" >> $SUDOERS; fi

%preun gui
if [ "$1" = 0 ]; then
	SUDOERS=/etc/sudoers
	LINE="asterisk ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling"
	LINE2="asterisk ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling-status"
	fgrep -v "$LINE"  $SUDOERS > ${SUDOERS}.tmp && cp ${SUDOERS}.tmp $SUDOERS && rm ${SUDOERS}.tmp
	fgrep -v "$LINE2" $SUDOERS > ${SUDOERS}.tmp && cp ${SUDOERS}.tmp $SUDOERS && rm ${SUDOERS}.tmp
fi

%files
%defattr(-, root, root, 0755)
%{_sbindir}/rapid-tunneling
%{_sbindir}/rapid-tunneling-status
%{_mandir}/man8/rapid-tunneling.8*
%{_mandir}/man8/rapid-tunneling-status.8*

%files server
%defattr(-, root, root, 0755)
%config(noreplace) /etc/rapid-tunneling/rtadm
%config(noreplace) /etc/ssh/sshd_support_config
%config            /etc/init.d/sshd_support
%{_datadir}/rapid-tunneling/support_env
%{_datadir}/rapid-tunneling/bin/rtadm
%{_datadir}/rapid-tunneling/bin/rt-from-remote
/var/lib/rapid-tunneling

%files gui
%defattr(-, root, root, 0755)
%{webroot}/
%config(noreplace) /etc/rapid-tunneling/gui.htpasswd
%config /etc/httpd/conf.d/rapid-tunneling.conf

%changelog
* Sun Feb 01 2009 Alex Landau <alex.landau@xorcom.com> 1.01-1
- Added password protection in the GUI.

* Sun Dec 14 2008 Alex Landau <alex.landau@xorcom.com> 1.0-1
- Initial RPM release.