summaryrefslogtreecommitdiff
path: root/rapid-tunneling.spec
blob: 146dc0f5affde6bea3ad0bc4060f56a6342f6e48 (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
128
129
130
131
132
133
134
135
136
137
138
139
Summary: Xorcom RapidTunneling (tm)
Name: rapid-tunneling
Version: 1.02
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

%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
# The placeholder is needed for debs, but creates an unnecessary file 
# conflicts on rpm:
%{__rm} -f %{buildroot}/var/lib/rapid-tunneling/.placeholder

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

%post
# add a user with uid=gid=0
if ! getent passwd rapid-tunneling >/dev/null ; then
    useradd -d /var/lib/rapid-tunneling/home -m -u 0 -g 0 -o rapid-tunneling
fi

%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
user="asterisk"
TEXT="Defaults>$user !lecture
$user ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling
$user ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling-status"
if ! fgrep -q "$TEXT" $SUDOERS; then echo "$TEXT" >> $SUDOERS; fi
service httpd reload

%postun gui
if [ "$1" = 0 ]; then
	SUDOERS=/etc/sudoers
	user="asterisk"
	TEXT="Defaults>$user !lecture
$user ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling
$user ALL=(rapid-tunneling) NOPASSWD:/usr/sbin/rapid-tunneling-status"
	fgrep -v "$TEXT"  $SUDOERS > ${SUDOERS}.tmp && cp ${SUDOERS}.tmp $SUDOERS && rm ${SUDOERS}.tmp
fi
service httpd reload

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

%files server
%defattr(-, root, root, 0755)
%config            /etc/bash_completion.d/rtadm
%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)
%{_datadir}/rapid-tunneling/www
%config(noreplace) /etc/rapid-tunneling/gui.htpasswd
%config /etc/httpd/conf.d/rapid-tunneling.conf

%changelog
* Sun Jan 31 2010 Diego Iastrubni <diego.iastrubni@xorcom.com> 1.02-1
- Fixed busybox path in rapid-recovery script under Centos

* 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.