summaryrefslogtreecommitdiff
path: root/rapid-tunneling.spec
blob: 4773cb83f91950a4cabd9d22c8a121fec8db7a53 (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.12
Release: 1
License: GPLv2+
Group: Applications/Internet
URL: http://www.xorcom.com/
Source: rapid-tunneling-%{version}.tar.gz
#BuildRequires: asciidoc
Requires: openssh-clients busybox

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 shadow-utils

%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
make

%install
%{__rm} -rf %{buildroot}
make install DESTDIR=%{buildroot}
# 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 server
HOME_DIR=/var/lib/rapid-tunneling/support
NEW_USER=support
NEW_GROUP=$NEW_USER
getent group $NEW_GROUP >/dev/null || groupadd -r $NEW_GROUP
getent passwd $NEW_USER >/dev/null || \
    useradd -r -g $NEW_GROUP -d $HOME_DIR \
    -c "RapidTunneling support user" $NEW_USER
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

%post gui
# 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
SUDOERS=/etc/sudoers
user="asterisk"
TEXT="Defaults>$user !lecture
$user ALL= NOPASSWD:/usr/sbin/rapid-tunneling
$user ALL= 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
	# Not optimal, but better than nothing. Only proper fix
	# is suddoers.d:
	SUDOERS=/etc/sudoers
	sed -i -e "/NOPASSWD:\/usr\/sbin\/rapid-tunneling/d" /etc/sudoers
fi
service httpd reload

%files
%defattr(-, root, root, 0755)
%doc README README.html ChangeLog
%{_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)
%doc README ChangeLog README.html rt_handle_uploaded_key
%config            /etc/bash_completion.d/rtadm
%config(noreplace) /etc/rapid-tunneling/rtadm
%{_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
%config /etc/sudoers.d/rapid-tunneling

%changelog
* Mon Dec 19 2011 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 1.12-1
- Removed separate rapid-tunneling "user".
- Work around a bug in centos5 sudo: no more permanent "connecting".
- Separate sudoers file added for e.g. Centos6.

* Tue Jun 14 2011 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 1.11-1
- Only create rapid-tunneling user in scripts of -gui
- Don't delete created users (rpmlint, Elad)
- Dependency and misc. cleanups (rpmlint, Elad)
- License is GPL2+ (Elad)
- Do include README and upstream Changelog.

* Sun Oct  3 2010 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 1.10-1
- Get rid if the dedicated sshd.

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