Compare commits
16 Commits
master
...
a4dfee99e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4dfee99e2 | ||
|
|
8e7c97ff7f | ||
|
|
b7206fc83a | ||
|
|
2ee152f543 | ||
|
|
829be767c9 | ||
|
|
a4d3ded77e | ||
|
|
0d3bbdec8e | ||
|
|
ed3acbe2d4 | ||
|
|
9670c4e749 | ||
|
|
a3f7460150 | ||
|
|
476c51ac10 | ||
|
|
5bbe69ac5f | ||
|
|
331fb1a746 | ||
|
|
bb9392b9b0 | ||
|
|
24f48e1f96 | ||
|
|
0a31d87196 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
error.log
|
||||
75
CMakeLists.txt
Normal file
75
CMakeLists.txt
Normal file
@@ -0,0 +1,75 @@
|
||||
#################################
|
||||
# Project
|
||||
##############
|
||||
|
||||
#################################
|
||||
# Dependencies
|
||||
##############
|
||||
|
||||
#################################
|
||||
# Generated files
|
||||
##############
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/smart.conf.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/smart.conf"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/smart.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/smart"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
#################################
|
||||
# Compiler Switches
|
||||
##############
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include
|
||||
)
|
||||
|
||||
#################################
|
||||
# Source Files
|
||||
##############
|
||||
|
||||
add_executable(nwwebui nwwebui.c)
|
||||
add_executable(check_login check_login.c)
|
||||
|
||||
#################################
|
||||
# Linking
|
||||
##############
|
||||
|
||||
target_link_libraries(nwwebui
|
||||
OpenSSL::SSL
|
||||
OpenSSL::Crypto
|
||||
)
|
||||
|
||||
target_link_libraries(check_login
|
||||
${PAM_LIBRARY}
|
||||
${DL_LIBRARY}
|
||||
)
|
||||
|
||||
#################################
|
||||
# Install Files
|
||||
##############
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/smart.conf DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR})
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/smart DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
|
||||
|
||||
install(PROGRAMS apply.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
|
||||
install(PROGRAMS readconfig.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
|
||||
install(PROGRAMS settings.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
|
||||
install(PROGRAMS static.pl DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
|
||||
|
||||
install(DIRECTORY static/ DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}/static)
|
||||
|
||||
install(TARGETS check_login DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
|
||||
|
||||
install(TARGETS nwwebui DESTINATION ${CMAKE_INSTALL_SBINDIR})
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# mars-smart
|
||||
|
||||
SMArT is a web configuration tool for MARS_NWE, a Novell NetWare 3.x emulator for Linux and FreeBSD.
|
||||
8
apply.pl
8
apply.pl
@@ -138,17 +138,17 @@ sub handle_request()
|
||||
if( $p{mars_config} ne $mars_config )
|
||||
{
|
||||
# Just append the line. Messy but easy. ;)
|
||||
open( FILE, '>>' . $base . 'smart.conf' );
|
||||
open( FILE, '>>' . $smart_conf_path ) or die "Could not open $smart_conf_path: $!";
|
||||
print( FILE "\n" . '$mars_config = \'' . $p{mars_config} . '\';' . "\n" );
|
||||
close( FILE );
|
||||
}
|
||||
|
||||
open( FILE, '>' . $base . '.nwclient' );
|
||||
open( FILE, '>' . $smart_nwclient_path ) or die "Could not open $smart_nwclient_path: $!";
|
||||
print( FILE $p{bind_server} . '/' . $p{bind_user} . ' ' . $p{bind_pass } . "\n" );
|
||||
close( FILE );
|
||||
|
||||
chown( scalar( getpwnam( $nonroot_user ) ), 0, $base . '.nwclient' );
|
||||
chmod( 0600, $base . '.nwclient' );
|
||||
chown( scalar( getpwnam( $nonroot_user ) ), 0, $smart_nwclient_path );
|
||||
chmod( 0600, $smart_nwclient_path );
|
||||
}
|
||||
elsif( $c[1] eq 'users' )
|
||||
{
|
||||
|
||||
BIN
check_login
BIN
check_login
Binary file not shown.
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <security/pam_appl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int my_conv(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr);
|
||||
|
||||
|
||||
31
config.h.cmake
Normal file
31
config.h.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef NWWEBUI_CONFIG_H
|
||||
#define NWWEBUI_CONFIG_H
|
||||
|
||||
#define NWWEBUI_NAME "nwwebui"
|
||||
#define NWWEBUI_VERSION "@MARS_NWE_VERSION@"
|
||||
|
||||
#define DEFAULT_SMART_CONF "@MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf"
|
||||
#define DEFAULT_SMART_PERL "@MARS_NWE_INSTALL_FULL_LIBEXECDIR@/smart"
|
||||
|
||||
#define LOG_PATH_DEFAULT "@MARS_NWE_LOG_DIR@/nwwebui.log"
|
||||
|
||||
#define LOG_LEVEL_ERROR 0
|
||||
#define LOG_LEVEL_INFO 1
|
||||
#define LOG_LEVEL_DEBUG 2
|
||||
#define LOG_LEVEL_DEFAULT LOG_LEVEL_INFO
|
||||
|
||||
#define DEFAULT_BIND_IP "0.0.0.0"
|
||||
#define DEFAULT_SSL_ENABLE 1
|
||||
#define DEFAULT_HTTP_PORT 9080
|
||||
#define DEFAULT_HTTPS_PORT 9443
|
||||
|
||||
#define DEFAULT_CERT_FILE "@MARS_NWE_INSTALL_FULL_CONFDIR@/server.crt"
|
||||
#define DEFAULT_KEY_FILE "@MARS_NWE_INSTALL_FULL_CONFDIR@/server.key"
|
||||
|
||||
#define DEFAULT_PID_FILE "@MARS_NWE_PID_DIR@/nwwebui.pid"
|
||||
#define DEFAULT_DAEMONIZE 0
|
||||
|
||||
#define NW_BACKLOG 64
|
||||
#define NW_BUF_SZ 16384
|
||||
|
||||
#endif
|
||||
335
readconfig.pl
335
readconfig.pl
@@ -1,28 +1,12 @@
|
||||
#
|
||||
# SMArT
|
||||
#
|
||||
#
|
||||
# Configuration file code
|
||||
#
|
||||
#
|
||||
# Copyright 2001 Wilmer van der Gaast (lintux@lintux.cx)
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#
|
||||
# Updated for marker-aware config writing.
|
||||
|
||||
my( @info, @conf, $l );
|
||||
my( @info, @conf, @rawconf, $l );
|
||||
|
||||
$info[1] = 'Volume';
|
||||
$info[2] = 'Server name';
|
||||
@@ -53,6 +37,7 @@ $info[47] = 'Trustee files';
|
||||
$info[50] = 'Conversion tables';
|
||||
$info[60] = 'MAX_CONNECTIONS';
|
||||
$info[61] = 'MAX_NW_VOLS';
|
||||
$info[62] = 'Reserved';
|
||||
$info[63] = 'MAX_DIR_BASE_ENTRIES';
|
||||
$info[68] = 'USE_MMAP';
|
||||
$info[69] = 'HANDLE_ALL_SAP_TYPS';
|
||||
@@ -79,19 +64,25 @@ $info[400] = 'nwserv.stations file';
|
||||
$info[401] = 'Reply to nearest server requests';
|
||||
$info[402] = 'Reply to connect requests';
|
||||
|
||||
open( CONF, '<' . $mars_config );
|
||||
open( CONF, '<' . $mars_config ) or die "Could not open $mars_config: $!";
|
||||
@conf = ();
|
||||
@rawconf = ();
|
||||
|
||||
while( $l = <CONF> )
|
||||
{
|
||||
$l =~ s/[\r\n]//g;
|
||||
$l =~ s/[\t ]+/ /g;
|
||||
$l =~ s/#.*//;
|
||||
$l =~ s/^[\t ]*//;
|
||||
$l =~ s/[\t ]*$//;
|
||||
if( $l ne '' )
|
||||
{
|
||||
unshift( @conf, $l );
|
||||
}
|
||||
push( @rawconf, $l );
|
||||
|
||||
my $x = $l;
|
||||
$x =~ s/[\r\n]//g;
|
||||
$x =~ s/[\t ]+/ /g;
|
||||
$x =~ s/#.*//;
|
||||
$x =~ s/^[\t ]*//;
|
||||
$x =~ s/[\t ]*$//;
|
||||
|
||||
if( $x ne '' )
|
||||
{
|
||||
push( @conf, $x );
|
||||
}
|
||||
}
|
||||
close( CONF );
|
||||
|
||||
@@ -99,53 +90,279 @@ sortconfig();
|
||||
|
||||
sub sortconfig()
|
||||
{
|
||||
@conf = sort( { $a cmp $b } @conf );
|
||||
@conf = sort( { ( split( ' ', $a ) )[0] <=> ( split( ' ', $b ) )[0] } @conf );
|
||||
@conf = sort( { $a cmp $b } @conf );
|
||||
@conf = sort( { ( split( ' ', $a ) )[0] <=> ( split( ' ', $b ) )[0] } @conf );
|
||||
}
|
||||
|
||||
sub getconfigline( $ )
|
||||
{
|
||||
my( @c, $c );
|
||||
|
||||
@c = getconfig( @_ );
|
||||
$c = $c[0];
|
||||
$c =~ s/^[0-9]* //;
|
||||
return( $c );
|
||||
my( @c, $c );
|
||||
|
||||
@c = getconfig( @_ );
|
||||
$c = $c[0];
|
||||
$c =~ s/^[0-9]* //;
|
||||
return( $c );
|
||||
}
|
||||
|
||||
sub getconfig( $ )
|
||||
{
|
||||
my( @c );
|
||||
|
||||
@c = grep( /^$_[0] /i, @conf );
|
||||
return( @c );
|
||||
my( @c );
|
||||
|
||||
@c = grep( /^$_[0] /i, @conf );
|
||||
return( @c );
|
||||
}
|
||||
|
||||
sub addconfigline( $ )
|
||||
{
|
||||
unshift( @conf, $_[0] );
|
||||
unshift( @conf, $_[0] );
|
||||
}
|
||||
|
||||
sub delconfigline( $ )
|
||||
{
|
||||
@conf = grep( !/^$_[0] /i, grep( !/^$_[0]$/i, @conf ) );
|
||||
@conf = grep( !/^$_[0] /i, grep( !/^$_[0]$/i, @conf ) );
|
||||
}
|
||||
|
||||
sub normalize_line( $ )
|
||||
{
|
||||
my $x = $_[0];
|
||||
|
||||
$x =~ s/[\r\n]//g;
|
||||
$x =~ s/[\t ]+/ /g;
|
||||
$x =~ s/#.*//;
|
||||
$x =~ s/^[\t ]*//;
|
||||
$x =~ s/[\t ]*$//;
|
||||
|
||||
return( $x );
|
||||
}
|
||||
|
||||
sub section_of_line( $ )
|
||||
{
|
||||
my $x = normalize_line( $_[0] );
|
||||
|
||||
if( $x =~ /^([0-9]+)\b/ )
|
||||
{
|
||||
return( $1 );
|
||||
}
|
||||
|
||||
return( '' );
|
||||
}
|
||||
|
||||
sub grouped_section_key( $ )
|
||||
{
|
||||
my $sec = $_[0];
|
||||
|
||||
if( $sec >= 100 && $sec <= 106 ) { return '100-106'; }
|
||||
if( $sec >= 200 && $sec <= 202 ) { return '200-202'; }
|
||||
if( $sec >= 210 && $sec <= 211 ) { return '210-211'; }
|
||||
if( $sec >= 300 && $sec <= 302 ) { return '300-302'; }
|
||||
|
||||
return $sec;
|
||||
}
|
||||
|
||||
sub build_marker_map()
|
||||
{
|
||||
my( %map, $line, $sec, $key );
|
||||
|
||||
foreach $line ( @conf )
|
||||
{
|
||||
$sec = section_of_line( $line );
|
||||
next if $sec eq '';
|
||||
|
||||
$key = grouped_section_key( $sec );
|
||||
push( @{ $map{$key} }, $line );
|
||||
}
|
||||
|
||||
# Keep SYS as first entry in section 1
|
||||
if( defined( $map{'1'} ) )
|
||||
{
|
||||
my @sys = grep( /^1 SYS /, @{ $map{'1'} } );
|
||||
my @rest = grep( !/^1 SYS /, @{ $map{'1'} } );
|
||||
$map{'1'} = [ @sys, @rest ];
|
||||
}
|
||||
|
||||
return %map;
|
||||
}
|
||||
|
||||
sub writeconfig_compact()
|
||||
{
|
||||
my( $i, $l );
|
||||
|
||||
sortconfig();
|
||||
|
||||
open( CONF, '>' . $mars_config ) or die "Could not write $mars_config: $!";
|
||||
|
||||
$l = ( getconfig( '1 SYS' ) )[0];
|
||||
delconfigline( '1 SYS' );
|
||||
addconfigline( $l );
|
||||
|
||||
foreach $i ( @conf )
|
||||
{
|
||||
$l = $i;
|
||||
$l =~ s/ .*//;
|
||||
printf( CONF "%-50s # %s\n", $i, $info[$l] );
|
||||
}
|
||||
|
||||
close( CONF );
|
||||
}
|
||||
|
||||
sub writeconfig_markers()
|
||||
{
|
||||
my( %secmap, %emitted );
|
||||
my( $line, $active_key, $inside_active );
|
||||
|
||||
%secmap = build_marker_map();
|
||||
$inside_active = '';
|
||||
|
||||
open( CONF, '>' . $mars_config ) or die "Could not write $mars_config: $!";
|
||||
|
||||
foreach $line ( @rawconf )
|
||||
{
|
||||
if( $line =~ /^\s*#\s*>>>\s*SMARTHOOK\s+SECTION\s+([0-9]+(?:-[0-9]+)?)\s+ACTIVE\s+BEGIN/i )
|
||||
{
|
||||
$active_key = $1;
|
||||
$inside_active = $active_key;
|
||||
|
||||
print CONF $line;
|
||||
|
||||
if( defined( $secmap{$active_key} ) )
|
||||
{
|
||||
foreach my $entry ( @{ $secmap{$active_key} } )
|
||||
{
|
||||
print CONF $entry . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$emitted{$active_key} = 1;
|
||||
next;
|
||||
}
|
||||
|
||||
if( $line =~ /^\s*#\s*<<<\s*SMARTHOOK\s+SECTION\s+([0-9]+(?:-[0-9]+)?)\s+ACTIVE\s+END/i )
|
||||
{
|
||||
$inside_active = '';
|
||||
print CONF $line;
|
||||
next;
|
||||
}
|
||||
|
||||
if( $inside_active ne '' )
|
||||
{
|
||||
# Skip old content inside ACTIVE blocks completely.
|
||||
next;
|
||||
}
|
||||
|
||||
print CONF $line;
|
||||
}
|
||||
|
||||
close( CONF );
|
||||
}
|
||||
|
||||
sub writeconfig_preserve_layout()
|
||||
{
|
||||
my( %secmap, %written, @sections, $sec, $line, $sysline );
|
||||
my( $heading_sec );
|
||||
|
||||
sortconfig();
|
||||
|
||||
$sysline = ( grep( /^1 SYS /, @conf ) )[0];
|
||||
if( defined( $sysline ) )
|
||||
{
|
||||
@conf = grep( $_ ne $sysline, @conf );
|
||||
unshift( @conf, $sysline );
|
||||
}
|
||||
|
||||
foreach $line ( @conf )
|
||||
{
|
||||
$sec = section_of_line( $line );
|
||||
if( $sec ne '' )
|
||||
{
|
||||
push( @{ $secmap{$sec} }, $line );
|
||||
}
|
||||
}
|
||||
|
||||
open( CONF, '>' . $mars_config ) or die "Could not write $mars_config: $!";
|
||||
|
||||
foreach $line ( @rawconf )
|
||||
{
|
||||
if( $line =~ /^\s*#.*Section\s+([0-9]+)\b/i )
|
||||
{
|
||||
$heading_sec = $1;
|
||||
|
||||
foreach $sec ( sort { $a <=> $b } keys( %secmap ) )
|
||||
{
|
||||
next if $written{$sec};
|
||||
next if $sec > $heading_sec;
|
||||
|
||||
if( defined( $secmap{$sec} ) )
|
||||
{
|
||||
foreach my $entry ( @{ $secmap{$sec} } )
|
||||
{
|
||||
print CONF $entry . "\n";
|
||||
}
|
||||
}
|
||||
$written{$sec} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$sec = section_of_line( $line );
|
||||
|
||||
if( $sec eq '' )
|
||||
{
|
||||
print CONF $line;
|
||||
next;
|
||||
}
|
||||
|
||||
if( ! $written{$sec} )
|
||||
{
|
||||
if( defined( $secmap{$sec} ) )
|
||||
{
|
||||
foreach my $entry ( @{ $secmap{$sec} } )
|
||||
{
|
||||
print CONF $entry . "\n";
|
||||
}
|
||||
}
|
||||
$written{$sec} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@sections = sort { $a <=> $b } keys( %secmap );
|
||||
foreach $sec ( @sections )
|
||||
{
|
||||
next if $written{$sec};
|
||||
|
||||
print CONF "\n";
|
||||
foreach my $entry ( @{ $secmap{$sec} } )
|
||||
{
|
||||
print CONF $entry . "\n";
|
||||
}
|
||||
$written{$sec} = 1;
|
||||
}
|
||||
|
||||
close( CONF );
|
||||
}
|
||||
|
||||
sub config_has_smart_markers()
|
||||
{
|
||||
foreach my $line ( @rawconf )
|
||||
{
|
||||
if( $line =~ /SMARTHOOK\s+SECTION/i )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub writeconfig()
|
||||
{
|
||||
my( $i, $l );
|
||||
|
||||
sortconfig();
|
||||
|
||||
open( CONF, '>' . $mars_config );
|
||||
$l = ( getconfig( '1 SYS' ) )[0];
|
||||
delconfigline( '1 SYS' );
|
||||
addconfigline( $l );
|
||||
foreach $i ( @conf )
|
||||
{
|
||||
$l = $i;
|
||||
$l =~ s/ .*//;
|
||||
printf( CONF "%-50s # %s\n", $i, $info[$l] );
|
||||
}
|
||||
close( CONF );
|
||||
if( defined( $smart_compact_nwservconf ) && $smart_compact_nwservconf )
|
||||
{
|
||||
writeconfig_compact();
|
||||
}
|
||||
elsif( config_has_smart_markers() )
|
||||
{
|
||||
writeconfig_markers();
|
||||
}
|
||||
else
|
||||
{
|
||||
writeconfig_preserve_layout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1167,7 +1167,7 @@ EOF
|
||||
}
|
||||
elsif( $c[1] eq 'smart' )
|
||||
{
|
||||
open( FILE, '<' . $base . '.nwclient' );
|
||||
open( FILE, '<' . $smart_nwclient_path ) or die "Could not open $smart_nwclient_path: $!";
|
||||
$x = <FILE>;
|
||||
close( FILE );
|
||||
|
||||
|
||||
@@ -25,16 +25,18 @@
|
||||
|
||||
$redirected = 0;
|
||||
|
||||
$server_id = 'Server: SMArT/Perl/0.99';
|
||||
$base = $0;
|
||||
$base =~ s/\/[^\/]*$//g;
|
||||
$base .= '/';
|
||||
$server_id = 'Server: SMArT/Perl/@MARS_NWE_VERSION@';
|
||||
|
||||
do( $base . 'smart.conf' );
|
||||
do( '@MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf' )
|
||||
or die "Could not load @MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf: $@ $!";
|
||||
|
||||
close( STDERR );
|
||||
open( STDERR, '>>' . $base . 'error.log' );
|
||||
$ENV{HOME} = $base;
|
||||
open( STDERR, '>>' . $smart_log_path )
|
||||
or die "Could not open $smart_log_path: $!";
|
||||
|
||||
$ENV{HOME} = '@MARS_NWE_INSTALL_FULL_CONFDIR@';
|
||||
$smart_libexec_dir = '@MARS_NWE_INSTALL_FULL_LIBEXECDIR@';
|
||||
$smart_libexec_dir =~ s#/*$##;
|
||||
|
||||
$l = <STDIN>;
|
||||
$l =~ s/[\n\r]//g;
|
||||
@@ -75,7 +77,7 @@ else
|
||||
if( $l[0] ne 'root' )
|
||||
{ error( 401 ); }
|
||||
else
|
||||
{ if( $x = system( $base . 'check_login', @l ) )
|
||||
{ if( $x = system( $smart_check_login, @l ) )
|
||||
{ error( 401 ); } }
|
||||
}
|
||||
}
|
||||
@@ -104,14 +106,14 @@ foreach $p ( @p )
|
||||
|
||||
if( $c[0] eq 'apply' )
|
||||
{
|
||||
do( $base . 'readconfig.pl' );
|
||||
do( $base . 'apply.pl' );
|
||||
do( $smart_libexec_dir . '/readconfig.pl' );
|
||||
do( $smart_libexec_dir . '/apply.pl' );
|
||||
handle_request();
|
||||
exit;
|
||||
}
|
||||
elsif( $c[0] eq 'settings' )
|
||||
{
|
||||
do( $base . 'readconfig.pl' );
|
||||
do( $smart_libexec_dir . '/readconfig.pl' );
|
||||
}
|
||||
|
||||
drop_root();
|
||||
@@ -137,11 +139,11 @@ EOF
|
||||
}
|
||||
elsif( $c[0] eq 'static' )
|
||||
{
|
||||
do( $base . 'static.pl' );
|
||||
do( $smart_libexec_dir . '/static.pl' );
|
||||
}
|
||||
elsif( $c[0] eq 'settings' )
|
||||
{
|
||||
do( $base . 'settings.pl' );
|
||||
do( $smart_libexec_dir . '/settings.pl' );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -239,7 +241,7 @@ EOF
|
||||
|
||||
sub get_server
|
||||
{
|
||||
open( SFILE, '<' . $base . '.nwclient' );
|
||||
open( SFILE, '<' . $smart_nwclient_path );
|
||||
chomp( $line = <SFILE> );
|
||||
close( SFILE );
|
||||
|
||||
@@ -249,7 +251,7 @@ sub get_server
|
||||
|
||||
sub get_bindery_password
|
||||
{
|
||||
open( SFILE, '<' . $base . '.nwclient' );
|
||||
open( SFILE, '<' . $smart_nwclient_path );
|
||||
chomp( $line = <SFILE> );
|
||||
close( SFILE );
|
||||
|
||||
11
smart.conf
11
smart.conf
@@ -1,11 +0,0 @@
|
||||
$COLOR_BACK = "#F0F0FF";
|
||||
$COLOR_HEAD_BACK = "#C0C0FF";
|
||||
$COLOR_HEAD_FORE = "#000000";
|
||||
$COLOR_SUBH_BACK = "#D0D0FF";
|
||||
$COLOR_SUBH_FORE = "#000000";
|
||||
$COLOR_TEXT_BACK = "#E0E0FF";
|
||||
$COLOR_TEXT_FORE = "#000000";
|
||||
|
||||
$mars_config = '/usr/local/etc/nwserv.conf';
|
||||
|
||||
$nonroot_user = 'nobody';
|
||||
118
smart.conf.cmake
Normal file
118
smart.conf.cmake
Normal file
@@ -0,0 +1,118 @@
|
||||
# SMArT / nwwebui configuration file
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# UI colors
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# Background color used for the main page body.
|
||||
$COLOR_BACK = "#F0F0FF";
|
||||
|
||||
# Background color used for section headers.
|
||||
$COLOR_HEAD_BACK = "#C0C0FF";
|
||||
|
||||
# Text color used for section headers.
|
||||
$COLOR_HEAD_FORE = "#000000";
|
||||
|
||||
# Background color used for subsection headers.
|
||||
$COLOR_SUBH_BACK = "#D0D0FF";
|
||||
|
||||
# Text color used for subsection headers.
|
||||
$COLOR_SUBH_FORE = "#000000";
|
||||
|
||||
# Background color used for normal content rows.
|
||||
$COLOR_TEXT_BACK = "#E0E0FF";
|
||||
|
||||
# Text color used for normal content rows.
|
||||
$COLOR_TEXT_FORE = "#000000";
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Main MARS NWE configuration
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# Path to the main mars_nwe server configuration file.
|
||||
# This file is read and modified by the SMArT configuration pages.
|
||||
$mars_config = '@MARS_NWE_INSTALL_FULL_CONFDIR@/nwserv.conf';
|
||||
|
||||
# User name used when SMArT drops privileges for non-root operations.
|
||||
# Keep this set to an unprivileged local account.
|
||||
$nonroot_user = 'nobody';
|
||||
|
||||
# Write the mars_nwe configuration file in compact form.
|
||||
# 0 = preserve comments, blank lines and the original section layout
|
||||
# 1 = write a compact configuration file without the original long comments
|
||||
$smart_compact_nwservconf = 0;
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# SMArT internal file layout
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# Absolute path to the SMArT configuration file itself.
|
||||
# Used when SMArT needs to append updated settings.
|
||||
$smart_conf_path = '@MARS_NWE_INSTALL_FULL_CONFDIR@/smart.conf';
|
||||
|
||||
# File used to store bindery login information for SMArT helper tools.
|
||||
# This file should remain readable only by the service user or root.
|
||||
$smart_nwclient_path = '@MARS_NWE_INSTALL_FULL_CONFDIR@/.nwclient';
|
||||
|
||||
# Directory containing static HTML and image files served by SMArT.
|
||||
$smart_static_dir = '@MARS_NWE_INSTALL_FULL_LIBEXECDIR@/static';
|
||||
|
||||
# Log file used by the Perl SMArT frontend.
|
||||
# Keep this separate from the nwwebui log file.
|
||||
$smart_log_path = '@MARS_NWE_LOG_DIR@/smart.log';
|
||||
|
||||
# Path to the PAM-based login helper used for root authentication.
|
||||
$smart_check_login = '@MARS_NWE_INSTALL_FULL_LIBEXECDIR@/check_login';
|
||||
|
||||
# Optional explicit path to the main SMArT Perl program.
|
||||
# This is normally not required, because nwwebui already has a built-in default.
|
||||
# Uncomment and adjust only if a non-standard location must be used.
|
||||
# $smart_perl_path = '@MARS_NWE_INSTALL_FULL_LIBEXECDIR@/smart';
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# nwwebui listener settings
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# IP address used for the HTTP and HTTPS listeners.
|
||||
# Use 0.0.0.0 to listen on all IPv4 interfaces.
|
||||
# Use 127.0.0.1 for local-only testing.
|
||||
$nw_bind_ip = '0.0.0.0';
|
||||
|
||||
# Log level used by nwwebui.
|
||||
# 0 = errors only
|
||||
# 1 = informational messages
|
||||
# 2 = debug messages
|
||||
$nw_log_level = 1;
|
||||
|
||||
# Run nwwebui in daemon mode by default.
|
||||
# 0 = stay in foreground
|
||||
# 1 = detach into background
|
||||
$nw_daemonize = 0;
|
||||
|
||||
# PID file written by nwwebui.
|
||||
$nw_pid_file = '@MARS_NWE_PID_DIR@/nwwebui.pid';
|
||||
|
||||
# Enable or disable TLS/SSL support.
|
||||
# 1 = enable HTTPS listener
|
||||
# 0 = disable HTTPS listener
|
||||
#
|
||||
# When disabled, nwwebui can still serve plain HTTP if nw_http_port > 0.
|
||||
$nw_ssl_enable = 0;
|
||||
|
||||
# Plain HTTP listener port.
|
||||
# Set to 0 to disable plain HTTP completely.
|
||||
# This is useful for local or isolated-network testing.
|
||||
$nw_http_port = 9080;
|
||||
|
||||
# HTTPS listener port.
|
||||
# Used only when $nw_ssl_enable is set to 1.
|
||||
# Set to 0 to disable HTTPS listening.
|
||||
$nw_https_port = 9443;
|
||||
|
||||
# TLS certificate file in PEM format.
|
||||
# Required only when HTTPS is enabled.
|
||||
$nw_cert_file = '@MARS_NWE_INSTALL_FULL_CONFDIR@/server.crt';
|
||||
|
||||
# TLS private key file in PEM format.
|
||||
# Required only when HTTPS is enabled.
|
||||
$nw_key_file = '@MARS_NWE_INSTALL_FULL_CONFDIR@/server.key';
|
||||
Reference in New Issue
Block a user