Skip to content

Commit

Permalink
Merge pull request #19 from dlundquist/rename
Browse files Browse the repository at this point in the history
Rename sni_proxy -> sniproxy
  • Loading branch information
dlundquist committed Sep 2, 2013
2 parents 368a56a + 152983c commit 8eaa877
Show file tree
Hide file tree
Showing 16 changed files with 98 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Makefile.in
config.status
config.log
INSTALL
sniproxy-*.tar.gz
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SNI Proxy

Proxies incoming HTTP and TLS connections based on the hostname contained in
the initial request. This enables HTTPS name based virtual hosting to seperate
backend servers without the installing the private key on the proxy machine.
backend servers without the installing the private key on the proxy machine.

Features
--------
Expand All @@ -17,8 +17,8 @@ Features
Usage
-----

Usage: sni_proxy [-c <config>] [-f]
-c configruation file, defaults to /etc/sni_proxy.conf
Usage: sniproxy [-c <config>] [-f]
-c configruation file, defaults to /etc/sniproxy.conf
-f run in foreground, do not drop privileges


Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.60])
AC_INIT([https-sni-proxy], [0.1])
AC_CONFIG_SRCDIR([src/sni_proxy.c])
AC_INIT([sniproxy], [0.1])
AC_CONFIG_SRCDIR([src/sniproxy.c])
AM_INIT_AUTOMAKE

# Checks for programs.
Expand Down
2 changes: 1 addition & 1 deletion debian/init.d
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="HTTPS SNI proxy" # Introduce a short description here
NAME=sniproxy # Introduce the short server's name here
DAEMON=/usr/sbin/sni_proxy # Introduce the server's location here
DAEMON=/usr/sbin/sniproxy # Introduce the server's location here
DAEMON_ARGS="" # Arguments to run the daemon with
SCRIPTNAME=/etc/init.d/$NAME
ENABLED=1
Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ include /usr/share/cdbs/1/rules/autoreconf.mk
CDBS_BUILD_DEPENDS += , dh-autoreconf

install/sniproxy::
install -D -m 644 sni_proxy.conf debian/sniproxy/etc/sni_proxy.conf
install -D -m 644 sniproxy.conf debian/sniproxy/etc/sniproxy.conf

2 changes: 1 addition & 1 deletion debian/sniproxy.default
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# by setting DAEMON_ARGS to -c <file>

# Additional options that are passed to the Daemon.
#DAEMON_ARGS="-c /etc/sni_proxy.conf"
#DAEMON_ARGS="-c /etc/sniproxy.conf"

# Whether or not to run the sniproxy daemon; set to 0 to disable, 1 to enable.
ENABLED=0
Expand Down
2 changes: 1 addition & 1 deletion sni_proxy.conf → sniproxy.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# sni_proxy example configuration file
# sniproxy example configuration file
# lines that start with # are comments
# lines with only white space are ignored

Expand Down
46 changes: 46 additions & 0 deletions sniproxy.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Name: sniproxy
Version: 0.1
Release: 1%{?dist}
Summary: Transparent TLS proxy

Group: System Environment/Daemons
License: BSD
URL: https://github.com/dlundquist/sniproxy
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: autoconf, automake, curl, pcre-devel, perl
Requires: pcre

%description
Proxies incoming HTTP and TLS connections based on the hostname contained in
the initial request. This enables HTTPS name based virtual hosting to seperate
backend servers without the installing the private key on the proxy machine.


%prep
%setup -q


%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{_sbindir}/sniproxy
%doc



%changelog
2 changes: 1 addition & 1 deletion src/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sni_proxy
sniproxy
43 changes: 28 additions & 15 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@

sbin_PROGRAMS = sni_proxy
sbin_PROGRAMS = sniproxy

