-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vHosts Package #369
Closed
Closed
vHosts Package #369
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1a6830d
Restored branch. Ready for PR but README.md needs work.
sthames42 344400c
Restored branch. Ready for PR but README.md needs work.
sthames42 41f8476
Merge branch 'vhosts-package' of https://github.com/softlife/FreeBSD-…
sthames42 1177f29
Updated README.
sthames42 c66d3aa
Merge branch 'devel' into vhosts-package
sthames42 c49f50c
Merge branch 'devel' into vhosts-package
sthames42 5249fce
Minor changes to install.
sthames42 283f83a
Changes requested for package acceptance.
sthames42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Created by: Steve Thames <[email protected]> | ||
# $FreeBSD$ | ||
#******************************************************************************* | ||
# vHosts package makefile. | ||
# see: https://github.com/pfsense/FreeBSD-ports/blob/devel/Mk/bsd.port.mk | ||
# and: https://www.freebsd.org/doc/en/books/porters-handbook/ | ||
#******************************************************************************* | ||
|
||
PORTNAME= pfSense-pkg-vHosts | ||
PORTVERSION= 1.0.0 | ||
PORTREVISION= 0 | ||
CATEGORIES= www | ||
MASTER_SITES= # empty | ||
DISTFILES= # empty | ||
EXTRACT_ONLY= # empty | ||
|
||
MAINTAINER= [email protected] | ||
COMMENT= Web Server Package for pfSense | ||
|
||
LICENSE= APACHE20 | ||
|
||
NO_BUILD= yes | ||
NO_MTREE= yes | ||
|
||
SUB_FILES= pkg-install pkg-deinstall | ||
SUB_LIST= PORTNAME=${PORTNAME} | ||
|
||
do-extract: | ||
${MKDIR} ${WRKSRC} | ||
|
||
do-install: | ||
${MKDIR} ${STAGEDIR}/etc/inc/priv | ||
${MKDIR} ${STAGEDIR}${PREFIX}/pkg/shortcuts | ||
${MKDIR} ${STAGEDIR}${PREFIX}/www | ||
${MKDIR} ${STAGEDIR}${DATADIR} | ||
${INSTALL_DATA} ${FILESDIR}/etc/inc/priv/vhosts.inc ${STAGEDIR}/etc/inc/priv | ||
${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/vhosts.xml ${STAGEDIR}${PREFIX}/pkg | ||
${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/vhosts.inc ${STAGEDIR}${PREFIX}/pkg | ||
${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/shortcuts/vhosts.inc ${STAGEDIR}${PREFIX}/pkg/shortcuts | ||
${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/vhosts.php ${STAGEDIR}${PREFIX}/www | ||
${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/vhosts_certs.php ${STAGEDIR}${PREFIX}/www | ||
${INSTALL_DATA} ${FILESDIR}${DATADIR}/info.xml ${STAGEDIR}${DATADIR} | ||
@${REINPLACE_CMD} -i '' -e "s|%%PKGVERSION%%|${PKGVERSION}|" ${STAGEDIR}${DATADIR}/info.xml | ||
|
||
.include <bsd.port.mk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# vHosts | ||
|
||
## Name/IP Based Virtual Host Web Server | ||
--- | ||
A web server package to host HTML, Javascript, CSS, and PHP as Name or IP Based virtual hosts. | ||
This is a full rewrite/port of the pre-2.3.0 vhosts package using the [nginx](https://wiki.nginx.org/) | ||
web server installed with pfSense 2.3.0 and later versions. | ||
|
||
This tool was ported to provide a simple way of returning a single page, for all requests, to a web server | ||
that sits behind the router and requires maintenance. This is a very limited requirement and using | ||
this package on the router for anything more robust than simple serving of pages is not recommended. | ||
|
||
## Configuration | ||
|
||
The vHosts server creates an instance of the nginx web server using a configuration file built from the | ||
list of vHosts definitions. The Certificates list contains SSL/TLS certificates that may be bound to hosts | ||
requiring secure connections. | ||
|
||
### Hosts | ||
|
||
* **Directory Name** | ||
<br>Document root directory name in `/usr/local/vhosts`. The default documents are `index.html`, | ||
`index.htm`, and `index.php`. If none exists, `index.php` is created to display the current PHP status. | ||
<br><br>**Note:** Other than creation of the default `index.php`, the vHosts package does not manage any | ||
of the files in a host root directory. Pages must be added and removed manually. | ||
|
||
* **IP Address** | ||
<br>Host IP address. Must be one of the IP addresses bound to the router. | ||
|
||
* **Port** | ||
<br>Port number for binding to the IP address. | ||
|
||
* **Host Name(s)** | ||
<br>Space separated list of Name-Based Host(s). Not required for an IP-Based host. | ||
|
||
* **Secure Certificate** | ||
<br>The certificate common name (CN) of the certificate selected to secure the host. Certificates must | ||
be loaded to the Certificates list before they can be assigned to a host. | ||
|
||
* **Custom Configuration** | ||
<br>Additional configuration parameters to be included in the nginx configuration. Simple parameters are | ||
recommended to prevent creating errors in the configuration. | ||
<br><br>**Note:** If the vHosts service fails to start, configuration errors will be found in `/var/log/nginx/error.log`. | ||
<br><br>Examples: | ||
- `return 301 https://$host$request_uri;` | ||
<br>Redirect the request to "https:". | ||
|
||
- `rewrite ^.*$ /allpages.html last` | ||
<br>Rewrite the URI to return a single page for all requests. | ||
|
||
### Certificates | ||
|
||
For secure hosts, the SSL/TLS certificate must be loaded into the certificates list before it can be | ||
assigned to a host. Multiple hosts may be bound to a single certificate. | ||
|
||
Certificates may be added or updated by dropping/pasting the Certificate and Certificate Key in X.509 | ||
PEM format or by loading the PKCS#12 file (.p12/.pfx) containing the key-pair. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/******************************************************************************* | ||
* vHosts package privileges. | ||
* ------------------------------------------------------------------------------ | ||
* Part of pfSense 2.3 and later (https://www.pfSense.org/). | ||
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate) | ||
* | ||
* Inspired by vhosts package originally written by Mark Crane. | ||
* Copyright (C) 2008 Mark J Crane | ||
* Copyright (C) 2015 ESF, LLC | ||
* Copyright (C) 2016 Softlife Consulting | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
global $priv_list; | ||
|
||
$priv_list['page-services-vhosts'] = array(); | ||
$priv_list['page-services-vhosts']['name'] = "WebCfg - Services: vHosts package"; | ||
$priv_list['page-services-vhosts']['descr'] = "Allow access to vHosts package GUI"; | ||
|
||
$priv_list['page-services-vhosts']['match'] = array(); | ||
$priv_list['page-services-vhosts']['match'][] = "vhosts.php*"; | ||
$priv_list['page-services-vhosts']['match'][] = "vhosts_certs.php*"; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
/usr/local/bin/php -f /etc/rc.packages %%PORTNAME%% ${2} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
if [ "${2}" != "POST-INSTALL" ]; then | ||
exit 0 | ||
fi | ||
|
||
/usr/local/bin/php -f /etc/rc.packages %%PORTNAME%% ${2} |
30 changes: 30 additions & 0 deletions
30
www/pfSense-pkg-vHosts/files/usr/local/pkg/shortcuts/vhosts.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/******************************************************************************* | ||
* vHosts package shortcuts. | ||
* ------------------------------------------------------------------------------ | ||
* Part of pfSense 2.3 and later (https://www.pfSense.org/). | ||
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate) | ||
* | ||
* Inspired by vhosts package originally written by Mark Crane. | ||
* Copyright (C) 2008 Mark J Crane | ||
* Copyright (C) 2015 ESF, LLC | ||
* Copyright (C) 2016 Softlife Consulting | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
global $shortcuts; | ||
|
||
$shortcuts['vhosts'] = array(); | ||
$shortcuts['vhosts']['service'] = 'vhostsd'; | ||
?> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not add other files like this in root port directory. This information can be moved as a comment in the source code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this one has me baffled. README.md is not included in the build and only serves as a help page for someone that might want to have a look at some documentation. The help page facility for packages is broken which is why there is no help for many packages. In the future, I'm hoping to fix that and use this file to create the actual help page. In the meantime, what is the objection to putting this file in the root given it's not included in the build?