sni_proxy_SOURCES = sni_proxy.c \
config.c \
cfg_parser.c \
cfg_tokenizer.c \
util.c \
server.c \
listener.c \
table.c \
backend.c \
connection.c \
buffer.c \
tls.c \
http.c
sni_proxy_LDADD = -lpcre
sniproxy_SOURCES = backend.c \
backend.h \
buffer.c \
buffer.h \
cfg_parser.c \
cfg_parser.h \
cfg_tokenizer.c \
cfg_tokenizer.h \
config.c \
config.h \
connection.c \
connection.h \
http.c \
http.h \
listener.c \
listener.h \
server.c \
server.h \
sniproxy.c \
sniproxy.h \
table.c \
table.h \
tls.c \
tls.h \
util.c \
util.h
sniproxy_LDADD = -lpcre
2 changes: 1 addition & 1 deletion src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ handle_connections(fd_set *rfds, fd_set *wfds) {
void
print_connections() {
struct Connection *iter;
char filename[] = "/tmp/sni-proxy-connections-XXXXXX";
char filename[] = "/tmp/sniproxy-connections-XXXXXX";
int fd;
FILE *temp;

Expand Down
6 changes: 3 additions & 3 deletions src/sni_proxy.c → src/sniproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "sni_proxy.h"
#include "sniproxy.h"
#include "server.h"


Expand All @@ -45,7 +45,7 @@ static void daemonize(const char *);
int
main(int argc, char **argv) {
struct Config *config = NULL;
const char *config_file = "/etc/sni_proxy.conf";
const char *config_file = "/etc/sniproxy.conf";
int background_flag = 1;
int opt;

Expand Down Expand Up @@ -160,5 +160,5 @@ daemonize(const char *username) {

static void
usage() {
fprintf(stderr, "Usage: sni_proxy [-c <config>] [-f]\n");
fprintf(stderr, "Usage: sniproxy [-c <config>] [-f]\n");
}
6 changes: 3 additions & 3 deletions src/sni_proxy.h → src/sniproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SNI_PROXY_H
#define SNI_PROXY_H
#ifndef SNIPROXY_H
#define SNIPROXY_H

#define SYSLOG_IDENT "sni_proxy"
#define SYSLOG_IDENT "sniproxy"
#define SYSLOG_FACILITY LOG_DAEMON
#define DEFAULT_USERNAME "daemon"

Expand Down
2 changes: 1 addition & 1 deletion tests/config_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
int main() {
struct Config *config;

config = init_config("../sni_proxy.conf");
config = init_config("../sniproxy.conf");
if (config == NULL) {
fprintf(stderr, "Failed to parse config\n");
return 1;
Expand Down
6 changes: 3 additions & 3 deletions tests/connection_reset_test
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use File::Temp;
sub proxy {
my $config = shift;

exec(@_, '../src/sni_proxy', '-f', '-c', $config);
exec(@_, '../src/sniproxy', '-f', '-c', $config);
}

sub simple_server($) {
Expand Down Expand Up @@ -93,7 +93,7 @@ sub main {
my $httpd_port = $ENV{TEST_HTTPD_PORT} || 8081;

my $config = make_config($proxy_port, $httpd_port);
my $proxy_pid = start_child('sni_proxy', \&proxy, $config, @ARGV);
my $proxy_pid = start_child('sniproxy', \&proxy, $config, @ARGV);
my $httpd_pid = start_child('server', \&simple_server, $httpd_port);

# Wait for proxy to load and parse config
Expand All @@ -111,7 +111,7 @@ sub main {

# For troubleshooting connections stuck in CLOSE_WAIT state
#kill 10, $proxy_pid;
#system("netstat -ptn | grep $proxy_pid\/sni_proxy");
#system("netstat -ptn | grep $proxy_pid\/sniproxy");

# For troubleshooting 100% CPU usage
#system("top -n 1 -p $proxy_pid -b");
Expand Down
4 changes: 2 additions & 2 deletions tests/functional_test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use File::Temp;
sub proxy {
my $config = shift;

exec(@_, '../src/sni_proxy', '-f', '-c', $config);
exec(@_, '../src/sniproxy', '-f', '-c', $config);
}

sub worker($$$$) {
Expand Down Expand Up @@ -59,7 +59,7 @@ sub main {

# For troubleshooting connections stuck in CLOSE_WAIT state
#kill 10, $proxy_pid;
#system("netstat -ptn | grep $proxy_pid\/sni_proxy");
#system("netstat -ptn | grep $proxy_pid\/sniproxy");

# For troubleshooting 100% CPU usage
#system("top -n 1 -p $proxy_pid -b");
Expand Down

0 comments on commit 8eaa877

Please sign in to comment.