diff options
106 files changed, 10418 insertions, 601 deletions
diff --git a/config/Fit123/bin/afc/reset_states.sh b/config/Fit123/bin/afc/reset_states.sh new file mode 100644 index 00000000..e0d0d48b --- /dev/null +++ b/config/Fit123/bin/afc/reset_states.sh @@ -0,0 +1,5 @@ +#!/bin/sh +sleep 60 +/sbin/pfctl -F state +sleep 40 +/sbin/pfctl -F state diff --git a/config/Fit123/bin/code-red/all.css b/config/Fit123/bin/code-red/all.css new file mode 100644 index 00000000..e813ff4d --- /dev/null +++ b/config/Fit123/bin/code-red/all.css @@ -0,0 +1,1178 @@ +/* Element CSS Definitions */
+html, body, td, th, input, select {
+ font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
+ font-size: 0.9em;
+
+}
+
+div.GraphLink {
+ position: relative;
+}
+
+span.GraphLinkLine {
+ position: absolute;
+ background-color: #990000;
+ width: 100%;
+}
+
+/* DOM Tooltip CSS definitions */
+div.niceTitle
+{
+ background-color: #333333;
+ color: #FFFFFF;
+ font-weight: bold;
+ font-size: 13px;
+ font-family: "Trebuchet MS", sans-serif;
+ width: 220px;
+ left: 0;
+ top: 0;
+ padding: 4px;
+ position: absolute;
+ text-align: left;
+ z-index: 20;
+ -moz-border-radius: 0 10px 10px 10px;
+ filter: progid:DXImageTransform.Microsoft.Alpha(opacity=87);
+ -moz-opacity: .87;
+ -khtml-opacity: .87;
+ opacity: .87;
+}
+div.niceTitle h1
+{
+ background: #990000;
+ border-bottom: 1px dotted #FFFFFF;
+ font-weight: bold;
+ font-size: 13px;
+ font-family: "Trebuchet MS", sans-serif;
+ margin: 3px;
+ padding-top: 1px;
+ padding-bottom: 1px;
+ padding-left: 3px;
+ text-align: left;
+ left: 0;
+ top: 0;
+ -moz-border-radius: 0 8px 0 0;
+ -moz-opacity: 1;
+}
+div.niceTitle .contents
+{
+ margin: 0;
+ padding: 0 3px;
+ filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
+ -moz-opacity: 1;
+ -khtml-opacity: 1;
+ opacity: 1;
+}
+div.niceTitle p
+{
+ background: #FFFFFF;
+ border: 1px solid #990000;
+ color: #000000;
+ font-size: 11px;
+ font-family: "Trebuchet MS", sans-serif;
+ padding: 5px;
+ margin: 3px;
+ text-align: left;
+ -moz-opacity: 1;
+ -moz-border-radius: 0 0 8px 8px;
+}
+
+body {
+ margin: 0px auto;
+ background: url('images/background.gif') no-repeat;
+ background-position : center 0px;
+ background-color: #4a0203;
+}
+
+form {
+ margin: 0px;
+}
+a {
+ text-decoration: none;
+}
+form input {
+ font-size: 1.1em;
+}
+
+iframe {
+ z-index: 1;
+ border: 1px dashed #990000;
+}
+.iframe {
+ background-color: #FFFFFF;
+}
+
+/* ID Based CSS Definitions */
+#wrapper {
+ width: 810px;
+ margin: 0px auto;
+}
+
+#header {
+ background: url('images/header.png') no-repeat;
+ background-position: 0px;
+ height: 102px;
+ width: 810px;
+ margin-bottom: 5px;
+ z-index: 2;
+}
+#header-left {
+ position: relative;
+ /* background: url('images/logo.gif') no-repeat; */
+ background-position: center;
+ height: 65px;
+ width: 145px;
+ left: 10px;
+ float: left;
+}
+#header-left #status-link {
+ position: relative;
+ top: 10px;
+ left: 6px;
+}
+#header-right {
+ position: relative;
+ /* background: url('images/header.gif') no-repeat; */
+ height: 70px;
+ color: #fff;
+ left: 0px;
+ margin-left: 165px;
+}
+#header-right .alert {
+ position: relative;
+ /* background: url('images/alert.gif') no-repeat; */
+ background-position: 4px 2px;
+ color: #fff;
+ height: 17px;
+ width: 500px;
+ padding: 4px;
+ padding-left: 27px;
+ float: left;
+}
+#header-right .container {
+ position: relative;
+}
+#header-right .container .left {
+ position: relative;
+ float: left;
+ font-size: 1.3em;
+ font-weight: bold;
+ top: 15px;
+ left: 4px;
+ display: none;
+}
+#header-right .container .right {
+ position: relative;
+ float: right;
+ top: 22px;
+ padding-right: 4px;
+ z-index: 1;
+}
+
+#header-right .container .right #alerts {
+ position: relative;
+ background: url('images/alert_bgr.png') no-repeat;
+ height: 39px;
+ width: 431px;
+ z-index: 1;
+ padding-top: 20px;
+ padding-left: 5px;
+ margin: 0px;
+}
+#header-right .container .right #hostname {
+ position: relative;
+ height: 39px;
+ width: 431px;
+ z-index: 1;
+ padding-left: 5px;
+ margin: 0px;
+ top: 25px;
+ left: 230px;
+ font-size: 14px;
+ color: #990000;
+ font-weight: bold;
+}
+
+
+
+table#marquee {
+ position: relative;
+ top: -6px;
+ left: -5px;
+ border: 0;
+ padding: 0;
+ margin: 0;
+ width: 424px;
+ background-color: transparent;
+ padding: 2px;
+ border: 0px;
+}
+span#marquee-container {
+ position: absolute;
+ visibility: hidden;
+ top: -100px;
+ left: -10000px;
+}
+div#marquee-text {
+ font-size: 1.18em;
+ font-weight: normal;
+ font-family: Verdana;
+ color: #ffffff;
+}
+table#marquee div#container {
+ position: relative;
+ overflow: hidden;
+ width: 418px;
+ height: 20px;
+}
+table#marquee div#container div#scroller {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+}
+
+
+
+
+
+#content {
+ position: relative;
+ top: -5px;
+ left: 0px;
+ margin-top: 0px;
+ margin-left: 0px;
+ padding-top: 0px;
+ width: 810px;
+ background-color: #ffffff;
+}
+
+#left {
+ width: 810px;
+ height: 1px;
+}
+#right {
+ position: relative;
+ top: -10px;
+ width: 770px;
+ margin-top: 0px;
+ margin-left: 5px;
+ margin-right: 5px;
+ padding-top: 5px;
+ padding-left: 10px;
+ padding-right: 10px;
+ padding-bottom: 20px;
+ min-height: 400px;
+}
+
+#footer {
+ position: relative;
+ background: url('images/footer.png') no-repeat;
+ top: -18px;
+ left: 0px;
+ width: 810px;
+ height: 75px;
+ color: #999999;
+ text-align: center;;
+ font-size: 0.9em;
+ padding-top: 17px;
+ margin-bottom: 20px;
+ clear: both;
+}
+#footer p {
+ padding: 0px;
+ margin: 0px;
+}
+
+/* Style the List */
+#navigation {
+ /* background: url('images/menu.gif') no-repeat; */
+ /* width: 693px; */
+ position: relative;
+ top: -35px;
+ left: 3px;
+ width: 810px;
+ padding: 0px;
+ height: 28px;
+ z-index: 3;
+}
+#navigation ul {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+ text-align: center;
+}
+#navigation ul#menu {
+ padding-top: 3px;
+ padding-left: 5px;
+}
+
+/* Style the List Elements */
+#navigation ul li {
+ float: left;
+ position: relative;
+ /* width: 7.5em; */
+ width: 8.77em;
+}
+#navigation ul li div {
+ font-size: 1em;
+ font-weight: bold;
+}
+/* Make the List inside the List Elements */
+/* initially hidden with absolute position */
+#navigation ul li ul {
+ display: none;
+ position: absolute;
+ top: 2em;
+ left: -2px;
+ width: 9em;
+ font-weight: normal;
+ background: transparent bottom left no-repeat; /* This is key to making the menu maintain visibility when not on a link */
+ /* background-color: #202020;
+ background: url("images/menu_footer.gif") no-repeat;
+ background-position: bottom;
+ */
+ padding: 0em 0 0.4em 0;
+ padding-top: 0.3em;
+}
+/* to override top and left in browsers other than IE */
+/* which will position to the top right of the containing */
+/* li, rather than bottom left */
+#navigation ul li > ul {
+ top: auto;
+ left: auto;
+ left: -1px !important;
+}
+/* Show initial drop down upon mouse over, but do not show */
+/* nested side drop menus within listed elements */
+#navigation ul li:hover ul {
+ display: block;
+ cursor: pointer;
+}
+#navigation ul li:hover {
+ cursor: pointer;
+ cursor: pointer;
+}
+#navigation ul li:hover div {
+ text-decoration: none;
+}
+
+#navigation ul li {
+ background-color: transparent;
+ color: #FFF;
+}
+#navigation ul li ul li {
+ border: 1px solid #990000;
+ width: 8.8em;
+ height: 1.6em;
+ line-height: 1.6em;
+ background-color: #990000;
+ color: #FFF;
+}
+#navigation ul li ul li:hover {
+ background-color: #666666;
+}
+
+#navigation li li a {
+ display: block;
+ padding-left: 10px;
+ padding-right: 10px;
+}
+
+#navigation ul li ul li a.navlnk:hover {
+ text-decoration: none;
+}
+#navigation ul li.first {
+ border-right: 0px;
+}
+#navigation ul li.middle {
+ border-right: 0px;
+}
+#navigation ul li.last {
+
+}
+
+#navigation ul li.dropfirst {
+ border-bottom: 0px;
+}
+#navigation ul li.dropmiddle {
+ border-bottom: 0px;
+}
+#navigation ul li.droplast {
+}
+
+#wzdtabcont {
+ float: left;
+ background-color: #FFFFFF;
+ color: #000000;
+ padding: 0;
+}
+
+ul#wzdnav {
+ font-size: 0.96em;
+ float: left;
+ width: 14.5em;
+ margin: 0;
+ padding-left: 18px;
+}
+
+ul#wzdnav li {
+ list-style: none;
+ margin: 0;
+ padding-bottom: 0.2em;
+ padding-left: 0;
+}
+
+ul#wzdnav a {
+ display: block;
+ padding: 0.3em;
+ font-weight: normal;
+}
+
+#wzdnavbold a {
+ display: block;
+ padding: 0.3em;
+ font-weight: bold ! important;
+}
+
+ul#wzdnav a:link {
+ color: black;
+ background-color: #eee;
+}
+
+ul#wzdnav a:visited {
+ color: #666;
+ background-color: #eee;
+}
+
+ul#wzdnav a:hover {
+ color: black;
+ background-color: white;
+}
+
+ul#wzdnav a:active {
+ color: white;
+ background-color: gray;
+}
+
+#graph {
+ position: relative;
+ z-index: 10;
+}
+
+#logoutbtn {
+ position: absolute;
+ left: 95%;
+ vertical-align: middle;
+}
+
+
+#graph {
+ position: relative;
+ z-index: 10;
+}
+
+
+
+/* Class Based CSS Definitions */
+.pgtitle {
+ font-size: 18px;
+ color: #777777;
+ font-weight: bold;
+}
+.tfrtitle {
+ font-size: 18px;
+ color: #ffffff;
+ font-weight: bold;
+}
+.vncell {
+ background-color: #DDDDDD;
+ padding-right: 20px;
+ padding-left: 8px;
+ border-bottom: 1px solid #999999;
+}
+.formfld {
+ font-size: small;
+}
+.formselect {
+ font-size: 1.0em;
+}
+.langopt {
+ padding-left: 34px;
+ padding-top: 2px;
+ padding-bottom: 2px;
+}
+.saved {
+ /* background: url('/themes/nione/images/icons/icon_wzd_saved.png') no-repeat 0 1px #FFFFFF; */
+ list-style-image: url('/themes/nervecenter/images/icons/icon_wzd_saved.png') ! important;
+}
+.notsaved {
+ /* background: url('/themes/nione/images/icons/icon_wzd_nsaved.png') no-repeat 0 1px #FFFFFF; */
+ list-style-image: url('/themes/nervecenter/images/icons/icon_wzd_nsaved.png') ! important;
+}
+.en {
+ background: url('/themes/nervecenter/images/icons/icon_flag_en.png') no-repeat 0 1px #FFFFFF;
+}
+.de {
+ background: url('/themes/nervecenter/images/icons/icon_flag_de.png') no-repeat 0 1px #FFFFFF;
+}
+.es {
+ background: url('/themes/nervecenter/images/icons/icon_flag_es.png') no-repeat 0 1px #FFFFFF;
+}
+.pt_BR {
+ background: url('/themes/nervecenter/images/icons/icon_flag_pt_BR.png') no-repeat 0 1px #FFFFFF;
+}
+.host {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_host.png') no-repeat 0 1px #FFFFFF;
+}
+.search {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_search.png') no-repeat 0 1px #FFFFFF;
+}
+.file {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_file.png') no-repeat 0 1px #FFFFFF;
+}
+.mail {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_mail.png') no-repeat 0 1px #FFFFFF;
+}
+.imp {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_imp.png') no-repeat 0 1px #FFFFFF;
+}
+.pwd {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_pwd.png') no-repeat 0 1px #FFFFFF;
+}
+.user {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_user.png') no-repeat 0 1px #FFFFFF ;
+}
+.group {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_group.png') no-repeat 0 1px #FFFFFF;
+}
+.url {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_url.png') no-repeat 0 1px #FFFFFF;
+}
+.time {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_time.png') no-repeat 0 1px #FFFFFF;
+}
+.unknown {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_unknown.png') no-repeat 0 1px #FFFFFF;
+}
+.formfld_cert {
+ background: url('/themes/nervecenter/images/icons/icon_frmfld_cert.png') no-repeat 0 1px #FFFFFF;
+ padding-left: 28px;
+ font-family: Courier New, Courier, monospaced;
+ font-size: 11px;
+}
+.formfldalias {
+ background-color: #990000;
+ color: #FFFFFF;
+}
+.formpre {
+ font-family: Courier New, Courier, monospaced;
+ font-size: 10px;
+}
+.formbtn {
+ font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
+ font-size: 13px;
+ font-weight: bold;
+}
+.formbtns {
+ font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
+ font-size: 10px;
+ font-weight: bold;
+}
+.vvcell {
+ background-color: #FFFFC6;
+}
+.errmsg {
+ font-weight: bold;
+ color: #CC0000;
+}
+.red {
+ color: #CC0000;
+}
+.gray {
+ color: #A0A0A0;
+}
+.vexpl {
+ font-size: 11px;
+}
+.navlnk {
+ color: #FFFFFF;
+ text-decoration: none;
+ font-size: 13px;
+}
+.navlnks {
+ color: #FFFFFF;
+ text-decoration: none;
+ font-size: 11px;
+}
+.redlnk {
+ color: #990000;
+ text-decoration: none;
+}
+.tblnk {
+ color: #999999;
+ text-decoration: none;
+}
+.vncellreq {
+ background-color: #DDDDDD;
+ padding-right: 20px;
+ padding-left: 8px;
+ font-weight: bold;
+ border-bottom: 1px solid #999999;
+}
+.vncellt {
+ background-color: #DDDDDD;
+ padding-right: 20px;
+ padding-left: 8px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ font-weight: bold;
+ border-bottom: 1px solid #999999;
+}
+.vtable {
+ border-bottom: 1px solid #999999;
+}
+.vnsepcell {
+ background-color: #BBBBBB;
+ padding-right: 20px;
+ padding-left: 8px;
+ font-weight: bold;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+}
+.cpline {
+ font-size: 11px;
+ color: #FFFFFF;
+}
+.hostname {
+ font-size: 11px;
+ color: #990000;
+ font-weight: bold;
+}
+.vnsepcellr {
+ background-color: #BBBBBB;
+ padding-right: 20px;
+ padding-left: 8px;
+ font-weight: bold;
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+}
+.listr {
+ background-color: #FFFFFF;
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+ padding-right: 6px;
+ padding-left: 6px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+}
+.listrpad {
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+ padding-right: 16px;
+ padding-left: 10px;
+ padding-top: 8px;
+ padding-bottom: 8px;
+}
+.listn {
+ font-size: 11px;
+ padding-right: 16px;
+ padding-left: 6px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+}
+.listbg {
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+ background-color: #990000;
+ color: #FFFFFF;
+ padding-right: 16px;
+ padding-left: 6px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+}
+.listbggrey {
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+ background-color: #999999;
+ padding-right: 16px;
+ padding-left: 6px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+}
+.listhdr {
+ background-color: #BBBBBB;
+ padding-right: 16px;
+ padding-left: 6px;
+ font-weight: bold;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+.listhdr a {
+ color: #000000;
+}
+.listhdrr {
+ background-color: #BBBBBB;
+ padding-right: 16px;
+ padding-left: 6px;
+ font-weight: bold;
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+.listhdrr a {
+ color: #000000;
+}
+.listlr {
+ background-color: #FFFFFF;
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ border-left: 1px solid #999999;
+ font-size: 11px;
+ padding-right: 6px;
+ padding-left: 6px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+}
+.listlrns {
+ background-color: #FFFFFF;
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ border-left: 1px solid #999999;
+ font-size: 11px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+}
+.list {
+ font-size: 11px;
+ padding-left: 6px;
+ padding-top: 2px;
+ padding-bottom: 2px;
+}
+.listt {
+ font-size: 11px;
+ padding-top: 5px;
+}
+.listhdrrns {
+ background-color: #BBBBBB;
+ padding-left: 6px;
+ padding-top: 5px;
+ padding-bottom: 5px;
+ padding-right: 6px;
+ font-weight: bold;
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+}
+.listbgns {
+ border-right: 1px solid #999999;
+ border-bottom: 1px solid #999999;
+ font-size: 11px;
+ background-color: #D9DEE8;
+ padding-left: 6px;
+ padding-right: 4px;
+ padding-top: 4px;
+ padding-bottom: 4px;
+}
+.listtopic {
+ border-right: 1px solid #999999;
+ font-size: 11px;
+ background-color: #990000;
+ padding-right: 16px;
+ padding-left: 6px;
+ color: #FFFFFF;
+ font-weight: bold;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+.optsect_t {
+ border-right: 1px solid #999999;
+ background-color: #990000;
+ padding-right: 6px;
+ padding-left: 6px;
+ padding-top: 2px;
+ padding-bottom: 2px;
+}
+.optsect_s {
+ font-size: 11px;
+ color: #FFFFFF;
+ font-weight: bold;
+}
+.tabnavtbl {
+}
+
+
+/* MISC CSS Definitions */
+ul#tabnav {
+ font-size: 11px;
+ font-weight: bold;
+ list-style-type: none;
+ margin: 0;
+ padding: 0;
+}
+ul#tabnav li.tabinact1 {
+ float: left;
+ background-color: #777777;
+ color: #FFFFFF;
+ padding: 0;
+ white-space: nowrap;
+}
+ul#tabnav li.tabinact {
+ float: left;
+ border-left: 1px solid #999999;
+ background-color: #777777;
+ color: #FFFFFF;
+ padding: 0;
+ white-space: nowrap;
+}
+ul#tabnav li.tabinact a {
+ float: left;
+ display: block;
+ text-decoration: none;
+ padding: 5px 8px 5px 8px;
+ color: #FFFFFF;
+}
+ul#tabnav li.tabinact1 a {
+ float: left;
+ display: block;
+ text-decoration: none;
+ padding: 5px 8px 5px 8px;
+ color: #FFFFFF;
+}
+ul#tabnav li.tabact {
+ float: left;
+ background-color: #EEEEEE;
+ color: #000000;
+ padding: 5px 8px 5px 8px;
+ white-space: nowrap;
+}
+.tabcont {
+ background-color: #EEEEEE;
+ padding-right: 12px;
+ padding-left: 12px;
+ padding-top: 12px;
+ padding-bottom: 12px;
+}
+.tabact {
+ float: left;
+ background-color: #EEEEEE;
+ color: #000000;
+ padding: 5px 8px 5px 8px;
+ white-space: nowrap;
+}
+.tabinact {
+ font-weight: bold;
+ float: left;
+ border-left: 1px solid #999999;
+ background-color: #777777;
+ color: #FFFFFF;
+ padding: 0;
+ white-space: nowrap;
+}
+.menu {
+ background-color: #000000;
+ white-space: nowrap;
+ padding: 0px 5px 0px 5px;
+ width: 100%;
+ vertical-align: top;
+}
+
+
+/* Auto Complete Suggestions */
+div.suggestions {
+ -moz-box-sizing: border-box;
+ /* box-sizing: border-box; */
+ border: 1px solid black;
+ position: absolute;
+ background-color: #990000;
+ color: #FFF;
+}
+
+div.suggestions div {
+ cursor: default;
+ padding: 0px 3px;
+ background-color: #990000;
+ color: #FFF;
+}
+
+div.suggestions div.current {
+ background-color: #3366cc;
+ color: #FFF;
+}
+/* End Auto Complete Suggestions */
+
+
+/* Nifty Corners Crap */
+.rtop,.artop{display:block}
+.rtop *,.artop *{display:block;height:1px;overflow:hidden;font-size:1px}
+.artop *{border-style: solid;border-width:0 1px}
+.r1,.rl1,.re1,.rel1{margin-left:5px}
+.r1,.rr1,.re1,.rer1{margin-right:5px}
+.r2,.rl2,.re2,.rel2,.ra1,.ral1{margin-left:3px}
+.r2,.rr2,.re2,.rer2,.ra1,.rar1{margin-right:3px}
+.r3,.rl3,.re3,.rel3,.ra2,.ral2,.rs1,.rsl1,.res1,.resl1{margin-left:2px}
+.r3,.rr3,.re3,.rer3,.ra2,.rar2,.rs1,.rsr1,.res1,.resr1{margin-right:2px}
+.r4,.rl4,.rs2,.rsl2,.re4,.rel4,.ra3,.ral3,.ras1,.rasl1,.res2,.resl2{margin-left:1px}
+.r4,.rr4,.rs2,.rsr2,.re4,.rer4,.ra3,.rar3,.ras1,.rasr1,.res2,.resr2{margin-right:1px}
+.rx1,.rxl1{border-left-width:5px}
+.rx1,.rxr1{border-right-width:5px}
+.rx2,.rxl2{border-left-width:3px}
+.rx2,.rxr2{border-right-width:3px}
+.re2,.rel2,.ra1,.ral1,.rx3,.rxl3,.rxs1,.rxsl1{border-left-width:2px}
+.re2,.rer2,.ra1,.rar1,.rx3,.rxr3,.rxs1,.rxsr1{border-right-width:2px}
+.rxl1,.rxl2,.rxl3,.rxl4,.rxsl1,.rxsl2,.ral1,.ral2,.ral3,.ral4,.rasl1,.rasl2{border-right-width:0}
+.rxr1,.rxr2,.rxr3,.rxr4,.rxsr1,.rxsr2,.rar1,.rar2,.rar3,.rar4,.rasr1,.rasr2{border-left-width:0}
+.r4,.rl4,.rr4,.re4,.rel4,.rer4,.ra4,.rar4,.ral4,.rx4,.rxl4,.rxr4{height:2px}
+.rer1,.rel1,.re1,.res1,.resl1,.resr1{border-width:1px 0 0;height:0px !important;height /**/:1px}
+/* End Nifty Corners Crap */
+
+/* Widget CSS */
+.widgetsubheader {
+ border-right: 1px solid #999999;
+ font-size: 11px;
+ background-color: #999999;
+ padding-right: 6px;
+ padding-left: 6px;
+ color: #FFFFFF;
+ font-weight: bold;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+.widgetheader {
+ border-right: 1px solid #999999;
+ font-size: 11px;
+ background-color: #990000;
+ padding-right: 6px;
+ padding-left: 6px;
+ color: #FFFFFF;
+ font-weight: bold;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+.widgetdiv{
+ margin:5px;
+ padding: 5px;
+ background:#CCCCCC;
+}
+
+/* CSS for Dynamic Log Viewer */
+/* Author: Erik Kristensen */
+div#log div.log-entry {
+ clear: both;
+}
+
+div#log div.log-entry span,
+div#log div.log-header span {
+ padding: 3px 2px 3px 2px;
+ padding-left: 8px;
+}
+
+div#log div.log-entry span.log-action {
+ padding-bottom: 6px;
+ padding-left: 5px;
+ padding-right: 5px;
+}
+
+div#log div.log-header span {
+ border-top: 1px solid #999;
+ background-color: #bbb;
+ font-weight: bold;
+ text-align: left;
+}
+
+div#log span.log-action,
+div#log span.log-time,
+div#log span.log-interface,
+div#log span.log-source,
+div#log span.log-destination,
+div#log span.log-protocol {
+ float: left;
+ text-align: left;
+ border-left: 1px solid #999;
+ border-bottom: 1px solid #999;
+}
+
+div#log span.log-general {
+
+}
+
+div#log span.log-protocol {
+ border-right: 1px solid #999;
+}
+
+div#log span.log-action {
+ width: 2em;
+ text-align: center;
+}
+
+div#log span.log-time {
+ width: 12.5em;
+}
+
+div#log span.log-interface {
+ width: 5em;
+}
+
+div#log span.log-source,
+div#log span.log-destination {
+ width: 17.6em;
+}
+
+div#log span.log-protocol {
+ width: 5.5em;
+}
+/* END CSS FOR DYNAMIC LOG VIEWER */
+
+#login {
+ background: #cccccc;
+ border: 0px solid #666666;
+ margin: 5em auto;
+ padding: 0em;
+ width: 340px;
+}
+
+#login h1 {
+ background: url(images/misc/logon.png) no-repeat top left;
+ margin-top: 0;
+ display: block;
+ text-indent: -1000px;
+ height: 50px;
+ border-bottom: none;
+}
+
+#login p {
+ font-size: 1em;
+ font-weight: bold;
+ padding: 3px;
+ margin: 0em;
+ text-indent: 10px;
+}
+
+#login span {
+ font-size: 1em;
+ font-weight: bold;
+ width: 20%;
+ padding: 3px;
+ margin: 0em;
+ text-indent: 10px;
+}
+
+#login p#text {
+ font-size: 1em;
+ font-weight: normal;
+ padding: 3px;
+ margin: 0em;
+ text-indent: 10px;
+}
+
+#login #submit {
+ font-size: 1em;
+ font-weight: bold;
+ padding: 3px;
+ margin: 0em;
+ text-indent: 10px;
+}
+
+/* Widget CSS */
+.widgetsubheader {
+ border-right: 1px solid #999999;
+ font-size: 11px;
+ background-color: #B1B1B1;
+ padding-right: 6px;
+ padding-left: 6px;
+ color: #000000;
+ font-weight: bold;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+.widgetheader {
+ border-right: 1px solid #999999;
+ font-size: 11px;
+ background-color: #990000;
+ padding-right: 6px;
+ padding-left: 6px;
+ color: #FFFFFF;
+ font-weight: bold;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+.widgetdiv{
+ margin:5px;
+ padding: 5px;
+ background:#CCCCCC;
+}
+.widgetconfigdiv{
+ background:#BBBBBB;
+ font-size: 11px;
+ color: #000000;
+ padding-right: 5px;
+ padding-left: 5px;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+
+div#log div.log-entry-mini {
+ clear: both;
+}
+
+div#log div.log-entry-mini span {
+ padding: 2px 2px 2px 2px;
+ padding-left: 8px;
+}
+
+div#log span.log-action-mini-header,
+div#log span.log-interface-mini-header,
+div#log span.log-source-mini-header,
+div#log span.log-destination-mini-header,
+div#log span.log-protocol-mini-header {
+ float: left;
+ text-align: left;
+ background-color: #FFFFFF;
+ font-size: 12px;
+ border-left: 1px solid #999;
+ border-bottom: 1px solid #999;
+}
+
+div#log span.log-action-mini,
+div#log span.log-time-mini,
+div#log span.log-interface-mini,
+div#log span.log-source-mini,
+div#log span.log-destination-mini,
+div#log span.log-protocol-mini {
+ float: left;
+ text-align: left;
+ background-color: #FFFFFF;
+ font-size: 11px;
+ border-left: 1px solid #999;
+ border-bottom: 1px solid #999;
+}
+
+div#log span.log-action-mini,
+div#log span.log-action-mini-header {
+ width: 6%;
+}
+
+div#log span.log-interface-mini,
+div#log span.log-interface-mini-header {
+ width: 8%;
+}
+
+div#log span.log-source-mini,
+div#log span.log-destination-mini,
+div#log span.log-source-mini-header,
+div#log span.log-destination-mini-header {
+ width: 31%;
+}
+
+div#log span.log-protocol-mini,
+div#log span.log-protocol-mini-header {
+ width: 8%;
+ border-right: 1px solid #999;
+}
diff --git a/config/Fit123/bin/code-red/background.gif b/config/Fit123/bin/code-red/background.gif Binary files differnew file mode 100644 index 00000000..3f0dc770 --- /dev/null +++ b/config/Fit123/bin/code-red/background.gif diff --git a/config/Fit123/bin/code-red/footer.png b/config/Fit123/bin/code-red/footer.png Binary files differnew file mode 100644 index 00000000..b668a615 --- /dev/null +++ b/config/Fit123/bin/code-red/footer.png diff --git a/config/Fit123/bin/code-red/header.png b/config/Fit123/bin/code-red/header.png Binary files differnew file mode 100644 index 00000000..06921877 --- /dev/null +++ b/config/Fit123/bin/code-red/header.png diff --git a/config/Fit123/bin/date/index.abc b/config/Fit123/bin/date/index.abc new file mode 100644 index 00000000..73a81fa1 --- /dev/null +++ b/config/Fit123/bin/date/index.abc @@ -0,0 +1,275 @@ +<?php +/* $Id$ */ +/* + index.php + Copyright (C) 2004, 2005 Scott Ullrich + All rights reserved. + + Originally part of m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + oR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + + ## Load Essential Includes + require_once('guiconfig.inc'); + require_once('notices.inc'); + + + ## Load Functions Files + require_once('includes/functions.inc.php'); + + + ## Load AJAX, Initiate Class ############################################### + require_once('includes/sajax.class.php'); + + ## Initiate Class and Set location of ajax file containing + ## the information that we need for this page. Also set functions + ## that SAJAX will be using. + $oSajax = new sajax(); + $oSajax->sajax_remote_uri = 'sajax/index.sajax.php'; + $oSajax->sajax_request_type = 'POST'; + $oSajax->sajax_export("get_stats"); + $oSajax->sajax_handle_client_request(); + ############################################################################ + + + ## Check to see if we have a swap space, + ## if true, display, if false, hide it ... + if(file_exists("/usr/sbin/swapinfo")) { + $swapinfo = `/usr/sbin/swapinfo`; + if(stristr($swapinfo,'%') == true) $showswap=true; + } + + + ## User recently restored his config. + ## If packages are installed lets resync + if(file_exists('/conf/needs_package_sync')) { + if($config['installedpackages'] <> '') { + conf_mount_rw(); + unlink('/conf/needs_package_sync'); + header('Location: pkg_mgr_install.php?mode=reinstallall'); + exit; + } + } + + + ## If it is the first time webGUI has been + ## accessed since initial install show this stuff. + if(file_exists('/conf/trigger_initial_wizard')) { + + echo <<<EOF +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html> +<head> + <title>{$g['product_name']}.local - {$g['product_name']} first time setup</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" /> + <script type="text/javascript">var theme = "nervecenter"</script> + <script type="text/javascript" src="/themes/nervecenter/loader.js"></script> + +EOF; + echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n"; + + if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) + echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n"; + else + echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />"; + + echo "<form>\n"; + echo "<center>\n"; + echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\"><p>\n"; + echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n"; + echo "Welcome to {$g['product_name']}!<p>\n"; + echo "One moment while we start the initial setup wizard.<p>\n"; + echo "Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.<p>\n"; + echo "To bypass the wizard, click on the {$g['product_name']} logo on the initial page.\n"; + echo "</div>\n"; + echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n"; + echo "<script type=\"text/javascript\">\n"; + echo "NiftyCheck();\n"; + echo "Rounded(\"div#nifty\",\"all\",\"#AAA\",\"#FFFFFF\",\"smooth\");\n"; + echo "</script>\n"; + exit; + } + + + ## Find out whether there's hardware encryption or not + unset($hwcrypto); + $fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r"); + if ($fd) { + while (!feof($fd)) { + $dmesgl = fgets($fd); + if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)) { + $hwcrypto = $matches[1]; + break; + } + } + fclose($fd); + } + + + ## Set Page Title and Include Header + $pgtitle = "{$g['product_name']} webGUI"; + include("head.inc"); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<script language="javascript"> +var ajaxStarted = false; +</script> +<?php +include("fbegin.inc"); + if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo")) + echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\"></center><br>"; +?> +<? +exec("/bin/date", $dateOutput, $dateStatus); +$currentDate = $dateOutput[0]; +?> +<p class="pgtitle">System Overview</p> + +<div id="niftyOutter"> +<form action="index.php" method="post"> +<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0"> + <tbody> + <tr> + <td colspan="2" class="listtopic">System information</td> + </tr> + <tr> + <td width="25%" class="vncellt">Name</td> + <td width="75%" class="listr"><?php echo $config['system']['hostname'] . "." . $config['system']['domain']; ?></td> + </tr> + <tr> + <td width="25%" valign="top" class="vncellt">Version</td> + <td width="75%" class="listr"> + <strong><?php readfile("/etc/version"); ?></strong> + <br /> + built on <?php readfile("/etc/version.buildtime"); ?> + </td> + </tr> + <tr> + <td width="25%" class="vncellt">Platform / Current Date </td> + <td width="75%" class="listr"><?=htmlspecialchars($g['platform']);?> / <?=$currentDate;?></td> + </tr> + <?php if ($hwcrypto): ?> + <tr> + <td width="25%" class="vncellt">Hardware crypto</td> + <td width="75%" class="listr"><?=htmlspecialchars($hwcrypto);?></td> + </tr> + <?php endif; ?> + <tr> + <td width="25%" class="vncellt">Uptime</td> + <td width="75%" class="listr"><input style="border: 0px solid white;" size="30" name="uptime" id="uptime" value="<?= htmlspecialchars(get_uptime()); ?>" /></td> + </tr> + <?php if ($config['lastchange']): ?> + <tr> + <td width="25%" class="vncellt">Last config change</td> + <td width="75%" class="listr"><?= htmlspecialchars(date("D M j G:i:s T Y", $config['revision']['time']));?></td> + </tr> + <?php endif; ?> + <tr> + <td width="25%" class="vncellt">State table size</td> + <td width="75%" class="listr"> + <input style="border: 0px solid white;" size="30" name="pfstate" id="pfstate" value="<?= htmlspecialchars(get_pfstate()); ?>" /> + <br /> + <a href="diag_dump_states.php">Show states</a> + </td> + </tr> + <tr> + <td width="25%" class="vncellt">MBUF Usage</td> + <td width="75%" class="listr"> + <?php + $mbufs_inuse=`netstat -mb | grep "mbufs in use" | awk '{ print $1 }' | cut -d"/" -f1`; + $mbufs_total=`netstat -mb | grep "mbufs in use" | awk '{ print $1 }' | cut -d"/" -f3`; + ?> + <?=$mbufs_inuse?>/<?=$mbufs_total?> + </td> + </tr> + <tr> + <td width="25%" class="vncellt">CPU usage</td> + <td width="75%" class="listr"> + <?php $cpuUsage = "0"; ?> + <img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" name="cpuwidtha" id="cpuwidtha" width="<?= $cpuUsage; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" name="cpuwidthb" id="cpuwidthb" width="<?= (100 - $cpuUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> + + <input style="border: 0px solid white;" size="30" name="cpumeter" id="cpumeter" value="(Updating in 5 seconds)" /> + </td> + </tr> + <tr> + <td width="25%" class="vncellt">Memory usage</td> + <td width="75%" class="listr"> + <?php $memUsage = mem_usage(); ?> + <img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" name="memwidtha" id="memwidtha" width="<?= $memUsage; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" name="memwidthb" id="memwidthb" width="<?= (100 - $memUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> + + <input style="border: 0px solid white;" size="30" name="memusagemeter" id="memusagemeter" value="<?= $memUsage.'%'; ?>" /> + </td> + </tr> + <?php if($showswap == true): ?> + <tr> + <td width="25%" class="vncellt">SWAP usage</td> + <td width="75%" class="listr"> + <?php $swapusage = swap_usage(); ?> + <img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" width="<?= $swapUsage; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" width="<?= (100 - $swapUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> + + <input style="border: 0px solid white;" size="30" name="swapusagemeter" id="swapusagemeter" value="<?= $swapusage.'%'; ?>" /> + </td> + </tr> + <?php endif; ?> +<?php + if(has_temp()): +?> + <tr> + <td width='25%' class='vncellt'>Temperature</td> + <td width='75%' class='listr'> + <?php $temp = get_temp(); ?> + <img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_blue.gif" height="15" name="tempwidtha" id="tempwidtha" width="<?= $temp; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_gray.gif" height="15" name="tempwidthb" id="tempwidthb" width="<?= (100 - $temp); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> + + <input style="border: 0px solid white;" size="30" name="tempmeter" id="tempmeter" value="<?= $temp."C"; ?>" /> + </td> + </tr> + <?php endif; ?> + <tr> + <td width="25%" class="vncellt">Disk usage</td> + <td width="75%" class="listr"> + <?php $diskusage = disk_usage(); ?> + <img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_blue.gif" height="15" width="<?= $diskusage; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_gray.gif" height="15" width="<?= (100 - $diskusage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> + + <input style="border: 0px solid white;" size="30" name="diskusagemeter" id="diskusagemeter" value="<?= $diskusage.'%'; ?>" /> + </td> + </tr> + </tbody> +</table> +</form> +</div> + +<?php include("fend.inc"); ?> + +<script type="text/javascript"> + NiftyCheck(); + Rounded("div#nifty","top","#FFF","#EEEEEE","smooth"); +</script> + +</body> +</html> diff --git a/config/Fit123/bin/dnssrv/system.abc b/config/Fit123/bin/dnssrv/system.abc new file mode 100755 index 00000000..24021aab --- /dev/null +++ b/config/Fit123/bin/dnssrv/system.abc @@ -0,0 +1,347 @@ +<?php +/* $Id$ */ +/* + system.php + part of m0n0wall (http://m0n0.ch/wall) + + Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); + +$pconfig['hostname'] = $config['system']['hostname']; +$pconfig['domain'] = $config['system']['domain']; +list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['system']['dnsserver']; + +$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']); +$pconfig['username'] = $config['system']['username']; +if (!$pconfig['username']) + $pconfig['username'] = "admin"; +$pconfig['webguiproto'] = $config['system']['webgui']['protocol']; +if (!$pconfig['webguiproto']) + $pconfig['webguiproto'] = "http"; +$pconfig['webguiport'] = $config['system']['webgui']['port']; +$pconfig['timezone'] = $config['system']['timezone']; +$pconfig['timeupdateinterval'] = $config['system']['time-update-interval']; +$pconfig['timeservers'] = $config['system']['timeservers']; +$pconfig['theme'] = $config['system']['theme']; + +if (!isset($pconfig['timeupdateinterval'])) + $pconfig['timeupdateinterval'] = 300; +if (!$pconfig['timezone']) + $pconfig['timezone'] = "Etc/UTC"; +if (!$pconfig['timeservers']) + $pconfig['timeservers'] = "pool.ntp.org"; + +$changedesc = "System: "; +$changecount = 0; + +function is_timezone($elt) { + return !preg_match("/\/$/", $elt); +} + +if($pconfig['timezone'] <> $_POST['timezone']) { + /* restart firewall log dumper helper */ + require_once("functions.inc"); + $pid = `ps awwwux | grep -v "grep" | grep "tcpdump -v -l -n -e -ttt -i pflog0" | awk '{ print $2 }'`; + if($pid) { + mwexec("kill $pid"); + usleep(1000); + } + filter_pflog_start(); +} + +exec('/usr/bin/tar -tzf /usr/share/zoneinfo.tgz', $timezonelist); +$timezonelist = array_filter($timezonelist, 'is_timezone'); +sort($timezonelist); + +if ($_POST) { + + $changecount++; + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + $reqdfields = split(" ", "hostname domain username"); + $reqdfieldsn = split(",", "Hostname,Domain,Username"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + if ($_POST['hostname'] && !is_hostname($_POST['hostname'])) { + $input_errors[] = "The hostname may only contain the characters a-z, 0-9 and '-'."; + } + if ($_POST['domain'] && !is_domain($_POST['domain'])) { + $input_errors[] = "The domain may only contain the characters a-z, 0-9, '-' and '.'."; + } + if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2'])) || ($_POST['dns3'] && !is_ipaddr($_POST['dns3'])) || ($_POST['dns4'] && !is_ipaddr($_POST['dns4']))) { + $input_errors[] = "A valid IP address must be specified for the primary/secondary DNS server."; + } + if ($_POST['username'] && !preg_match("/^[a-zA-Z0-9]*$/", $_POST['username'])) { + $input_errors[] = "The username may only contain the characters a-z, A-Z and 0-9."; + } + if ($_POST['webguiport'] && (!is_numericint($_POST['webguiport']) || + ($_POST['webguiport'] < 1) || ($_POST['webguiport'] > 65535))) { + $input_errors[] = "A valid TCP/IP port must be specified for the webGUI port."; + } + if (($_POST['password']) && ($_POST['password'] != $_POST['password2'])) { + $input_errors[] = "The passwords do not match."; + } + + $t = (int)$_POST['timeupdateinterval']; + if (($t < 0) || (($t > 0) && ($t < 6)) || ($t > 1440)) { + $input_errors[] = "The time update interval must be either 0 (disabled) or between 6 and 1440."; + } + foreach (explode(' ', $_POST['timeservers']) as $ts) { + if (!is_domain($ts)) { + $input_errors[] = "A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'."; + } + } + + if (!$input_errors) { + update_if_changed("hostname", $config['system']['hostname'], strtolower($_POST['hostname'])); + update_if_changed("domain", $config['system']['domain'], strtolower($_POST['domain'])); + update_if_changed("username", $config['system']['username'], $_POST['username']); + + if (update_if_changed("webgui protocol", $config['system']['webgui']['protocol'], $_POST['webguiproto'])) + $restart_webgui = true; + if (update_if_changed("webgui port", $config['system']['webgui']['port'], $_POST['webguiport'])) + $restart_webgui = true; + + update_if_changed("timezone", $config['system']['timezone'], $_POST['timezone']); + update_if_changed("NTP servers", $config['system']['timeservers'], strtolower($_POST['timeservers'])); + update_if_changed("NTP update interval", $config['system']['time-update-interval'], $_POST['timeupdateinterval']); + + /* pfSense themes */ + update_if_changed("System Theme", $config['theme'], $_POST['theme']); + + /* XXX - billm: these still need updating after figuring out how to check if they actually changed */ + unset($config['system']['dnsserver']); + if ($_POST['dns1']) + $config['system']['dnsserver'][] = $_POST['dns1']; + if ($_POST['dns2']) + $config['system']['dnsserver'][] = $_POST['dns2']; + if ($_POST['dns3']) + $config['system']['dnsserver'][] = $_POST['dns3']; + if ($_POST['dns4']) + $config['system']['dnsserver'][] = $_POST['dns4']; + + $olddnsallowoverride = $config['system']['dnsallowoverride']; + + unset($config['system']['dnsallowoverride']); + $config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false; + if ($_POST['password']) { + $config['system']['password'] = crypt($_POST['password']); + update_changedesc("password changed via webConfigurator"); + sync_webgui_passwords(); + } + + if ($changecount > 0) + write_config($changedesc); + + if ($restart_webgui) { + global $_SERVER; + list($host) = explode(":", $_SERVER['HTTP_HOST']); + if ($config['system']['webgui']['port']) { + $url="{$config['system']['webgui']['protocol']}://{$host}:{$config['system']['webgui']['port']}/system.php"; + } else { + $url = "{$config['system']['webgui']['protocol']}://{$host}/system.php"; + } + } + + $retval = 0; + config_lock(); + $retval = system_hostname_configure(); + $retval |= system_hosts_generate(); + $retval |= system_resolvconf_generate(); + $retval |= system_password_configure(); + $retval |= services_dnsmasq_configure(); + $retval |= system_timezone_configure(); + $retval |= system_ntp_configure(); + + if ($olddnsallowoverride != $config['system']['dnsallowoverride']) + $retval |= interfaces_wan_configure(); + + config_unlock(); + + // Reload filter -- plugins might need to run + filter_configure(); + + $savemsg = get_std_save_message($retval); + if ($restart_webgui) + $savemsg .= "<br />One moment...redirecting to {$url} in 10 seconds."; + } +} + +$pgtitle = "System: General Setup"; +include("head.inc"); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle"><?=$pgtitle?></p> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<form action="system.php" method="post"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq">Hostname</td> + <td width="78%" class="vtable"> <input name="hostname" type="text" class="formfld" id="hostname" size="40" value="<?=htmlspecialchars($pconfig['hostname']);?>"> + <br> <span class="vexpl">name of the firewall host, without + domain part<br> + e.g. <em>firewall</em></span></td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq">Domain</td> + <td width="78%" class="vtable"> <input name="domain" type="text" class="formfld" id="domain" size="40" value="<?=htmlspecialchars($pconfig['domain']);?>"> + <br> <span class="vexpl">e.g. <em>mycorp.com</em> </span></td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">DNS servers</td> + <td width="78%" class="vtable"> <p> + <input name="dns1" type="text" class="formfld" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>"> + <br> + <input name="dns2" type="text" class="formfld" id="dns22" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>"> + <br> + <input name="dns3" type="text" class="formfld" id="dns3" size="20" value="<?=htmlspecialchars($pconfig['dns3']);?>"> + <br> + <input name="dns4" type="text" class="formfld" id="dns4" size="20" value="<?=htmlspecialchars($pconfig['dns4']);?>"> + <br> + <span class="vexpl">IP addresses; these are also used for + the DHCP service, DNS forwarder and for PPTP VPN clients<br> + <br> + <input name="dnsallowoverride" type="checkbox" id="dnsallowoverride" value="yes" <?php if ($pconfig['dnsallowoverride']) echo "checked"; ?>> + <strong>Allow DNS server list to be overridden by DHCP/PPP + on WAN</strong><br> + If this option is set, <?=$g['product_name']?> will use DNS servers assigned + by a DHCP/PPP server on WAN for its own purposes (including + the DNS forwarder). They will not be assigned to DHCP and + PPTP VPN clients, though.</span></p></td> + </tr> + <tr> + <td valign="top" class="vncell">Username</td> + <td class="vtable"> <input name="username" type="text" class="formfld" id="username" size="20" value="<?=$pconfig['username'];?>"> + <br> + <span class="vexpl">If you want + to change the username for accessing the webGUI, enter it + here.</span></td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Password</td> + <td width="78%" class="vtable"> <input name="password" type="password" class="formfld" id="password" size="20"> + <br> <input name="password2" type="password" class="formfld" id="password2" size="20"> + (confirmation) <br> <span class="vexpl">If you want + to change the password for accessing the webGUI, enter it + here twice.</span></td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">webGUI protocol</td> + <td width="78%" class="vtable"> <input name="webguiproto" type="radio" value="http" <?php if ($pconfig['webguiproto'] == "http") echo "checked"; ?>> + HTTP <input type="radio" name="webguiproto" value="https" <?php if ($pconfig['webguiproto'] == "https") echo "checked"; ?>> + HTTPS</td> + </tr> + <tr> + <td valign="top" class="vncell">webGUI port</td> + <td class="vtable"> <input name="webguiport" type="text" class="formfld" id="webguiport" "size="5" value="<?=htmlspecialchars($config['system']['webgui']['port']);?>"> + <br> + <span class="vexpl">Enter a custom port number for the webGUI + above if you want to override the default (80 for HTTP, 443 + for HTTPS). Changes will take effect immediately after save.</span></td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Time zone</td> + <td width="78%" class="vtable"> <select name="timezone" id="timezone"> + <?php foreach ($timezonelist as $value): ?> + <option value="<?=htmlspecialchars($value);?>" <?php if ($value == $pconfig['timezone']) echo "selected"; ?>> + <?=htmlspecialchars($value);?> + </option> + <?php endforeach; ?> + </select> <br> <span class="vexpl">Select the location closest + to you</span></td> + </tr> + <!-- + <tr> + <td width="22%" valign="top" class="vncell">Time update interval</td> + <td width="78%" class="vtable"> <input name="timeupdateinterval" type="text" class="formfld" id="timeupdateinterval" size="4" value="<?=htmlspecialchars($pconfig['timeupdateinterval']);?>"> + <br> <span class="vexpl">Minutes between network time sync.; + 300 recommended, or 0 to disable </span></td> + </tr> + --> + <tr> + <td width="22%" valign="top" class="vncell">NTP time server</td> + <td width="78%" class="vtable"> <input name="timeservers" type="text" class="formfld" id="timeservers" size="40" value="<?=htmlspecialchars($pconfig['timeservers']);?>"> + <br> <span class="vexpl">Use a space to separate multiple + hosts (only one required). Remember to set up at least one + DNS server if you enter a host name here!</span></td> + </tr> + <tr> + <td colspan="2" class="list" height="12"> </td> + </tr> + <tr> + <td colspan="2" valign="top" class="listtopic">Theme</td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <select name="theme"> +<?php + $files = return_dir_as_array("/usr/local/www/themes/"); + foreach($files as $f) { + if ( (substr($f, 0, 1) == "_") && !isset($config['system']['developer']) ) continue; + if($f == "CVS") continue; + $selected = ""; + if($f == $config['theme']) + $selected = " SELECTED"; + if($config['theme'] == "" and $f == "pfsense") + $selceted = " SELECTED"; + echo "\t\t\t\t\t"."<option{$selected}>{$f}</option>\n"; + } +?> + </select> + <strong>This will change the look and feel of <?=$g['product_name']?></strong> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> <input name="Submit" type="submit" class="formbtn" value="Save"> + </td> + </tr> + </table> +</form> +<?php include("fend.inc"); ?> +<?php + // restart webgui if proto or port changed + if ($restart_webgui) { + echo "<meta http-equiv=\"refresh\" content=\"10;url={$url}\">"; + } +?> +</body> +</html> +<?php +if ($restart_webgui) { + touch("/tmp/restart_webgui"); +} +?> diff --git a/config/Fit123/bin/ltsp/services.inc b/config/Fit123/bin/ltsp/services.inc new file mode 100644 index 00000000..a788a2b3 --- /dev/null +++ b/config/Fit123/bin/ltsp/services.inc @@ -0,0 +1,1316 @@ +<?php +/* $Id$ */ +/* + services.inc + part of m0n0wall (http://m0n0.ch/wall) + + Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +/* include all configuration functions */ +require_once("functions.inc"); + +function load_balancer_use_sticky() { + global $config, $g; + if (isset ($config['system']['lb_use_sticky'])) + touch("/var/etc/use_pf_pool__stickyaddr"); + else + unlink_if_exists("/var/etc/use_pf_pool__stickyaddr"); +} + +function services_dhcpd_configure() { + global $config, $g; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "services_dhcpd_configure($if) being called $mt\n"; + } + + /* if OLSRD is enabled, allow WAN to house DHCP. */ + if($config['installedpackages']['olsrd']) + foreach($config['installedpackages']['olsrd']['config'] as $olsrd) + if($olsrd['enable']) + $is_olsr_enabled = true; + + /* configure DHCPD chroot */ + $fd = fopen("/tmp/dhcpd.sh","w"); + $status = `mount | grep "{$g['dhcpd_chroot_path']}/dev"`; + fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}\n"); + fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/dev\n"); + fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/etc\n"); + fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/usr/local/sbin\n"); + fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/var/db\n"); + fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/usr\n"); + fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/lib\n"); + fwrite($fd, "mkdir -p {$g['dhcpd_chroot_path']}/run\n"); + fwrite($fd, "chown -R dhcpd:_dhcp {$g['dhcpd_chroot_path']}/*\n"); + fwrite($fd, "cp /lib/libc.so.* {$g['dhcpd_chroot_path']}/lib/\n"); + fwrite($fd, "cp /usr/local/sbin/dhcpd {$g['dhcpd_chroot_path']}/usr/local/sbin/\n"); + fwrite($fd, "chmod a+rx {$g['dhcpd_chroot_path']}/usr/local/sbin/dhcpd\n"); + if(!trim($status)) + fwrite($fd, "mount -t devfs devfs {$g['dhcpd_chroot_path']}/dev\n"); + fclose($fd); + mwexec("/bin/sh /tmp/dhcpd.sh"); + + /* kill any running dhcpd */ + if(is_process_running("dhcpd")) + mwexec("killall dhcpd", true); + + $syscfg = $config['system']; + $dhcpdcfg = $config['dhcpd']; + + /* DHCP enabled on any interfaces? */ + $dhcpdenable = false; + if(is_array($dhcpdcfg)) + foreach ($dhcpdcfg as $dhcpif => $dhcpifconf) { + if (isset($dhcpifconf['enable']) && + (($dhcpif == "lan") || + (isset($config['interfaces'][$dhcpif]['enable']) && + $config['interfaces'][$dhcpif]['if'] && (!$config['interfaces'][$dhcpif]['bridge'])))) + $dhcpdenable = true; + if (isset($dhcpifconf['enable']) && + (($dhcpif == "wan") || (isset($config['interfaces'][$dhcpif]['enable']) && + $config['interfaces'][$dhcpif]['if'] && (!$config['interfaces'][$dhcpif]['bridge'])))) + $dhcpdenable = true; + } + + if (!$dhcpdenable) + return 0; + + if ($g['booting']) + echo "Starting DHCP service..."; + else + sleep(1); + + /* write dhcpd.conf */ + $fd = fopen("{$g['dhcpd_chroot_path']}/etc/dhcpd.conf", "w"); + if (!$fd) { + printf("Error: cannot open dhcpd.conf in services_dhcpd_configure().\n"); + return 1; + } + + + + $dhcpdconf = <<<EOD +option domain-name "{$syscfg['domain']}"; +default-lease-time 7200; +max-lease-time 86400; +authoritative; +log-facility local7; +ddns-update-style none; +one-lease-per-client true; +deny duplicates; + +EOD; + + $dhcpdifs = array(); + + /* loop through and deterimine if we need to setup + * failover peer "bleh" entries + */ + $dhcpnum = 0; + foreach ($dhcpdcfg as $dhcpif => $dhcpifconf) { + if($dhcpifconf['failover_peerip'] <> "") { + /* + * yep, failover peer is defined. + * does it match up to a defined vip? + */ + $skew = 110; + $a_vip = &$config['virtualip']['vip']; + if(is_array($a_vip)) { + foreach ($a_vip as $vipent) { + $int = guess_interface_from_ip($dhcpifconf['failover_peerip']); + $intip = find_interface_ip($int); + $real_dhcpif = convert_friendly_interface_to_real_interface_name($dhcpif); + if($int == $real_dhcpif) { + /* this is the interface! */ + if($vipent['advskew'] < "20") + $skew = 0; + } + } + } else { + log_error("Warning! DHCP Failover setup and no CARP virtual IP's defined!"); + } + if($skew > 10) { + $type = "secondary"; + $dhcpdconf_pri = "mclt 600;\n"; + $my_port = "520"; + $peer_port = "519"; + } else { + $my_port = "519"; + $peer_port = "520"; + $type = "primary"; + $dhcpdconf_pri = "split 128;\n"; + $dhcpdconf_pri .= " mclt 600;\n"; + } + $dhcpdconf .= <<<EOPP +failover peer "dhcp{$dhcpnum}" { + {$type}; + address {$intip}; + port {$my_port}; + peer address {$dhcpifconf['failover_peerip']}; + peer port {$peer_port}; + max-response-delay 10; + max-unacked-updates 10; + {$dhcpdconf_pri} + load balance max seconds 3; +} + +EOPP; + $dhcpnum++; + } + } + + $dhcpnum = 0; + + foreach ($dhcpdcfg as $dhcpif => $dhcpifconf) { + + $ifcfg = $config['interfaces'][$dhcpif]; + + if (!isset($dhcpifconf['enable']) || + ($ifcfg['ipaddr'] == "dhcp") || + (($dhcpif != "lan") && + (!isset($ifcfg['enable']) || !$ifcfg['if'] || $ifcfg['bridge']))) + continue; + + if($dhcpif == "lan" && $ifcfg['bridge']) + log_error("NOTE: DHCP Server on LAN is enabled."); + + $subnet = gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']); + $subnetmask = gen_subnet_mask($ifcfg['subnet']); + + if($is_olsr_enabled == true) + if($dhcpifconf['netmask']) + $subnetmask = gen_subnet_mask($dhcpifconf['netmask']); + + $dnscfg = ""; + + if ($dhcpifconf['domain']) { + $dnscfg .= " option domain-name \"{$dhcpifconf['domain']}\";\n"; + } + if (isset($dhcpifconf['ddnsupdate'])) { + if($dhcpifconf['ddnsdomain'] <> "") { + $dnscfg .= " ddns-domainname \"{$dhcpifconf['ddnsdomain']}\";\n"; + } + $dnscfg .= " ddns-update-style interim;\n"; + } + + + if (is_array($dhcpifconf['dnsserver']) && ($dhcpifconf['dnsserver'][0])) { + $dnscfg .= " option domain-name-servers " . join(",", $dhcpifconf['dnsserver']) . ";"; + } else if (isset($config['dnsmasq']['enable'])) { + $dnscfg .= " option domain-name-servers " . $ifcfg['ipaddr'] . ";"; + } else if (is_array($syscfg['dnsserver']) && ($syscfg['dnsserver'][0])) { + $dnscfg .= " option domain-name-servers " . join(",", $syscfg['dnsserver']) . ";"; + } + + $dhcpdconf .= "subnet $subnet netmask $subnetmask {\n"; + $dhcpdconf .= " pool {\n"; + + /* is failover dns setup? */ + if (is_array($dhcpifconf['dnsserver']) && $dhcpifconf['dnsserver'][0] <> "") { + $dhcpdconf .= " option domain-name-servers {$dhcpifconf['dnsserver'][0]}"; + if($dhcpifconf['dnsserver'][1] <> "") + $dhcpdconf .= ",{$dhcpifconf['dnsserver'][1]}"; + $dhcpdconf .= ";\n"; + } + + if($dhcpifconf['failover_peerip'] <> "") + $dhcpdconf .= " deny dynamic bootp clients;\n"; + + if (isset($dhcpifconf['denyunknown'])) + $dhcpdconf .= " deny unknown clients;\n"; + + if ($dhcpifconf['gateway']) + $routers = $dhcpifconf['gateway']; + else + $routers = $ifcfg['ipaddr']; + + if($dhcpifconf['failover_peerip'] <> "") { + $dhcpdconf .= " failover peer \"dhcp{$dhcpnum}\";\n"; + $dhcpnum++; + } + + $dhcpdconf .= <<<EOD + range {$dhcpifconf['range']['from']} {$dhcpifconf['range']['to']}; + } + option routers {$routers}; +$dnscfg + +EOD; + + if ($dhcpifconf['defaultleasetime']) + $dhcpdconf .= " default-lease-time {$dhcpifconf['defaultleasetime']};\n"; + if ($dhcpifconf['maxleasetime']) + $dhcpdconf .= " max-lease-time {$dhcpifconf['maxleasetime']};\n"; + + if (is_array($dhcpifconf['winsserver']) && $dhcpifconf['winsserver'][0]) { + $dhcpdconf .= " option netbios-name-servers " . join(",", $dhcpifconf['winsserver']) . ";\n"; + $dhcpdconf .= " option netbios-node-type 8;\n"; + } + + if (is_array($dhcpifconf['ntpserver']) && $dhcpifconf['ntpserver'][0]) + $dhcpdconf .= " option ntp-servers " . join(",", $dhcpifconf['ntpserver']) . ";\n"; + + if(isset($dhcpifconf['netboot'])) { + if (($dhcpifconf['next-server'] <> "") && ($dhcpifconf['filename'] <> "")) { + $dhcpdconf .= " next-server {$dhcpifconf['next-server']};\n"; + $dhcpdconf .= " filename \"{$dhcpifconf['filename']}\";\n"; + } + if ($dhcpifconf['rootpath'] <> "") { + $dhcpdconf .= " option root-path \"{$dhcpifconf['rootpath']}\";\n"; + } + } + $dhcpdconf .= <<<EOD +} + +EOD; + + /* add static mappings */ + if (is_array($dhcpifconf['staticmap'])) { + + $i = 0; + foreach ($dhcpifconf['staticmap'] as $sm) { + $dhcpdconf .= <<<EOD +host s_{$dhcpif}_{$i} { + hardware ethernet {$sm['mac']}; + +EOD; + if ($sm['ipaddr']) + $dhcpdconf .= " fixed-address {$sm['ipaddr']};\n"; + + $dhcpdconf .= "}\n"; + $i++; + } + } + + $dhcpdifs[] = $ifcfg['if']; + } + + fwrite($fd, $dhcpdconf); + fclose($fd); + + /* create an empty leases database */ + touch("{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases"); + + /* fire up dhcpd in a chroot */ + mwexec("/usr/local/sbin/dhcpd -user dhcpd -group _dhcp -chroot {$g['dhcpd_chroot_path']} -cf {$g['dhcpd_chroot_path']}/etc/dhcpd.conf " . + join(" ", $dhcpdifs)); + + if ($g['booting']) { + print "done.\n"; + } + + return 0; +} + +function interfaces_staticarp_configure($if) { + global $config, $g; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "interfaces_staticarp_configure($if) being called $mt\n"; + } + + $ifcfg = $config['interfaces'][$if]; + + /* Enable staticarp, if enabled */ + if(isset($config['dhcpd'][$if]['staticarp'])) { + mwexec("/sbin/ifconfig " . escapeshellarg($ifcfg['if']) . " staticarp " ); + mwexec("/usr/sbin/arp -ad > /dev/null 2>&1 "); + if (is_array($config['dhcpd'][$if]['staticmap'])) { + + foreach ($config['dhcpd'][$if]['staticmap'] as $arpent) { + mwexec("/usr/sbin/arp -s " . escapeshellarg($arpent['ipaddr']) . " " . escapeshellarg($arpent['mac'])); + log_error("/usr/sbin/arp -s " . escapeshellarg($arpent['ipaddr']) . " " . escapeshellarg($arpent['mac'])); + } + + } + } else { + mwexec("/sbin/ifconfig " . escapeshellarg($ifcfg['if']) . " -staticarp " ); + mwexec("/usr/sbin/arp -da > /dev/null 2>&1 "); + } + + return 0; +} + +function services_dhcrelay_configure() { + global $config, $g; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "services_dhcrelay_configure() being called $mt\n"; + } + + /* kill any running dhcrelay */ + killbypid("{$g['varrun_path']}/dhcrelay.pid"); + + $dhcrelaycfg = $config['dhcrelay']; + + /* DHCPRelay enabled on any interfaces? */ + $dhcrelayenable = false; + if(is_array($dhcrelaycfg)) { + foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) { + if (isset($dhcrelayifconf['enable']) && + (($dhcrelayif == "lan") || + (isset($config['interfaces'][$dhcrelayif]['enable']) && + $config['interfaces'][$dhcrelayif]['if'] && (!$config['interfaces'][$dhcrelayif]['bridge'])))) + $dhcrelayenable = true; + } + } + + if (!$dhcrelayenable) + return 0; + + if ($g['booting']) + echo "Starting DHCP relay service..."; + else + sleep(1); + + $dhcrelayifs = array(); + foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) { + + $ifcfg = $config['interfaces'][$dhcrelayif]; + + if (!isset($dhcrelayifconf['enable']) || + (($dhcrelayif != "lan") && + (!isset($ifcfg['enable']) || !$ifcfg['if'] || $ifcfg['bridge']))) + continue; + + $dhcrelayifs[] = $ifcfg['if']; + } + + /* In order for the relay to work, it needs to be active on the + interface in which the destination server sits */ + foreach ($config['interfaces'] as $ifname) { + $subnet = $ifname['ipaddr'] . "/" . $ifname['subnet']; + if (ip_in_subnet($dhcrelaycfg['server'],$subnet)) + $destif = $ifname['if']; + } + + if (!isset($destif)) + $destif = $config['interfaces']['wan']['if']; + + $dhcrelayifs[] = $destif; + $dhcrelayifs = array_unique($dhcrelayifs); + + /* fire up dhcrelay */ + $cmd = "/usr/local/sbin/dhcrelay -i " . join(" -i ", $dhcrelayifs); + + if (isset($dhcrelaycfg['agentoption'])) + $cmd .= " -a -m replace"; + + $cmd .= " {$dhcrelaycfg['server']}"; + mwexec($cmd); + + if (!$g['booting']) { + /* set the reload filter dity flag */ + touch("{$g['tmp_path']}/filter_dirty"); + } + + return 0; +} + +function services_dyndns_reset() { + global $config, $g; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "services_dyndns_reset() being called $mt\n"; + } + + if (file_exists("{$g['vardb_path']}/ez-ipupdate.cache")) { + conf_mount_rw(); + unlink("{$g['vardb_path']}/ez-ipupdate.cache"); + conf_mount_ro(); + } + + if (file_exists("{$g['conf_path']}/ez-ipupdate.cache")) { + conf_mount_rw(); + unlink("{$g['conf_path']}/ez-ipupdate.cache"); + conf_mount_ro(); + } + + if (file_exists("{$g['conf_path']}/dyndns.cache")) { + conf_mount_rw(); + unlink("{$g['conf_path']}/dyndns.cache"); + conf_mount_ro(); + } + + return 0; +} + +function services_dyndns_configure() { + global $config, $g; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "services_dyndns_configure() being called $mt\n"; + } + + $dyndnscfg = $config['dyndns']; + $wancfg = $config['interfaces']['wan']; + + if (isset($dyndnscfg['enable'])) { + + if ($g['booting']) { + echo "Starting DynDNS client..."; + if(isset($config['system']['use_old_dyndns'])) { + echo " [Using ez-ipupdate] "; + services_dyndns_configure_old(); + return; + } + } else { + sleep(1); + if(isset($config['system']['use_old_dyndns'])) { + services_dyndns_configure_old(); + return; + } + } + + /* load up the dyndns.class */ + require_once("dyndns.class"); + + log_error("DynDns: Running updatedns()"); + + /* determine WAN interface name */ + $wanif = get_real_wan_interface(); + /* get ip */ + $ip = find_interface_ip($wanif); + + $dns = new updatedns($dnsService = $config['dyndns']['type'], + $dnsHost = $config['dyndns']['host'], + $dnsUser = $config['dyndns']['username'], + $dnsPass = $config['dyndns']['password'], + $dnsWilcard = $config['dyndns']['wildcard'], + $dnsMX = $config['dyndns']['mx']); + + if ($g['booting']) + echo "done.\n"; + } + + return 0; +} + +function services_dyndns_configure_old() { + global $config, $g; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "services_dyndns_configure_old() being called $mt\n"; + } + + /* kill any running ez-ipupdate */ + /* ez-ipupdate needs SIGQUIT instead of SIGTERM */ + sigkillbypid("{$g['varrun_path']}/ez-ipupdate.pid", "QUIT"); + + $dyndnscfg = $config['dyndns']; + $wancfg = $config['interfaces']['wan']; + + if (isset($dyndnscfg['enable'])) { + + if ($g['booting']) + echo "Starting DynDNS client..."; + else + sleep(1); + + /* determine WAN interface name */ + $wanif = get_real_wan_interface(); + + /* write ez-ipupdate.conf */ + $fd = fopen("{$g['varetc_path']}/ez-ipupdate.conf", "w"); + if (!$fd) { + printf("Error: cannot open ez-ipupdate.conf in services_dyndns_configure().\n"); + return 1; + } + + $ezipupdateconf = <<<EOD +service-type={$dyndnscfg['type']} +user={$dyndnscfg['username']}:{$dyndnscfg['password']} +host={$dyndnscfg['host']} +interface={$wanif} +max-interval=2073600 +pid-file={$g['varrun_path']}/ez-ipupdate.pid +cache-file={$g['vardb_path']}/ez-ipupdate.cache +execute=/etc/rc.dyndns.storecache +daemon + +EOD; + + /* enable server[:port]? */ + if ($dyndnscfg['server']) { + if ($dyndnscfg['port']) + $ezipupdateconf .= "server={$dyndnscfg['server']}:{$dyndnscfg['port']}\n"; + else + $ezipupdateconf .= "server={$dyndnscfg['server']}\n"; + } + + /* enable MX? */ + if ($dyndnscfg['mx']) { + $ezipupdateconf .= "mx={$dyndnscfg['mx']}\n"; + } + + /* enable wildcards? */ + if (isset($dyndnscfg['wildcard'])) { + $ezipupdateconf .= "wildcard\n"; + } + + fwrite($fd, $ezipupdateconf); + fclose($fd); + + /* if we're booting, copy the cache file from /conf */ + if ($g['booting']) { + if (file_exists("{$g['conf_path']}/ez-ipupdate.cache")) { + copy("{$g['conf_path']}/ez-ipupdate.cache", "{$g['vardb_path']}/ez-ipupdate.cache"); + } + } + + /* run ez-ipupdate */ + mwexec("/usr/local/bin/ez-ipupdate -c {$g['varetc_path']}/ez-ipupdate.conf"); + + if ($g['booting']) + echo "done\n"; + } + + return 0; +} + +function services_dnsmasq_configure() { + global $config, $g; + $return = 0; + + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "services_dnsmasq_configure() being called $mt\n"; + } + + /* kill any running dnsmasq */ + sigkillbypid("{$g['varrun_path']}/dnsmasq.pid", "TERM"); + + if (isset($config['dnsmasq']['enable'])) { + + if ($g['booting']) + echo "Starting DNS forwarder..."; + else + sleep(1); + + /* generate hosts file */ + if(system_hosts_generate()!=0) + $return = 1; + + $args = ""; + + if (isset($config['dnsmasq']['regdhcp'])) { + + $args .= " -l {$g['dhcpd_chroot_path']}/var/db/dhcpd.leases" . + " -s {$config['system']['domain']}"; + } + + if (isset($config['dnsmasq']['domainoverrides']) && is_array($config['dnsmasq']['domainoverrides'])) { + foreach($config['dnsmasq']['domainoverrides'] as $override) { + $args .= ' --server=/' . $override['domain'] . '/' . $override['ip']; + } + } + + /* suppose that dnsmasq handles our domain and don't send + requests for our local domain to upstream servers */ + //if (!empty($config['system']['domain'])) { + // $args .= sprintf(' --local=/%s/', $config['system']['domain']); + //} + + /* run dnsmasq */ + mwexec("/usr/local/sbin/dnsmasq {$args}"); + + if ($g['booting']) + echo "done.\n"; + } + + if (!$g['booting']) { + if(services_dhcpd_configure()!=0) + $return = 1; + } + + return $return; +} + +function services_snmpd_configure() { + global $config, $g; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "services_snmpd_configure() being called $mt\n"; + } + + /* kill any running snmpd */ + sigkillbypid("{$g['varrun_path']}/snmpd.pid", "TERM"); + if(is_process_running("bsnmpd")) + mwexec("/usr/bin/killall bsnmpd", true); + + if (isset($config['snmpd']['enable'])) { + + if ($g['booting']) + echo "Starting SNMP daemon... "; + + /* generate snmpd.conf */ + $fd = fopen("{$g['varetc_path']}/snmpd.conf", "w"); + if (!$fd) { + printf("Error: cannot open snmpd.conf in services_snmpd_configure().\n"); + return 1; + } + + + $snmpdconf = <<<EOD +location := "{$config['snmpd']['syslocation']}" +contact := "{$config['snmpd']['syscontact']}" +read := "{$config['snmpd']['rocommunity']}" + +EOD; + +/* No docs on what write strings do there for disable for now. + if(isset($config['snmpd']['rwenable']) && preg_match('/^\S+$/', $config['snmpd']['rwcommunity'])){ + $snmpdconf .= <<<EOD +# write string +write := "{$config['snmpd']['rwcommunity']}" + +EOD; + } +*/ + + + if(isset($config['snmpd']['trapenable']) && preg_match('/^\S+$/', $config['snmpd']['trapserver'])){ + $snmpdconf .= <<<EOD +# SNMP Trap support. +traphost := {$config['snmpd']['trapserver']} +trapport := {$config['snmpd']['trapserverport']} +trap := "{$config['snmpd']['trapstring']}" + + +EOD; + } + + + $snmpdconf .= <<<EOD +system := 1 # pfSense +%snmpd +begemotSnmpdDebugDumpPdus = 2 +begemotSnmpdDebugSyslogPri = 7 +begemotSnmpdCommunityString.0.1 = $(read) + +EOD; + +/* No docs on what write strings do there for disable for now. + if(isset($config['snmpd']['rwcommunity']) && preg_match('/^\S+$/', $config['snmpd']['rwcommunity'])){ + $snmpdconf .= <<<EOD +begemotSnmpdCommunityString.0.2 = $(write) + +EOD; + } +*/ + + + if(isset($config['snmpd']['trapenable']) && preg_match('/^\S+$/', $config['snmpd']['trapserver'])){ + $snmpdconf .= <<<EOD +begemotTrapSinkStatus.[$(traphost)].$(trapport) = 4 +begemotTrapSinkVersion.[$(traphost)].$(trapport) = 2 +begemotTrapSinkComm.[$(traphost)].$(trapport) = $(trap) + +EOD; + } + + + $snmpdconf .= <<<EOD +begemotSnmpdCommunityDisable = 1 + +EOD; + + if(isset($config['snmpd']['bindlan'])) { + $bind_to_ip = $config['interfaces']['lan']['ipaddr']; + } else { + $bind_to_ip = "0.0.0.0"; + } + + if(is_port( $config['snmpd']['pollport'] )) { + $snmpdconf .= <<<EOD +begemotSnmpdPortStatus.{$bind_to_ip}.{$config['snmpd']['pollport']} = 1 + +EOD; + + } + + $snmpdconf .= <<<EOD +begemotSnmpdLocalPortStatus."/var/run/snmpd.sock" = 1 +begemotSnmpdLocalPortType."/var/run/snmpd.sock" = 4 + +# These are bsnmp macros not php vars. +sysContact = $(contact) +sysLocation = $(location) +sysObjectId = 1.3.6.1.4.1.12325.1.1.2.1.$(system) + +snmpEnableAuthenTraps = 2 + +EOD; + + if (is_array( $config['snmpd']['modules'] )) { + if(isset($config['snmpd']['modules']['mibii'])) { + $snmpdconf .= <<<EOD +begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so" + +EOD; + } + + if(isset($config['snmpd']['modules']['netgraph'])) { + $snmpdconf .= <<<EOD +begemotSnmpdModulePath."netgraph" = "/usr/lib/snmp_netgraph.so" +%netgraph +begemotNgControlNodeName = "snmpd" + +EOD; + } + + if(isset($config['snmpd']['modules']['pf'])) { + $snmpdconf .= <<<EOD +begemotSnmpdModulePath."pf" = "/usr/lib/snmp_pf.so" + +EOD; + } + + if(isset($config['snmpd']['modules']['hostres'])) { + $snmpdconf .= <<<EOD +begemotSnmpdModulePath."hostres" = "/usr/lib/snmp_hostres.so" + +EOD; + } + if(isset($config['snmpd']['modules']['bridge'])) { + $snmpdconf .= <<<EOD +begemotSnmpdModulePath."bridge" = "/usr/lib/snmp_bridge.so" +# config must end with blank line + + +EOD; + } + } + + fwrite($fd, $snmpdconf); + fclose($fd); + + if (isset($config['snmpd']['bindlan'])) { + $bindlan = ""; + } + + /* run bsnmpd */ + mwexec("/usr/sbin/bsnmpd -c {$g['varetc_path']}/snmpd.conf" . + "{$bindlan} -p {$g['varrun_path']}/snmpd.pid"); + + if ($g['booting']) + echo "done.\n"; + } + + return 0; +} + +function services_proxyarp_configure() { + global $config, $g; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "services_proxyarp_configure() being called $mt\n"; + } + + /* kill any running choparp */ + killbyname("choparp"); + + if (isset($config['virtualip']) && is_array($config['virtualip']['vip'])) { + $paa = array(); + + /* group by interface */ + foreach ($config['virtualip']['vip'] as $vipent) { + if ($vipent['mode'] === "proxyarp") { + if ($vipent['interface']) + $if = $vipent['interface']; + else + $if = "wan"; + + if (!is_array($paa[$if])) + $paa[$if] = array(); + + $paa[$if][] = $vipent; + } + } + + if (count($paa)) + foreach ($paa as $paif => $paents) { + if ($paif == "wan" && !(is_ipaddr($config['interfaces']['wan']['ipaddr']) || + ($config['interfaces']['wan']['ipaddr'] == "dhcp") || + ($config['interfaces']['wan']['ipaddr'] == "bigpond"))) + continue; + + $args = $config['interfaces'][$paif]['if'] . " auto"; + + foreach ($paents as $paent) { + + if (isset($paent['subnet'])) + $args .= " " . escapeshellarg("{$paent['subnet']}/{$paent['subnet_bits']}"); + else if (isset($paent['range'])) + $args .= " " . escapeshellarg($paent['range']['from'] . "-" . + $paent['range']['to']); + } + + mwexec_bg("/usr/local/sbin/choparp " . $args); + } + } +} + +function services_dnsupdate_process() { + global $config, $g; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "services_dnsupdate_process() being called $mt\n"; + } + + /* Dynamic DNS updating active? */ + if (isset($config['dnsupdate']['enable'])) { + + $wanip = get_current_wan_address(); + if ($wanip) { + + $keyname = $config['dnsupdate']['keyname']; + /* trailing dot */ + if (substr($keyname, -1) != ".") + $keyname .= "."; + + $hostname = $config['dnsupdate']['host']; + /* trailing dot */ + if (substr($hostname, -1) != ".") + $hostname .= "."; + + /* write private key file + this is dumb - public and private keys are the same for HMAC-MD5, + but nsupdate insists on having both */ + $fd = fopen("{$g['varetc_path']}/K{$keyname}+157+00000.private", "w"); + $privkey .= <<<EOD +Private-key-format: v1.2 +Algorithm: 157 (HMAC) +Key: {$config['dnsupdate']['keydata']} + +EOD; + fwrite($fd, $privkey); + fclose($fd); + + /* write public key file */ + if ($config['dnsupdate']['keytype'] == "zone") { + $flags = 257; + $proto = 3; + } else if ($config['dnsupdate']['keytype'] == "host") { + $flags = 513; + $proto = 3; + } else if ($config['dnsupdate']['keytype'] == "user") { + $flags = 0; + $proto = 2; + } + + $fd = fopen("{$g['varetc_path']}/K{$keyname}+157+00000.key", "w"); + fwrite($fd, "{$keyname} IN KEY {$flags} {$proto} 157 {$config['dnsupdate']['keydata']}\n"); + fclose($fd); + + /* generate update instructions */ + $upinst = "update delete {$config['dnsupdate']['host']} A\n"; + $upinst .= "update add {$config['dnsupdate']['host']} {$config['dnsupdate']['ttl']} A {$wanip}\n"; + $upinst .= "\n"; /* mind that trailing newline! */ + + $fd = fopen("{$g['varetc_path']}/nsupdatecmds", "w"); + fwrite($fd, $upinst); + fclose($fd); + + /* invoke nsupdate */ + $cmd = "/usr/sbin/nsupdate -k {$g['varetc_path']}/K{$keyname}+157+00000.key"; + if (isset($config['dnsupdate']['usetcp'])) + $cmd .= " -v"; + $cmd .= " {$g['varetc_path']}/nsupdatecmds"; + + mwexec_bg($cmd); + } + } + + return 0; +} + +function setup_wireless_olsr() { + global $config, $g; + if(!$config['installedpackages']['olsrd'] || !$config['installedpackages']) + return; + if(isset($config['system']['developerspew'])) { + $mt = microtime(); + echo "setup_wireless_olsr($interface) being called $mt\n"; + } + conf_mount_rw(); + foreach($config['installedpackages']['olsrd']['config'] as $olsrd) { + $olsr_enable = $olsrd['enable']; + if($olsr_enable <> "on") + return; + $fd = fopen("{$g['varetc_path']}/olsr.conf", "w"); + + if($olsrd['announcedynamicroute'] or $olsrd['enableannounce'] == "on") { + $enableannounce .= "\nHna4\n"; + $enableannounce .= "{\n"; + if($olsrd['announcedynamicroute']) + $enableannounce .= "\t{$olsrd['announcedynamicroute']}\n"; + if($olsrd['enableannounce'] == "on") + $enableannounce .= "0.0.0.0 0.0.0.0"; + $enableannounce .= "\n}\n"; + } else { + $enableannounce = ""; + } + + $olsr .= <<<EODA +# +# olsr.org OLSR daemon config file +# +# Lines starting with a # are discarded +# +# This file was generated by setup_wireless_olsr() in services.inc +# + +# This file is an example of a typical +# configuration for a mostly static +# network(regarding mobility) using +# the LQ extention + +# Debug level(0-9) +# If set to 0 the daemon runs in the background + +DebugLevel 2 + +# IP version to use (4 or 6) + +IpVersion 4 + +# Clear the screen each time the internal state changes + +ClearScreen yes + +{$enableannounce} + +# Should olsrd keep on running even if there are +# no interfaces available? This is a good idea +# for a PCMCIA/USB hotswap environment. +# "yes" OR "no" + +AllowNoInt yes + +# TOS(type of service) value for +# the IP header of control traffic. +# If not set it will default to 16 + +#TosValue 16 + +# The fixed willingness to use(0-7) +# If not set willingness will be calculated +# dynamically based on battery/power status +# if such information is available + +#Willingness 4 + +# Allow processes like the GUI front-end +# to connect to the daemon. + +IpcConnect +{ + # Determines how many simultaneously + # IPC connections that will be allowed + # Setting this to 0 disables IPC + + MaxConnections 0 + + # By default only 127.0.0.1 is allowed + # to connect. Here allowed hosts can + # be added + + Host 127.0.0.1 + #Host 10.0.0.5 + + # You can also specify entire net-ranges + # that are allowed to connect. Multiple + # entries are allowed + + #Net 192.168.1.0 255.255.255.0 +} + +# Wether to use hysteresis or not +# Hysteresis adds more robustness to the +# link sensing but delays neighbor registration. +# Used by default. 'yes' or 'no' + +UseHysteresis no + +# Hysteresis parameters +# Do not alter these unless you know +# what you are doing! +# Set to auto by default. Allowed +# values are floating point values +# in the interval 0,1 +# THR_LOW must always be lower than +# THR_HIGH. + +#HystScaling 0.50 +#HystThrHigh 0.80 +#HystThrLow 0.30 + + +# Link quality level +# 0 = do not use link quality +# 1 = use link quality for MPR selection +# 2 = use link quality for MPR selection and routing +# Defaults to 0 + +LinkQualityLevel {$olsrd['enablelqe']} + +# Link quality window size +# Defaults to 10 + +LinkQualityWinSize 10 + +# Polling rate in seconds(float). +# Default value 0.05 sec + +Pollrate 0.05 + + +# TC redundancy +# Specifies how much neighbor info should +# be sent in TC messages +# Possible values are: +# 0 - only send MPR selectors +# 1 - send MPR selectors and MPRs +# 2 - send all neighbors +# +# defaults to 0 + +TcRedundancy 2 + +# +# MPR coverage +# Specifies how many MPRs a node should +# try select to reach every 2 hop neighbor +# +# Can be set to any integer >0 +# +# defaults to 1 + +MprCoverage 3 + +# Example plugin entry with parameters: + +EODA; + +if($olsrd['enablehttpinfo'] == "on") { + $olsr .= <<<EODB + +LoadPlugin "/usr/local/lib/olsrd_httpinfo.so.0.1" +{ + PlParam "port" "{$olsrd['port']}" + PlParam "Net" "{$olsrd['allowedhttpinfohost']} {$olsrd['allowedhttpinfosubnet']}" +} + +EODB; + +} + +if($olsrd['enabledsecure'] == "on") { + $olsr .= <<<EODC + +LoadPlugin "/usr/local/lib/olsrd_secure.so.0.5" +{ + PlParam "Keyfile" "/usr/local/etc/olsrkey.txt" +} + +EODC; + +} + +if($olsrd['enabledyngw'] == "on") { + + /* unset default route, olsr auto negotiates */ + mwexec("/sbin/route delete default"); + + $olsr .= <<<EODE + +LoadPlugin "/usr/local/lib/olsrd_dyn_gw.so.0.4" +{ + # how often to look for a inet gw, in seconds + # defaults to 5 secs, if commented out + PlParam "Interval" "{$olsrd['polling']}" + + # if one or more IPv4 addresses are given, do a ping on these in + # descending order to validate that there is not only an entry in + # routing table, but also a real internet connection. If any of + # these addresses could be pinged successfully, the test was + # succesful, i.e. if the ping on the 1st address was successful,the + # 2nd won't be pinged + PlParam "Ping" "{$olsrd['ping']}" + #PlParam "HNA" "192.168.81.0 255.255.255.0" +} + +EODE; + +} + +foreach($config['installedpackages']['olsrd']['config'] as $conf) { + $interfaces = explode(',', $conf['iface_array']); + foreach($interfaces as $interface) { + $realinterface = convert_friendly_interface_to_real_interface_name($interface); +$olsr .= <<<EODAD +Interface "{$realinterface}" +{ + + # Hello interval in seconds(float) + HelloInterval 2.0 + + # HELLO validity time + HelloValidityTime 20.0 + + # TC interval in seconds(float) + TcInterval 5.0 + + # TC validity time + TcValidityTime 30.0 + + # MID interval in seconds(float) + MidInterval 5.0 + + # MID validity time + MidValidityTime 30.0 + + # HNA interval in seconds(float) + HnaInterval 5.0 + + # HNA validity time + HnaValidityTime 30.0 + + # When multiple links exist between hosts + # the weight of interface is used to determine + # the link to use. Normally the weight is + # automatically calculated by olsrd based + # on the characteristics of the interface, + # but here you can specify a fixed value. + # Olsrd will choose links with the lowest value. + + # Weight 0 + + +} + +EODAD; + + } + break; +} + fwrite($fd, $olsr); + fclose($fd); + } + + if(is_process_running("olsrd")) + mwexec("/usr/bin/killall olsrd", true); + + sleep(2); + + mwexec_bg("/usr/local/sbin/olsrd -f {$g['varetc_path']}/olsr.conf"); + + conf_mount_ro(); +} + +/* configure cron service */ +function configure_cron() { + global $g, $config; + conf_mount_rw(); + /* preserve existing crontab entries */ + $crontab_contents = file_get_contents("/etc/crontab"); + $crontab_contents_a = split("\n", $crontab_contents); + + for ($i = 0; $i < count($crontab_contents_a); $i++) { + $item =& $crontab_contents_a[$i]; + if (strpos($item, "# pfSense specific crontab entries") !== false) { + array_splice($crontab_contents_a, $i - 1); + break; + } + } + $crontab_contents = implode("\n", $crontab_contents_a) . "\n"; + + + if (is_array($config['cron']['item'])) { + $crontab_contents .= "#\n"; + $crontab_contents .= "# pfSense specific crontab entries\n"; + $crontab_contents .= "# Created: " . date("F j, Y, g:i a") . "\n"; + $crontab_contents .= "#\n"; + + foreach ($config['cron']['item'] as $item) { + $crontab_contents .= "\n{$item['minute']}\t"; + $crontab_contents .= "{$item['hour']}\t"; + $crontab_contents .= "{$item['mday']}\t"; + $crontab_contents .= "{$item['month']}\t"; + $crontab_contents .= "{$item['wday']}\t"; + $crontab_contents .= "{$item['who']}\t"; + $crontab_contents .= "{$item['command']}"; + } + + $crontab_contents .= "\n#\n"; + $crontab_contents .= "# If possible do not add items to this file manually.\n"; + $crontab_contents .= "# If you do so, this file must be terminated with a blank line (e.g. new line)\n"; + $crontab_contents .= "#\n\n"; + } + + /* please maintain the newline at the end of file */ + file_put_contents("/etc/crontab", $crontab_contents); + + if (!$g['booting']) + conf_mount_ro(); +} + +function upnp_action ($action) { + switch($action) { + case "start": + if(file_exists('/var/etc/miniupnpd.conf')) + mwexec_bg('/usr/local/sbin/miniupnpd -f /var/etc/miniupnpd.conf'); + break; + case "stop": + while((int)exec("pgrep miniupnpd | wc -l") > 0) + mwexec('killall miniupnpd 2>/dev/null', true); + mwexec('/sbin/pfctl -aminiupnpd -Fr 2>&1 >/dev/null'); + mwexec('/sbin/pfctl -aminiupnpd -Fn 2>&1 >/dev/null'); + break; + case "restart": + upnp_action('stop'); + upnp_action('start'); + break; + } +} + +function upnp_start() { + global $config, $g; + if($config['installedpackages']['miniupnpd']['config'][0]['enable']) { + if($g['booting']) { + echo "Starting UPnP service..."; + include('/usr/local/pkg/miniupnpd.inc'); + sync_package_miniupnpd(); + echo "done.\n"; + } + else { + upnp_action('start'); + } + } +} + +?> diff --git a/config/Fit123/bin/ltsp/services_dhcp.abc b/config/Fit123/bin/ltsp/services_dhcp.abc new file mode 100644 index 00000000..89548502 --- /dev/null +++ b/config/Fit123/bin/ltsp/services_dhcp.abc @@ -0,0 +1,642 @@ +<?php +/* $Id$ */ +/* + services_dhcp.php + part of m0n0wall (http://m0n0.ch/wall) + + Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); + +$if = $_GET['if']; +if ($_POST['if']) + $if = $_POST['if']; + +/* if OLSRD is enabled, allow WAN to house DHCP. */ +if($config['installedpackages']['olsrd']) { + foreach($config['installedpackages']['olsrd']['config'] as $olsrd) { + if($olsrd['enable']) { + $iflist = array("lan" => "LAN", "wan" => "WAN"); + $is_olsr_enabled = true; + break; + } + } +} + +if(!$iflist) + $iflist = array("lan" => "LAN"); + +for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) { + $oc = $config['interfaces']['opt' . $i]; + + if (isset($oc['enable']) && $oc['if'] && (!$oc['bridge'])) { + $iflist['opt' . $i] = $oc['descr']; + } +} + +if (!$if || !isset($iflist[$if])) + $if = "lan"; + +$pconfig['range_from'] = $config['dhcpd'][$if]['range']['from']; +$pconfig['range_to'] = $config['dhcpd'][$if]['range']['to']; +$pconfig['deftime'] = $config['dhcpd'][$if]['defaultleasetime']; +$pconfig['maxtime'] = $config['dhcpd'][$if]['maxleasetime']; +$pconfig['gateway'] = $config['dhcpd'][$if]['gateway']; +list($pconfig['wins1'],$pconfig['wins2']) = $config['dhcpd'][$if]['winsserver']; +list($pconfig['dns1'],$pconfig['dns2']) = $config['dhcpd'][$if]['dnsserver']; +$pconfig['enable'] = isset($config['dhcpd'][$if]['enable']); +$pconfig['denyunknown'] = isset($config['dhcpd'][$if]['denyunknown']); +$pconfig['staticarp'] = isset($config['dhcpd'][$if]['staticarp']); +$pconfig['ddnsdomain'] = $config['dhcpd'][$if]['ddnsdomain']; +$pconfig['ddnsupdate'] = isset($config['dhcpd'][$if]['ddnsupdate']); +list($pconfig['ntp1'],$pconfig['ntp2']) = $config['dhcpd'][$if]['ntpserver']; +$pconfig['netboot'] = isset($config['dhcpd'][$if]['netboot']); +$pconfig['nextserver'] = $config['dhcpd'][$if]['next-server']; +$pconfig['filename'] = $config['dhcpd'][$if]['filename']; +$pconfig['rootpath'] = $config['dhcpd'][$if]['rootpath']; +$pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip']; +$pconfig['netmask'] = $config['dhcpd'][$if]['netmask']; + +$ifcfg = $config['interfaces'][$if]; + +/* set the enabled flag which will tell us if DHCP relay is enabled + * on any interface. We will use this to disable DHCP server since + * the two are not compatible with each other. + */ + +$dhcrelay_enabled = false; +$dhcrelaycfg = $config['dhcrelay']; + +if(is_array($dhcrelaycfg)) { + foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) { + if (isset($dhcrelayifconf['enable']) && + (($dhcrelayif == "lan") || + (isset($config['interfaces'][$dhcrelayif]['enable']) && + $config['interfaces'][$dhcrelayif]['if'] && (!$config['interfaces'][$dhcrelayif]['bridge'])))) + $dhcrelay_enabled = true; + } +} + + +if (!is_array($config['dhcpd'][$if]['staticmap'])) { + $config['dhcpd'][$if]['staticmap'] = array(); +} +staticmaps_sort($if); +$a_maps = &$config['dhcpd'][$if]['staticmap']; + +function is_inrange($test, $start, $end) { + if ( (ip2long($test) < ip2long($end)) && (ip2long($test) > ip2long($start)) ) + return true; + else + return false; +} + +if ($_POST) { + + unset($input_errors); + + $pconfig = $_POST; + + /* input validation */ + if ($_POST['enable']) { + $reqdfields = explode(" ", "range_from range_to"); + $reqdfieldsn = explode(",", "Range begin,Range end"); + + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + foreach($a_maps as $mapent) { + if(is_inrange($mapent['ipaddr'], $_POST['range_from'], $_POST['range_to'])) { + $input_errors[] = "{$mapent['ipaddr']} is inside the range you specified."; + } + + } + + if (($_POST['range_from'] && !is_ipaddr($_POST['range_from']))) { + $input_errors[] = "A valid range must be specified."; + } + if (($_POST['range_to'] && !is_ipaddr($_POST['range_to']))) { + $input_errors[] = "A valid range must be specified."; + } + if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) { + $input_errors[] = "A valid IP address must be specified for the gateway."; + } + if (($_POST['wins1'] && !is_ipaddr($_POST['wins1'])) || ($_POST['wins2'] && !is_ipaddr($_POST['wins2']))) { + $input_errors[] = "A valid IP address must be specified for the primary/secondary WINS servers."; + } + if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2']))) { + $input_errors[] = "A valid IP address must be specified for the primary/secondary DNS servers."; + } + if ($_POST['deftime'] && (!is_numeric($_POST['deftime']) || ($_POST['deftime'] < 60))) { + $input_errors[] = "The default lease time must be at least 60 seconds."; + } + if ($_POST['maxtime'] && (!is_numeric($_POST['maxtime']) || ($_POST['maxtime'] < 60) || ($_POST['maxtime'] <= $_POST['deftime']))) { + $input_errors[] = "The maximum lease time must be at least 60 seconds and higher than the default lease time."; + } + if (($_POST['ddnsdomain'] && !is_domain($_POST['ddnsdomain']))) { + $input_errors[] = "A valid domain name must be specified for the dynamic DNS registration."; + } + if (($_POST['ntp1'] && !is_ipaddr($_POST['ntp1'])) || ($_POST['ntp2'] && !is_ipaddr($_POST['ntp2']))) { + $input_errors[] = "A valid IP address must be specified for the primary/secondary NTP servers."; + } + if (($_POST['nextserver'] && !is_ipaddr($_POST['nextserver']))) { + $input_errors[] = "A valid IP address must be specified for the network boot server."; + } + + + if (!$input_errors) { + /* make sure the range lies within the current subnet */ + $subnet_start = (ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet'])); + $subnet_end = (ip2long($ifcfg['ipaddr']) | (~gen_subnet_mask_long($ifcfg['subnet']))); + + if ((ip2long($_POST['range_from']) < $subnet_start) || (ip2long($_POST['range_from']) > $subnet_end) || + (ip2long($_POST['range_to']) < $subnet_start) || (ip2long($_POST['range_to']) > $subnet_end)) { + $input_errors[] = "The specified range lies outside of the current subnet."; + } + + if (ip2long($_POST['range_from']) > ip2long($_POST['range_to'])) + $input_errors[] = "The range is invalid (first element higher than second element)."; + + /* make sure that the DHCP Relay isn't enabled on this interface */ + if (isset($config['dhcrelay'][$if]['enable'])) + $input_errors[] = "You must disable the DHCP relay on the {$iflist[$if]} interface before enabling the DHCP server."; + } + } + + if (!$input_errors) { + $config['dhcpd'][$if]['range']['from'] = $_POST['range_from']; + $config['dhcpd'][$if]['range']['to'] = $_POST['range_to']; + $config['dhcpd'][$if]['defaultleasetime'] = $_POST['deftime']; + $config['dhcpd'][$if]['maxleasetime'] = $_POST['maxtime']; + $config['dhcpd'][$if]['netmask'] = $_POST['netmask']; + $previous = $config['dhcpd'][$if]['failover_peerip']; + if($previous <> $_POST['failover_peerip']) { + mwexec("rm -rf /var/dhcpd/var/db/*"); + } + $config['dhcpd'][$if]['failover_peerip'] = $_POST['failover_peerip']; + + unset($config['dhcpd'][$if]['winsserver']); + if ($_POST['wins1']) + $config['dhcpd'][$if]['winsserver'][] = $_POST['wins1']; + if ($_POST['wins2']) + $config['dhcpd'][$if]['winsserver'][] = $_POST['wins2']; + + unset($config['dhcpd'][$if]['dnsserver']); + if ($_POST['dns1']) + $config['dhcpd'][$if]['dnsserver'][] = $_POST['dns1']; + if ($_POST['dns2']) + $config['dhcpd'][$if]['dnsserver'][] = $_POST['dns2']; + + $config['dhcpd'][$if]['gateway'] = $_POST['gateway']; + $config['dhcpd'][$if]['denyunknown'] = ($_POST['denyunknown']) ? true : false; + $config['dhcpd'][$if]['enable'] = ($_POST['enable']) ? true : false; + $config['dhcpd'][$if]['staticarp'] = ($_POST['staticarp']) ? true : false; + $config['dhcpd'][$if]['ddnsdomain'] = $_POST['ddnsdomain']; + $config['dhcpd'][$if]['ddnsupdate'] = ($_POST['ddnsupdate']) ? true : false; + + unset($config['dhcpd'][$if]['ntpserver']); + if ($_POST['ntp1']) + $config['dhcpd'][$if]['ntpserver'][] = $_POST['ntp1']; + if ($_POST['ntp2']) + $config['dhcpd'][$if]['ntpserver'][] = $_POST['ntp2']; + + $config['dhcpd'][$if]['netboot'] = ($_POST['netboot']) ? true : false; + $config['dhcpd'][$if]['next-server'] = $_POST['nextserver']; + $config['dhcpd'][$if]['filename'] = $_POST['filename']; + $config['dhcpd'][$if]['rootpath'] = $_POST['rootpath']; + + write_config(); + + /* static arp configuration */ + interfaces_staticarp_configure($if); + + $retval = 0; + $retvaldhcp = 0; + $retvaldns = 0; + config_lock(); + /* dnsmasq_configure calls dhcpd_configure */ + /* no need to restart dhcpd twice */ + if (isset($config['dnsmasq']['regdhcpstatic'])) { + $retvaldns = services_dnsmasq_configure(); + if ($retvaldns == 0) { + if (file_exists($d_hostsdirty_path)) + unlink($d_hostsdirty_path); + if (file_exists($d_staticmapsdirty_path)) + unlink($d_staticmapsdirty_path); + } + } else { + $retvaldhcp = services_dhcpd_configure(); + if ($retvaldhcp == 0) { + if (file_exists($d_staticmapsdirty_path)) + unlink($d_staticmapsdirty_path); + } + } + config_unlock(); + if($retvaldhcp == 1 || $retvaldns == 1) + $retval = 1; + $savemsg = get_std_save_message($retval); + } +} + +if ($_GET['act'] == "del") { + if ($a_maps[$_GET['id']]) { + unset($a_maps[$_GET['id']]); + write_config(); + if(isset($config['dhcpd'][$if]['enable'])) { + touch($d_staticmapsdirty_path); + if (isset($config['dnsmasq']['regdhcpstatic'])) + touch($d_hostsdirty_path); + } + header("Location: services_dhcp.php?if={$if}"); + exit; + } +} + +$pgtitle = "Services: DHCP server"; +include("head.inc"); + +?> + +<script type="text/javascript" language="JavaScript"> + +function enable_change(enable_over) { + var endis; + endis = !(document.iform.enable.checked || enable_over); + document.iform.range_from.disabled = endis; + document.iform.range_to.disabled = endis; + document.iform.wins1.disabled = endis; + document.iform.wins2.disabled = endis; + document.iform.dns1.disabled = endis; + document.iform.dns2.disabled = endis; + document.iform.deftime.disabled = endis; + document.iform.maxtime.disabled = endis; + document.iform.gateway.disabled = endis; + document.iform.failover_peerip.disabled = endis; + document.iform.staticarp.disabled = endis; + document.iform.ddnsdomain.disabled = endis; + document.iform.ddnsupdate.disabled = endis; + document.iform.ntp1.disabled = endis; + document.iform.ntp2.disabled = endis; + document.iform.netboot.disabled = endis; + document.iform.nextserver.disabled = endis; + document.iform.filename.disabled = endis; + document.iform.rootpath.disabled = endis; + document.iform.denyunknown.disabled = endis; +} + +function show_ddns_config() { + document.getElementById("showddnsbox").innerHTML=''; + aodiv = document.getElementById('showddns'); + aodiv.style.display = "block"; +} + +function show_ntp_config() { + document.getElementById("showntpbox").innerHTML=''; + aodiv = document.getElementById('showntp'); + aodiv.style.display = "block"; +} + +function show_netboot_config() { + document.getElementById("shownetbootbox").innerHTML=''; + aodiv = document.getElementById('shownetboot'); + aodiv.style.display = "block"; +} + +</script> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle"><?=$pgtitle?></p> +<form action="services_dhcp.php" method="post" name="iform" id="iform"> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<?php + if ($dhcrelay_enabled) { + echo "DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface."; + include("fend.inc"); + echo "</body>"; + echo "</html>"; + exit; + } +?> +<?php if (file_exists($d_staticmapsdirty_path)): ?><p> +<?php print_info_box_np("The static mapping configuration has been changed.<br>You must apply the changes in order for them to take effect.");?><br> +<?php endif; ?> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr><td> + <?php + /* active tabs */ + $tab_array = array(); + $tabscounter = 0; + $i = 0; + foreach ($iflist as $ifent => $ifname) { + if ($ifent == $if) + $active = true; + else + $active = false; + $tab_array[] = array($ifname, $active, "services_dhcp.php?if={$ifent}"); + } + display_top_tabs($tab_array); + ?> + </td></tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vtable"> </td> + <td width="78%" class="vtable"> + <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)"> + <strong>Enable DHCP server on + <?=htmlspecialchars($iflist[$if]);?> + interface</strong></td> + </tr> + <tr> + <td width="22%" valign="top" class="vtable"> </td> + <td width="78%" class="vtable"> + <input name="denyunknown" id="denyunknown" type="checkbox" value="yes" <?php if ($pconfig['denyunknown']) echo "checked"; ?>> + <strong>Deny unknown clients</strong><br> + If this is checked, only the clients defined below will get DHCP leases from this server. </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq">Subnet</td> + <td width="78%" class="vtable"> + <?=gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']);?> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq">Subnet + mask</td> + <td width="78%" class="vtable"> + <?=gen_subnet_mask($ifcfg['subnet']);?> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq">Available + range</td> + <td width="78%" class="vtable"> + <?=long2ip(ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']));?> + - + <?=long2ip(ip2long($ifcfg['ipaddr']) | (~gen_subnet_mask_long($ifcfg['subnet']))); ?> + </td> + </tr> + <?php if($is_olsr_enabled): ?> + <tr> + <td width="22%" valign="top" class="vncellreq">Subnet Mask</td> + <td width="78%" class="vtable"> + <select name="netmask" class="formfld" id="netmask"> + <?php + for ($i = 32; $i > 0; $i--) { + if($i <> 31) { + echo "<option value=\"{$i}\" "; + if ($i == $pconfig['netmask']) echo "selected"; + echo ">" . $i . "</option>"; + } + } + ?> + </select> + </td> + </tr> + <?php endif; ?> + <tr> + <td width="22%" valign="top" class="vncellreq">Range</td> + <td width="78%" class="vtable"> + <input name="range_from" type="text" class="formfld" id="range_from" size="20" value="<?=htmlspecialchars($pconfig['range_from']);?>"> + to <input name="range_to" type="text" class="formfld" id="range_to" size="20" value="<?=htmlspecialchars($pconfig['range_to']);?>"> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">WINS servers</td> + <td width="78%" class="vtable"> + <input name="wins1" type="text" class="formfld" id="wins1" size="20" value="<?=htmlspecialchars($pconfig['wins1']);?>"><br> + <input name="wins2" type="text" class="formfld" id="wins2" size="20" value="<?=htmlspecialchars($pconfig['wins2']);?>"> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">DNS servers</td> + <td width="78%" class="vtable"> + <input name="dns1" type="text" class="formfld" id="dns1" size="20" value="<?=htmlspecialchars($pconfig['dns1']);?>"><br> + <input name="dns2" type="text" class="formfld" id="dns2" size="20" value="<?=htmlspecialchars($pconfig['dns2']);?>"><br> + NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS forwarder is enabled, otherwise the servers configured on the General page. + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Gateway</td> + <td width="78%" class="vtable"> + <input name="gateway" type="text" class="formfld" id="gateway" size="20" value="<?=htmlspecialchars($pconfig['gateway']);?>"><br> + The default is to use the IP on this interface of the firewall as the gateway. Specify an alternate gateway here if this is not the correct gateway for your network. + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Default lease + time</td> + <td width="78%" class="vtable"> + <input name="deftime" type="text" class="formfld" id="deftime" size="10" value="<?=htmlspecialchars($pconfig['deftime']);?>"> + seconds<br> + This is used for clients that do not ask for a specific + expiration time.<br> + The default is 7200 seconds. + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Maximum lease + time</td> + <td width="78%" class="vtable"> + <input name="maxtime" type="text" class="formfld" id="maxtime" size="10" value="<?=htmlspecialchars($pconfig['maxtime']);?>"> + seconds<br> + This is the maximum lease time for clients that ask + for a specific expiration time.<br> + The default is 86400 seconds. + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Failover peer IP:</td> + <td width="78%" class="vtable"> + <input name="failover_peerip" type="text" class="formfld" id="failover_peerip" size="20" value="<?=htmlspecialchars($pconfig['failover_peerip']);?>"><br> + Leave blank to disable. Enter the REAL address of the other machine. Machines must be using CARP. + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Static ARP</td> + <td width="78%" class="vtable"> + <table> + <tr> + <td> + <input valign="middle" type="checkbox" value="yes" name="staticarp" id="staticarp" <?php if($pconfig['staticarp']) echo " checked"; ?>> + </td> + <td> + <b>Enable Static ARP entries</b> + </td> + </tr> + <tr> + <td> + + </td> + <td> + <span class="red"><strong>Note:</strong></span> Only the machines listed below will be able to communicate with the firewall on this NIC. + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Dynamic DNS</td> + <td width="78%" class="vtable"> + <div id="showddnsbox"> + <input type="button" onClick="show_ddns_config()" value="Advanced"></input> - Show Dynamic DNS</a> + </div> + <div id="showddns" style="display:none"> + <input valign="middle" type="checkbox" value="yes" name="ddnsupdate" id="ddnsupdate" <?php if($pconfig['ddnsupdate']) echo " checked"; ?>> + <b>Enable registration of DHCP client names in DNS.</b><br /> + <p> + <input name="ddnsdomain" type="text" class="formfld" id="ddnsdomain" size="20" value="<?=htmlspecialchars($pconfig['ddnsdomain']);?>"><br /> + Note: Leave blank to disable dynamic DNS registration.<br /> + Enter the dynamic DNS domain which will be used to register client names in the DNS server. + </div> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">NTP servers</td> + <td width="78%" class="vtable"> + <div id="showntpbox"> + <input type="button" onClick="show_ntp_config()" value="Advanced"></input> - Show NTP configuration</a> + </div> + <div id="showntp" style="display:none"> + <input name="ntp1" type="text" class="formfld" id="ntp1" size="20" value="<?=htmlspecialchars($pconfig['ntp1']);?>"><br> + <input name="ntp2" type="text" class="formfld" id="ntp2" size="20" value="<?=htmlspecialchars($pconfig['ntp2']);?>"> + </div> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Enable Network booting</td> + <td width="78%" class="vtable"> + <div id="shownetbootbox"> + <input type="button" onClick="show_netboot_config()" value="Advanced"></input> - Show Network booting</a> + </div> + <div id="shownetboot" style="display:none"> + <input valign="middle" type="checkbox" value="yes" name="netboot" id="netboot" <?php if($pconfig['netboot']) echo " checked"; ?>> + <b>Enables network booting.</b> + <p> + <input name="nextserver" type="text" class="formfld" id="nextserver" size="20" value="<?=htmlspecialchars($pconfig['nextserver']);?>"><br> + Enter the IP address from the network boot server. + <p> + <input name="filename" type="text" class="formfld" id="filename" size="20" value="<?=htmlspecialchars($pconfig['filename']);?>"><br> + Enter the filename used for network booting.<br /> + Note: You need both a filename and a boot server configured for this to work!<br /> + <p> + <input name="rootpath" type="text" class="formfld" id="rootpath" size="20" value="<?=htmlspecialchars($pconfig['rootpath']);?>"><br> + Enter option root-path. + </div> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input name="if" type="hidden" value="<?=$if;?>"> + <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)"> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> <p><span class="vexpl"><span class="red"><strong>Note:<br> + </strong></span>The DNS servers entered in <a href="system.php">System: + General setup</a> (or the <a href="services_dnsmasq.php">DNS + forwarder</a>, if enabled) </span><span class="vexpl">will + be assigned to clients by the DHCP server.<br> + <br> + The DHCP lease table can be viewed on the <a href="diag_dhcp_leases.php">Status: + DHCP leases</a> page.<br> + </span></p> + </td> + </tr> + </table> + <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="25%" class="listhdrr">MAC address</td> + <td width="15%" class="listhdrr">IP address</td> + <td width="20%" class="listhdrr">Hostname</td> + <td width="30%" class="listhdr">Description</td> + <td width="10%" class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle" width="17"></td> + <td valign="middle"><a href="services_dhcp_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php if(is_array($a_maps)): ?> + <?php $i = 0; foreach ($a_maps as $mapent): ?> + <?php if($mapent['mac'] <> "" or $mapent['ipaddr'] <> ""): ?> + <tr> + <td class="listlr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';"> + <?=htmlspecialchars($mapent['mac']);?> + </td> + <td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';"> + <?=htmlspecialchars($mapent['ipaddr']);?> + </td> + <td class="listr" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';"> + <?=htmlspecialchars($mapent['hostname']);?> + </td> + <td class="listbg" ondblclick="document.location='services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>';"> + <font color="#FFFFFF"><?=htmlspecialchars($mapent['descr']);?> </font> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="services_dhcp_edit.php?if=<?=$if;?>&id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td valign="middle"><a href="services_dhcp.php?if=<?=$if;?>&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this mapping?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php endif; ?> + <?php $i++; endforeach; ?> + <?php endif; ?> + <tr> + <td class="list" colspan="4"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle" width="17"></td> + <td valign="middle"><a href="services_dhcp_edit.php?if=<?=$if;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> +</form> +<script language="JavaScript"> +<!-- +enable_change(false); +//--> +</script> +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/Fit123/ddns.xml b/config/Fit123/ddns.xml new file mode 100644 index 00000000..ea461254 --- /dev/null +++ b/config/Fit123/ddns.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright></copyright> + <description>Describe your package here</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>ddns</name>
+ <title>DDNS</title>
+ <include_file>/usr/local/pkg/fit123.inc</include_file>
+ <tabs>
+ <tab>
+ <text>Fit123</text>
+ <url>/pkg_edit.php?xml=fit123.xml&id=0</url>
+ <active/>
+ </tab> + <tab>
+ <text>DDNS</text>
+ <url>/pkg_edit.php?xml=ddns.xml&id=0</url>
+ </tab> + </tabs>
+ <fields>
+ <field>
+ <fielddescr>Dynamic DNS</fielddescr>
+ <fieldname>enable</fieldname>
+ <description> + A more customize way to update dynamic dns and mainly for IP's that doesn't change very often.<br> + Will check for ip change every 5 min via local shell script and will only contact provider on change.<br> + </description>
+ <type>checkbox</type> + </field> + <field> + <fielddescr>Enter string that should be phrased</fielddescr> + <fieldname>line1</fieldname> + <description> + String for OpenDNS should look like:<br> + https://username:password@updates.opendns.com/nic/update?hostname= + </description> + <type>textarea</type> + <cols>80</cols> + <rows>1</rows> + </field> + <field> + <fielddescr>Enter 2th string that should be phrased</fielddescr> + <fieldname>line2</fieldname> + <description>Leave empty if not used</description> + <type>textarea</type> + <cols>80</cols> + <rows>1</rows> + </field> + <field> + <fielddescr>Enter 3th string that should be phrased</fielddescr> + <fieldname>line3</fieldname> + <description>Leave empty if not used</description> + <type>textarea</type> + <cols>80</cols> + <rows>1</rows> + </field> + </fields> + <custom_add_php_command></custom_add_php_command> + <custom_php_command_before_form>ddns_config();</custom_php_command_before_form> + <custom_php_after_form_command></custom_php_after_form_command> + <custom_php_validation_command></custom_php_validation_command> + <custom_php_resync_config_command></custom_php_resync_config_command> + <custom_php_install_command>Fit123_install_config();</custom_php_install_command> + <custom_php_deinstall_command>Fit123_install_deinstall();</custom_php_deinstall_command> +</packagegui> diff --git a/config/Fit123/fit123.inc b/config/Fit123/fit123.inc new file mode 100644 index 00000000..646ab65f --- /dev/null +++ b/config/Fit123/fit123.inc @@ -0,0 +1,298 @@ +<?php + +function Fit123_install_deinstall() { + conf_mount_rw();
+ config_lock(); + exec("cd .."); + exec("rm -d -R /usr/local/pkg/Fit123"); + conf_mount_ro();
+ config_unlock(); +} + +function Fit123_install_config() { + conf_mount_rw();
+ config_lock(); + exec("cd .."); +//Creating backup directory + exec("mkdir /usr/local/pkg/Fit123"); + exec("mkdir /usr/local/pkg/Fit123/backup"); +//Copy orignal files to backup dir + //Date + exec("cp /usr/local/www/index.php /usr/local/pkg/Fit123/backup/"); + //Code-Red Nervecenter Theme + exec("cp /usr/local/www/themes/nervecenter/all.css /usr/local/pkg/Fit123/backup/"); + exec("cp /usr/local/www/themes/nervecenter/images/background.gif /usr/local/pkg/Fit123/backup/"); + exec("cp /usr/local/www/themes/nervecenter/images/footer.png /usr/local/pkg/Fit123/backup/"); + exec("cp /usr/local/www/themes/nervecenter/images/header.png /usr/local/pkg/Fit123/backup/"); + //LTSP network boot Option + exec("cp /etc/inc/services.inc /usr/local/pkg/Fit123/backup/"); + exec("cp /usr/local/www/services_dhcp.php /usr/local/pkg/Fit123/backup/"); + //DNS Server adds option for a 3th and 4th DNS Server + exec("cp /usr/local/www/system.php /usr/local/pkg/Fit123/backup/"); +//Greate directories and downloading files to them + //Date + exec("mkdir /usr/local/pkg/Fit123/date"); + exec("fetch -o /usr/local/pkg/Fit123/date/index.php http://www.pfsense.com/packages/config/Fit123/bin/date/index.abc"); + //Code-Red Nervecenter Theme + exec("mkdir /usr/local/pkg/Fit123/code-red"); + exec("fetch -o /usr/local/pkg/Fit123/code-red/ http://www.pfsense.com/packages/config/Fit123/bin/code-red/all.css"); + exec("fetch -o /usr/local/pkg/Fit123/code-red/ http://www.pfsense.com/packages/config/Fit123/bin/code-red/background.gif"); + exec("fetch -o /usr/local/pkg/Fit123/code-red/ http://www.pfsense.com/packages/config/Fit123/bin/code-red/footer.png"); + exec("fetch -o /usr/local/pkg/Fit123/code-red/ http://www.pfsense.com/packages/config/Fit123/bin/code-red/header.png"); + //LTSP 3th network boot Option + exec("mkdir /usr/local/pkg/Fit123/LTSP"); + exec("fetch -o /usr/local/pkg/Fit123/LTSP/ http://www.pfsense.com/packages/config/Fit123/bin/ltsp/services.inc"); + exec("fetch -o /usr/local/pkg/Fit123/LTSP/services_dhcp.php http://www.pfsense.com/packages/config/Fit123/bin/ltsp/services_dhcp.abc"); + //AFC Reset's states after filter change + exec("mkdir /usr/local/pkg/Fit123/afc"); + exec("fetch -o /usr/local/pkg/Fit123/afc/reset_states.sh http://www.pfsense.com/packages/config/Fit123/bin/afc/reset_states.sh"); + exec("chmod 744 /usr/local/pkg/Fit123/afc/reset_states.sh"); + //DDNS + exec("mkdir /usr/local/pkg/Fit123/ddns"); + //DNS Server adds option for a 3th and 4th DNS Server + exec("mkdir /usr/local/pkg/Fit123/dnssrv"); + exec("fetch -o /usr/local/pkg/Fit123/dnssrv/system.php http://www.pfsense.com/packages/config/Fit123/bin/dnssrv/system.abc"); + conf_mount_ro();
+ config_unlock(); +} + +function Fit123_config() { +global $config; + + $adddate = $config['installedpackages']['fit123']['config'][0]['adddate'];
+ if($adddate) + exec("cp /usr/local/pkg/Fit123/date/index.php /usr/local/www/index.php");
+ else + exec("cp /usr/local/pkg/Fit123/backup/index.php /usr/local/www/index.php");
+ + $codered = $config['installedpackages']['fit123']['config'][0]['codered'];
+ if($codered){
+ exec("cp /usr/local/pkg/Fit123/code-red/all.css /usr/local/www/themes/nervecenter/all.css"); + exec("cp /usr/local/pkg/Fit123/code-red/background.gif /usr/local/www/themes/nervecenter/images/background.gif"); + exec("cp /usr/local/pkg/Fit123/code-red/footer.png /usr/local/www/themes/nervecenter/images/footer.png"); + exec("cp /usr/local/pkg/Fit123/code-red/header.png /usr/local/www/themes/nervecenter/images/header.png"); + } + else + { + exec("cp /usr/local/pkg/Fit123/backup/all.css /usr/local/www/themes/nervecenter/all.css"); + exec("cp /usr/local/pkg/Fit123/backup/background.gif /usr/local/www/themes/nervecenter/images/background.gif"); + exec("cp /usr/local/pkg/Fit123/backup/footer.png /usr/local/www/themes/nervecenter/images/footer.png"); + exec("cp /usr/local/pkg/Fit123/backup/header.png /usr/local/www/themes/nervecenter/images/header.png"); + } + + $ltsp = $config['installedpackages']['fit123']['config'][0]['ltsp'];
+ if($ltsp){ + exec("cp /usr/local/pkg/Fit123/LTSP/services.inc /etc/inc/services.inc"); + exec("cp /usr/local/pkg/Fit123/LTSP/services_dhcp.php /usr/local/www/services_dhcp.php"); + } + else
+ { + exec("cp /usr/local/pkg/Fit123/backup/services.inc /etc/inc/services.inc"); + exec("cp /usr/local/pkg/Fit123/backup/services_dhcp.php /usr/local/www/services_dhcp.php"); + } + + $afc = $config['installedpackages']['fit123']['config'][0]['afc']; + if($afc) + $config['system']['afterfilterchangeshellcmd'] = "/usr/local/bin/reset_states.sh"; + else + $config['system']['afterfilterchangeshellcmd'] = ""; + + $dnssrv = $config['installedpackages']['fit123']['config'][0]['dnssrv'];
+ if($dnssrv) + exec("cp /usr/local/pkg/Fit123/dnssrv/system.php /usr/local/www/system.php");
+ else + exec("cp /usr/local/pkg/Fit123/backup/system.php /usr/local/www/system.php"); +} + +function ddns_config(){ +global $config; + +// Is DDNS enable or not + $hoba = $config['installedpackages']['ddns']['config'][0]['enable']; + if($hoba){ + // Is DDNS.sh already added as a conjob + $task_key = '/usr/local/pkg/Fit123/ddns/DDNS.sh'; + $x_name=''; + $x=0; + foreach($config['cron']['item'] as $item) { + if($item['command']==$task_key) { + $x_name = $x; + } + $x++; + } + unset($x); + if(!$x_name > 0) + { + // Add cron job DDNS.sh to config.xml + $cron_item = array(); + $cron_item['minute'] = "*/5"; + $cron_item['hour'] = "*"; + $cron_item['mday'] = "*"; + $cron_item['month'] = "*"; + $cron_item['wday'] = "*"; + $cron_item['who'] = "root"; + $cron_item['command'] = "/usr/local/pkg/Fit123/ddns/DDNS.sh"; + $config['cron']['item'][] = $cron_item; + write_config(); + configure_cron(); + } + } + else + { + // Remove DDNS.sh cron entry from config.xml + $task_key = '/usr/local/pkg/Fit123/ddns/DDNS.sh'; + $x_name=''; + $x=0; + foreach($config['cron']['item'] as $item) { + if($item['command']==$task_key) { + $x_name = $x; + } + $x++; + } + unset($x); + if($x_name > 0) + { + unset($config['cron']['item'][$x_name]); + write_config(); + } + configure_cron(); + } + +// Created DDNS updater file ddns.php + + //Get user entry from config.xml + $line1text = $config['installedpackages']['ddns']['config'][0]['line1']; + $line2text = $config['installedpackages']['ddns']['config'][0]['line2']; + $line3text = $config['installedpackages']['ddns']['config'][0]['line3']; + + // Open ddns.php for writing + $hf = fopen("/usr/local/pkg/Fit123/ddns/ddns.php","w"); + if(!$hf) { + log_error("could not open /usr/local/pkg/Fit123/ddns/ddns.php for writing"); + exit; + } + + // The start of the config file + fwrite($hf, '<?php'); + fwrite($hf, "\n"); + fwrite($hf, '$ch = curl_init();'); + fwrite($hf, "\n"); + fwrite($hf, 'curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);'); + fwrite($hf, "\n"); + // add to config file + if ($line1text != ""){ + fwrite($hf, 'curl_setopt($ch, CURLOPT_URL, "'); + fwrite($hf, $line1text); + fwrite($hf, '");'); + fwrite($hf, "\n"); + fwrite($hf, '$result = curl_exec($ch);'); + fwrite($hf, "\n"); + } + if ($line2text != ""){ + fwrite($hf, 'curl_setopt($ch, CURLOPT_URL, "'); + fwrite($hf, $line2text); + fwrite($hf, '");'); + fwrite($hf, "\n"); + fwrite($hf, '$result = curl_exec($ch);'); + fwrite($hf, "\n"); + } + if ($line3text != ""){ + fwrite($hf, 'curl_setopt($ch, CURLOPT_URL, "'); + fwrite($hf, $line3text); + fwrite($hf, '");'); + fwrite($hf, "\n"); + fwrite($hf, '$result = curl_exec($ch);'); + fwrite($hf, "\n"); + } + // The end of the config file + fwrite($hf, 'curl_close ($ch);'); + fwrite($hf, "\n"); + fwrite($hf, '?>'); + fwrite($hf, "\n"); + fclose($hf); + +// Create local shell script to watch for wan ip change + + // Get WAN nic name from config.xml + $wannic = $config['interfaces']['wan']['if']; + + //Open DDNS.sh for writing + $hfd = fopen("/usr/local/pkg/Fit123/ddns/DDNS.sh","w"); + if(!$hfd) { + log_error("could not open /usr/local/pkg/Fit123/ddns/DDNS.sh for writing"); + exit; + } + // The start of the config file + fwrite($hfd, '#!/bin/sh'); + fwrite($hfd, "\n"); + fwrite($hfd, 'ext_if="'); + fwrite($hfd, $wannic); + fwrite($hfd, '"'); + fwrite($hfd, "\n"); + fwrite($hfd, 'dns_file="/usr/local/pkg/Fit123/ddns/DDNS.ip"'); + fwrite($hfd, "\n"); + fwrite($hfd, 'update_file="/usr/local/bin/php /usr/local/pkg/Fit123/ddns/ddns.php"'); + fwrite($hfd, "\n"); + fwrite($hfd, 'EXIT_SUCCESS=0'); + fwrite($hfd, "\n"); + fwrite($hfd, 'EXIT_FAILURE=1'); + fwrite($hfd, "\n"); + fwrite($hfd, 'if [ `id -u` -ne 0 ]'); + fwrite($hfd, "\n"); + fwrite($hfd, 'then'); + fwrite($hfd, "\n"); + fwrite($hfd, ' echo "Only root may run this program."'); + fwrite($hfd, "\n"); + fwrite($hfd, ' exit $EXIT_FAILURE'); + fwrite($hfd, "\n"); + fwrite($hfd, 'fi'); + fwrite($hfd, "\n"); + fwrite($hfd, 'get_ip(){'); + fwrite($hfd, "\n"); + fwrite($hfd, ' if [ -f $dns_file ]'); + fwrite($hfd, "\n"); + fwrite($hfd, ' then'); + fwrite($hfd, "\n"); + fwrite($hfd, ' registered_ip=`cat ${dns_file}`'); + fwrite($hfd, "\n"); + fwrite($hfd, ' else'); + fwrite($hfd, "\n"); + fwrite($hfd, ' registered_ip=""'); + fwrite($hfd, "\n"); + fwrite($hfd, ' fi'); + fwrite($hfd, "\n"); + fwrite($hfd, ' current_ip=`ifconfig ${ext_if} | awk '); + fwrite($hfd, "'"); + fwrite($hfd, '/inet / { print $2 }'); + fwrite($hfd, "'"); + fwrite($hfd, '`'); + fwrite($hfd, "\n"); + fwrite($hfd, '}'); + fwrite($hfd, "\n"); + fwrite($hfd, 'update_hosts(){'); + fwrite($hfd, "\n"); + fwrite($hfd, ' if [ "$registered_ip" != "$current_ip" ]'); + fwrite($hfd, "\n"); + fwrite($hfd, ' then'); + fwrite($hfd, "\n"); + fwrite($hfd, ' $update_file'); + fwrite($hfd, "\n"); + fwrite($hfd, ' echo $current_ip > $dns_file'); + fwrite($hfd, "\n"); + fwrite($hfd, ' echo "Your DDNS records have been updated" | logger'); + fwrite($hfd, "\n"); + fwrite($hfd, ' fi'); + fwrite($hfd, "\n"); + fwrite($hfd, '}'); + fwrite($hfd, "\n"); + fwrite($hfd, 'get_ip'); + fwrite($hfd, "\n"); + fwrite($hfd, 'update_hosts'); + fwrite($hfd, "\n"); + fwrite($hfd, 'exit $EXIT_SUCCESS'); + fwrite($hfd, "\n"); + fclose($hfd); + + exec("chmod 744 /usr/local/pkg/Fit123/ddns/DDNS.sh"); +} +?> diff --git a/config/Fit123/fit123.xml b/config/Fit123/fit123.xml new file mode 100644 index 00000000..04274234 --- /dev/null +++ b/config/Fit123/fit123.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright></copyright> + <description>Describe your package here</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>Fit123</name>
+ <version>0.0.0.1</version>
+ <title>Fit123</title>
+ <include_file>/usr/local/pkg/fit123.inc</include_file>
+ <menu> + <name>Fit123</name> + <tooltiptext></tooltiptext> + <section>Status</section> + <url>/pkg_edit.php?xml=fit123.xml&id=0</url> + </menu> + <tabs>
+ <tab>
+ <text>Fit123</text>
+ <url>/pkg_edit.php?xml=fit123.xml&id=0</url>
+ <active/>
+ </tab> + <tab>
+ <text>DDNS</text>
+ <url>/pkg_edit.php?xml=ddns.xml&id=0</url>
+ </tab> + </tabs>
+ <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/Fit123/fit123.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/Fit123/ddns.xml</item> + </additional_files_needed> + <fields>
+ <field>
+ <fielddescr>Date</fielddescr>
+ <fieldname>adddate</fieldname>
+ <description>Adds current date to front page</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>Code-red</fielddescr>
+ <fieldname>codered</fieldname>
+ <description>Change nervecenter Theme to Code-red</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <fielddescr>LTSP</fielddescr>
+ <fieldname>ltsp</fieldname>
+ <description>Adds 3th network boot option</description>
+ <type>checkbox</type>
+ </field> + <field>
+ <fielddescr>After Filter Change</fielddescr>
+ <fieldname>afc</fieldname>
+ <description> + When using voip behind a multiwan failover setup, states needs to be cleared.<br> + (Press save twice to activate and deactivate) + </description>
+ <type>checkbox</type>
+ </field> + <field>
+ <fielddescr>DNS Servers</fielddescr>
+ <fieldname>dnssrv</fieldname>
+ <description>Adds option for a 3th and 4th DNS Server</description>
+ <type>checkbox</type>
+ </field> + </fields> + <custom_php_command_before_form>Fit123_config();</custom_php_command_before_form> + <custom_php_after_form_command></custom_php_after_form_command> + <custom_php_validation_command></custom_php_validation_command> + <custom_php_resync_config_command></custom_php_resync_config_command> + <custom_php_install_command>Fit123_install_config();</custom_php_install_command> + <custom_php_deinstall_command>Fit123_install_deinstall();</custom_php_deinstall_command> +</packagegui> diff --git a/config/autoconfigbackup/autoconfigbackup.inc b/config/autoconfigbackup/autoconfigbackup.inc index fd0d3169..ac8038d2 100644 --- a/config/autoconfigbackup/autoconfigbackup.inc +++ b/config/autoconfigbackup/autoconfigbackup.inc @@ -133,8 +133,8 @@ function upload_config($reasonm = "") { if(!file_exists("/cf/conf/autoconfigback.notice")) { $notice_text = "Either the username, password or encryption password is not set for Automatic Configuration Backup. "; $notice_text .= "Please correct this in Diagnostics -> AutoConfigBackup -> Settings."; - log_error($notice_text); - file_notice("AutoConfigBackup", $notice_text, $notice_text, ""); + //log_error($notice_text); + //file_notice("AutoConfigBackup", $notice_text, $notice_text, ""); conf_mount_rw(); touch("/cf/conf/autoconfigback.notice"); conf_mount_ro(); diff --git a/config/autoconfigbackup/autoconfigbackup.php b/config/autoconfigbackup/autoconfigbackup.php index 80db5543..4f143adb 100644 --- a/config/autoconfigbackup/autoconfigbackup.php +++ b/config/autoconfigbackup/autoconfigbackup.php @@ -64,7 +64,7 @@ else $myhostname = $config['system']['hostname'] . "." . $config['system']['domain']; if(!$username) { - Header("Location: /pkg_edit.php?xml=autoconfigbackup.xml&id=0"); + Header("Location: /pkg_edit.php?xml=autoconfigbackup.xml&id=0&savemsg=Please+setup+Auto+Config+Backup"); exit; } @@ -127,6 +127,10 @@ function get_hostnames() { print_info_box("Warning! You are currently viewing an alternate hosts backup history ($hostname)"); ?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td> +<div id="loading"> + <img src="/themes/metallic/images/misc/loader.gif"> Loading, please wait... + <p/> +</div> <div id='feedbackdiv'></div> <?php $tab_array = array(); @@ -149,9 +153,6 @@ function get_hostnames() { <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> <td colspan="2" align="left"> - <div id="loading"> - <img src="themes/metallic/images/misc/loader.gif"> Loading, please wait... - </div> <?php if($_REQUEST['rmver'] != "") { $curl_session = curl_init(); diff --git a/config/autoconfigbackup/autoconfigbackup.xml b/config/autoconfigbackup/autoconfigbackup.xml index 5e5eaf73..869cd747 100644 --- a/config/autoconfigbackup/autoconfigbackup.xml +++ b/config/autoconfigbackup/autoconfigbackup.xml @@ -49,11 +49,6 @@ <url>/autoconfigbackup.php</url> </menu> <additional_files_needed> - <prefix>/usr/local/pkg/pf/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/autoconfigbackup/upload_config_filter.php</item> - </additional_files_needed> - <additional_files_needed> <prefix>/usr/local/pkg/parse_config/</prefix> <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/autoconfigbackup/parse_config_upload.php</item> diff --git a/config/autoconfigbackup/autoconfigbackup_backup.php b/config/autoconfigbackup/autoconfigbackup_backup.php index cebd7a56..47336c27 100644 --- a/config/autoconfigbackup/autoconfigbackup_backup.php +++ b/config/autoconfigbackup/autoconfigbackup_backup.php @@ -57,7 +57,7 @@ $del_url = "https://{$username}:{$password}@portal.pfsense.org/pfSconfigbackup $hostname = $config['system']['hostname'] . "." . $config['system']['domain']; if(!$username) { - Header("Location: /pkg_edit.php?xml=autoconfigbackup.xml&id=0"); + Header("Location: /pkg_edit.php?xml=autoconfigbackup.xml&id=0&savemsg=Please+setup+Auto+Config+Backup"); exit; } diff --git a/config/autoconfigbackup/autoconfigbackup_stats.php b/config/autoconfigbackup/autoconfigbackup_stats.php index 65f02b2d..c024d689 100644 --- a/config/autoconfigbackup/autoconfigbackup_stats.php +++ b/config/autoconfigbackup/autoconfigbackup_stats.php @@ -60,7 +60,7 @@ $stats_url = "https://{$username}:{$password}@portal.pfsense.org/pfSconfigback $hostname = $config['system']['hostname'] . "." . $config['system']['domain']; if(!$username) { - Header("Location: /pkg_edit.php?xml=autoconfigbackup.xml&id=0"); + Header("Location: /pkg_edit.php?xml=autoconfigbackup.xml&id=0&savemsg=Please+setup+Auto+Config+Backup"); exit; } diff --git a/config/backup/backup.inc b/config/backup/backup.inc new file mode 100644 index 00000000..fa2783d6 --- /dev/null +++ b/config/backup/backup.inc @@ -0,0 +1,127 @@ +<?php +/* $Id$ */ +/* +/* ========================================================================== */ +/* + backup.inc + Copyright (C) 2008 Mark J Crane + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + + +function byte_convert( $bytes ) { + + if ($bytes<=0) + return '0 Byte'; + + $convention=1000; //[1000->10^x|1024->2^x] + $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); + $e=floor(log($bytes,$convention)); + return round($bytes/pow($convention,$e),2).' '.$s[$e]; +} + + +function backup_sync_package_php() +{ + + global $config; + if($config['installedpackages']['backup']['config'] != "") { + + conf_mount_rw(); + config_unlock(); + + foreach($config['installedpackages']['backup']['config'] as $rowhelper) { + if ($rowhelper['enabled'] != "false") { + //$tmp_php = base64_decode($rowhelper['php']); + if (strlen($tmp_php) > 0) { + $tmp .= "// name: ".$rowhelper['name']." \n"; + $tmp .= "// description: ".$rowhelper['description']." \n\n"; + $tmp .= base64_decode($rowhelper['php']); + $tmp .= "\n"; + } + } + + } + + conf_mount_ro(); + + } +} + + +function php_sync_package() +{ + + global $config; + backup_sync_package_php(); + +} + + +function php_install_command() +{ + + global $config; + conf_mount_rw(); + config_lock(); + + if (!is_dir('/usr/local/www/packages/')) { + exec("mkdir /usr/local/www/packages/"); + } + + if (!is_dir('/usr/local/www/packages/backup/')) { + exec("mkdir /usr/local/www/packages/backup/"); + } + + //rename PHP files from .tmp to .php + exec("cp /tmp/backup.tmp /usr/local/www/packages/backup/backup.php"); + unlink_if_exists("/tmp/backup.tmp"); + + exec("cp /tmp/backup_edit.tmp /usr/local/www/packages/backup/backup_edit.php"); + unlink_if_exists("/tmp/backup_edit.tmp"); + + php_sync_package(); + + conf_mount_ro(); + config_unlock(); + +} + + +function deinstall_command() +{ + + conf_mount_rw(); + config_lock(); + unlink_if_exists("/usr/local/pkg/backup.xml"); + unlink_if_exists("/usr/local/pkg/backup.inc"); + exec("rm /usr/local/www/packages/backup/"); + conf_mount_ro(); + config_unlock(); + +} + +?>
\ No newline at end of file diff --git a/config/backup/backup.tmp b/config/backup/backup.tmp new file mode 100644 index 00000000..86d645d0 --- /dev/null +++ b/config/backup/backup.tmp @@ -0,0 +1,309 @@ +<?php +/* $Id$ */ +/* + backup.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/backup.inc"); + +$a_backup = &$config['installedpackages']['backup']['config']; + + +if ($_GET['act'] == "del") { + if ($_GET['type'] == 'backup') { + if ($a_backup[$_GET['id']]) { + unset($a_backup[$_GET['id']]); + write_config(); + header("Location: backup.php"); + exit; + } + } +} + +if ($_GET['a'] == "download") { + if ($_GET['t'] == "backup") { + $tmp = '/tmp/'; + $filename = 'pfsense.bak.tgz'; + //system('cd /usr/local/;tar cvzf /tmp/pfsense.bak.tgz freeswitch'); + + $i = 0; + if (count($a_backup) > 0) { + $backup_cmd = 'tar --create --verbose --gzip --file '.$tmp.$filename.' --directory / '; + foreach ($a_backup as $ent) { + if ($ent['enabled'] =="true"){ + //htmlspecialchars($ent['name']); + //htmlspecialchars($ent['path']); + //htmlspecialchars($ent['description']); + $backup_cmd .= htmlspecialchars($ent['path']).' '; + + } + $i++; + } + //echo $backup_cmd; //exit; + system($backup_cmd); + } + + session_cache_limiter('public'); + $fd = fopen($tmp.$filename, "rb"); + header("Content-Type: binary/octet-stream"); + header("Content-Length: " . filesize($tmp.$filename)); + header('Content-Disposition: attachment; filename="'.$filename.'"'); + fpassthru($fd); + exit; + } +} + +if ($_GET['a'] == "other") { + if ($_GET['t'] == "restore") { + $tmp = '/tmp/'; + $filename = 'pfsense.bak.tgz'; + + //extract the tgz file + if (file_exists('/tmp/'.$filename)) { + //echo "The file $filename exists"; + system('cd /; tar xvpfz /tmp/'.$filename.' '); + header( 'Location: backup.php?savemsg=Backup+has+been+restored.' ) ; + } + else { + header( 'Location: backup.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ; + } + + exit; + } +} + +if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { + $filename = 'pfsense.bak.tgz'; + move_uploaded_file($_FILES['ulfile']['tmp_name'], "/tmp/" . $filename); + $savemsg = "Uploaded file to /tmp/" . htmlentities($_FILES['ulfile']['name']); + system('cd /; tar xvpfz /tmp/'.$filename.' '); +} + + +include("head.inc"); + +?> + + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle">Backup: Files & Directories</p> + +<?php +if ($_GET["savemsg"]) { + print_info_box($_GET["savemsg"]); +} +?> + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + + $tab_array = array(); + $tab_array[] = array(gettext("Settings"), false, "/packages/backup/backup.php"); + display_top_tabs($tab_array); + +?> +</td></tr> +</table> + +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <p> + Use this to tool to backup files and directories. The following directories + are recommended for backup. + + <table> + <tr><td><strong>pfSense Config</strong></td><td>/cf/conf</td></tr> + <tr><td><strong>RRD Graph Data Files</strong></td><td>/var/db/rrd</td></tr> + </table> + </p> + </td> + </tr> + </table> + + <br/> + <br/> + + <div id="niftyOutter"> + + <form action="backup.php" method="POST" enctype="multipart/form-data" name="frmUpload" onSubmit=""> + <table width='100%' width='690' cellpadding='0' cellspacing='0' border='0'> + <tr><td align='left' colspan='4'><strong>Upload and Restore</strong></td></tr> + <tr> + <td colspan='2'>Use this to upload and restore your backup file.</td> + <td align="right">File to upload:</td> + <td width='50%' valign="top" align='right' class="label"> + <input name="ulfile" type="file" class="button" id="ulfile"> + </td> + <td valign="top" class="label"> + <input name="submit" type="submit" class="button" id="upload" value="Upload"> + </td> + </tr> + + </table> + <br /> + <br /> + </div> + </form> + + +<?php + echo "<table width='690' cellpadding='0' cellspacing='0' border='0'>\n"; + echo "<tr>\n"; + echo "<td width='80%'>\n"; + echo "<b>Backup / Restore</b><br />\n"; + echo "The 'backup' button will tar gzip the directories that are listed below to /tmp/pfsense.bak.tgz it then presents a file to download. \n"; + echo "If the backup file does not exist in /tmp/pfsense.bak.tgz then the 'restore' button will be hidden. \n"; + echo "<br /><br />\n"; + echo "</td>\n"; + echo "<td width='20%' valign='middle' align='right'>\n"; + echo " <input type='button' value='backup' onclick=\"document.location.href='backup.php?a=download&t=backup';\" />\n"; + if (file_exists('/tmp/pfsense.bak.tgz')) { + echo " <input type='button' value='restore' onclick=\"document.location.href='backup.php?a=other&t=restore';\" />\n"; + } + echo "</td>\n"; + echo "</tr>\n"; + echo "</table>\n"; + echo "<br /><br />\n\n"; + + +echo " <form action='backup.php' method='post' name='iform' id='iform'>\n"; + + +if ($config_change == 1) { + write_config(); + $config_change = 0; +} + +//if ($savemsg) print_info_box($savemsg); +//if (file_exists($d_hostsdirty_path)): echo"<p>"; +//print_info_box_np("This is an info box."); +//echo"<br />"; +//endif; + +?> + + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="30%" class="listhdrr">Name</td> + <td width="20%" class="listhdrr">Enabled</td> + <td width="40%" class="listhdr">Description</td> + <td width="10%" class="list"> + + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td width="17"></td> + <td valign="middle"><a href="backup_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + + </td> + </tr> + + + <?php + + $i = 0; + if (count($a_backup) > 0) { + + foreach ($a_backup as $ent) { + + ?> + <tr> + <td class="listr" ondblclick="document.location='backup_edit.php?id=<?=$i;?>';"> + <?=$ent['name'];?> + </td> + <td class="listr" ondblclick="document.location='backup_edit.php?id=<?=$i;?>';"> + <?=$ent['enabled'];?> + </td> + <td class="listbg" ondblclick="document.location='backup_edit.php?id=<?=$i;?>';"> + <font color="#FFFFFF"><?=htmlspecialchars($ent['description']);?> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="backup_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="backup_edit.php?type=backup&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php + + $i++; + } + } + ?> + + <tr> + <td class="list" colspan="3"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td width="17"></td> + <td valign="middle"><a href="backup_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + + <tr> + <td class="list" colspan="3"></td> + <td class="list"></td> + </tr> + </table> + +</form> + + +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> + +</td> +</tr> +</table> + +</div> + + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/backup/backup.xml b/config/backup/backup.xml new file mode 100644 index 00000000..a0f72ba2 --- /dev/null +++ b/config/backup/backup.xml @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ========================================================================== */ +/* + backup.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + </copyright> + <description>Backup</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>Backup Settings</name> + <version>0.1.5</version> + <title>Settings</title> + <include_file>/usr/local/pkg/backup.inc</include_file> + <menu> + <name>Backup Files/Dir</name> + <tooltiptext>Backup settings.</tooltiptext> + <section>Diagnostics</section> + <configfile>backup.xml</configfile> + <url>/packages/backup/backup.php</url> + </menu> + <tabs> + <tab> + <text>Settings</text> + <url>/pkg_edit.php?xml=backup.xml&id=0</url> + <active/> + </tab> + <tab> + <text>Settings</text> + <url>/packages/backup.php</url> + <active/> + </tab> + </tabs> + <configpath>installedpackages->package->$packagename->configuration->backup</configpath> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/backup/backup.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/backup/backup.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/backup/backup.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/backup/backup_edit.tmp</item> + </additional_files_needed> + <fields> + <field> + <fielddescr>Example Variable One</fielddescr> + <fieldname>var1</fieldname> + <description>Enter the variable one here.</description> + <type>input</type> + </field> + <field> + <fielddescr>Example Variable Two</fielddescr> + <fieldname>var1</fieldname> + <description>Enter the variable one here.</description> + <type>input</type> + </field> + </fields> + <custom_add_php_command> + </custom_add_php_command> + <custom_php_resync_config_command> + php_sync_package(); + </custom_php_resync_config_command> + <custom_delete_php_command> + php_sync_package(); + </custom_delete_php_command> + <custom_php_install_command> + php_install_command(); + </custom_php_install_command> + <custom_php_deinstall_command> + deinstall_command(); + </custom_php_deinstall_command> +</packagegui>
\ No newline at end of file diff --git a/config/backup/backup_edit.tmp b/config/backup/backup_edit.tmp new file mode 100755 index 00000000..69d63866 --- /dev/null +++ b/config/backup/backup_edit.tmp @@ -0,0 +1,213 @@ +<?php +/* $Id$ */ +/* + + backup_edit.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/backup.inc"); + + +$a_backup = &$config['installedpackages']['backup']['config']; + +$id = $_GET['id']; +if (isset($_POST['id'])) { + $id = $_POST['id']; +} + +if ($_GET['act'] == "del") { + if ($_GET['type'] == 'backup') { + if ($a_backup[$_GET['id']]) { + unset($a_backup[$_GET['id']]); + write_config(); + php_sync_package(); + header("Location: backup.php"); + exit; + } + } +} + +if (isset($id) && $a_backup[$id]) { + + $pconfig['name'] = $a_backup[$id]['name']; + $pconfig['path'] = $a_backup[$id]['path']; + $pconfig['enabled'] = $a_backup[$id]['enabled']; + $pconfig['description'] = $a_backup[$id]['description']; + +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + if (!$input_errors) { + + $ent = array(); + $ent['name'] = $_POST['name']; + $ent['path'] = $_POST['path']; + $ent['enabled'] = $_POST['enabled']; + $ent['description'] = $_POST['description']; + + if (isset($id) && $a_backup[$id]) { + //update + $a_backup[$id] = $ent; + } + else { + //add + $a_backup[] = $ent; + } + + write_config(); + php_sync_package(); + + header("Location: backup.php"); + exit; + } +} + +include("head.inc"); + +?> + +<script type="text/javascript" language="JavaScript"> + +function show_advanced_config() { + document.getElementById("showadvancedbox").innerHTML=''; + aodiv = document.getElementById('showadvanced'); + aodiv.style.display = "block"; +</script> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle">Backup: Edit</p> +<?php if ($input_errors) print_input_errors($input_errors); ?> + + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + + $tab_array = array(); + $tab_array[] = array(gettext("Settings"), false, "/packages/backup/backup.php"); + display_top_tabs($tab_array); + +?> +</td></tr> +</table> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + + <!-- + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td><p><span class="vexpl"><span class="red"><strong>PHP<br> + </strong></span> + </p></td> + </tr> + </table> + --> + <br /> + + <form action="backup_edit.php" method="post" name="iform" id="iform"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + <tr> + <td width="25%" valign="top" class="vncellreq">Name</td> + <td width="75%" class="vtable"> + <input name="name" type="text" class="formfld" id="name" size="40" value="<?=htmlspecialchars($pconfig['name']);?>"> + </td> + </tr> + + <tr> + <td width="22%" valign="top" class="vncellreq">Path</td> + <td width="78%" class="vtable"> + <input name="path" type="text" class="formfld" id="path" size="40" value="<?=htmlspecialchars($pconfig['path']);?>"> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncellreq">Enabled</td> + <td width="78%" class="vtable"> + <?php + echo " <select name='enabled' class='formfld'>\n"; + echo " <option></option>\n"; + switch (htmlspecialchars($pconfig['enabled'])) { + case "true": + echo " <option value='true' selected='yes'>true</option>\n"; + echo " <option value='false'>false</option>\n"; + break; + case "false": + echo " <option value='true'>true</option>\n"; + echo " <option value='false' selected='yes'>false</option>\n"; + + break; + default: + echo " <option value='true' selected='yes'>true</option>\n"; + echo " <option value='false'>false</option>\n"; + } + echo " </select>\n"; + ?> + </td> + </tr> + <tr> + <td width="25%" valign="top" class="vncellreq">Description</td> + <td width="75%" class="vtable"> + <input name="description" type="text" class="formfld" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>"> + <br><span class="vexpl">Enter the description here.<br></span> + </td> + </tr> + + <tr> + <td valign="top"> </td> + <td> + <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> + <?php if (isset($id) && $a_backup[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + </td> + </tr> + </table> + </form> + + <br> + <br> + <br> + <br> + <br> + <br> + + </td> + </tr> +</table> + +</div> + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/cron/cron.inc b/config/cron/cron.inc new file mode 100644 index 00000000..63059a04 --- /dev/null +++ b/config/cron/cron.inc @@ -0,0 +1,124 @@ +<?php +/* $Id$ */ +/* +/* ========================================================================== */ +/* + cron.inc + Copyright (C) 2008 Mark J Crane + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("services.inc"); + +function pkg_is_service_running($servicename) +{ + exec("/bin/ps ax | awk '{ print $5 }'", $psout); + array_shift($psout); + foreach($psout as $line) { + $ps[] = trim(array_pop(explode(' ', array_pop(explode('/', $line))))); + } + if(is_service_running($servicename, $ps) or is_process_running($servicename) ) { + return true; + } + else { + return false; + } +} + +function php_sync_package() +{ + + global $config; + //synch cron tab + configure_cron(); + $handle = popen("/usr/local/etc/rc.d/cron.sh stop", "r"); + pclose($handle); + $handle = popen("/usr/local/etc/rc.d/cron.sh start", "r"); + pclose($handle); + +} + + +function php_install_command() +{ + + global $config; + conf_mount_rw(); + config_lock(); + + if (!is_dir('/usr/local/www/packages/')) { + exec("mkdir /usr/local/www/packages/"); + } + + if (!is_dir('/usr/local/www/packages/cron/')) { + exec("mkdir /usr/local/www/packages/cron/"); + } + + + //rename PHP files from .tmp to .php + exec("cp /tmp/cron.tmp /usr/local/www/packages/cron/cron.php"); + unlink_if_exists("/tmp/cron.tmp"); + + exec("cp /tmp/cron_edit.tmp /usr/local/www/packages/cron/cron_edit.php"); + unlink_if_exists("/tmp/cron_edit.tmp"); + + //write_config(); + + write_rcfile(array( + "file" => "cron.sh", + "start" => "/usr/sbin/cron -s &", + "stop" => "kill -9 `cat /var/run/cron.pid`" + ) + ); + + php_sync_package(); + + //if (pkg_is_service_running('cron')) { + //documentation purposes + //} + + conf_mount_ro(); + config_unlock(); + +} + + +function deinstall_command() +{ + + conf_mount_rw(); + config_lock(); + $handle = popen("/usr/local/etc/rc.d/cron.sh stop", "r"); + unlink_if_exists("/usr/local/pkg/cron.xml"); + unlink_if_exists("/usr/local/www/cron.inc"); + exec("rm -R /usr/local/www/packages/cron"); + //unlink_if_exists("/usr/local/etc/rc.d/cron.sh"); + conf_mount_ro(); + config_unlock(); + +} + +?>
\ No newline at end of file diff --git a/config/cron/cron.tmp b/config/cron/cron.tmp new file mode 100644 index 00000000..8750febc --- /dev/null +++ b/config/cron/cron.tmp @@ -0,0 +1,208 @@ +<?php +/* $Id$ */ +/* + cron.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/cron.inc"); + +$a_cron = &$config['cron']['item']; + + +if ($_GET['act'] == "del") { + if ($_GET['type'] == 'php') { + if ($a_cron[$_GET['id']]) { + unset($a_cron[$_GET['id']]); + write_config(); + header("Location: cron.php"); + exit; + } + } +} + +include("head.inc"); + +?> + + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle">Cron: Settings</p> + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + + $tab_array = array(); + $tab_array[] = array(gettext("Settings"), false, "/packages/cron/cron.php"); + display_top_tabs($tab_array); + +?> +</td></tr> +</table> + +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + +<form action="cron.php" method="post" name="iform" id="iform"> +<?php + +if ($config_change == 1) { + write_config(); + $config_change = 0; +} + +//if ($savemsg) print_info_box($savemsg); +//if (file_exists($d_hostsdirty_path)): echo"<p>"; +//print_info_box_np("This is an info box."); +//echo"<br />"; +//endif; + +?> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td><p><!--<span class="vexpl"><span class="red"><strong>Cron<br></strong></span>--> + Cron controls the scheduling of commands. + <br /><br /> + For more information see: <a href='http://www.freebsd.org/doc/en/books/handbook/configtuning-cron.html' target='_blank'>http://www.freebsd.org/doc/en/books/handbook/configtuning-cron.html</a> + </p></td> + </tr> + </table> + <br /> + + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="5%" class="listhdrr">minute</td> + <td width="5%" class="listhdrr">hour</td> + <td width="5%" class="listhdrr">mday</td> + <td width="5%" class="listhdrr">month</td> + <td width="5%" class="listhdrr">wday</td> + <td width="5%" class="listhdrr">who</td> + <td width="60%" class="listhdr">command</td> + <td width="10%" class="list"> + + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td width="17"></td> + <td valign="middle"><a href="cron_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + + </td> + </tr> + + + <?php + + $i = 0; + if (count($a_cron) > 0) { + + foreach ($a_cron as $ent) { + + ?> + + <tr> + <td class="listr" ondblclick="document.location='cron_edit.php?id=<?=$i;?>';"> + <?=$ent['minute'];?> + </td> + <td class="listr" ondblclick="document.location='cron_edit.php?id=<?=$i;?>';"> + <?=$ent['hour'];?> + </td> + <td class="listr" ondblclick="document.location='cron_edit.php?id=<?=$i;?>';"> + <?=$ent['mday'];?> + </td> + <td class="listr" ondblclick="document.location='cron_edit.php?id=<?=$i;?>';"> + <?=$ent['month'];?> + </td> + <td class="listr" ondblclick="document.location='cron_edit.php?id=<?=$i;?>';"> + <?=$ent['wday'];?> + </td> + <td class="listr" ondblclick="document.location='cron_edit.php?id=<?=$i;?>';"> + <?=$ent['who'];?> + </td> + <td class="listr" ondblclick="document.location='cron_edit.php?id=<?=$i;?>';"> + <?=$ent['command'];?> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="cron_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="cron_edit.php?type=php&act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php + + $i++; + } + } + ?> + + <tr> + <td class="list" colspan="7"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td width="17"></td> + <td valign="middle"><a href="cron_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + + <tr> + <td class="list" colspan="8"></td> + <td class="list"></td> + </tr> + </table> + +</form> + + +<br> +<br> +<br> +<br> +<br> +<br> +<br> +<br> + +</td> +</tr> +</table> + +</div> + + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/cron/cron.xml b/config/cron/cron.xml new file mode 100644 index 00000000..856747c2 --- /dev/null +++ b/config/cron/cron.xml @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ========================================================================== */ +/* + cron.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + </copyright> + <description>Cron</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>Cron Settings</name> + <version>0.1.5</version> + <title>Settings</title> + <include_file>/usr/local/pkg/cron.inc</include_file> + <menu> + <name>Cron</name> + <tooltiptext>cron settings.</tooltiptext> + <section>Services</section> + <configfile>cron.xml</configfile> + <url>/packages/cron/cron.php</url> + </menu> + <service> + <name>cron</name> + <rcfile>cron.sh</rcfile> + <executable>cron</executable> + <description>The cron utility is used to manage commands on a schedule.</description> + </service> + <tabs> + <tab> + <text>Settings</text> + <url>/pkg_edit.php?xml=cron.xml&id=0</url> + <active/> + </tab> + <tab> + <text>Settings</text> + <url>/packages/cron.php</url> + <active/> + </tab> + </tabs> + <configpath>installedpackages->package->$packagename->configuration->cron</configpath> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/cron/cron.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/cron/cron.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/cron/cron.tmp</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/cron/cron_edit.tmp</item> + </additional_files_needed> + <fields> + <field> + <fielddescr>Variable One</fielddescr> + <fieldname>var1</fieldname> + <description>Enter the variable one here.</description> + <type>input</type> + </field> + <field> + <fielddescr>Variable Two</fielddescr> + <fieldname>var1</fieldname> + <description>Enter the variable one here.</description> + <type>input</type> + </field> + </fields> + <custom_add_php_command> + </custom_add_php_command> + <custom_php_resync_config_command> + php_sync_package(); + </custom_php_resync_config_command> + <custom_delete_php_command> + php_sync_package(); + </custom_delete_php_command> + <custom_php_install_command> + php_install_command(); + </custom_php_install_command> + <custom_php_deinstall_command> + deinstall_command(); + </custom_php_deinstall_command> +</packagegui>
\ No newline at end of file diff --git a/config/cron/cron_edit.tmp b/config/cron/cron_edit.tmp new file mode 100644 index 00000000..9922e350 --- /dev/null +++ b/config/cron/cron_edit.tmp @@ -0,0 +1,281 @@ +<?php +/* $Id$ */ +/* + + cron_edit.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/cron.inc"); + + +$a_cron = &$config['cron']['item']; + +$id = $_GET['id']; +if (isset($_POST['id'])) { + $id = $_POST['id']; +} + +if ($_GET['act'] == "del") { + if ($_GET['type'] == 'php') { + if ($a_cron[$_GET['id']]) { + unset($a_cron[$_GET['id']]); + write_config(); + php_sync_package(); + header("Location: cron.php"); + exit; + } + } +} + +if (isset($id) && $a_cron[$id]) { + + $pconfig['minute'] = $a_cron[$id]['minute']; + $pconfig['hour'] = $a_cron[$id]['hour']; + $pconfig['mday'] = $a_cron[$id]['mday']; + $pconfig['month'] = $a_cron[$id]['month']; + $pconfig['wday'] = $a_cron[$id]['wday']; + $pconfig['who'] = $a_cron[$id]['who']; + $pconfig['command'] = $a_cron[$id]['command']; + +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + if (!$input_errors) { + + $ent = array(); + $ent['minute'] = $_POST['minute']; + $ent['hour'] = $_POST['hour']; + $ent['mday'] = $_POST['mday']; + $ent['month'] = $_POST['month']; + $ent['wday'] = $_POST['wday']; + $ent['who'] = $_POST['who']; + $ent['command'] = $_POST['command']; + + if (isset($id) && $a_cron[$id]) { + //update + $a_cron[$id] = $ent; + } + else { + //add + $a_cron[] = $ent; + } + + write_config(); + php_sync_package(); + + header("Location: cron.php"); + exit; + } +} + +include("head.inc"); + +?> + +<script type="text/javascript" language="JavaScript"> + +function show_advanced_config() { + document.getElementById("showadvancedbox").innerHTML=''; + aodiv = document.getElementById('showadvanced'); + aodiv.style.display = "block"; +</script> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle">Cron: Edit</p> +<?php if ($input_errors) print_input_errors($input_errors); ?> + + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + + $tab_array = array(); + $tab_array[] = array(gettext("Settings"), false, "/packages/cron/cron.php"); + display_top_tabs($tab_array); + +?> +</td></tr> +</table> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + + <!-- + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td><p><span class="vexpl"><span class="red"><strong>Cron<br> + </strong></span> + </p></td> + </tr> + </table> + --> + <br /> + + <form action="cron_edit.php" method="post" name="iform" id="iform"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + + + + + <tr> + <td width="25%" valign="top" class="vncellreq">minute</td> + <td width="75%" class="vtable"> + <input name="minute" type="text" class="formfld" id="minute" size="40" value="<?=htmlspecialchars($pconfig['minute']);?>"> + </td> + </tr> + + <tr> + <td width="25%" valign="top" class="vncellreq">hour</td> + <td width="75%" class="vtable"> + <input name="hour" type="text" class="formfld" id="hour" size="40" value="<?=htmlspecialchars($pconfig['hour']);?>"> + </td> + </tr> + + <tr> + <td width="25%" valign="top" class="vncellreq">mday</td> + <td width="75%" class="vtable"> + <input name="mday" type="text" class="formfld" id="mday" size="40" value="<?=htmlspecialchars($pconfig['mday']);?>"> + </td> + </tr> + + <tr> + <td width="25%" valign="top" class="vncellreq">month</td> + <td width="75%" class="vtable"> + <input name="month" type="text" class="formfld" id="month" size="40" value="<?=htmlspecialchars($pconfig['month']);?>"> + </td> + </tr> + + <tr> + <td width="25%" valign="top" class="vncellreq">wday</td> + <td width="75%" class="vtable"> + <input name="wday" type="text" class="formfld" id="wday" size="40" value="<?=htmlspecialchars($pconfig['wday']);?>"> + </td> + </tr> + + <tr> + <td width="25%" valign="top" class="vncellreq">who</td> + <td width="75%" class="vtable"> + <input name="who" type="text" class="formfld" id="who" size="40" value="<?=htmlspecialchars($pconfig['who']);?>"> + </td> + </tr> + + <tr> + <td width="25%" valign="top" class="vncellreq">command</td> + <td width="75%" class="vtable"> + <input name="command" type="text" class="formfld" id="command" size="40" value="<?=htmlspecialchars($pconfig['command']);?>"> + </td> + </tr> + <!-- + <tr> + <td width="22%" valign="top" class="vncell">PHP</td> + <td width="78%" class="vtable"> + --> + <?php + //echo "<textarea name=\"php\" id=\"php\" cols=\"70\" rows=\"15\" wrap=\"off\">".htmlspecialchars($pconfig['php'])."</textarea>\n"; + ?> + <!-- + <br> + <select name='dialplan_expression_select' id='dialplan_expression_select' onchange="document.getElementById('dialplan_expression').value += document.getElementById('dialplan_expression_select').value + '\n';" class='formfld'> + <option></option> + <option value='snortkillsessions'>snort kill sessions</option> + </select> + <span class="vexpl"> + <br /> + </span> + </td> + </tr> + --> + <!-- + <tr> + <td width="22%" valign="top" class="vncellreq">Enabled</td> + <td width="78%" class="vtable"> + <?php + echo " <select name='enabled' class='formfld'>\n"; + echo " <option></option>\n"; + switch (htmlspecialchars($pconfig['enabled'])) { + case "true": + echo " <option value='true' selected='yes'>true</option>\n"; + echo " <option value='false'>false</option>\n"; + break; + case "false": + echo " <option value='true'>true</option>\n"; + echo " <option value='false' selected='yes'>false</option>\n"; + + break; + default: + echo " <option value='true' selected='yes'>true</option>\n"; + echo " <option value='false'>false</option>\n"; + } + echo " </select>\n"; + ?> + </td> + </tr> + --> + <!-- + <tr> + <td width="25%" valign="top" class="vncellreq">Description</td> + <td width="75%" class="vtable"> + <input name="description" type="text" class="formfld" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>"> + <br><span class="vexpl">Enter the description here.<br></span> + </td> + </tr> + --> + + <tr> + <td valign="top"> </td> + <td> + <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> + <?php if (isset($id) && $a_cron[$id]): ?> + <input name="id" type="hidden" value="<?=$id;?>"> + <?php endif; ?> + </td> + </tr> + </table> + </form> + + <br> + <br> + <br> + <br> + <br> + <br> + + </td> + </tr> +</table> + +</div> + +<?php include("fend.inc"); ?> +</body> +</html> diff --git a/config/dashboard/dashboard.inc b/config/dashboard/dashboard.inc index b147632e..07f4610c 100644 --- a/config/dashboard/dashboard.inc +++ b/config/dashboard/dashboard.inc @@ -4,10 +4,17 @@ function dashboard_install() { global $g, $config; assign_privs(); if(!file_exists("/usr/local/www/index.php.before_dashboard")) { - /* backup the pre-dashboard index.php file */ - mwexec("cp /usr/local/www/index.php /usr/local/www/index.php.before_dashboard"); - /* backup the pre-dashboard fbegin.inc file */ - mwexec("cp /usr/local/www/fbegin.inc /usr/local/www/fbegin.inc.before_dashboard"); + /* backup the pre-dashboard files */ + mwexec("mv /usr/local/www/index.php /usr/local/www/index.php.before_dashboard"); + mwexec("mv /usr/local/www/fbegin.inc /usr/local/www/fbegin.inc.before_dashboard"); + mwexec("mv /usr/local/www/diag_logs_filter.php /usr/local/www/diag_logs_filter.php.before_dashboard"); + mwexec("mv /usr/local/www/diag_logs_filter_dynamic.php /usr/local/www/diag_logs_filter_dynamic.php.before_dashboard"); + } else { + /* Move the files, since we do not know what version they are, don't try to keep them. */ + mwexec("mv /usr/local/www/index.php /usr/local/www/index.php.tmp"); + mwexec("mv /usr/local/www/fbegin.inc /usr/local/www/fbegin.inc.tmp"); + mwexec("mv /usr/local/www/diag_logs_filter.php /usr/local/www/diag_logs_filter.php.tmp"); + mwexec("mv /usr/local/www/diag_logs_filter_dynamic.php /usr/local/www/diag_logs_filter_dynamic.php.tmp"); } mwexec("tar xzvpf /usr/local/pkg/widgets.tgz -C /"); assign_privs(); @@ -18,21 +25,28 @@ function dashboard_deinstall() { assign_privs(); if(file_exists("/usr/local/www/index.php.before_dashboard")) { /* restore the files prior to the dashboard package installation */ - mwexec("cp /usr/local/www/index.php.before_dashboard /usr/local/www/index.php"); - mwexec("cp /usr/local/www/fbegin.inc.before_dashboard /usr/local/www/fbegin.inc"); + mwexec("mv /usr/local/www/index.php.before_dashboard /usr/local/www/index.php"); + mwexec("mv /usr/local/www/fbegin.inc.before_dashboard /usr/local/www/fbegin.inc"); + mwexec("mv /usr/local/www/diag_logs_filter.php.before_dashboard /usr/local/www/diag_logs_filter.php"); + mwexec("mv /usr/local/www/diag_logs_filter_dynamic.php.before_dashboard /usr/local/www/diag_logs_filter_dynamic.php"); } assign_privs(); } function assign_privs() { + /* Fix permissions on replaced files */ mwexec("chown root:wheel /usr/local/www/index.php"); mwexec("chown root:wheel /usr/local/www/fbegin.php"); mwexec("chown root:wheel /usr/local/www/graph_cpu.php"); mwexec("chown root:wheel /usr/local/www/stats.php"); - mwexec("chmod a+rw /usr/local/www/index.php"); - mwexec("chmod a+rw /usr/local/www/fbegin.php"); - mwexec("chmod a+rw /usr/local/www/graph_cpu.php"); - mwexec("chmod a+rw /usr/local/www/stats.php"); + mwexec("chown root:wheel /usr/local/www/diag_logs_filter.php"); + mwexec("chown root:wheel /usr/local/www/diag_logs_filter_dynamic.php"); + mwexec("chmod ug+rw,o-w /usr/local/www/index.php"); + mwexec("chmod ug+rw,o-w /usr/local/www/fbegin.php"); + mwexec("chmod ug+rw,o-w /usr/local/www/graph_cpu.php"); + mwexec("chmod ug+rw,o-w /usr/local/www/stats.php"); + mwexec("chmod ug+rw,o-w /usr/local/www/diag_logs_filter.php"); + mwexec("chmod ug+rw,o-w /usr/local/www/diag_logs_filter_dynamic.php"); } ?>
\ No newline at end of file diff --git a/config/dashboard/dashboard.xml b/config/dashboard/dashboard.xml index a0e1b35a..3b6de1b0 100644 --- a/config/dashboard/dashboard.xml +++ b/config/dashboard/dashboard.xml @@ -42,11 +42,11 @@ /* ========================================================================== */ ]]> </copyright> - <description>Describe your package here</description> + <description>Dashboard package</description> <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>dashboard</name> - <version>0.2</version> + <version>0.7.5.3</version> <title>Dashboard</title> <include_file>/usr/local/pkg/dashboard.inc</include_file> <additional_files_needed> @@ -59,13 +59,10 @@ <chmod>077</chmod> <item>http://www.pfsense.com/packages/config/dashboard/binaries/widgets.tgz</item> </additional_files_needed> - <custom_php_install_command> + <custom_php_install_command> dashboard_install(); - </custom_php_install_command> + </custom_php_install_command> <custom_php_deinstall_command> dashboard_deinstall(); </custom_php_deinstall_command> </packagegui> - - - diff --git a/config/freeswitch/begin_recording.wav b/config/freeswitch/begin_recording.wav Binary files differindex 9e4992ca..9e4992ca 100644..100755 --- a/config/freeswitch/begin_recording.wav +++ b/config/freeswitch/begin_recording.wav diff --git a/config/freeswitch/class.phpmailer.tmp b/config/freeswitch/class.phpmailer.tmp index 2ddc30fd..2ddc30fd 100644..100755 --- a/config/freeswitch/class.phpmailer.tmp +++ b/config/freeswitch/class.phpmailer.tmp diff --git a/config/freeswitch/class.smtp.tmp b/config/freeswitch/class.smtp.tmp index 398c3ffb..398c3ffb 100644..100755 --- a/config/freeswitch/class.smtp.tmp +++ b/config/freeswitch/class.smtp.tmp diff --git a/config/freeswitch/freeswitch.inc b/config/freeswitch/freeswitch.inc index d5f31330..4222d27a 100644..100755 --- a/config/freeswitch/freeswitch.inc +++ b/config/freeswitch/freeswitch.inc @@ -1672,9 +1672,9 @@ function sync_package_freeswitch() function freeswitch_php_install_command() { global $config; - $freeswitch_package_version = "0.8.3.1"; + $freeswitch_package_version = "0.8.3.5"; $freeswitch_build_version = "1.0.3"; - $freeswitch_build_revision = "12228"; + $freeswitch_build_revision = "12545"; conf_mount_rw(); config_lock(); diff --git a/config/freeswitch/freeswitch.xml b/config/freeswitch/freeswitch.xml index 665dabb9..65acc4d8 100644..100755 --- a/config/freeswitch/freeswitch.xml +++ b/config/freeswitch/freeswitch.xml @@ -2,18 +2,18 @@ <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - freeswitch.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - */ + freeswitch.xml + Copyright (C) 2008 Mark J Crane + All rights reserved + + FreeSWITCH (TM) + http://www.freeswitch.org/ + */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -38,13 +38,13 @@ POSSIBILITY OF SUCH DAMAGE. */ /* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + ]]> + </copyright> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> <name>FreeSWITCH Settings</name> - <version>0.8.3.1</version> + <version>0.8.3.5</version> <title>FreeSWITCH: Settings</title> <include_file>/usr/local/pkg/freeswitch.inc</include_file> <menu> @@ -56,8 +56,8 @@ </menu> <service> <name>freeswitch</name> - <rcfile>freeswitch.sh</rcfile> - <executable>freeswitch</executable> + <rcfile>freeswitch.sh</rcfile> + <executable>freeswitch</executable> <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow. </description> </service> <tabs> @@ -77,7 +77,7 @@ <tab> <text>External</text> <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> + </tab> <tab> <text>Gateways</text> <url>/freeswitch/freeswitch_gateways.php</url> @@ -89,11 +89,11 @@ <tab> <text>IVR</text> <url>/freeswitch/freeswitch_ivr.php</url> - </tab> + </tab> <tab> <text>Modules</text> <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> + </tab> <tab> <text>Public</text> <url>/freeswitch/freeswitch_public_includes.php</url> @@ -105,28 +105,28 @@ <tab> <text>Status</text> <url>/freeswitch/freeswitch_status.php</url> - </tab> + </tab> <tab> <text>Vars</text> <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> </tab> </tabs> <configpath>installedpackages->package->$packagename->configuration->freeswitchsettings</configpath> - <additional_files_needed> - <prefix>/tmp/</prefix> - <chmod>0755</chmod> - <item>http://portableusbapps.com/packages/config/freeswitch/freeswitch.tgz</item> - </additional_files_needed> + <additional_files_needed> + <prefix>/tmp/</prefix> + <chmod>0755</chmod> + <item>http://portableusbapps.com/packages/config/freeswitch/freeswitch.tgz</item> + </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch.inc</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/usr/local/lib/</prefix> <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/libtinfo.so.5.6</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/usr/local/lib/</prefix> <chmod>0755</chmod> @@ -146,12 +146,12 @@ <prefix>/usr/local/lib/</prefix> <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/libcurl.so.5</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/mod_shout.so.1</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> <chmod>0755</chmod> @@ -166,185 +166,185 @@ <prefix>/usr/local/lib/</prefix> <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/libodbc.so.1</item> - </additional_files_needed> - <additional_files_needed> - <prefix>/usr/local/lib/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/config/freeswitch/libiconv.so.3</item> - </additional_files_needed> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/lib/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/freeswitch/libiconv.so.3</item> + </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/please_enter_your_pin_number.wav</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/begin_recording.wav</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/your_pin_number_is_incorect_goodbye.wav</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/class.smtp.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/class.phpmailer.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_cmd.tmp</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan.xml</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_edit.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_details.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_extensions.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_extensions_edit.tmp</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_external.xml</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_gateways.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_gateways_edit.tmp</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_internal.xml</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr.tmp</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_edit.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_options_edit.tmp</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr_options.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_mailto.tmp</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_modules.xml</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public.xml</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes.tmp</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes_edit.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes_details.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_public_includes_details_edit.tmp</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings_edit.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_recordings_play.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_status.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_time_conditions.tmp</item> </additional_files_needed> <additional_files_needed> <prefix>/tmp/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_time_conditions_edit.tmp</item> - </additional_files_needed> + </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>0755</chmod> + <chmod>0755</chmod> <item>http://www.pfsense.com/packages/config/freeswitch/freeswitch_vars.xml</item> </additional_files_needed> <fields> @@ -371,31 +371,31 @@ <fieldname>event_socket_port</fieldname> <description>Enter the event socket port here. default: 8021</description> <type>input</type> - </field> + </field> <field> <fielddescr>Event Socket Password</fielddescr> <fieldname>event_socket_password</fieldname> <description>Enter the event socket password here. default: ClueCon</description> <type>password</type> - </field> + </field> <field> <fielddescr>XML RPC HTTP Port</fielddescr> <fieldname>xml_rpc_http_port</fieldname> <description>Enter the XML RPC HTTP Port here. default: 8787</description> <type>input</type> - </field> + </field> <field> <fielddescr>XML RPC Auth Realm</fielddescr> <fieldname>xml_rpc_auth_realm</fieldname> <description>Enter the XML RPC Auth Realm here. default: freeswitch</description> <type>input</type> - </field> + </field> <field> <fielddescr>XML RPC Auth User</fielddescr> <fieldname>xml_rpc_auth_user</fieldname> <description>Enter the XML RPC Auth User here. default: freeswitch</description> <type>input</type> - </field> + </field> <field> <fielddescr>XML RPC Auth Password</fielddescr> <fieldname>xml_rpc_auth_pass</fieldname> @@ -411,9 +411,9 @@ <field> <fielddescr>SMTP Host</fielddescr> <fieldname>smtphost</fieldname> - <description>Enter the SMTP host address. If you using a different port append it on the end with a semi-colon. e.g. smtp.gmail.com:465</description> + <description>Enter the SMTP host address. If you using a different port append it on the end with a colon. e.g. smtp.gmail.com:465</description> <type>input</type> - </field> + </field> <field> <fielddescr>SMTP Secure</fielddescr> <fieldname>smtpsecure</fieldname> @@ -449,7 +449,7 @@ <value>false</value> </option> </options> - </field> + </field> <field> <fielddescr>SMTP Username</fielddescr> <fieldname>smtpusername</fieldname> @@ -474,14 +474,14 @@ <description>Enter the SMTP From Name.</description> <type>input</type> </field> - </fields> + </fields> <custom_add_php_command> </custom_add_php_command> <custom_php_resync_config_command> - sync_package_freeswitch_settings(); + sync_package_freeswitch_settings(); </custom_php_resync_config_command> - <custom_delete_php_command> - sync_package_freeswitch_settings(); + <custom_delete_php_command> + sync_package_freeswitch_settings(); </custom_delete_php_command> <custom_php_install_command> freeswitch_php_install_command(); diff --git a/config/freeswitch/freeswitch_cmd.tmp b/config/freeswitch/freeswitch_cmd.tmp index 05ae77cf..05ae77cf 100644..100755 --- a/config/freeswitch/freeswitch_cmd.tmp +++ b/config/freeswitch/freeswitch_cmd.tmp diff --git a/config/freeswitch/freeswitch_dialplan.xml b/config/freeswitch/freeswitch_dialplan.xml index 3ce35570..41ca32d4 100644..100755 --- a/config/freeswitch/freeswitch_dialplan.xml +++ b/config/freeswitch/freeswitch_dialplan.xml @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - freeswitch_dialplan.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. + freeswitch_dialplan.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ + FreeSWITCH (TM) + http://www.freeswitch.org/ + + + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. + All rights reserved. + */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -44,18 +44,18 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + ]]> + </copyright> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> <name>freeswitchdialplan</name> <version>0.1</version> <title>FreeSWITCH: Dialplan</title> <aftersaveredirect>pkg_edit.php?xml=freeswitch_dialplan.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> + <include_file>/usr/local/pkg/freeswitch.inc</include_file> <tabs> <tab> <text>Settings</text> @@ -73,7 +73,7 @@ <tab> <text>External</text> <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> + </tab> <tab> <text>Gateways</text> <url>/freeswitch/freeswitch_gateways.php</url> @@ -85,11 +85,11 @@ <tab> <text>IVR</text> <url>/freeswitch/freeswitch_ivr.php</url> - </tab> + </tab> <tab> <text>Modules</text> <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> + </tab> <tab> <text>Public</text> <url>/freeswitch/freeswitch_public_includes.php</url> @@ -97,11 +97,11 @@ <tab> <text>Rec</text> <url>/freeswitch/freeswitch_recordings.php</url> - </tab> + </tab> <tab> <text>Status</text> <url>/freeswitch/freeswitch_status.php</url> - </tab> + </tab> <tab> <text>Vars</text> <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> @@ -117,20 +117,20 @@ <encoding>base64</encoding> <wrap>off</wrap> <size>30</size> - <cols>70</cols> + <cols>70</cols> <rows>33</rows> </field> </fields> <custom_php_command_before_form> </custom_php_command_before_form> <custom_php_after_head_command> - sync_package_freeswitch_dialplan(); + sync_package_freeswitch_dialplan(); </custom_php_after_head_command> <custom_php_after_form_command> </custom_php_after_form_command> <custom_php_validation_command> - </custom_php_validation_command> + </custom_php_validation_command> <custom_php_resync_config_command> - sync_package_freeswitch_dialplan(); + sync_package_freeswitch_dialplan(); </custom_php_resync_config_command> </packagegui>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_dialplan_includes.tmp b/config/freeswitch/freeswitch_dialplan_includes.tmp index 4b7bacfa..4b7bacfa 100644..100755 --- a/config/freeswitch/freeswitch_dialplan_includes.tmp +++ b/config/freeswitch/freeswitch_dialplan_includes.tmp diff --git a/config/freeswitch/freeswitch_dialplan_includes_details.tmp b/config/freeswitch/freeswitch_dialplan_includes_details.tmp index 7b14dae4..7b14dae4 100644..100755 --- a/config/freeswitch/freeswitch_dialplan_includes_details.tmp +++ b/config/freeswitch/freeswitch_dialplan_includes_details.tmp diff --git a/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp b/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp index 391d46d7..391d46d7 100644..100755 --- a/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp +++ b/config/freeswitch/freeswitch_dialplan_includes_details_edit.tmp diff --git a/config/freeswitch/freeswitch_dialplan_includes_edit.tmp b/config/freeswitch/freeswitch_dialplan_includes_edit.tmp index e838a277..e838a277 100644..100755 --- a/config/freeswitch/freeswitch_dialplan_includes_edit.tmp +++ b/config/freeswitch/freeswitch_dialplan_includes_edit.tmp diff --git a/config/freeswitch/freeswitch_extensions.tmp b/config/freeswitch/freeswitch_extensions.tmp index ca6f3d73..ca6f3d73 100644..100755 --- a/config/freeswitch/freeswitch_extensions.tmp +++ b/config/freeswitch/freeswitch_extensions.tmp diff --git a/config/freeswitch/freeswitch_extensions.xml b/config/freeswitch/freeswitch_extensions.xml index 61277e97..1e3c13a4 100644..100755 --- a/config/freeswitch/freeswitch_extensions.xml +++ b/config/freeswitch/freeswitch_extensions.xml @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - freeswitch_extensions.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. + freeswitch_extensions.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ + FreeSWITCH (TM) + http://www.freeswitch.org/ + + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. + All rights reserved. + */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -44,13 +44,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + ]]> + </copyright> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> <name>freeswitchextensions</name> <version>0.1</version> <title>FreeSWITCH: Extensions</title> @@ -72,7 +72,7 @@ <tab> <text>External</text> <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> + </tab> <tab> <text>Gateways</text> <url>/freeswitch/freeswitch_gateways.php</url> @@ -80,7 +80,7 @@ <tab> <text>Internal</text> <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> - </tab> + </tab> <tab> <text>IVR</text> <url>/freeswitch/freeswitch_ivr.php</url> @@ -88,7 +88,7 @@ <tab> <text>Modules</text> <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> + </tab> <tab> <text>Public</text> <url>/freeswitch/freeswitch_public_includes.php</url> @@ -100,7 +100,7 @@ <tab> <text>Status</text> <url>/freeswitch/freeswitch_status.php</url> - </tab> + </tab> <tab> <text>Vars</text> <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> @@ -111,7 +111,7 @@ <columnitem> <fielddescr>Extension</fielddescr> <fieldname>extension</fieldname> - </columnitem> + </columnitem> <columnitem> <fielddescr>Mailbox</fielddescr> <fieldname>mailbox</fieldname> @@ -120,7 +120,7 @@ <fielddescr>Description</fielddescr> <fieldname>description</fieldname> </columnitem> - </adddeleteeditpagefields> + </adddeleteeditpagefields> <fields> <field> <fielddescr>Extension</fielddescr> @@ -176,14 +176,14 @@ <description>Enter the outbound caller id number here.</description> <type>input</type> </field> - <field> - <fielddescr>Voicemail Mail To</fielddescr> + <field> + <fielddescr>Voicemail Mail To</fielddescr> <fieldname>vm-mailto</fieldname> <description>Optional: Enter the email address to send voicemail to.</description> <type>input</type> - </field> - <field> - <fielddescr>Voicemail Attach File</fielddescr> + </field> + <field> + <fielddescr>Voicemail Attach File</fielddescr> <fieldname>vm-attach-file</fieldname> <description>Choose whether to attach the file to the email.</description> <type>select</type> @@ -197,8 +197,8 @@ <value>false</value> </option> </options> - </field> - + </field> + <field> <fielddescr>User Context</fielddescr> <fieldname>user_context</fieldname> @@ -215,10 +215,10 @@ <custom_add_php_command> </custom_add_php_command> <custom_php_resync_config_command> - sync_package_freeswitch_extensions(); + sync_package_freeswitch_extensions(); </custom_php_resync_config_command> - <custom_delete_php_command> - sync_package_freeswitch_extensions(); + <custom_delete_php_command> + sync_package_freeswitch_extensions(); </custom_delete_php_command> <custom_php_deinstall_command> </custom_php_deinstall_command> diff --git a/config/freeswitch/freeswitch_extensions_edit.tmp b/config/freeswitch/freeswitch_extensions_edit.tmp index 9b1639f5..aeaaf4bc 100644..100755 --- a/config/freeswitch/freeswitch_extensions_edit.tmp +++ b/config/freeswitch/freeswitch_extensions_edit.tmp @@ -172,49 +172,49 @@ function show_advanced_config() { <tr> <td width="25%" valign="top" class="vncellreq">Extension</td> <td width="75%" class="vtable"> - <input name="extension" type="text" class="formfld" id="extension" size="40" value="<?=htmlspecialchars($pconfig['extension']);?>"> + <input name="extension" type="text" class="formfld unknown" id="extension" size="40" value="<?=htmlspecialchars($pconfig['extension']);?>"> <br><span class="vexpl">Enter the extension here. The default configuration expects extension numbers between 1000 -1019. To use 3 digit extensions adjust the dialplan 'default.xml' under name="Local_Extension" change the regular expression="^(10[01][0-9])$" to expression="^(\d{3})$".<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq">Password</td> <td width="75%" class="vtable"> - <input name="password" type="password" class="formfld" id="password" size="40" value="<?=htmlspecialchars($pconfig['password']);?>"> + <input name="password" type="password" class="formfld pwd" id="password" size="40" value="<?=htmlspecialchars($pconfig['password']);?>"> <br><span class="vexpl">Enter the password here.<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq">Mailbox</td> <td width="75%" class="vtable"> - <input name="mailbox" type="text" class="formfld" id="mailbox" size="40" value="<?=htmlspecialchars($pconfig['mailbox']);?>"> + <input name="mailbox" type="text" class="formfld unknown" id="mailbox" size="40" value="<?=htmlspecialchars($pconfig['mailbox']);?>"> <br><span class="vexpl">Enter the mailbox here. Example: extension 1001 then mailbox 1001<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq">Voicemail Password</td> <td width="75%" class="vtable"> - <input name="vm-password" type="password" class="formfld" id="vm-password" size="40" value="<?=htmlspecialchars($pconfig['vm-password']);?>"> + <input name="vm-password" type="password" class="formfld pwd" id="vm-password" size="40" value="<?=htmlspecialchars($pconfig['vm-password']);?>"> <br><span class="vexpl">Enter the voicemail password here.<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq">Account Code</td> <td width="75%" class="vtable"> - <input name="accountcode" type="text" class="formfld" id="accountcode" size="40" value="<?=htmlspecialchars($pconfig['accountcode']);?>"> + <input name="accountcode" type="text" class="formfld unknown" id="accountcode" size="40" value="<?=htmlspecialchars($pconfig['accountcode']);?>"> <br><span class="vexpl">Enter the account code here. Example: extension 1001 then accountcode 1001<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Effective Caller ID Name</td> <td width="75%" class="vtable"> - <input name="effective_caller_id_name" type="text" class="formfld" id="effective_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_name']);?>"> + <input name="effective_caller_id_name" type="text" class="formfld unknown" id="effective_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_name']);?>"> <br><span class="vexpl">Enter the effective caller id name here.<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Effective Caller ID Number</td> <td width="75%" class="vtable"> - <input name="effective_caller_id_number" type="text" class="formfld" id="effective_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_number']);?>"> + <input name="effective_caller_id_number" type="text" class="formfld unknown" id="effective_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['effective_caller_id_number']);?>"> <br><span class="vexpl">Enter the effective caller id number here.<br></span> </td> </tr> @@ -222,14 +222,14 @@ function show_advanced_config() { <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Outbound Caller ID Name</td> <td width="75%" class="vtable"> - <input name="outbound_caller_id_name" type="text" class="formfld" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>"> + <input name="outbound_caller_id_name" type="text" class="formfld unknown" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>"> <br><span class="vexpl">Enter the outbound caller id name here.<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Outbound Caller ID Number</td> <td width="75%" class="vtable"> - <input name="outbound_caller_id_number" type="text" class="formfld" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>"> + <input name="outbound_caller_id_number" type="text" class="formfld unknown" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>"> <br><span class="vexpl">Enter the outbound caller id number here.<br></span> </td> </tr> @@ -237,7 +237,7 @@ function show_advanced_config() { <tr> <td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Mail To</td> <td width="75%" class="vtable"> - <input name="vm-mailto" type="text" class="formfld" id="vm-mailto" size="40" value="<?=htmlspecialchars($pconfig['vm-mailto']);?>"> + <input name="vm-mailto" type="text" class="formfld unknown" id="vm-mailto" size="40" value="<?=htmlspecialchars($pconfig['vm-mailto']);?>"> <br><span class="vexpl">Optional: Enter the email address to send voicemail to.<br></span> </td> </tr> @@ -245,7 +245,7 @@ function show_advanced_config() { <td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Attach File</td> <td width="75%" class="vtable"> <?php - echo " <select name='vm-attach-file' class='formfld'>\n"; + echo " <select name='vm-attach-file' class='formfld unknown'>\n"; echo " <option></option>\n"; switch (htmlspecialchars($pconfig['vm-attach-file'])) { case "true": @@ -269,14 +269,14 @@ function show_advanced_config() { <tr> <td width="25%" valign="top" class="vncellreq">User Context</td> <td width="75%" class="vtable"> - <input name="user_context" type="text" class="formfld" id="user_context" size="40" value="<?=htmlspecialchars($pconfig['user_context']);?>"> + <input name="user_context" type="text" class="formfld unknown" id="user_context" size="40" value="<?=htmlspecialchars($pconfig['user_context']);?>"> <br><span class="vexpl">Enter the user context here. Example: default<br></span> </td> </tr> <tr> <td width="25%" valign="top" class="vncellreq">Call Group</td> <td width="75%" class="vtable"> - <input name="callgroup" type="text" class="formfld" id="callgroup" size="40" value="<?=htmlspecialchars($pconfig['callgroup']);?>"> + <input name="callgroup" type="text" class="formfld unknown" id="callgroup" size="40" value="<?=htmlspecialchars($pconfig['callgroup']);?>"> <br><span class="vexpl">Enter the user call group here. Example: sales, support<br></span> </td> </tr> @@ -297,14 +297,14 @@ function show_advanced_config() { <tr> <td width="25%" valign="top" class="vncell">Auth-ACL</td> <td width="75%" class="vtable"> - <input name="auth-acl" type="text" class="formfld" id="auth-acl" size="40" value="<?=htmlspecialchars($pconfig['auth-acl']);?>"> + <input name="auth-acl" type="text" class="formfld unknown" id="auth-acl" size="40" value="<?=htmlspecialchars($pconfig['auth-acl']);?>"> <br> <span class="vexpl">Enter the auth acl here.<br></span> </td> </tr> <tr> <td valign="top" class="vncell">CIDR</td> <td class="vtable"> - <input name="cidr" type="text" class="formfld" id="cidr" size="40" value="<?=htmlspecialchars($pconfig['cidr']);?>"> + <input name="cidr" type="text" class="formfld unknown" id="cidr" size="40" value="<?=htmlspecialchars($pconfig['cidr']);?>"> <br> <span class="vexpl">Enter the cidr here.<br></span> </td> </tr> @@ -315,7 +315,7 @@ function show_advanced_config() { <tr> <td width="25%" valign="top" class="vncellreq">Extension Description</td> <td width="75%" class="vtable"> - <input name="description" type="text" class="formfld" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>"> + <input name="description" type="text" class="formfld unknown" id="description" size="40" value="<?=htmlspecialchars($pconfig['description']);?>"> <br><span class="vexpl">Enter the description of the extension here.<br></span> </td> </tr> @@ -323,7 +323,7 @@ function show_advanced_config() { <td valign="top"> </td> <td> <input name="outbound_caller_id_name" type="hidden" class="formfld" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>"> - <input name="outbound_caller_id_number" type="hidden" class="formfld" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>"> + <input name="outbound_caller_id_number" type="hidden" class="formfld unknown" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>"> <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> <?php if (isset($id) && $a_extensions[$id]): ?> <input name="id" type="hidden" value="<?=$id;?>"> diff --git a/config/freeswitch/freeswitch_external.xml b/config/freeswitch/freeswitch_external.xml index 62fa9dd3..7dd2d65b 100644..100755 --- a/config/freeswitch/freeswitch_external.xml +++ b/config/freeswitch/freeswitch_external.xml @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - freeswitch_external.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. + freeswitch_external.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ + FreeSWITCH (TM) + http://www.freeswitch.org/ + + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. + All rights reserved. + */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -44,18 +44,18 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + ]]> + </copyright> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> <name>freeswitchexternal</name> <version>0.1</version> <title>FreeSWITCH: External</title> <aftersaveredirect>pkg_edit.php?xml=freeswitch_external.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> + <include_file>/usr/local/pkg/freeswitch.inc</include_file> <tabs> <tab> <text>Settings</text> @@ -73,7 +73,7 @@ <text>External</text> <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> <active/> - </tab> + </tab> <tab> <text>Gateways</text> <url>/freeswitch/freeswitch_gateways.php</url> @@ -81,7 +81,7 @@ <tab> <text>Internal</text> <url>/pkg_edit.php?xml=freeswitch_internal.xml&id=0</url> - </tab> + </tab> <tab> <text>IVR</text> <url>/freeswitch/freeswitch_ivr.php</url> @@ -89,7 +89,7 @@ <tab> <text>Modules</text> <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> + </tab> <tab> <text>Public</text> <url>/freeswitch/freeswitch_public_includes.php</url> @@ -101,7 +101,7 @@ <tab> <text>Status</text> <url>/freeswitch/freeswitch_status.php</url> - </tab> + </tab> <tab> <text>Vars</text> <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> @@ -117,20 +117,20 @@ <encoding>base64</encoding> <wrap>off</wrap> <size>30</size> - <cols>70</cols> + <cols>70</cols> <rows>33</rows> </field> </fields> <custom_php_command_before_form> </custom_php_command_before_form> <custom_php_after_head_command> - sync_package_freeswitch_external(); + sync_package_freeswitch_external(); </custom_php_after_head_command> <custom_php_after_form_command> </custom_php_after_form_command> <custom_php_validation_command> - </custom_php_validation_command> + </custom_php_validation_command> <custom_php_resync_config_command> - sync_package_freeswitch_external(); + sync_package_freeswitch_external(); </custom_php_resync_config_command> </packagegui>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_gateways.tmp b/config/freeswitch/freeswitch_gateways.tmp index 75718a7c..75718a7c 100644..100755 --- a/config/freeswitch/freeswitch_gateways.tmp +++ b/config/freeswitch/freeswitch_gateways.tmp diff --git a/config/freeswitch/freeswitch_gateways_edit.tmp b/config/freeswitch/freeswitch_gateways_edit.tmp index 030f88cf..030f88cf 100644..100755 --- a/config/freeswitch/freeswitch_gateways_edit.tmp +++ b/config/freeswitch/freeswitch_gateways_edit.tmp diff --git a/config/freeswitch/freeswitch_internal.xml b/config/freeswitch/freeswitch_internal.xml index 4ae5848f..db43b707 100644..100755 --- a/config/freeswitch/freeswitch_internal.xml +++ b/config/freeswitch/freeswitch_internal.xml @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - freeswitch_internal.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. + freeswitch_internal.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ + FreeSWITCH (TM) + http://www.freeswitch.org/ + + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net> + All rights reserved. + */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -44,18 +44,18 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + ]]> + </copyright> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> <name>freeswitchinternal</name> <version>0.1</version> <title>FreeSWITCH: Internal</title> <aftersaveredirect>pkg_edit.php?xml=freeswitch_internal.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> + <include_file>/usr/local/pkg/freeswitch.inc</include_file> <tabs> <tab> <text>Settings</text> @@ -72,7 +72,7 @@ <tab> <text>External</text> <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> + </tab> <tab> <text>Gateways</text> <url>/freeswitch/freeswitch_gateways.php</url> @@ -89,7 +89,7 @@ <tab> <text>Modules</text> <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> + </tab> <tab> <text>Public</text> <url>/freeswitch/freeswitch_public_includes.php</url> @@ -101,7 +101,7 @@ <tab> <text>Status</text> <url>/freeswitch/freeswitch_status.php</url> - </tab> + </tab> <tab> <text>Vars</text> <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> @@ -117,20 +117,20 @@ <encoding>base64</encoding> <wrap>off</wrap> <size>30</size> - <cols>70</cols> + <cols>70</cols> <rows>33</rows> </field> </fields> <custom_php_command_before_form> </custom_php_command_before_form> <custom_php_after_head_command> - sync_package_freeswitch_internal(); + sync_package_freeswitch_internal(); </custom_php_after_head_command> <custom_php_after_form_command> </custom_php_after_form_command> <custom_php_validation_command> - </custom_php_validation_command> + </custom_php_validation_command> <custom_php_resync_config_command> - sync_package_freeswitch_internal(); + sync_package_freeswitch_internal(); </custom_php_resync_config_command> </packagegui>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_ivr.tmp b/config/freeswitch/freeswitch_ivr.tmp index d05337ce..d05337ce 100644..100755 --- a/config/freeswitch/freeswitch_ivr.tmp +++ b/config/freeswitch/freeswitch_ivr.tmp diff --git a/config/freeswitch/freeswitch_ivr_edit.tmp b/config/freeswitch/freeswitch_ivr_edit.tmp index f9d4652d..f9d4652d 100644..100755 --- a/config/freeswitch/freeswitch_ivr_edit.tmp +++ b/config/freeswitch/freeswitch_ivr_edit.tmp diff --git a/config/freeswitch/freeswitch_ivr_options.tmp b/config/freeswitch/freeswitch_ivr_options.tmp index 8356bc58..8356bc58 100644..100755 --- a/config/freeswitch/freeswitch_ivr_options.tmp +++ b/config/freeswitch/freeswitch_ivr_options.tmp diff --git a/config/freeswitch/freeswitch_ivr_options_edit.tmp b/config/freeswitch/freeswitch_ivr_options_edit.tmp index 78975a7f..78975a7f 100644..100755 --- a/config/freeswitch/freeswitch_ivr_options_edit.tmp +++ b/config/freeswitch/freeswitch_ivr_options_edit.tmp diff --git a/config/freeswitch/freeswitch_mailto.tmp b/config/freeswitch/freeswitch_mailto.tmp index 23645570..23645570 100644..100755 --- a/config/freeswitch/freeswitch_mailto.tmp +++ b/config/freeswitch/freeswitch_mailto.tmp diff --git a/config/freeswitch/freeswitch_modules.xml b/config/freeswitch/freeswitch_modules.xml index 91620ac9..fd962aa3 100644..100755 --- a/config/freeswitch/freeswitch_modules.xml +++ b/config/freeswitch/freeswitch_modules.xml @@ -1,26 +1,26 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - freeswitch_modules.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. + freeswitch_modules.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ + FreeSWITCH (TM) + http://www.freeswitch.org/ + + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. + All rights reserved. + */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -43,13 +43,13 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + ]]> + </copyright> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> <name>FreeSWITCH Modules</name> <version>0.2</version> <title>FreeSWITCH: Modules</title> @@ -63,8 +63,8 @@ </menu> <service> <name>freeswitch</name> - <rcfile>freeswitch.sh</rcfile> - <executable>freeswitch</executable> + <rcfile>freeswitch.sh</rcfile> + <executable>freeswitch</executable> <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> </service> <tabs> @@ -83,7 +83,7 @@ <tab> <text>External</text> <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> + </tab> <tab> <text>Gateways</text> <url>/freeswitch/freeswitch_gateways.php</url> @@ -99,8 +99,8 @@ <tab> <text>Modules</text> <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - <active/> - </tab> + <active/> + </tab> <tab> <text>Public</text> <url>/freeswitch/freeswitch_public_includes.php</url> @@ -112,21 +112,21 @@ <tab> <text>Status</text> <url>/freeswitch/freeswitch_status.php</url> - </tab> + </tab> <tab> <text>Vars</text> <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> </tab> </tabs> - <configpath>installedpackages->package->$packagename->configuration->freeswitchmodules</configpath> + <configpath>installedpackages->package->$packagename->configuration->freeswitchmodules</configpath> <fields> - <field> + <field> <fielddescr><b>Loggers</b></fielddescr> <fieldname>loggers</fieldname> <description></description> <type>listtopic</type> </field> - <field> + <field> <fielddescr>mod_console</fielddescr> <fieldname>mod_console</fieldname> <description>Send logs to the console.</description> @@ -141,8 +141,8 @@ <value>disable</value> </option> </options> - </field> - <field> + </field> + <field> <fielddescr>mod_logfile</fielddescr> <fieldname>mod_logfile</fieldname> <description>Send logs to the local file system.</description> @@ -158,7 +158,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_syslog</fielddescr> <fieldname>mod_syslog</fieldname> <description>Send logs to a remote syslog server.</description> @@ -174,13 +174,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Multi-Faceted</b></fielddescr> <fieldname>multi-faceted</fieldname> <description></description> <type>listtopic</type> </field> - <field> + <field> <fielddescr>mod_enum</fielddescr> <fieldname>mod_enum</fieldname> <description>Route PSTN numbers over internet according to ENUM servers, such as e164.org.</description> @@ -196,13 +196,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>XML Interfaces</b></fielddescr> <fieldname>xml_interfaces</fieldname> <description></description> - <type>listtopic</type> + <type>listtopic</type> </field> - <field> + <field> <fielddescr>mod_xml_rpc</fielddescr> <fieldname>mod_xml_rpc</fieldname> <description>XML Remote Procedure Calls. Issue commands from your web application.</description> @@ -218,7 +218,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_xml_curl</fielddescr> <fieldname>mod_xml_curl</fieldname> <description>XML Gateway Code. Configure FreeSWITCH from a web server on boot and on the fly.</description> @@ -233,8 +233,8 @@ <value>disable</value> </option> </options> - </field> - <field> + </field> + <field> <fielddescr>mod_xml_cdr</fielddescr> <fieldname>mod_xml_cdr</fieldname> <description>XML based call detail record handler.</description> @@ -250,13 +250,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Event Handlers</b></fielddescr> <fieldname>event_handlers</fieldname> <description></description> <type>listtopic</type> - </field> - <field> + </field> + <field> <fielddescr>mod_cdr_csv</fielddescr> <fieldname>mod_cdr_csv</fieldname> <description>CSV call detail record handler.</description> @@ -272,7 +272,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_event_multicast</fielddescr> <fieldname>mod_event_multicast</fieldname> <description>Broadcasts events to netmask.</description> @@ -288,7 +288,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_event_socket</fielddescr> <fieldname>mod_event_socket</fieldname> <description>Sends events via a single socket.</description> @@ -303,8 +303,8 @@ <value>disable</value> </option> </options> - </field> - <field> + </field> + <field> <fielddescr>mod_zeroconf</fielddescr> <fieldname>mod_zeroconf</fieldname> <description>Support for zeroconf.</description> @@ -320,13 +320,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Directory Interfaces</b></fielddescr> <fieldname>directory_interfaces</fieldname> <description></description> <type>listtopic</type> </field> - <field> + <field> <fielddescr>mod_ldap</fielddescr> <fieldname>mod_ldap</fieldname> <description>LDAP module made to obtain dialplans, user accounts, etc.</description> @@ -342,13 +342,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Endpoints</b></fielddescr> <fieldname>endpoints</fieldname> <description></description> <type>listtopic</type> - </field> - <field> + </field> + <field> <fielddescr>mod_dingaling</fielddescr> <fieldname>mod_dingaling</fieldname> <description>Jabber/GoogleTalk Talk integration module.</description> @@ -364,7 +364,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_iax</fielddescr> <fieldname>mod_iax</fieldname> <description>IAX2.</description> @@ -379,8 +379,8 @@ <value>disable</value> </option> </options> - </field> - <field> + </field> + <field> <fielddescr>mod_portaudio</fielddescr> <fieldname>mod_portaudio</fieldname> <description>Voice through a local soundcard.</description> @@ -396,7 +396,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_alsa</fielddescr> <fieldname>mod_alsa</fieldname> <description></description> @@ -411,8 +411,8 @@ <value>disable</value> </option> </options> - </field> - <field> + </field> + <field> <fielddescr>mod_sofia</fielddescr> <fieldname>mod_sofia</fieldname> <description>SIP module.</description> @@ -428,7 +428,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_loopback</fielddescr> <fieldname>mod_loopback</fieldname> <description>A loopback channel driver to make an outbound call as an inbound call.</description> @@ -444,7 +444,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_wanpipe</fielddescr> <fieldname>mod_wanpipe</fieldname> <description>T1/E1 Sangoma Card module.</description> @@ -460,7 +460,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_woomera</fielddescr> <fieldname>mod_woomera</fieldname> <description>H.323/Woomera module.</description> @@ -476,7 +476,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_openzap</fielddescr> <fieldname>mod_openzap</fieldname> <description>Interface to Zaptel hardware.</description> @@ -492,13 +492,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Applications</b></fielddescr> <fieldname>applications</fieldname> <description></description> <type>listtopic</type> - </field> - <field> + </field> + <field> <fielddescr>mod_commands</fielddescr> <fieldname>mod_commands</fieldname> <description>A mass plethora of API interface commands.</description> @@ -514,7 +514,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_conference</fielddescr> <fieldname>mod_conference</fieldname> <description>Conference room module.</description> @@ -530,7 +530,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_dptools</fielddescr> <fieldname>mod_dptools</fieldname> <description>Dialplan Tools: provides a number of apps and utilities for the dialplan.</description> @@ -546,7 +546,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_expr</fielddescr> <fieldname>mod_expr</fieldname> <description>Brian Allen Vanderburgs expression evaluation library.</description> @@ -562,7 +562,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_fax</fielddescr> <fieldname>mod_fax</fieldname> <description>FAX provides fax send and receive.</description> @@ -578,7 +578,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_fifo</fielddescr> <fieldname>mod_fifo</fieldname> <description>FIFO provides custom call queues including call park.</description> @@ -594,7 +594,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_voicemail</fielddescr> <fieldname>mod_voicemail</fieldname> <description>Full featured voicemail module.</description> @@ -610,7 +610,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_limit</fielddescr> <fieldname>mod_limit</fieldname> <description>Resource limitation module.</description> @@ -626,7 +626,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_esf</fielddescr> <fieldname>mod_esf</fieldname> <description>Holds the multi cast paging application for SIP.</description> @@ -642,7 +642,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_fsv</fielddescr> <fieldname>mod_fsv</fieldname> <description>FreeSWITCH Video application (Recording and playback).</description> @@ -658,13 +658,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>SNOM Module</b></fielddescr> <fieldname>snom_module</fieldname> <description></description> <type>listtopic</type> - </field> - <field> + </field> + <field> <fielddescr>mod_snom</fielddescr> <fieldname>mod_snom</fieldname> <description></description> @@ -680,13 +680,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Dialplan Interfaces</b></fielddescr> <fieldname>dialplan_interfaces</fieldname> <description></description> <type>listtopic</type> - </field> - <field> + </field> + <field> <fielddescr>mod_dialplan_directory</fielddescr> <fieldname>mod_dialplan_directory</fieldname> <description>Allows you to obtain a dialplan from a directory resource.</description> @@ -702,7 +702,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_dialplan_xml</fielddescr> <fieldname>mod_dialplan_xml</fieldname> <description>Allows you to program dialplans in XML format.</description> @@ -718,7 +718,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_dialplan_asterisk</fielddescr> <fieldname>mod_dialplan_asterisk</fieldname> <description>Allows you to create dialplans the old-fashioned way.</description> @@ -734,7 +734,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_yaml</fielddescr> <fieldname>mod_yaml</fieldname> <description>Allows you to program dialplans in YAML format.</description> @@ -750,13 +750,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Codec Interfaces</b></fielddescr> <fieldname>codec_interfaces</fieldname> <description></description> <type>listtopic</type> - </field> - <field> + </field> + <field> <fielddescr>mod_voipcodecs</fielddescr> <fieldname>mod_voipcodecs</fieldname> <description></description> @@ -772,7 +772,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_g723_1</fielddescr> <fieldname>mod_g723_1</fieldname> <description>G.723.1 codec.</description> @@ -788,7 +788,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_g729</fielddescr> <fieldname>mod_g729</fieldname> <description>G729 codec is only supported in passthrough mode.</description> @@ -804,7 +804,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_amr</fielddescr> <fieldname>mod_amr</fieldname> <description>amr codec.</description> @@ -820,7 +820,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_ilbc</fielddescr> <fieldname>mod_ilbc</fieldname> <description>ILBC codec.</description> @@ -836,7 +836,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_speex</fielddescr> <fieldname>mod_speex</fieldname> <description>Speex codec.</description> @@ -852,7 +852,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_siren</fielddescr> <fieldname>mod_siren</fieldname> <description>Siren codec.</description> @@ -867,8 +867,8 @@ <value>disable</value> </option> </options> - </field> - <field> + </field> + <field> <fielddescr>mod_celt</fielddescr> <fieldname>mod_celt</fieldname> <description>Celt codec.</description> @@ -884,7 +884,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_h26x</fielddescr> <fieldname>mod_h26x</fieldname> <description>H26X signed linear codec. Video Pass-thru.</description> @@ -900,13 +900,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>File Format Interfaces</b></fielddescr> <fieldname>file_format_interfaces</fieldname> <description></description> <type>listtopic</type> - </field> - <field> + </field> + <field> <fielddescr>mod_sndfile</fielddescr> <fieldname>mod_sndfile</fieldname> <description>Multi-format file format transcoder (WAV, etc).</description> @@ -922,7 +922,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_native_file</fielddescr> <fieldname>mod_native_file</fieldname> <description>File interface for codec specific file formats.</description> @@ -938,13 +938,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Streams/Files</b></fielddescr> <fieldname>streams_files</fieldname> <description></description> <type>listtopic</type> </field> - <field> + <field> <fielddescr>mod_shout</fielddescr> <fieldname>mod_shout</fieldname> <description>mp3 files and shoutcast streams.</description> @@ -960,7 +960,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_local_stream</fielddescr> <fieldname>mod_local_stream</fieldname> <description>For local streams (play all the files in a directory).</description> @@ -976,7 +976,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_tone_stream</fielddescr> <fieldname>mod_tone_stream</fieldname> <description>Generate tone streams.</description> @@ -992,13 +992,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Languages</b></fielddescr> <fieldname>languages</fieldname> <description></description> <type>listtopic</type> </field> - <field> + <field> <fielddescr>mod_spidermonkey</fielddescr> <fieldname>mod_spidermonkey</fieldname> <description>JavaScript support.</description> @@ -1014,7 +1014,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_perl</fielddescr> <fieldname>mod_perl</fieldname> <description>Perl support.</description> @@ -1030,7 +1030,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_python</fielddescr> <fieldname>mod_python</fieldname> <description>Python support.</description> @@ -1046,7 +1046,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_java</fielddescr> <fieldname>mod_java</fieldname> <description>Java support.</description> @@ -1062,7 +1062,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_lua</fielddescr> <fieldname>mod_lua</fieldname> <description>Lua support.</description> @@ -1078,13 +1078,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>ASR /TTS</b></fielddescr> <fieldname>asr_tts</fieldname> <description></description> <type>listtopic</type> </field> - <field> + <field> <fielddescr>mod_flite</fielddescr> <fieldname>mod_flite</fieldname> <description>Free open source Text to Speech.</description> @@ -1100,7 +1100,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_pocketsphinx</fielddescr> <fieldname>mod_pocketsphinx</fieldname> <description>Free open source Speech Recognition.</description> @@ -1116,7 +1116,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_cepstral</fielddescr> <fieldname>mod_cepstral</fieldname> <description>Links into Cepstral for dynamic sound output. Not available on this build.</description> @@ -1132,7 +1132,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_openmrcp</fielddescr> <fieldname>mod_openmrcp</fieldname> <description>Module for an open MRCP implementation.</description> @@ -1148,7 +1148,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_rss</fielddescr> <fieldname>mod_rss</fieldname> <description>Reads RSS feeds via a TTS engine.</description> @@ -1164,13 +1164,13 @@ </option> </options> </field> - <field> + <field> <fielddescr><b>Say</b></fielddescr> <fieldname>say</fieldname> <description></description> <type>listtopic</type> - </field> - <field> + </field> + <field> <fielddescr>mod_say_en</fielddescr> <fieldname>mod_say_en</fieldname> <description></description> @@ -1186,7 +1186,7 @@ </option> </options> </field> - <field> + <field> <fielddescr>mod_say_zh</fielddescr> <fieldname>mod_say_zh</fieldname> <description></description> @@ -1201,15 +1201,15 @@ <value>disable</value> </option> </options> - </field> - </fields> + </field> + </fields> <custom_add_php_command> </custom_add_php_command> <custom_php_resync_config_command> - sync_package_freeswitch_modules(); + sync_package_freeswitch_modules(); </custom_php_resync_config_command> - <custom_delete_php_command> - sync_package_freeswitch_modules(); + <custom_delete_php_command> + sync_package_freeswitch_modules(); </custom_delete_php_command> <custom_php_deinstall_command> </custom_php_deinstall_command> diff --git a/config/freeswitch/freeswitch_public.xml b/config/freeswitch/freeswitch_public.xml index fab77635..ed633a4e 100644..100755 --- a/config/freeswitch/freeswitch_public.xml +++ b/config/freeswitch/freeswitch_public.xml @@ -1,26 +1,26 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - freeswitch_public.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. + freeswitch_public.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ + FreeSWITCH (TM) + http://www.freeswitch.org/ + + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net> + All rights reserved. + */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -43,18 +43,18 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + ]]> + </copyright> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> <name>freeswitchpublic</name> <version>0.1</version> <title>FreeSWITCH: Public</title> <aftersaveredirect>pkg_edit.php?xml=freeswitch_public.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> + <include_file>/usr/local/pkg/freeswitch.inc</include_file> <tabs> <tab> <text>Settings</text> @@ -71,7 +71,7 @@ <tab> <text>External</text> <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> + </tab> <tab> <text>Gateways</text> <url>/freeswitch/freeswitch_gateways.php</url> @@ -87,7 +87,7 @@ <tab> <text>Modules</text> <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> + </tab> <tab> <text>Public</text> <url>/freeswitch/freeswitch_public_includes.php</url> @@ -100,7 +100,7 @@ <tab> <text>Status</text> <url>/freeswitch/freeswitch_status.php</url> - </tab> + </tab> <tab> <text>Vars</text> <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> @@ -116,20 +116,20 @@ <encoding>base64</encoding> <wrap>off</wrap> <size>30</size> - <cols>70</cols> + <cols>70</cols> <rows>33</rows> </field> </fields> <custom_php_command_before_form> </custom_php_command_before_form> <custom_php_after_head_command> - sync_package_freeswitch_public(); + sync_package_freeswitch_public(); </custom_php_after_head_command> <custom_php_after_form_command> </custom_php_after_form_command> <custom_php_validation_command> - </custom_php_validation_command> + </custom_php_validation_command> <custom_php_resync_config_command> - sync_package_freeswitch_public(); + sync_package_freeswitch_public(); </custom_php_resync_config_command> </packagegui>
\ No newline at end of file diff --git a/config/freeswitch/freeswitch_public_includes.tmp b/config/freeswitch/freeswitch_public_includes.tmp index 66f733b3..66f733b3 100644..100755 --- a/config/freeswitch/freeswitch_public_includes.tmp +++ b/config/freeswitch/freeswitch_public_includes.tmp diff --git a/config/freeswitch/freeswitch_public_includes_details.tmp b/config/freeswitch/freeswitch_public_includes_details.tmp index c28a7647..c28a7647 100644..100755 --- a/config/freeswitch/freeswitch_public_includes_details.tmp +++ b/config/freeswitch/freeswitch_public_includes_details.tmp diff --git a/config/freeswitch/freeswitch_public_includes_details_edit.tmp b/config/freeswitch/freeswitch_public_includes_details_edit.tmp index 821d9097..821d9097 100644..100755 --- a/config/freeswitch/freeswitch_public_includes_details_edit.tmp +++ b/config/freeswitch/freeswitch_public_includes_details_edit.tmp diff --git a/config/freeswitch/freeswitch_public_includes_edit.tmp b/config/freeswitch/freeswitch_public_includes_edit.tmp index 94454fd3..94454fd3 100644..100755 --- a/config/freeswitch/freeswitch_public_includes_edit.tmp +++ b/config/freeswitch/freeswitch_public_includes_edit.tmp diff --git a/config/freeswitch/freeswitch_recordings.tmp b/config/freeswitch/freeswitch_recordings.tmp index 7d9b539d..7d9b539d 100644..100755 --- a/config/freeswitch/freeswitch_recordings.tmp +++ b/config/freeswitch/freeswitch_recordings.tmp diff --git a/config/freeswitch/freeswitch_recordings_edit.tmp b/config/freeswitch/freeswitch_recordings_edit.tmp index 18612b93..18612b93 100644..100755 --- a/config/freeswitch/freeswitch_recordings_edit.tmp +++ b/config/freeswitch/freeswitch_recordings_edit.tmp diff --git a/config/freeswitch/freeswitch_recordings_play.tmp b/config/freeswitch/freeswitch_recordings_play.tmp index 8dfb90c2..8dfb90c2 100644..100755 --- a/config/freeswitch/freeswitch_recordings_play.tmp +++ b/config/freeswitch/freeswitch_recordings_play.tmp diff --git a/config/freeswitch/freeswitch_status.tmp b/config/freeswitch/freeswitch_status.tmp index 2d84a6ec..2d84a6ec 100644..100755 --- a/config/freeswitch/freeswitch_status.tmp +++ b/config/freeswitch/freeswitch_status.tmp diff --git a/config/freeswitch/freeswitch_time_conditions.tmp b/config/freeswitch/freeswitch_time_conditions.tmp index 617bb5cf..617bb5cf 100644..100755 --- a/config/freeswitch/freeswitch_time_conditions.tmp +++ b/config/freeswitch/freeswitch_time_conditions.tmp diff --git a/config/freeswitch/freeswitch_time_conditions_edit.tmp b/config/freeswitch/freeswitch_time_conditions_edit.tmp index c40b84f8..c40b84f8 100644..100755 --- a/config/freeswitch/freeswitch_time_conditions_edit.tmp +++ b/config/freeswitch/freeswitch_time_conditions_edit.tmp diff --git a/config/freeswitch/freeswitch_vars.xml b/config/freeswitch/freeswitch_vars.xml index ac4246b9..9a4e172c 100644..100755 --- a/config/freeswitch/freeswitch_vars.xml +++ b/config/freeswitch/freeswitch_vars.xml @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - freeswitch_vars.xml - Copyright (C) 2008 Mark J Crane - All rights reserved. - - FreeSWITCH (TM) - http://www.freeswitch.org/ - - part of pfSense (http://www.pfSense.com) - Copyright (C) 2007 to whom it may belong - All rights reserved. + freeswitch_vars.xml + Copyright (C) 2008 Mark J Crane + All rights reserved. - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ + FreeSWITCH (TM) + http://www.freeswitch.org/ + + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007 to whom it may belong + All rights reserved. + + Based on m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. + All rights reserved. + */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without @@ -44,18 +44,18 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ /* ========================================================================== */ - ]]> - </copyright> - <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + ]]> + </copyright> + <description>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> <name>freeswitchvars</name> <version>0.1</version> <title>FreeSWITCH: Vars</title> <aftersaveredirect>pkg_edit.php?xml=freeswitch_vars.xml&id=0</aftersaveredirect> - <include_file>/usr/local/pkg/freeswitch.inc</include_file> + <include_file>/usr/local/pkg/freeswitch.inc</include_file> <tabs> <tab> <text>Settings</text> @@ -72,7 +72,7 @@ <tab> <text>External</text> <url>/pkg_edit.php?xml=freeswitch_external.xml&id=0</url> - </tab> + </tab> <tab> <text>Gateways</text> <url>/freeswitch/freeswitch_gateways.php</url> @@ -88,7 +88,7 @@ <tab> <text>Modules</text> <url>/pkg_edit.php?xml=freeswitch_modules.xml&id=0</url> - </tab> + </tab> <tab> <text>Public</text> <url>/freeswitch/freeswitch_public_includes.php</url> @@ -100,7 +100,7 @@ <tab> <text>Status</text> <url>/freeswitch/freeswitch_status.php</url> - </tab> + </tab> <tab> <text>Vars</text> <url>/pkg_edit.php?xml=freeswitch_vars.xml&id=0</url> @@ -117,20 +117,20 @@ <encoding>base64</encoding> <wrap>off</wrap> <size>30</size> - <cols>70</cols> + <cols>70</cols> <rows>33</rows> </field> </fields> <custom_php_command_before_form> </custom_php_command_before_form> <custom_php_after_head_command> - sync_package_freeswitch_vars(); + sync_package_freeswitch_vars(); </custom_php_after_head_command> <custom_php_after_form_command> </custom_php_after_form_command> <custom_php_validation_command> - </custom_php_validation_command> + </custom_php_validation_command> <custom_php_resync_config_command> - sync_package_freeswitch_vars(); + sync_package_freeswitch_vars(); </custom_php_resync_config_command> </packagegui>
\ No newline at end of file diff --git a/config/freeswitch/libcurl.so.5 b/config/freeswitch/libcurl.so.5 Binary files differindex 3d57856f..3d57856f 100644..100755 --- a/config/freeswitch/libcurl.so.5 +++ b/config/freeswitch/libcurl.so.5 diff --git a/config/freeswitch/libiconv.so.3 b/config/freeswitch/libiconv.so.3 Binary files differindex f207e92c..f207e92c 100644..100755 --- a/config/freeswitch/libiconv.so.3 +++ b/config/freeswitch/libiconv.so.3 diff --git a/config/freeswitch/libncurses.so.5.6 b/config/freeswitch/libncurses.so.5.6 Binary files differindex 3b40374c..3b40374c 100644..100755 --- a/config/freeswitch/libncurses.so.5.6 +++ b/config/freeswitch/libncurses.so.5.6 diff --git a/config/freeswitch/libodbc.so.1 b/config/freeswitch/libodbc.so.1 Binary files differindex eb7cb3af..eb7cb3af 100644..100755 --- a/config/freeswitch/libodbc.so.1 +++ b/config/freeswitch/libodbc.so.1 diff --git a/config/freeswitch/libogg.so.5.3 b/config/freeswitch/libogg.so.5.3 Binary files differindex d230b68e..d230b68e 100644..100755 --- a/config/freeswitch/libogg.so.5.3 +++ b/config/freeswitch/libogg.so.5.3 diff --git a/config/freeswitch/libspandsp.so.1 b/config/freeswitch/libspandsp.so.1 Binary files differindex 177b8c22..177b8c22 100644..100755 --- a/config/freeswitch/libspandsp.so.1 +++ b/config/freeswitch/libspandsp.so.1 diff --git a/config/freeswitch/libtinfo.so.5.6 b/config/freeswitch/libtinfo.so.5.6 Binary files differindex 1263ec79..1263ec79 100644..100755 --- a/config/freeswitch/libtinfo.so.5.6 +++ b/config/freeswitch/libtinfo.so.5.6 diff --git a/config/freeswitch/libvorbis.so.4 b/config/freeswitch/libvorbis.so.4 Binary files differindex ec91ac85..ec91ac85 100644..100755 --- a/config/freeswitch/libvorbis.so.4 +++ b/config/freeswitch/libvorbis.so.4 diff --git a/config/freeswitch/mod_fax.so.1 b/config/freeswitch/mod_fax.so.1 Binary files differindex 68bd05d0..68bd05d0 100644..100755 --- a/config/freeswitch/mod_fax.so.1 +++ b/config/freeswitch/mod_fax.so.1 diff --git a/config/freeswitch/mod_shout.so.1 b/config/freeswitch/mod_shout.so.1 Binary files differindex 26d9b94b..26d9b94b 100644..100755 --- a/config/freeswitch/mod_shout.so.1 +++ b/config/freeswitch/mod_shout.so.1 diff --git a/config/freeswitch/please_enter_your_pin_number.wav b/config/freeswitch/please_enter_your_pin_number.wav Binary files differindex 46263917..46263917 100644..100755 --- a/config/freeswitch/please_enter_your_pin_number.wav +++ b/config/freeswitch/please_enter_your_pin_number.wav diff --git a/config/freeswitch/your_pin_number_is_incorect_goodbye.wav b/config/freeswitch/your_pin_number_is_incorect_goodbye.wav Binary files differindex 5683bb8e..5683bb8e 100644..100755 --- a/config/freeswitch/your_pin_number_is_incorect_goodbye.wav +++ b/config/freeswitch/your_pin_number_is_incorect_goodbye.wav diff --git a/config/havp/havp.inc b/config/havp/havp.inc new file mode 100644 index 00000000..85427eb2 --- /dev/null +++ b/config/havp/havp.inc @@ -0,0 +1,656 @@ +<?php +/* + havp.inc + Part of pfSense package + Copyright (C) 2008 Serg Dvorianceev + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +/* ! ÍÀVP v.0.88 !*/ + +require_once('globals.inc'); +require_once('config.inc'); +require_once('util.inc'); +require_once('pfsense-utils.inc'); +require_once('pkg-utils.inc'); +require_once('filter.inc'); +require_once('service-utils.inc'); + +# defines +define('HV_USER', 'havp'); +define('HV_AV_USER', 'havp'); + +define('HV_WORKDIR', '/usr/local/etc/havp'); +define('HV_CONFIGFILE', '/havp.config'); +define('HV_WHITELISTFILE', '/whitelist'); +define('HV_BLACKLISTFILE', '/blacklist'); + +define('HV_PIDFILE', '/var/run/havp.pid'); +define('HV_LOGDIR', '/var/log/havp'); +define('HV_AVLOGDIR', '/var/log/clamav'); +define('HV_ACCESSLOG', '/access.log'); +define('HV_LOG', '/havp.log'); +define('HV_TEMPDIR', '/var/tmp'); +define('HV_HAVPTEMPDIR', '/var/tmp/havp'); +define('HV_SCANTEMPFILE', '/havp/havp-XXXXXX'); +define('HV_DEFAULTPORT', '3125'); +define('HV_DEFAULTADDR', '127.0.0.1'); +define('HV_TEMPLATEPATH', '/usr/local/share/examples/havp/templates'); +define('HV_CRONNAME_AVUPD','havp_av_update'); +define('HV_CRONCMD_AVUPD', '/usr/local/etc/rc.d/clamav-freshclam start'); +define('HV_CRONKEY_AVUPD', '/clamav-freshclam'); +define('HV_AVUPD_SCRIPT', '/usr/local/etc/rc.d/havp_avupdate.sh'); +define('HV_FRESHCLAM_CONFIGFILE', '/usr/local/etc/freshclam.conf'); + +# XML fields +define('XML_HAVPENABLE', 'enable'); +define('XML_HAVPLANG', 'havplang'); +define('XML_PARENTPROXY', 'parentproxy'); +define('XML_WHITELIST', 'whitelist'); +define('XML_BLACKLIST', 'blacklist'); +define('XML_PROXYIFACE', 'proxyiface'); +define('XML_PROXYPORT', 'proxyport'); +define('XML_USEEXTIFACE', 'listenextinterface'); +define('XML_XFORWARDEDFOR', 'xforwardedfor'); +define('XML_FAILSCANERROR', 'failscanerror'); +define('XML_LANGUAGE', 'lang'); +define('XML_SCANIMG', 'scanimg'); +define('XML_SCANARC', 'scanarc'); +define('XML_SCANMAXSIZE', 'scanmaxsize'); +define('XML_MAXDOWNLOADSIZE', 'maxdownloadsize'); +define('XML_SYSLOG', 'syslog'); +define('XML_HAVPUPDATE', 'havpavupdate'); +# define('',''); + +function havp_install(){ + havp_check_system(); +} + +function havp_deinstall() { + havp_setup_cron(HV_CRONNAME_AVUPD,"", ""); + mwexec("rm -rf " . HV_AVUPD_SCRIPT); + mwexec("rm -rf " . HV_PIDFILE); +} + +function havp_resync() { + global $config; + $pfconf = $config['installedpackages']['havp']['config'][0]; + + havp_check_system(); + + # whitelist and blacklist + # also white-listed: + $whitelist = havp_whitelist_def() . "\n" . str_replace(" ", "\n", base64_decode($pfconf[XML_WHITELIST])); + $blacklist = str_replace(" ", "\n", base64_decode($pfconf[XML_BLACKLIST])); + # stupid havp parser - error on 0x0D: + $whitelist = str_replace("\r", "", $whitelist); + $blacklist = str_replace("\r", "", $blacklist); + file_put_contents(HV_WORKDIR . HV_WHITELISTFILE, $whitelist); + file_put_contents(HV_WORKDIR . HV_BLACKLISTFILE, $blacklist); + + # config havp + file_put_contents(HV_WORKDIR . HV_CONFIGFILE, havp_config()); + set_file_access(HV_WORKDIR, HV_USER, '0755'); + + # config freshclam + file_put_contents(HV_FRESHCLAM_CONFIGFILE, havp_config_freshclam()); + set_file_access(HV_FRESHCLAM_CONFIGFILE, HV_AV_USER, '0664'); + + # cron task + $on = false; + $opt = array("0", "*", "*", "*", "*", "root", "/usr/bin/nice -n20 " . HV_AVUPD_SCRIPT); + switch($pfconf['havpavupdate']) { + case 'none': $on = false; break; + case 'hv_01h': $on = true; $opt[1]= "*/1"; break; + case 'hv_02h': $on = true; $opt[1]= "*/2"; break; + case 'hv_03h': $on = true; $opt[1]= "*/3"; break; + case 'hv_04h': $on = true; $opt[1]= "*/4"; break; + case 'hv_06h': $on = true; $opt[1]= "*/6"; break; + case 'hv_08h': $on = true; $opt[1]= "*/8"; break; + case 'hv_12h': $on = true; $opt[1]= "*/12"; break; + case 'hv_24h': $on = true; $opt[1]= "0"; break; + default: break; + } + havp_setup_cron(HV_CRONNAME_AVUPD, $opt, $on); + + mwexec("killall havp"); + mwexec("killall havp"); + mwexec("/usr/local/sbin/havp -c /usr/local/etc/havp" . HV_CONFIGFILE); + +mountRAMdisk(); + +} + +function havp_check_system() { + + # workdir permissions + set_file_access(HV_WORKDIR, HV_USER, ''); + + # tempdir + if (!file_exists(HV_HAVPTEMPDIR)) mwexec("mkdir -p " . HV_HAVPTEMPDIR); + set_file_access(HV_HAVPTEMPDIR, HV_USER, ''); + + # template permissions + set_file_access(HV_TEMPLATEPATH, HV_USER, ''); + + # log files exists ? + if (!file_exists(HV_LOGDIR . HV_ACCESSLOG)) file_put_contents(HV_LOGDIR . HV_ACCESSLOG, ''); + if (!file_exists(HV_LOGDIR . HV_LOG)) file_put_contents(HV_LOGDIR . HV_LOG, ''); + # log dir permissions + set_file_access(HV_LOGDIR, HV_USER, '0764'); + + # pid file + if (!file_exists(HV_PIDFILE)) file_put_contents(HV_PIDFILE, ''); + set_file_access(HV_PIDFILE, HV_USER, '0664'); + + # freshclam config permissions + if (!file_exists(HV_FRESHCLAM_CONFIGFILE)) file_put_contents(HV_FRESHCLAM_CONFIGFILE, ''); + set_file_access(HV_FRESHCLAM_CONFIGFILE, HV_AV_USER, '0664'); + + # log files exists ? + if (!file_exists(HV_AVLOGDIR . '/clamd.log')) file_put_contents(HV_AVLOGDIR . '/clamd.log', ''); + if (!file_exists(HV_AVLOGDIR . '/freshclam.log')) file_put_contents(HV_AVLOGDIR . '/freshclam.log', ''); + # log dir permissions + set_file_access(HV_AVLOGDIR, HV_USER, '0777'); + + # checking dir's and permissions + # "DatabaseDirectory /var/db/clamav"; + # "UpdateLogFile /var/log/clamav/freshclam.log"; + + # AV update script + file_put_contents(HV_AVUPD_SCRIPT, havp_AVupdate_script()); + set_file_access(HV_AVUPD_SCRIPT, HV_AV_USER, '0755'); +} + +function havp_validate_settings($post, $input_errors) { + $submit = isset($_GET['submit']) ? $_GET['submit'] : $_POST['submit']; + + # manual update AV database + if ($submit === 'Update_AV') + havp_update_AV(); + else { + $prxport = trim($post[XML_PROXYPORT]); + if (!empty($prxport) && !is_port($prxport)) + $input_errors[] = 'You must enter a valid port number in the \'Proxy port\' field'; + + # check whitelist + $lst = explode("\n", str_replace(" ", "\n", $post[XML_WHITELIST])); + foreach ($lst as $dm) { + $dm = trim($dm); + if ($dm && check_bw_domain($dm) === false) + $input_errors[] = "Invalid whitelist element '$dm'."; + } + + # check blacklist + $lst = explode("\n", str_replace(" ", "\n", $post[XML_BLACKLIST])); + foreach ($lst as $dm) { + $dm = trim($dm); + if ($dm && check_bw_domain($dm) === false) + $input_errors[] = "Invalid blacklist element '$dm'."; + } + } + +} + +function havp_config() { + global $config; + $pfconf = $config['installedpackages']['havp']['config'][0]; + $conf = array(); + + $conf[] = +"# ============================================================ +# HAVP config file +# This file generated automaticly with HAVP configurator (part of pfSense) +# (C)2008 Serg Dvoriancev +# email: dv_serg@mail.ru +# ============================================================ +"; + + $conf[] = "USER " . HV_USER; + $conf[] = "GROUP " . HV_USER; + $conf[] = "DAEMON true"; + $conf[] = "PIDFILE " . HV_PIDFILE; + $conf[] = "\n# For single user home use, 8 should be minimum."; + $conf[] = "# For 500 users corporate use, start at 40."; + $conf[] = "SERVERNUMBER 3"; + $conf[] = "MAXSERVERS 100"; + + # log + $conf[] = "\n# log "; + $conf[] = "ACCESSLOG " . HV_LOGDIR . HV_ACCESSLOG; + $conf[] = "ERRORLOG " . HV_LOGDIR . HV_LOG; + # syslog + $syslog = ($pfconf[XML_SYSLOG] === 'on') ? 'true' : 'false'; + $conf[] = "\n# syslog"; + $conf[] = "USESYSLOG $syslog"; # use syslog? + $conf[] = "SYSLOGNAME havp"; + $conf[] = "SYSLOGFACILITY daemon"; + $conf[] = "SYSLOGLEVEL info"; + # + $conf[] = "\n# Level of HAVP logging\n# 0 = Only serious errors and information\n# 1 = Less interesting information is included"; + $conf[] = "LOG_OKS true"; # true - for debug, false - for work + $conf[] = "LOGLEVEL 1"; # 0 - work level, 1 - debug level + + # temp + $conf[] = "\n# temp "; + $conf[] = "SCANTEMPFILE " . HV_TEMPDIR . HV_SCANTEMPFILE; + $conf[] = "TEMPDIR " . HV_TEMPDIR; + + $conf[] = "\n#"; + $conf[] = "DBRELOAD 180"; + $conf[] = "TRANSPARENT false"; + $conf[] = "FORWARDED_IP false"; + + # X-FORWARD + $conf[] = "\n# X-FORWARD: proxy can include system's IP address or name in the HTTP requests it forwards"; + $v = ($pfconf[XML_XFORWARDEDFOR] === 'on') ? "true" : "false"; + $conf[] = "X_FORWARDED_FOR $v"; + + # parent proxy = [proxy:port] + if (!empty($pfconf[XML_PARENTPROXY])) { + $prxy = str_replace(" ", ":", $pfconf[XML_PARENTPROXY]); + $prxy = explode(":", $prxy); + $conf[] = "\n# parent proxy "; + $conf[] = "PARENTPROXY {$prxy[0]}"; + $conf[] = "PARENTPORT {$prxy[1]}"; + } + + # proxy listening on + $conf[] = "\n# havp is listening on "; + $pxyport = HV_DEFAULTPORT; + $pxyaddr = HV_DEFAULTADDR; + if (!empty($pfconf[XML_PROXYPORT])) $pxyport = $pfconf[XML_PROXYPORT]; + if ($pfconf[XML_USEEXTIFACE] === 'on' && !empty($pfconf[XML_PROXYIFACE])) { + $pxyaddr = get_real_interface_address($pfconf[XML_PROXYIFACE]); + $pxyaddr = $pxyaddr[0]; + } + $conf[] = "PORT $pxyport"; + $conf[] = "BIND_ADDRESS $pxyaddr"; + + # template files language + $conf[] = "\n# Path to template files "; + if (!empty($pfconf[XML_LANGUAGE])) + $conf[] = "TEMPLATEPATH " . HV_TEMPLATEPATH . "/" . trim($pfconf[XML_LANGUAGE]); + else $conf[] = "TEMPLATEPATH " . HV_TEMPLATEPATH . "/en"; + + $conf[] = "\n# whitelist and blacklist"; + $conf[] = "WHITELISTFIRST true"; + $conf[] = "WHITELIST /usr/local/etc/havp" . HV_WHITELISTFILE; + $conf[] = "BLACKLIST /usr/local/etc/havp" . HV_BLACKLISTFILE; + + # failscanerror - pass/block files if scanner error + $conf[] = "\n# block file if error scanning"; + $v = ($pfconf[XML_FAILSCANERROR] === 'on') ? "true" : "false"; + $conf[] = "FAILSCANERROR $v"; + + $conf[] = "\n# scanner "; + $conf[] = "SCANNERTIMEOUT 10"; + $conf[] = "RANGE false"; + + $conf[] = "\n# stream"; + $conf[] = "STREAMUSERAGENT Player Winamp iTunes QuickTime Audio RMA/ MAD/ Foobar2000 XMMS"; + $conf[] = "STREAMSCANSIZE 20000"; + + # scan image + $v = ($pfconf[XML_SCANIMG] === 'on') ? "true" : "false"; + $conf[] = "SCANIMAGES $v"; + + $val = (!empty($pfconf[XML_SCANMAXSIZE]) && is_numeric($pfconf[XML_SCANMAXSIZE])) ? $pfconf[XML_SCANMAXSIZE] : 0; + $conf[] = "MAXSCANSIZE $v"; + + $conf[] = "# KEEPBACKBUFFER 200000"; + $conf[] = "# KEEPBACKTIME 5"; + + $conf[] = "# After Trickling Time (seconds), some bytes are sent to browser to keep the connection alive"; + $conf[] = "TRICKLING 30"; + + $conf[] = "# Downloads larger than MAXDOWNLOADSIZE will be blocked."; + $val = (!empty($pfconf[XML_DOWNLOADMAXSIZE]) && is_numeric($pfconf[XML_DOWNLOADMAXSIZE])) ? $pfconf[XML_DOWNLOADMAXSIZE] : 0; + $conf[] = "MAXDOWNLOADSIZE $val"; + + $conf[] = "\n# ClamAV Library Scanner (libclamav) "; + $conf[] = "ENABLECLAMLIB true"; + $conf[] = "# Should we block encrypted archives?"; + $conf[] = "# CLAMBLOCKENCRYPTED false"; + $conf[] = "# Should we block files that go over maximum archive limits?"; + $conf[] = "# CLAMBLOCKMAX false"; + $conf[] = "# Scanning limits inside archives (filesize = MB):"; + $conf[] = "# CLAMMAXFILES 1000"; + $conf[] = "# CLAMMAXFILESIZE 10"; + $conf[] = "# CLAMMAXRECURSION 8"; + $conf[] = "# CLAMMAXRATIO 250"; + + $conf[] = ""; + return implode("\n", $conf); +} + +function havp_config_freshclam() +{ + global $config; + $pfconf = $config['installedpackages']['havp']['config'][0]; + $conf = array(); + + $conf[] = +"# ============================================================ +# freshclam(HAVP) config file +# This file generated automaticly with HAVP configurator (part of pfSense) +# (C)2008 Serg Dvoriancev +# email: dv_serg@mail.ru +# ============================================================ +"; + $conf[] = "DatabaseDirectory /var/db/clamav"; +# -- +# disable log to file while error not solved: +# "ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log)." +# -- +# $conf[] = "UpdateLogFile /var/log/clamav/freshclam.log"; + + if ($pfconf[XML_SYSLOG] === 'on') { + $conf[] = "\n# syslog"; + $conf[] = "LogSyslog yes"; + $conf[] = "LogFacility LOG_LOCAL6"; # LOG_LOCAL6 | LOG_MAIL + } + + $conf[] = "\n# pid"; + $conf[] = "PidFile /var/run/clamav/freshclam.pid"; + + $conf[] = "\n# db"; + $conf[] = "DatabaseOwner clamav"; + $conf[] = "AllowSupplementaryGroups yes"; + $conf[] = "DNSDatabaseInfo current.cvd.clamav.net"; + + $avsrv = $pfconf['avupdateserver']; + $avsrv = explode(" ", trim($avsrv)); + + foreach ($avsrv as $asr) + if (!empty($asr)) + $conf[] = "DatabaseMirror $asr"; + + # regional mirror + if (!empty($pfconf['dbregion'])) { + $conf[] = '# regional db'; + switch($pfconf['dbregion']) { + case 'au': $conf[] = "DatabaseMirror clamav.mirror.ayudahosting.com.au"; break; # australia + case 'ca': $conf[] = "DatabaseMirror clamav.mirror.rafal.ca"; break; # canada + case 'cn': $conf[] = "DatabaseMirror 4most2.clamav.ialfa.net"; break; # china + case 'eu': $conf[] = "DatabaseMirror clamav.edpnet.net"; break; # europe + case 'id': $conf[] = "DatabaseMirror db.clamav.or.id"; break; # indonesia + case 'jp': $conf[] = "DatabaseMirror clamavdb2.ml-club.jp"; break; # japan + case 'kr': $conf[] = "DatabaseMirror clamav.hostway.co.kr"; break; # korea + case 'ml': $conf[] = "DatabaseMirror clamav.doubleukay.com"; break; # malaysia + case 'ru': $conf[] = "DatabaseMirror clamav.citrin.ru"; break; # russia + case 'sa': $conf[] = "DatabaseMirror clamav.dial-up.net"; break; # south africa + case 'tw': $conf[] = "DatabaseMirror clamav.cs.pu.edu.tw"; break; # taiwan + case 'uk': $conf[] = "DatabaseMirror clamav.oucs.ox.ac.uk"; break; # united kingdom + case 'us': $conf[] = "DatabaseMirror clamav.catt.com "; break; # united states + default: break; + } + } + +# $conf[] = "DatabaseMirror db.ru.clamav.net"; +# $conf[] = "DatabaseMirror db.us.clamav.net"; + + $conf[] = "\n# DO NOT TOUCH the following line "; + $conf[] = "DatabaseMirror database.clamav.net"; + + $conf[] = "\n# Number of database checks per day. Default: 12 (every two hours)"; + $chks = 0; + switch($pfconf['havpavupdate']) { + case 'none': $chks = 0; break; + case 'hv_01h': $chks = 24; break; + case 'hv_02h': $chks = 12; break; + case 'hv_03h': $chks = 8; break; + case 'hv_04h': $chks = 6; break; + case 'hv_06h': $chks = 4; break; + case 'hv_08h': $chks = 3; break; + case 'hv_12h': $chks = 2; break; + case 'hv_24h': $chks = 1; break; + } + $conf[] = "Checks $chks"; + +# $conf[] = "# Proxy settings"; # future +#HTTPProxyServer myproxy.com +#HTTPProxyPort 1234 +#HTTPProxyUsername myusername +#HTTPProxyPassword mypass + +# MAKE GUI Errors display +# Run command when database update process fails. +# Default: disabled +#OnErrorExecute command + +# Run command when freshclam reports outdated version. +# In the command string %v will be replaced by the new version number. +# Default: disabled +#OnOutdatedExecute command + +# Enable debug messages in libclamav. +# Default: disabled +#Debug + + $conf[] = ""; + return implode("\n", $conf); +} + +function havp_whitelist_def() { + $whitelist = array(); + + $whitelist[] = "*sourceforge.net/*clamav-*"; + $whitelist[] = "*pfsense.com/*"; + $whitelist[] = "*.microsoft.com/*"; + $whitelist[] = "*.windowsupdate.com/*"; # M$ & M$ update + # media and image extensions + $whitelist[] = "*/*.gif\n*/*.swf\n*/*.png\n*/*.jpg\n*/*.jpeg\n*/*.mov\n*/*.avi\n*/*.flv\n*/*.bmp\n*/*.ico\n*/*.pdf\n*/*.mp3\n*/*.wma\n*/*.wmv\n*/*.ogg"; + + return implode("\n", $whitelist); +} + +# RAM disk +# Mem - RAM +# 128M - 16M +# 256M - 32M +# 512M - 64M +# 1G - 128M +# +function mountRAMdisk() +{ +# disabled for VMware +# return; + + # detach and free all resources used by /dev/md10: + mwexec("umount /var/tmp/havp"); + mwexec("mdconfig -d -u 10"); + + # create and mount a 8MByte swap backed file system on /var/tmp/havp by /dev/md10: + mwexec("mdconfig -a -t swap -s 1M -u 10"); + mwexec("newfs -U /dev/md10"); + mwexec("mount /dev/md10 /var/tmp/havp"); + mwexec("chmod 1777 /var/tmp/havp"); +} + +# ------------------------------------------------------------------------------ +function set_file_access($dir, $owner, $mod) { + mwexec("chgrp -R -v $owner $dir"); + mwexec("chown -R -v $owner $dir"); + if (!empty($mod)) { + mwexec( "chmod -R -v $mod $dir"); + } +} + +# Src from squid.inc +# Copyright (C) 2006 Scott Ullrich +# Copyright (C) 2006 Fernando Lemos +function get_real_interface_address($iface) { + global $config; + + $iface = convert_friendly_interface_to_real_interface_name($iface); + $line = trim(shell_exec("ifconfig $iface | grep inet | grep -v inet6")); + list($dummy, $ip, $dummy2, $netmask) = explode(" ", $line); + + return array($ip, long2ip(hexdec($netmask))); +} +#------------------------------------------------------------------------------- + +function havp_update_AV() { + # AV update script + if (file_exists(HV_AVUPD_SCRIPT)) { + file_put_contents(HV_AVUPD_SCRIPT, havp_AVupdate_script()); + set_file_access(HV_AVUPD_SCRIPT, HV_AV_USER, '0755'); + } + mwexec(HV_AVUPD_SCRIPT); +} + +# *** check black/white list domain *** +# Lines can hold URLs with wildcards with following rules: +# Line must cointain Domain/Path +# Domains can have a wildcard at begin. +# Pages can hav a wildcard at begin and end. +# URLs without wildcards are exact +# Examples: +# (1) www.server-side.de (Only this URL is whitelisted) +# (2) www.server-side.de/* (Domain is completely whitelisted) +# (3) *server-side.de/index.html +# (4) */*.gif (All .gif are whitelisted) +# (5) www.server-side.de/novirus* +# (6) www.server-side.de/*novirus* + +function check_bw_domain($_dm) { + $domain = ""; + $path = ""; + $pos = strpos($_dm, "/"); + + if ($pos === false) { + $domain = $_dm; + $path = ""; + } + else { + $domain = substr($_dm, 0, $pos); + $path = substr($_dm, $pos+1); + } + + $fmt = "[a-zA-Z0-9_-]"; + + # Domains can have a wildcard at begin '*xxx.xxx' - *my.domain.com + if (!eregi("^(\*)|((\*){0,1}($fmt\.){0,}$fmt{1,})$", $domain)) return false; + + # Path can have a wildcard at begin and end '*xxx*' + if ($path && !eregi("^(\*){0,1}(.[^\*][^=]){0,}(\*){0,1}$", $path)) return false; + + + return true; +} + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +function havp_AVupdate_script() { + +# *** AV update script *** + +$scr = <<<EOD +#!/bin/sh +# AV update script +# This file was automatically generated +# by the pfSense service handler. +/usr/local/bin/freshclam +wait +/usr/local/bin/sigtool --unpack-current daily.cvd +/usr/local/bin/sigtool --unpack-current main.cvd +wait +EOD; + +# --- AV update script --- + + return $scr; +} +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# === UNDER CONSTRUCTION === + +# $day: 1, 2, .., 31, *, mon, tue, wed, thu, fri, sat, sun ; every day : [$day] +# $mon: 1, 2, .., 12, * ; every mon: [$mon] [15]-[01]-[2001] +# $time = 'hh:mm': '12:00' - at 12:00; '*:*' - at any time; '/hh:/mm' - every hh every /mm +# havp_crontask('my_task', '15', '/1', '15:30', 'root' 'start_cmd', true); +function havp_crontask($task_name, $day, $mon, $time, $who, $cmd, $enabled) +{ + +} + +# / === UNDER CONSTRUCTION === + +# $options: [0]='minute', [1]='hour', [2]='mday', [3]='month', [4]='wday', [5]='who', [6]='command' +# +function havp_setup_cron($task_name, $options, $on_off) { + global $config; + $cron_item = array(); + + # $on_off = TRUE/FALSE - install/deinstall cron task: + # prepare new cron item + if (is_array($options)) { + $cron_item['task_name'] = $task_name; + $cron_item['minute'] = $options[0]; + $cron_item['hour'] = $options[1]; + $cron_item['mday'] = $options[2]; + $cron_item['month'] = $options[3]; + $cron_item['wday'] = $options[4]; + $cron_item['who'] = ($options[5]) ? $options[5] : 'nobody'; + $cron_item['command'] = $options[6]; + } + + # unset old cron task with $task_name + if ($task_name !== "") { + $flag_cron_upd = false; + + # delete old cron task if exists + foreach($config['cron']['item'] as $key => $val) { + if ($config['cron']['item'][$key]['task_name'] === $task_name) { + unset($config['cron']['item'][$key]); + $flag_cron_upd = true; + + # log ! cron task deleted ! + break; + } + } + + # set new cron task + if (($on_off === true) and !empty($cron_item)) { + $config['cron']['item'][] = $cron_item; + $flag_cron_upd = true; + + # log ! cron task installed ! + } + + # write config and configure cron only if cron task modified + if ($flag_cron_upd === true) { + write_config("Installed cron task '$task_name' for 'havp' package"); + configure_cron(); + # log ! cron stored ! + } + } + else { + # ! error $name ! + + # if error - break function + return; + } +} +?> diff --git a/config/havp/havp.xml b/config/havp/havp.xml new file mode 100644 index 00000000..a70b09bc --- /dev/null +++ b/config/havp/havp.xml @@ -0,0 +1,250 @@ +<?xml version="1.0" encoding="utf-8" ?> +<packagegui> + <name>havp</name> + <title>Services: Antivirus proxy server (havp + clamav) -> Settings</title> + <category>Status</category> + <version>1.7.1</version> + <include_file>havp.inc</include_file> + + <!-- Installation --> + <menu> + <name>HTTP Antivirus</name> + <tooltiptext>Proxy server antivirus</tooltiptext> + <section>Services</section> + <url>/pkg_edit.php?xml=havp.xml&id=0</url> + </menu> + + <additional_files_needed> + <item>http://www.pfsense.com/packages/config/havp/havp.inc</item> + </additional_files_needed> + + <tabs> + <tab> + <text>Settings</text> + <url>/pkg_edit.php?xml=havp.xml&id=0</url> + <active/> + </tab> + </tabs> + <fields> + <field> + <fielddescr>Enable</fielddescr> + <fieldname>enable</fieldname> + <description>Check this for enable proxy.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Use external interface</fielddescr> + <fieldname>listenextinterface</fieldname> + <description>Select this for use external interface, otherwise the proxy will use the internal interface '127.0.0.1'. Cascade you other proxy to the HAVP as 'parent proxy' via '127.0.0.1' ip.</description> + <type>checkbox</type> + <enablefields>proxyiface</enablefields> + </field> + <field> + <fielddescr>Proxy interface</fielddescr> + <fieldname>proxyiface</fieldname> + <description>The interface(s) the proxy server will bind to.</description> + <type>interfaces_selection</type> + <required/> + <default_value>lan</default_value> + </field> + <field> + <fielddescr>Proxy port</fielddescr> + <fieldname>proxyport</fieldname> + <description>This is the port the proxy server will listen on.</description> + <type>input</type> + <size>10</size> + <required/> + <default_value>3128</default_value> + </field> + <field> + <fielddescr>Parent proxy</fielddescr> + <fieldname>parentproxy</fieldname> + <description> + Enter the parent proxy as PROXY:PORT format or leave empty. + </description> + <type>input</type> + <size>90</size> + </field> + <field> + <fielddescr>Language</fielddescr> + <fieldname>lang</fieldname> + <description>Select the language in which the proxy server will display error messages to users.</description> + <type>select</type> + <value>en</value> + <options> + <option><value>br</value><name>Brazil</name></option> + <option><value>de</value><name>Germany</name></option> + <option><value>en</value><name>English</name></option> + <option><value>es</value><name>Spain</name></option> + <option><value>fr</value><name>French</name></option> + <option><value>it</value><name>Italian</name></option> + <option><value>nf</value><name>Norfolk Island</name></option> + <option><value>pl</value><name>Poland</name></option> + <option><value>ru</value><name>Russian</name></option> + </options> + </field> + <field> + <fielddescr>Max download size</fielddescr> + <fieldname>maxdownloadsize</fieldname> + <description>Enter value or leave empty. Value in bytes. Downloads larger than 'Max download size' will be blocked. Only if not Whitelisted!</description> + <type>input</type> + <size>10</size> + <default_value></default_value> + </field> + <field> + <fielddescr>Disable X-Forward</fielddescr> + <fieldname>xforwardedfor</fieldname> + <description>If not set, proxy will include your system's IP address or name in the HTTP requests it forwards.</description> + <type>checkbox</type> + </field> + + <field> + <fielddescr>Whitelist</fielddescr> + <fieldname>whitelist</fieldname> + <description> + Enter each destination url on a new line that will be accessable to the users without scanning. + Use '*' symbol for mask. Example: *.pfsense.com/*, *sourceforge.net/*clamav-*, */*.xml, */*.inc + </description> + <type>textarea</type> + <cols>60</cols> + <rows>5</rows> + <encoding>base64</encoding> + </field> + + <field> + <fielddescr>Blacklist</fielddescr> + <fieldname>blacklist</fieldname> + <description>Enter each destination domain on a new line that will be accessable to the users that are allowed to use the proxy.</description> + <type>textarea</type> + <cols>60</cols> + <rows>5</rows> + <encoding>base64</encoding> + </field> +<!-- Scanner --> + <field> + <fielddescr>Block file if error scanning</fielddescr> + <fieldname>failscanerror</fieldname> + <description>If set, the proxy will block the files on which an error scanning.</description> + <type>checkbox</type> + </field> + + <field> + <fielddescr>Scan max file size</fielddescr> + <fieldname>scanmaxsize</fieldname> + <description> + Enter here value in bytes (5, 10, 15, 20) or leave empty. + Files larger than this limit won't be scanned. + Empty or 0 also disables the limit. + NOTE: Setting limit is a security risk, because some archives like + ZIP need all the data to be scanned properly! Use this only if you + can't afford temporary space for big files. Also scanner settings + will affect how many files will be scanned inside an archive etc. + </description> + <type>input</type> + <size>10</size> + </field> + + <field> + <fielddescr>Scan images</fielddescr> + <fieldname>scanimg</fieldname> + <description>Check this for scan image files.</description> + <type>checkbox</type> + </field> + + <field> + <fielddescr>Scan archives</fielddescr> + <fieldname>scanarc</fieldname> + <description>Check this for scan within archives and compressed files.</description> + <type>checkbox</type> + </field> + + <field> + <fielddescr>Scan archive max file size</fielddescr> + <fieldname>scanarcmaxsize</fieldname> + <value>10M</value> + <description> + Enter here value in megabytes (15M) or leave empty. + Files in archives larger than this limit won't be scanned. + Value of 0 also disables the limit. + </description> + <type>input</type> + <size>10</size> + </field> + + <field> + <fielddescr>AV bases update</fielddescr> + <fieldname>havpavupdate</fieldname> + <description> + <input name='submit' type='submit' value='Update_AV'> + Press button for update AV database now. + </description> + <type>select</type> + <value>hv_none</value> + <options> + <option><name>none</name><value>hv_none</value></option> + <option><name>every 1 hours</name><value>hv_01h</value></option> + <option><name>every 2 hours</name><value>hv_02h</value></option> + <option><name>every 3 hours</name><value>hv_03h</value></option> + <option><name>every 4 hours</name><value>hv_04h</value></option> + <option><name>every 6 hours</name><value>hv_06h</value></option> + <option><name>every 8 hours</name><value>hv_08h</value></option> + <option><name>every 12 hours</name><value>hv_12h</value></option> + <option><name>every 24 hours</name><value>hv_24h</value></option> + </options> + </field> + <field> + <fielddescr>Regional AV database update mirror</fielddescr> + <fieldname>dbregion</fieldname> + <description>Select regional database mirror.</description> + <type>select</type> + <value></value> + <options> + <option><value></value><name>-----</name></option> + <option><value>au</value><name>Australia</name></option> + <option><value>eu</value><name>Europe</name></option> + <option><value>ca</value><name>Canada</name></option> + <option><value>cn</value><name>China</name></option> + <option><value>id</value><name>Indonesia</name></option> + <option><value>jp</value><name>Japan</name></option> + <option><value>kr</value><name>Korea</name></option> + <option><value>ml</value><name>Malaysia</name></option> + <option><value>ru</value><name>Russian</name></option> + <option><value>sa</value><name>South africa</name></option> + <option><value>tw</value><name>Taiwan</name></option> + <option><value>uk</value><name>United Kingdom</name></option> + <option><value>us</value><name>United States</name></option> + </options> + </field> + <field> + <fielddescr>Optional AV database update servers</fielddescr> + <fieldname>avupdateserver</fieldname> + <description>Enter here space separated AV update servers, or leave empty.</description> + <type>textarea</type> + <cols>60</cols> + <rows>5</rows> + </field> + + <field> + <fielddescr>Syslog</fielddescr> + <fieldname>syslog</fieldname> + <description>Check this for enable Syslog.</description> + <type>checkbox</type> + </field> + <field> + <fielddescr>Log</fielddescr> + <fieldname>log</fieldname> + <description>Check this for enable log.</description> + <type>checkbox</type> + </field> + </fields> + <custom_php_validation_command> + havp_validate_settings($_POST, &$input_errors); + </custom_php_validation_command> + <custom_php_resync_config_command> + havp_resync(); + </custom_php_resync_config_command> + <custom_php_install_command> + </custom_php_install_command> + <custom_php_deinstall_command> + </custom_php_deinstall_command> +</packagegui>
\ No newline at end of file diff --git a/config/jail_template.xml b/config/jail_template.xml new file mode 100644 index 00000000..d183200b --- /dev/null +++ b/config/jail_template.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <description>Basic jail template</description> + <requirements>Disk space...</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>jail_template</name> + <version>0.1</version> + <title>Jail template</title> + <!-- configpath gets expanded out automatically and config items will be + stored in that location --> + <configpath>['installedpackages']['$packagename']['config']</configpath> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/jail_template/jail_template.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/jail_template/jail_template.img.uzip</item> + </additional_files_needed> + + <include_file>/usr/local/pkg/jail_template.inc</include_file> + <custom_php_install_command> + jail_template_install(); + </custom_php_install_command> + <custom_php_deinstall_command> + jail_template_deinstall(); + </custom_php_deinstall_command> + <custom_php_resync_config_command> + jail_template_resync(); + </custom_php_resync_config_command> +</packagegui> + diff --git a/config/jail_template/jail_template.img.uzip b/config/jail_template/jail_template.img.uzip Binary files differnew file mode 100644 index 00000000..1c92fb90 --- /dev/null +++ b/config/jail_template/jail_template.img.uzip diff --git a/config/jail_template/jail_template.inc b/config/jail_template/jail_template.inc new file mode 100644 index 00000000..f9c00b79 --- /dev/null +++ b/config/jail_template/jail_template.inc @@ -0,0 +1,32 @@ +<?php +function jail_template_install() { + exec('mkdir /usr/jail_template'); + ## exec('tar -C /usr/jail_template -yxf /tmp/jail_template.tar.bz2 2>&1 &'); + $_rcfile['file']='000.jail_template.sh'; + $_rcfile['start']=''; + $_rcfile['stop']=''; + $_rcfile['start'].='mount -o ro /dev/`mdconfig -af /usr/jail_template.img.uzip`.uzip /usr/jail_template '."\n\t"; + $_rcfile['stop'].='umount -f /usr/jail_template '."\n\t"; + $_rcfile['stop'].='mdconfig -d -u `expr "$(mdconfig -l -v | grep jail_template | grep -v grep)" : "md\([0-9]*\)"` '."\n\t"; + write_rcfile($_rcfile); + exec('mount -o ro /dev/`mdconfig -af /usr/jail_template.img.uzip`.uzip /usr/jail_template'); + + $GLOBALS['config']['installedpackages']['pfjailctltemplates']['config'][0]['templates']['jail_template']['name']= + 'pfSense default jail template'; + $GLOBALS['config']['installedpackages']['pfjailctltemplates']['config'][0]['templates']['jail_template']['path']= + '/usr/jail_template'; +} + +function jail_template_deinstall() { + exec('umount -f /usr/jail_template'); + exec('mdconfig -d -u `expr "$(mdconfig -l -v | grep jail_template | grep -v grep)" : "md\([0-9]*\)'); + unset($GLOBALS['config']['installedpackages']['pfjailctltemplates']['config'][0]['templates']['jail_template']); +} + +function jail_template_resync() { + $GLOBALS['config']['installedpackages']['pfjailctltemplates']['config'][0]['templates']['jail_template']['name']= + 'pfSense default jail template'; + $GLOBALS['config']['installedpackages']['pfjailctltemplates']['config'][0]['templates']['jail_template']['path']= + '/usr/jail_template'; +} +?>
\ No newline at end of file diff --git a/config/jailctl.xml b/config/jailctl.xml new file mode 100644 index 00000000..079ddb6b --- /dev/null +++ b/config/jailctl.xml @@ -0,0 +1,233 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <description>Jail management</description> + <requirements>Disk space...</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>pfJailctl</name> + <version>0.1</version> + <title>Jails</title> + <!-- Menu is where this packages menu will appear --> + <menu> + <name>Jails</name> + <tooltiptext>Jail management</tooltiptext> + <section>Services</section> + <configfile>jailctl.xml</configfile> + </menu> + <service> + <name>Jails</name> + <rcfile>jails.sh</rcfile> + <description>All jails with autostart enabled.</description> + <custom_php_service_status_command> + include("/usr/local/pkg/jailctl.inc"); + jailctl_servicestatus(); + </custom_php_service_status_command> + </service> + <!-- configpath gets expanded out automatically and config items will be + stored in that location --> + <configpath>['installedpackages']['$packagename']['config']</configpath> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl_defaults.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl_settings.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl-utils.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl_list.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/sbin/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/sbin/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/sysinstall</item> + </additional_files_needed> + + <tabs> + <tab> + <text>Jails</text> + <url>/pkg.php?xml=jailctl.xml</url> + <active/> + </tab> + <tab> + <text>Global settings</text> + <url>/pkg_edit.php?xml=jailctl_settings.xml&id=0</url> + </tab> +<!-- <tab> + <text>Jail defaults</text> + <url>/pkg_edit.php?xml=jailctl_defaults.xml&id=0</url> + </tab> --> + </tabs> + + + <adddeleteeditpagefields> + <columnitem> + <fielddescr>State</fielddescr> + <fieldname>jstate</fieldname> + </columnitem> + <columnitem> + <fielddescr>Jail name</fielddescr> + <fieldname>jname</fieldname> + </columnitem> + <columnitem> + <fielddescr>Jail IF</fielddescr> + <fieldname>jifdesc</fieldname> + </columnitem> + <columnitem> + <fielddescr>Jail IP</fielddescr> + <fieldname>jip</fieldname> + </columnitem> + <columnitem> + <fielddescr>Jail path</fielddescr> + <fieldname>jpath</fieldname> + </columnitem> + <columnitem> + <fielddescr>Actions</fielddescr> + <fieldname>jactions</fieldname> + </columnitem> + + </adddeleteeditpagefields> + + <fields> + <field> + <fielddescr>Jail hostname</fielddescr> + <fieldname>jname</fieldname> + <description>FQDN of the jail</description> + <type>input</type> + </field> + <field> + <fielddescr>Network interface</fielddescr> + <fieldname>jif</fieldname> + <description>Jail will be bound to this interface</description> + <type>interfaces_selection</type> + </field> + <field> + <fielddescr>IP address</fielddescr> + <fieldname>jip</fieldname> + <description>Must be in the same subnet as the parent interface</description> + <type>input</type> + </field> + <field> + <fielddescr>Autostart jail on boot?</fielddescr> + <fieldname>jautostart</fieldname> + <description>Start this jail automatically when the system boots?</description> + <type>checkbox</type> + </field> + + + <field> + <fielddescr>Jail templates</fielddescr> + <fieldname>jselect_templates</fieldname> + <type>listtopic</type> + <name>Select a predefined template for your jail:</name> + </field> + <field> + <fielddescr>Templates</fielddescr> + <fieldname>jtemplates</fieldname> + <description>Files from the templates will be read-only inside the jail.</description> + <type>select</type> + <options> + <option><name> --- select --- </name><value></value></option> + </options> + <default_value>jtemplate_default</default_value> + </field> + <field> + <fielddescr>Use unionfs</fielddescr> + <fieldname>juse_unionfs</fieldname> + <description>Use unionfs instead of nullfs to mount the template contents into the jail</description> + <type>checkbox</type> + </field> + + <field> + <fielddescr>Package sets</fielddescr> + <fieldname>jselect_sets</fieldname> + <type>listtopic</type> + <name>OR select a distribution set to install:</name> + </field> + <field> + <fielddescr>Distribution sets</fielddescr> + <fieldname>jdistset</fieldname> + <description>Select a standard set of distributions to install</description> + <type>select</type> + <options> + <option><name> --- select --- </name><value></value></option> + <option><name>User (binaries only)</name><value>distSetUser</value></option> + <option><name>Developer (src/all, binaries)</name><value>distSetDeveloper</value></option> + <option><name>Kernel developer (src/kern, binaries)</name><value>distSetKernDeveloper</value></option> + <option><name>Minimum (minimal binaries)</name><value>distSet</value></option> + </options> + <default_value></default_value> + </field> + + <field> + <fielddescr>Individual packages</fielddescr> + <fieldname>jselect_individual</fieldname> + <type>listtopic</type> + <name>OR select individual distributions in addition to 'base':</name> + </field> + + <field> + <fielddescr>Individual distributions</fielddescr> + <fieldname>jdists</fieldname> + <description>Select individual distributions (multiple selection)</description> + <type>select</type> + <options> + <option><name>Manual pages</name><value>manpages</value></option> + <option><name>The Ports collection</name><value>ports</value></option> + <option><name>Miscellaneous documentation</name><value>doc</value></option> + <option><name>Local additions collection</name><value>local</value></option> + <option><name>X.org client binaries</name><value>Xbin</value></option> + <option><name>X.org libraries</name><value>Xlib</value></option> + <option><name>X.org manual pages</name><value>Xman</value></option> + <option><name>X.org imake distribution</name><value>Xprog</value></option> + <option><name>Games</name><value>games</value></option> + </options> + <multiple/> + </field> + + </fields> + + + <!-- php hooks --> + <include_file>/usr/local/pkg/jailctl_list.inc</include_file> + <custom_add_php_command> + sync_package_jailctl(); + </custom_add_php_command> + <custom_delete_php_command> + jailctl_delete(); + </custom_delete_php_command> + <custom_php_resync_config_command> + sync_package_jailctl(); + </custom_php_resync_config_command> + <custom_php_install_command> + jailctl_install(); + </custom_php_install_command> + <custom_php_deinstall_command> + jailctl_deinstall(); + </custom_php_deinstall_command> + <custom_php_after_form_command> + jailctl_addinterfaces($config); + jailctl_addtemplates($config); + </custom_php_after_form_command> +</packagegui> + diff --git a/config/jailctl/jailctl b/config/jailctl/jailctl new file mode 100755 index 00000000..542c2db6 --- /dev/null +++ b/config/jailctl/jailctl @@ -0,0 +1,1053 @@ +#!/bin/sh + +# ------------------------------------- +# Jail management script +# Copyright (c) 2004-2008 Eirik Oeverby +# All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name(s) of the author(s) may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------- + +############################################################################## +# Configuration section # +# # +# Change the CFGFILE variable to point to your jail configuration file. # +############################################################################## + +# Clear the hook lists (for security reasons) +unset BEFORESTART_HOOKS +unset AFTERSTART_HOOKS +unset BEFORESTOP_HOOKS +unset AFTERSTOP_HOOKS +unset BEFORESTATUS_HOOKS +unset AFTERSTATUS_HOOKS +unset BEFOREBACKUP_HOOKS +unset AFTERBACKUP_HOOKS +unset BEFORERESTORE_HOOKS +unset AFTERRESTORE_HOOKS +unset BEFORECREATE_HOOKS +unset AFTERCREATE_HOOKS +unset BEFOREUPGRADE_HOOKS +unset AFTERUPGRADE_HOOKS +unset BEFOREDELETE_HOOKS +unset AFTERDELETE_HOOKS + +CFGFILE="/usr/local/etc/jails.conf" +. ${CFGFILE} + +PROCFS=`expr "$PROCFS" : "[tT][rR][uU][eE]"` +LINPROCFS=`expr "$LINPROCFS" : "[tT][rR][uU][eE]"` + +############################################################################## +# Main function section # +# # +# These functions are wrappers for the action functions below. They do # +# various sanity checking of input parameters, and verify the existence and # +# required states of the affected jail(s). # +############################################################################## + +usage() { + ## Output usage information + echo "Usage:" >&2 + echo "jailctl <command> <jail> [<path>]" >&2 + echo "<command> = start|stop|status|create|delete|upgrade|backup|restore" >&2 + echo "<jail> = hostname|all" >&2 + echo "<path> = Backup destination / restore source" >&2 + echo >&2 +} + +jail_status() { + ## Output the status of one or several jails + if [ ! $JAIL ] || [ $JAIL = "all" ] || jail_exists ; then + # Jail exists (or "all" was specified), we can query its status + if [ ! $JAIL ] || [ $JAIL = "all" ] ; then + # Output a brief list for all jails + echo "Jail status (*=running, !=not configured):" + for JAIL in $JAILS ; do + # Loop through jails + JAIL=`expr "$JAIL" : "\(.*\):.*"` + # Run hooks + jail_run_hooks before-status + if jail_exists && jail_running ; then + # Jail is running + echo "*$JAIL ($(jail_ip))" + elif jail_exists ; then + # Jail not running + echo " $JAIL ($(jail_ip))" + else + # Jail nonexistant or not configured + echo "!$JAIL ($(jail_ip))" + fi + # Run hooks + jail_run_hooks after-status + done + else + # Output information for a specific jail + # Run hooks + jail_run_hooks before-status + if jail_running ; then + # Jail is running, be verbose + echo "$JAIL ($(jail_ip)) is up." + echo "Path: $(jail_path)" + echo "Interface: $(jail_if)" + echo "Process list:" + # Output process list for jail + jps + elif jail_exists; then + # Jail not running + echo "$JAIL ($(jail_ip)) is down." + echo "Path: $(jail_path)" + echo "Interface: $(jail_if)" + else + # Jail nonexistant or not configured + echo "Unable to query jail $JAIL!" + echo "Incomplete configuration?" + fi + # Run hooks + jail_run_hooks after-status + fi + else + echo "Path: $(jail_path)" + echo "Interface: $(jail_if)" + # No jail was specified, or the specified jail doesn't exist (on disk + # or in jails.conf. Show usage information) + echo "No valid jail specified!" + echo + usage + fi +} + +jail_start() { + ## Start one or several jails + if [ $JAIL ] && (jail_exists || [ $JAIL = "all" ]) ; then + # Jail exists (or "all" was specified), we can attempt to start it + if [ $JAIL = "all" ] ; then + # Attempting to start all jails + for JAIL in $JAILS ; do + # Loop through jails + JAIL=`expr "$JAIL" : "\(.*\):.*"` + if jail_running ; then + # Jail is running, cannot start + echo "Jail already running!" + elif jail_exists ; then + # Jail not running, starting + echo "Starting jail $JAIL..." + jstart + else + # Jail nonexistant or not configured + echo "Unable to start jail $JAIL!" + echo "Incomplete configuration?" + fi + done + else + # Start a specific jail + if jail_running && [ ! $FORCE ] ; then + # Jail is running, cannot start + echo "Jail already running!" + elif jail_exists ; then + # Jail not running, starting + echo "Starting jail $JAIL..." + jstart + else + # Jail nonexistant or not configured + echo "Unable to start jail $JAIL!" + echo "Incomplete configuration?" + fi + fi + else + # No jail was specified, or the specified jail doesn't exist (on disk + # or in jails.conf. Show usage information) + echo "No valid jail specified!" + echo + usage + fi +} + +jail_stop() { + ## Stop one or several jails + if [ $JAIL ] && (jail_exists || [ $JAIL = "all" ]) ; then + # Jail exists (or "all" was specified), we can attempt to stop it + if [ $JAIL = "all" ] ; then + # Attempting to stop all jails + if [ $VERSION -eq 4 ] && [ `ls /proc | wc -l` -eq 0 ] ; then + # We are on FreeBSD 4.x, and we have no /proc to rely on + jstop + else + for JAIL in $JAILS ; do + # Loop through jails + JAIL=`expr "$JAIL" : "\(.*\):.*"` + if jail_exists && jail_running ; then + # Jail is running, stopping + echo "Stopping jail $JAIL..." + jstop + elif jail_exists && ! jail_running ; then + # Jail not running, cannot stop + echo "Jail not running ($JAIL)!" + else + # Jail nonexistant or not configured + echo "Unable to stop jail $JAIL!" + echo "Incomplete configuration?" + fi + done + fi + else + if jail_exists && jail_running ; then + if [ $VERSION -eq 4 ] && [ `ls /proc | wc -l` -eq 0 ] ; then + # We are on FreeBSD 4.x, and we have no /proc to rely on + echo 'Without a proc filesystem, you must use "jailctl stop all"!' + else + # Jail running, stopping + echo "Stopping jail $JAIL..." + jstop + fi + elif jail_exists && ! jail_running ; then + # Jail not running, cannot stop + echo "Jail not running!" + else + # Jail nonexistant or not configured + echo "Unable to start jail $JAIL!" + echo "Incomplete configuration?" + fi + fi + else + # No jail was specified, or the specified jail doesn't exist (on disk + # or in jails.conf. Show usage information) + echo "No valid jail specified!" + echo + usage + fi +} + +jail_create() { + ## Create a jail + # Be more specific in distinguishing return codes from jail_exists + jail_exists ; RC=$? + if [ $JAIL ] && [ $RC -eq 1 ] ; then + # If the jail is configured but does not exist on disk, create the jail + echo "Creating jail $JAIL..." + jcreate + else + # Jail not configured or already exists + echo "Jail $JAIL cannot be created!" + fi + return 0 +} + +jail_upgrade() { + ## Upgrade one or several jails + if [ $JAIL ] && (jail_exists || [ $JAIL = "all" ]) ; then + # Jail exists (or "all" was specified), we can attempt to upgrade it + if [ $JAIL = "all" ] ; then + # Attempting to upgrade all jails + for JAIL in $JAILS ; do + # Loop through jails + JAIL=`expr "$JAIL" : "\(.*\):.*"` + if jail_exists ; then + # Jail exists and is not running, upgrading + echo "Upgrading jail $JAIL..." + jupgrade + else + # Jail nonexistant or not configured + echo "Jail does not exist, or not configured!" + fi + done + else + if jail_exists ; then + # Jail exists and is not running, upgrading + echo "Upgrading jail $JAIL..." + jupgrade + else + # Jail nonexistant or not configured + echo "Jail does not exist, or not configured!" + fi + fi + else + # No jail was specified, or the specified jail doesn't exist (on disk + # or in jails.conf. Show usage information) + echo "No valid jail specified!" + echo + usage + fi +} + +jail_delete() { + ## Delete a specific jail + if [ $JAIL ] && ((jail_exists && ! jail_running) || [ $FORCE ]) ; then + # Jail exists and is not running, deleting + echo "Deleting jail $JAIL..." + jdelete + else + # Jail nonexistant, running or not configured, cannot delete + echo "Jail $JAIL cannot be deleted!" + fi + return 0 +} + +jail_backup() { + ## Back up one or several jails + if [ $JAIL ] && (jail_exists || [ $JAIL = "all" ]) ; then + # Jail exists (or "all" was specified), we can attempt to back it up + if [ $JAIL = "all" ] ; then + # Attempting to back up all jails + for JAIL in $JAILS ; do + # Loop through jails + JAIL=`expr "$JAIL" : "\(.*\):.*"` + if jail_exists && ! jail_running ; then + # Jail exists and is not running, doing cold backup + echo "Doing cold backup of jail $JAIL..." + jbackup cold + elif jail_exists && jail_running ; then + # Jail is running, doing warm backup + echo "Doing warm backup of jail $JAIL..." + jbackup + else + # Jail nonexistant or not configured + echo "Jail does not exist, or not configured!" + fi + done + else + if jail_exists && ! jail_running ; then + # Jail exists and is not running, doing cold backup + echo "Doing cold backup of jail $JAIL..." + jbackup cold + elif jail_exists && jail_running ; then + # Jail is running, doing warm backup + echo "Doing warm backup of jail $JAIL..." + jbackup + else + # Jail nonexistant or not configured + echo "Jail does not exist, or not configured!" + fi + fi + else + # No jail was specified, or the specified jail doesn't exist (on disk + # or in jails.conf. Show usage information) + echo "No valid jail specified!" + echo + usage + fi +} + +jail_restore() { + ## Restore a jail + # Be more specific in distinguishing return codes from jail_exists + jail_exists ; RC=$? + if [ $JAIL ] && [ $RC -eq 1 ] ; then + echo "Restoring jail $JAIL from backup" + local JP=$(jail_path) + # Restore the jail + jrestore + else + # No jail was specified, or the specified jail doesn't exist (on disk + # or in jails.conf. Show usage information) + echo "No valid jail specified!" + echo + usage + fi +} + + +# +### Helper function section +# + +jail_exists() { + ## Query a jails existence + local J=`echo $JAILS | tr " " "\n" | grep "^${JAIL}:"` +# for J in $JAILS ; do + # Loop through configured jails + local J_NAME=`expr "$J" : "\(.*\):.*"` + if [ $J_NAME = $JAIL ] && [ -d "$(jail_path)" ] && \ + [ `expr $(ls -a $(jail_path) | grep -v "^.snap$" | wc -l)` -gt 2 ]; then + # Jail is configured, its directory exists, and the + # directory contains more than . and .. + return 0 + elif [ $J_NAME = $JAIL ] && [ ! -d "$(jail_path)" ] || \ + ( [ -d "$(jail_path)" ] && \ + [ `expr $(ls -a $(jail_path) | grep -v "^.snap$" | wc -l)` -le 2 ]); then + # Jail is defined, but not yet created (directory missing or empty) + return 1 + fi +# done + # Jail doesn't exist + return 2 +} + +jail_name() { + ## Query the name of a jail + ## Must be updated to be able to search per IP. Searching per name makes + ## no sense + local J=`echo $JAILS | tr " " "\n" | grep "^${JAIL}:"` +# for J in $JAILS ; do + # Loop through configured jails + local J_NAME=`expr "$J" : "\(.*\):.*"` + if [ $J_NAME = $JAIL ] ; then + # Name part of jail definition matches + echo $J_NAME + return 0 + fi +# done + # Jail not found or error + return 1 +} + +jail_ip() { + ## Query the IP of a jail + local J=`echo $JAILS | tr " " "\n" | grep "^${JAIL}:"` +# for J in $JAILS ; do + # Loop through configured jails + local J_NAME=`expr "$J" : "\([^;].*\):.*"` + if [ $J_NAME = $JAIL ] ; then + # Name part of jail definition matches, output IP +echo $J > debug.file + local J_IP=`expr "$J" : ".*:\([^;]*\)"` + echo $J_IP + return 0 + fi +# done + # Jail not found or error + return 1 +} + +jail_path() { + ## Query the path to a jail + local J=`echo $JAILS | tr " " "\n" | grep "^${JAIL}:"` +# for J in $JAILS ; do + # Loop through configured jails + local J_NAME=`expr "$J" : "\(.*\):.*"` + if [ $J_NAME = $JAIL ] ; then + # Name part of jail definition matches, output path + local J_HOME=`expr "$J" : "[^;]*;\([^;]*\).*$"` + if [ -n "$J_HOME" ] ; then + if [ `expr "$J_HOME" : ".*\/$"` -gt 0 ] ; then + local J_PATH=`expr "$J_HOME" : "\(.*\)/$"` + else + local J_PATH="${J_HOME}/${J_NAME}" + fi + else + local J_PATH="${JAIL_HOME}$J_NAME" + fi + echo $J_PATH + return 0 + fi +# done + # Jail not found or error + return 1 +} + +jail_if() { + ## Query the path to a jail + local J=`echo $JAILS | tr " " "\n" | grep "^${JAIL}:"` +# for J in $JAILS ; do + # Loop through configured jails + local J_NAME=`expr "$J" : "\(.*\):.*"` + if [ $J_NAME = $JAIL ] ; then + # Name part of jail definition matches, output path + local J_HOME=`expr "$J" : "[^;]*;\([^;]*\).*$"` + local J_IF=`expr "$J" : ".*;[^;]*;\([^;]*\).*$"` + if [ -z "$J_IF" ] ; then + local J_IF=$IF + fi + echo $J_IF + return 0 + fi +# done + # Jail not found or error + return 1 +} + +jail_running() { + ## Query the running state of a jail + if [ $VERSION -ge 5 ] ; then + # We are on FreeBSD 5.x, using jls(1) tool + local JLS="`/usr/sbin/jls | grep \"\/${JAIL}$\"`" + if [ ! "$JLS" ] ; then + # Jail is not running + return 1 + fi + for i in "$JLS" ; do + # Fetching output string, concatenating + local J_LIST="$J_LIST $i" + done + # Setting JAIL_ID variable; this is the system jail ID + JAIL_ID=`echo $J_LIST | cut -d \ -f 1` + local JPS=`expr "\`/usr/sbin/jexec $JAIL_ID /bin/ps ax | grep -v \"ps\ ax\" | wc -l | cut -f 2\`" : "[[:space:]]*\([0-9]*\).*"` + if [ "$JPS" -lt 2 ] ; then + # Jail is not running (no processes, anyway) + return 1 + fi + else + # We are on FreeBSD 4.x, use old dirty trick + if [ ! -f "/var/run/jails/${JAIL}.running" ] ; then + # Jail is not running + return 1 + fi + fi + # Jail is running + return 0 +} + +# +### Activity function section +# + +jail_run_hooks() { + ## Select a hook list to run + case $1 in + before-start) + jrunhooks "$1" "$BEFORESTART_HOOKS" + ;; + after-start) + jrunhooks "$1" "$AFTERSTART_HOOKS" + ;; + before-stop) + jrunhooks "$1" "$BEFORESTOP_HOOKS" + ;; + after-stop) + jrunhooks "$1" "$AFTERSTOP_HOOKS" + ;; + before-status) + jrunhooks "$1" "$BEFORESTATUS_HOOKS" + ;; + after-status) + jrunhooks "$1" "$AFTERSTATUS_HOOKS" + ;; + before-backup) + jrunhooks "$1" "$BEFOREBACKUP_HOOKS" + ;; + after-backup) + jrunhooks "$1" "$AFTERBACKUP_HOOKS" + ;; + before-restore) + jrunhooks "$1" "$BEFORERESTORE_HOOKS" + ;; + after-restore) + jrunhooks "$1" "$AFTERRESTORE_HOOKS" + ;; + before-create) + jrunhooks "$1" "$BEFORECREATE_HOOKS" + ;; + after-create) + jrunhooks "$1" "$AFTERCREATE_HOOKS" + ;; + before-upgrade) + jrunhooks "$1" "$BEFOREUPGRADE_HOOKS" + ;; + after-upgrade) + jrunhooks "$1" "$AFTERUPGRADE_HOOKS" + ;; + before-delete) + jrunhooks "$1" "$BEFOREDELETE_HOOKS" + ;; + after-delete) + jrunhooks "$1" "$AFTERDELETE_HOOKS" + ;; + esac +} + +jps() { + ## List running processes in a jail + if [ $VERSION -ge 5 ] ; then + # We are on FreeBSD 5.x, use jexec(1) tool + /usr/sbin/jexec $JAIL_ID ps auxwww + else + # We are on FreeBSD 4.x, use old dirty trick (requires /proc on host!) + echo "CMD PID TIME UTIME STIME" + cat /proc/*/status | grep "${JAIL}" | cut -d \ -f 1 -f 2 -f 8 -f 9 -f 10 + fi + return 0 +} + +jstart() { + ## Start a jail + local JP=$(jail_path) + local IP=$(jail_ip) + local JIF=$(jail_if) + if [ $PROCFS -gt 0 ] ; then + # Mount proc filesystem into jail + /sbin/mount_procfs procfs ${JP}/proc + fi + if [ $LINPROCFS -gt 0 ] ; then + # Mount Linux proc filesystem into jail + /sbin/mount_linprocfs linprocfs ${JP}/compat/linux/proc + fi + + if [ $VERSION -ge 5 ] ; then + # Run hooks + jail_run_hooks before-start + # We are on FreeBSD 5.x, use devfs + /sbin/mount -t devfs devfs ${JP}/dev + devfs -m ${JP}/dev ruleset 4 + devfs -m ${JP}/dev rule applyset + fi + + # Bring up network interface alias and start jail + [ $(echo $JIF | cut -c 1-4) != 'carp' ] && ifconfig $JIF inet $IP netmask 0xffffffff alias + echo >> ${JP}/var/log/jailstart.log + echo $(date) >> ${JP}/var/log/jailstart.log + jail $JP $JAIL $IP /bin/sh /etc/rc 2>&1 >${JP}/var/log/jailstart.log & + + if [ $VERSION -eq 4 ] ; then + # We're on FreeBSD 4.x, Create run file + touch /var/run/jails/${JAIL}.running + fi + + if [ $VERSION -ge 5 ] ; then + # Run hooks + jail_run_hooks after-start + fi + + return 0 +} + +jstop() { + ## Stop a jail + local JP=$(jail_path) + local IP=$(jail_ip) + local JIF=$(jail_if) + + if [ $VERSION -ge 5 ] ; then + # Run hooks + jail_run_hooks before-stop + fi + + echo "Sending TERM signal to jail processes..." + if [ $VERSION -ge 5 ] ; then + # We are on FreeBSD 5.x, use jexec(1) tool + /usr/sbin/jexec $JAIL_ID /bin/sh /etc/rc.shutdown + sleep 2 + /usr/sbin/jexec $JAIL_ID kill -15 -1 + # Waiting for processes to die + sleep 4 + while jail_running ; do + # Some processes are still running, do a kill -9 -1 + echo "Some processes would not terminate; sending KILL signal..." + /usr/sbin/jexec $JAIL_ID kill -9 -1 + # Give processes some time to die + sleep 2 + done + umount -f ${JP}/dev + else + # We are on FreeBSD 4.x + if [ "$JAIL" = "all" ] ; then + # /proc is unavailable, so we can only stop ALL jails at once + local PS="`ps ax|cut -c 1-16|grep J|cut -d \ -f 1`" + for PID in "$PS" ; do + kill -15 $PID 2>/dev/null 1>/dev/null + done + # Waiting for processes to die + sleep 4 + local PS="`ps ax|cut -c 1-16|grep J|cut -d \ -f 1`" + while [ "$PS" ] ; do + # Some processes are still running, do a kill -9 on each + echo "Some processes would not terminate; sending KILL signal..." + for PID in "$PS" ; do + # Sending KILL signal to all processes in the jail + kill -9 $PID 2>/dev/null 1>/dev/null + done + # Give processes some time to die + sleep 2 + local PS="`ps ax|cut -c 1-16|grep J|cut -d \ -f 1`" + done + else + # Use /proc filesystem (REQUIRED for single-jail operation!) + local PS="`cat /proc/*/status | cut -d \ -f 2 -f 15 2>/dev/null | grep \" ${JAIL} \" | cut -d \ -f 1`" + for PID in "$PS" ; do + # Sending TERM signal to all processes in the jail + kill -15 $PID 2>/dev/null 1>/dev/null + done + # Waiting for processes to die + sleep 4 + local PS="`cat /proc/*/status | cut -d \ -f 2 -f 15 2>/dev/null | grep \" ${JAIL} \" | cut -d \ -f 1`" + while [ "$PS" ] ; do + # Some processes are still running, do a kill -9 on each + echo "Some processes would not terminate; sending KILL signal..." + for PID in "$PS" ; do + # Sending KILL signal to all processes in the jail + kill -9 $PID 2>/dev/null 1>/dev/null + done + # Give processes some time to die + sleep 2 + local PS="`cat /proc/*/status | cut -d \ -f 2 -f 15 2>/dev/null | grep \" ${JAIL} \" | cut -d \ -f 1`" + done + fi + fi + + if [ $PROCFS -gt 0 ] ; then + # Unmount the jail proc filesystem + umount -f ${JP}/proc + fi + if [ $LINPROCFS -gt 0 ] ; then + # Unmount the jail Linux proc filesystem + umount -f ${JP}/compat/linux/proc + fi + + if [ $VERSION -eq 4 ] ; then + # We are on FreeBSD 4.x, remove runfile + rm /var/run/jails/${JAIL}.running + fi + + # Bring down network interface alias + [ $(echo $JIF | cut -c 1-4) != 'carp' ] && ifconfig $JIF inet $IP netmask 0xffffffff -alias + + if [ $VERSION -ge 5 ] ; then + # Run hooks + jail_run_hooks after-stop + fi + + return 0 +} + +jcreate() { + jail_run_hooks before-create + ## Create a jail + local JP=$(jail_path) + local IP=$(jail_ip) + local JIF=$(jail_if) + + # Create jail directory + mkdir -p $JP + # Populate jail directory + jpopulate + # Initialize jail directory contents + jinit + # Remove unneeded files and clean up + jcleanup + jail_run_hooks after-create + return 0 +} + +jupgrade() { + jail_run_hooks before-upgrade + ## Upgrade a jail + local JP=$(jail_path) + # Run mergemaster to prepare the jail for upgrade + mergemaster -Upi -D $JP + # Populate jail directory + jpopulate + # Run mergemaster to update default configuration files + mergemaster -Ui -D $JP + # Remove unneeded files and clean up + jcleanup + if jail_running ; then + echo "Jail running, please restart!" + fi + jail_run_hooks after-upgrade + +} + +jdelete() { + jail_run_hooks before-delete + ## Delete a jail + local JP=$(jail_path) + local m_search="" + if [ $PROCFS -gt 0 ] ; then m_search="${JP}/proc" ; fi + if [ $LINPROCFS -gt 0 ] ; then + if [ -n "${m_search}" ] ; then m_search="${m_search}\|" ; fi + m_search="${m_search}${JP}/compat/linux/proc" + fi + if [ $VERSION -ge 5 ] ; then + if [ -n "${m_search}" ] ; then m_search="${m_search}\|" ; fi + m_search="${m_search}${JP}/dev" + fi + MOUNTS=`mount | grep "$JP" | grep -v "${m_search} | cut -d \ -f 3"` + MOUNTS_NO=`echo -n $MOUNTS | wc -l` + if [ $MOUNTS_NO -gt 0 ]; then + echo "WARNING: Mounted directories found in ${JP}:" + echo $MOUNTS + echo -n "Unmount ('n' will cancel delete)? [y/n] " + read ANS + if [ x$ANS = xy ]; then + for m in $MOUNTS ; do + echo -n "Unmounting $m ..." + umount_msg=`umount -f $m 2>&1` + umount_res=$? + sleep 1 + if [ $umount_res -ne 0 ] ; then + echo "FAILED!" + echo "$umount_msg" + else + echo "ok." + fi + done + MOUNTS=`mount | grep "$JP" | grep -v "${m_search}"` + MOUNTS_NO=`echo -n $MOUNTS | wc -l` + echo $MOUNTS_NO + if [ $MOUNTS_NO -gt 0 ] ; then + echo "Unmounting failed. Jail not deleted." + else + echo "All filesystems unmounted successfully. Deleting jail." + # Pass one: removing unprotected files + rm -Rf $JP 2>&1 > /dev/null + # Pass two: removing SCHG flag from jail tree + chflags -R noschg $JP + # Pass three: Removing jail directory + rm -Rf $JP + fi + fi + else + # Pass one: removing unprotected files + rm -Rf $JP 2>&1 > /dev/null + # Pass two: removing SCHG flag from jail tree + chflags -R noschg $JP + # Pass three: Removing jail directory + rm -Rf $JP + fi + jail_run_hooks after-delete + +} + +jbackup() { + ## Back up a jail + local JP=$(jail_path) + + # Determine target file for backup + if [ -n "$CMD" ] ; then + TARGET=$CMD + else + TARGET="${BACKUPDIR}/${JAIL}.tar" + fi + + # Run backup + jail_run_hooks before-backup + if [ ! "$1" = "cold" -a $VERSION -ge 5 ] ; then + # Run warm backup - FreeBSD >=5 only + if [ -z "$GPG" ] ; then + /usr/sbin/jexec $JAIL_ID /usr/bin/tar --one-file-system -C / $BACKUP_EXCLUDE -cf - ./. | gzip --fast > ${TARGET}.gz + else + /usr/sbin/jexec $JAIL_ID /usr/bin/tar --one-file-system -C / $BACKUP_EXCLUDE -cf - ./. | gzip --fast | $GPG -o ${TARGET}.gz.gpg + fi + else + # Run cold backup + if [ -z "$GPG" ] ; then + chroot $JP /usr/bin/tar --one-file-system -C / $BACKUP_EXCLUDE -cf - ./. | gzip --fast > ${TARGET}.gz + else + chroot $JP /usr/bin/tar --one-file-system -C / $BACKUP_EXCLUDE -cf - ./. | gzip --fast | $GPG -o ${TARGET}.gz.gpg + fi + fi + jail_run_hooks after-backup +} + +jrestore() { + ## Restore a jail from backup + # Create jail home + mkdir -p $JP && cd $JP + + # Determine source file for backup + if [ -n "$CMD" ] ; then + SOURCE=$CMD + else + SOURCE="${BACKUPDIR}/${JAIL}.tar.gz" + fi + + [ -f $SOURCE ] && jail_run_hooks before-restore + # Restore + tar -zpxf $SOURCE + [ $? -eq 0 ] && jail_run_hooks after-restore +} + + +# +### Activity helper function section +# + +jpopulate() { + ## Populate a jail directory + cd /usr/src + # Running installworld into jail directory + make installworld ${INSTALLWORLD_FLAGS} DESTDIR=${JP} 2>&1 | grep '>>>' +} + +jcleanup() { + ## Remove unneeded files and clean up a jail + # Copying the most recent list of files to delete + if [ $VERSION -ge 5 ] ; then + cp ${JAIL_HOME}addons/dellist5.txt $JP/dellist.txt + else + cp ${JAIL_HOME}addons/dellist4.txt $JP/dellist.txt + fi + # Removing protection from files to be deleted + chroot $JP chflags -R noschg $(cat ${JP}/dellist.txt) 2>/dev/null 1>/dev/null + # Deleting files + chroot $JP rm -Rf $(cat ${JP}/dellist.txt) 2>/dev/null 1>/dev/null + + # Changing binaries to be jail compatible + chroot ${JP} ln -f /usr/bin/true /sbin/mount + chroot ${JP} ln -f /usr/bin/true /sbin/umount + chroot ${JP} ln -f /usr/bin/true /sbin/swapon + chroot ${JP} ln -f /usr/bin/true /sbin/swapoff + chroot ${JP} chflags noschg /sbin/init + chroot ${JP} rm /sbin/init + chroot ${JP} ln -f /usr/bin/true /sbin/init + chroot ${JP} ln -f /usr/bin/true /sbin/adjkerntz + chroot ${JP} ln -f /usr/bin/true /sbin/ifconfig + + # Copy timezone information from host + cp /etc/localtime ${JP}/etc/localtime +} + +jinit() { + ## Install default set of configuration files + cd /usr/src/etc + # Installing distribution files to jail directory + make distribution DESTDIR=${JP} -DNO_MAKEDEV_RUN 2>/dev/null 1>/dev/null + + # Create directories in jail + mkdir -p ${JP}/proc + mkdir -p ${JP}/usr/home + mkdir -p ${JP}/root/.ssh + mkdir -p ${JP}/compat/linux/proc + mkdir -p ${JP}/usr/local/bin + chroot ${JP} ln -sf /usr/home /home + + # Update passwd database with default root user/pw + IFS2=$IFS + IFS=$(echo -e '\n\t') + if [ -z "$BATCH" ] ; then + echo "Setting root password in jail" + chroot ${JP} /usr/bin/passwd root + else + for L in $(cat ${JP}/etc/master.passwd) ; do + if [ "$L" = 'root::0:0::0:0:Charlie &:/root:/bin/csh' ] ; then + echo "root:${ROOT_PW}:0:0::0:0:Charlie &:/root:/bin/csh" >> ${JP}/tmp/jailctl.001 + else + echo $L >> ${JP}/tmp/jailctl.001 + fi + done + pwd_mkdb -p -d ${JP}/etc ${JP}/tmp/jailctl.001 + IFS=$IFS2 + fi + + # Install jail hostname and IP into hosts file + JAIL_HOST=$(expr $JAIL : "\([a-zA-Z0-9\-]*\)\..*") + JAIL_DOMAIN=$(expr $JAIL : "${JAIL_HOST}\.\(.*\)") + echo "$IP $JAIL $JAIL_HOST" >> ${JP}/etc/hosts + + # Create new rc.conf + echo '# Default jail rc.conf' > ${JP}/etc/rc.conf + for L in $RC_CONF ; do + echo $L >> ${JP}/etc/rc.conf + done + echo "hostname=\"$JAIL\"" >> ${JP}/etc/rc.conf + + # Update SSH configuration + sed -i .jailctl -Ee "s/#?PermitRootLogin no/PermitRootLogin yes/" ${JP}/etc/ssh/sshd_config + + # Update resolv.conf + echo "domain $JAIL_DOMAIN" > ${JP}/etc/resolv.conf + # Update resolv.conf + for L in $NAMESERVERS ; do + echo "nameserver $L" >> ${JP}/etc/resolv.conf + done + + # Creating symlinks + chroot ${JP} ln -sf /dev/null /kernel + if [ $VERSION -ge 5 ] ; then + # We are on FreeBSD 5.x, work around distribution bug + chroot ${JP} ln -sf /lib/libm.so.3 /lib/libm.so.2 + fi + + if [ $VERSION -eq 4 ] ; then + # We are on FreeBSD 4.x, initializing device tree + cd ${JP}/dev + sh MAKEDEV jail + fi + + # Installing addons + cp -R ${JAIL_HOME}addons/* ${JP}/ + + # Starting jail for the first time, calling runme.sh to install software + [ $(echo $JIF | cut -c 1-4) != 'carp' ] && ifconfig $JIF inet $IP netmask 0xffffffff alias + JSTART=$(jail $JP $JAIL $IP /bin/sh /runme.sh) + [ $(echo $JIF | cut -c 1-4) != 'carp' ] && ifconfig $JIF inet $IP netmask 0xffffffff -alias + + # Output commmands used to run installation script for easy re-run + [ $(echo $JIF | cut -c 1-4) != 'carp' ] && echo "ifconfig $JIF inet $IP netmask 0xffffffff alias" + echo "jail $JP $JAIL $IP /bin/sh /runme.sh" + [ $(echo $JIF | cut -c 1-4) != 'carp' ] && echo "ifconfig $JIF inet $IP netmask 0xffffffff -alias" +} + +jrunhooks() { + ## Run a hook list + # Find jail ID on FreeBSD >5 + local JAIL_ID=0 + if [ $VERSION -ge 5 ] && jail_running ; then + local JLS="`/usr/sbin/jls | grep \"\/${JAIL}$\"`" + for i in "$JLS" ; do + # Fetching output string, concatenating + local J_LIST="$J_LIST $i" + done + # Setting JAIL_ID variable; this is the system jail ID + local JAIL_ID=`echo $J_LIST | cut -d \ -f 1` + fi + + for HOOK in $@; do + # Skip first parameter + [ ! "$HOOK" = "$1" ] && $HOOK $1 $JAIL $(jail_path) $JAIL_ID + done +} + +# +### Main block +# + +## Get current working directory +CWD=$(pwd) + +## Get command line parameters +ACTION=$1 +JAIL=$2 +CMD=$3 + +if [ "$CMD" = "force" ] ; then + FORCE=1 +fi + +## Checking current FreeBSD version +VERSION="`uname -r | cut -c 1`" + +if [ $VERSION -eq 4 ] ; then + # We are on FreeBSD 4.x, creating statefile directory + if [ ! -d "/var/run/jails" ] ; then + mkdir -p /var/run/jails + fi +fi + +case "$ACTION" in +status) jail_status ;; +start) jail_start ;; +stop) jail_stop ;; +create) jail_create ;; +upgrade) jail_upgrade ;; +delete) jail_delete ;; +backup) jail_backup ;; +restore) jail_restore ;; +*) usage ;; + +esac + +cd $CWD + +exit 0 + diff --git a/config/jailctl/jailctl-utils.inc b/config/jailctl/jailctl-utils.inc new file mode 100644 index 00000000..36c50d23 --- /dev/null +++ b/config/jailctl/jailctl-utils.inc @@ -0,0 +1,272 @@ +<?php +$GLOBALS['jailctl_tmp']['mounts'][]='bin'; +$GLOBALS['jailctl_tmp']['mounts'][]='lib'; +$GLOBALS['jailctl_tmp']['mounts'][]='libexec'; +$GLOBALS['jailctl_tmp']['mounts'][]='sbin'; +$GLOBALS['jailctl_tmp']['mounts'][]='usr/bin'; +$GLOBALS['jailctl_tmp']['mounts'][]='usr/include'; +$GLOBALS['jailctl_tmp']['mounts'][]='usr/lib'; +$GLOBALS['jailctl_tmp']['mounts'][]='usr/libdata'; +$GLOBALS['jailctl_tmp']['mounts'][]='usr/libexec'; +$GLOBALS['jailctl_tmp']['mounts'][]='usr/sbin'; +$GLOBALS['jailctl_tmp']['mounts'][]='usr/share'; + +$GLOBALS['jailctl_tmp']['unionmounts'][]='etc'; +$GLOBALS['jailctl_tmp']['unionmounts'][]='var'; +$GLOBALS['jailctl_tmp']['unionmounts'][]='usr/local/etc'; + +$GLOBALS['jailctl_tmp']['mount_unionfs']='mount -t unionfs -o below '; +$GLOBALS['jailctl_tmp']['mount_nullfs']='mount -t nullfs -o ro'; + +function jailctl_initialize_jail($jail, $jstatus, $jconfig) { + $cmd='sed -I "" -e s/"^root:[^:]*:"/"root:'.addcslashes($jconfig['jpasswd'], '$/').':"/ '.$jstatus['jpath'].'/etc/master.passwd '."\n"; + $cmd.='sed -I "" -e s/"^.PermitRootLogin.*"/"PermitRootLogin yes"/ '.$jstatus['jpath'].'/etc/ssh/sshd_config '."\n"; + $cmd.="pwd_mkdb -d ".$jstatus['jpath']."/etc ".$jstatus['jpath']."/etc/master.passwd \n"; + $cmd.="echo '".$jail['jip']." ".$jail['jname']." ".$jstatus['jhostname'][0]."' >> ".$jstatus['jpath']."/etc/hosts \n"; + $cmd.="echo 'hostname=\"".$jail['jname']."\"' > ".$jstatus['jpath']."/etc/rc.conf \n"; + + if(is_array($jconfig['row'])) { + foreach($jconfig['row'] as $_row) { + $cmd.="echo '".$_row['rcconfline']."' >> ".$jstatus['jpath']."/etc/rc.conf \n"; + #$cmd.="echo '".str_replace(' ', "\n", $jconfig['jrcconf'])."' >> ".$jstatus['jpath']."/etc/rc.conf \n"; + } + } + $cmd.="echo 'domain ".$jstatus['jhostname'][1]."' > ".$jstatus['jpath']."/etc/resolv.conf \n"; + foreach(explode(' ', trim($jconfig['jdnsservers'])) as $_ns) { + $cmd.="echo 'nameserver ".str_replace(' ', "\nnameserver ", $_ns)."' >> ".$jstatus['jpath']."/etc/resolv.conf \n"; + } + return $cmd; +} + +function jailctl_create_template($jail, $jstatus, $jconfig) { + $mounts=$GLOBALS['jailctl_tmp']['mounts']; + $unionmounts=$GLOBALS['jailctl_tmp']['unionmounts']; + $mount_unionfs=$GLOBALS['jailctl_tmp']['mount_unionfs']; + $mount_nullfs=$GLOBALS['jailctl_tmp']['mount_nullfs']; + + $_path=$jstatus['jpath']; + $_name=$jail['name']; + $_ip=$jail['jip']; + $_hostname=$jstatus['jhostname']; + $_dnsservers=$jconfig['jdnsservers']; + $_passwd=$jconfig['jpasswd']; + $_template=$jail['jtemplates']; + + exec('mkdir -p '.$_path.'/dev'); + exec('mkdir -p '.$_path.'/root'); + exec('ln -s /usr/home '.$_path.'/home'); + + $jail['juse_unionfs']=='on' ? $mount=$mount_unionfs : $mount=$mount_nullfs ; + + foreach($mounts as $mp) { + $cmd[]='mkdir -p '.$_path.'/'.$mp; + $cmd[]=$mount.' '.$_template.'/'.$mp.' '.$_path.'/'.$mp; + } + + foreach($unionmounts as $mp) { + $cmd[]='mkdir -p '.$_path.'/'.$mp; + $cmd[]=$mount_unionfs.' '.$_template.'/'.$mp.' '.$_path.'/'.$mp; + } + + foreach($cmd as $_t) { +# exec($_t.' 2>&1 ', $_mount); + exec($_t.' 2>&1 '); + } +# foreach($_mount as $_out) { +# echo $_out."<br>"; +# } + + $cmd=jailctl_initialize_jail($jail, $jstatus, $jconfig); + $fd=fopen('/tmp/jcreate_'.$jail['jname'], 'w+'); + fwrite($fd, $cmd); + fclose($fd); + exec("sh /tmp/jcreate_".$jail['jname']." 2>&1 >/var/log/jcreate_exec &"); + + foreach(array_reverse($mounts, true) as $mp) { + exec('umount -f '.$_path.'/'.$mp); + } + + foreach(array_reverse($unionmounts, true) as $mp) { + exec('umount -f '.$_path.'/'.$mp); + } +} + +function jailctl_create_sysinstall($jail, $jstatus, $jconfig) { + exec('mkdir -p '.$jstatus['jpath']); + $cmd="sysinstall "; + $cmd.="_ftpPath=".$jconfig['jftpmirror']." "; + $cmd.="nonInteractive=yes "; + $cmd.="mediaSetFTP "; + $cmd.="releaseName=7.1-RELEASE "; + if($jail['jdists']) { + $cmd.="dists=\"base ".str_replace(',', ' ', $jail['jdists'])."\" "; + $cmd.="distSetCustom "; + } else { + $cmd.=$jail['jdistset']." "; + } + $cmd.="installRoot=".$jstatus['jpath']." "; + $cmd.="installCommit "; + $cmd.="> /var/log/jcreate.log 2>/var/log/jcreate.err \n"; + $cmd.="\n"; + + $cmd.=jailctl_initialize_jail($jail, $jstatus, $jconfig); + + $fd=fopen('/tmp/jcreate_'.$jail['jname'], 'w+'); + fwrite($fd, $cmd); + fclose($fd); + + exec("sh /tmp/jcreate_".$jail['jname']." 2>&1 >/var/log/jcreate_exec &"); +} + +function jailctl_find_if($ip) { + exec("ifconfig | grep -C 1 '".addcslashes($ip, ".")."'", $_ifconfig); + $if=explode(':', $_ifconfig[0]); + + return $if[0]; +} + +function jailctl_addinterfaces($config) { + $vips=$config['virtualip']['vip']; + ?> + <script type="text/javascript"> + function isValidIPAddress(ipaddr) { + var re = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/; + if (re.test(ipaddr)) { + var parts = ipaddr.split("."); + if (parseInt(parseFloat(parts[0])) == 0) { return false; } + for (var i=0; i<parts.length; i++) { + if (parseInt(parseFloat(parts[i])) > 255) { return false; } + } + return true; + } else { + return false; + } + } + function addinterfaces() { + <?php + + foreach($vips as $vip) { + if($vip['mode']=='carp') { + echo("document.forms['iform'].jif.appendChild(new Option('".$vip['descr']." (".$vip['subnet'].")', '".$vip['subnet']."'));"); + } + } + + ?> + } + addinterfaces(); + + for (var i=0; i < document.forms['iform'].jif.length; i++) { + <?php + $jif=$config['installedpackages']['pfjailctl']['config'][$_GET['id']]['jif']; + echo('if (document.forms["iform"].jif[i].value == "'.$jif.'") {'); + ?> + document.forms['iform'].jif[i].selected = true; + } else { + document.forms['iform'].jif[i].selected = false; + } + } + if (isValidIPAddress(document.forms['iform'].jif.value)) { + document.forms['iform'].jip.disabled=true; + } + + function setdisableip() { + if (isValidIPAddress(document.forms['iform'].jif.value)) { + document.forms['iform'].jip.value=document.forms['iform'].jif.value; + document.forms['iform'].jip.disabled=true; + } else { + // document.forms['iform'].jip.value=''; + document.forms['iform'].jip.disabled=false; + } + } + document.forms['iform'].jif.addEventListener('change', setdisableip, true); + </script> + <?php +} + +function jailctl_addtemplates($config) { + $templates=$config['installedpackages']['pfjailctltemplates']['config'][0]['templates']; + ?> + <script type="text/javascript"> + function addtemplates() { + <?php + foreach($templates as $template) { + echo("document.forms['iform'].jtemplates.appendChild(new Option('".$template['name']."', '".$template['path']."'));"); + } + ?> + } + addtemplates(); + </script> + <?php +} + + +function jailctl_jailstatus($config, $jail) { + $jconfig=$config['installedpackages']['pfjailctlsettings']['config'][0]; + #echo("<pre>"); print_r($jail); echo("</pre>"); + + + $jname=$jail['jname']; + $jhostname=explode('.', $jname, 2); + $jpath=$jconfig['jstorage']."/".$jname; + $jip=$jail['jip']; + $jif=$jail['jif']; + + if(is_ipaddr($jif)) { + $jrealif=jailctl_find_if($jif); + #$jrealif=guess_interface_from_ip($jif); + #$jrealif=link_carp_interface_to_parent($jif); + } else { + $jrealif=$config['interfaces'][$jif]['if']; + } + + if($config['interfaces'][$jif]['descr']) { + $jifdesc=$config['interfaces'][$jif]['descr']; + } elseif(is_ipaddr($jif)) { + $vips=$config['virtualip']['vip']; + foreach($vips as $vip) { + if($vip['mode']=='carp' and $vip['subnet']==$jif) { + $jifdesc='CARP on '.strtoupper($vip['interface']); + } + } + } else { + $jifdesc=strtoupper($jail['jif']); + } + + $_out=Array(); + exec('ps axwww | grep "sysinstall.*'.$jname.'" | grep -v grep', $_out); + if(count($_out)) { + $jstate='Building'; + } else { + $_out=Array(); + exec('/usr/local/sbin/jailctl status '.$jname, $_out); + #echo("<pre>"); print_r($_out); echo("</pre>"); + if (substr($_out[0], 0, strlen($jname))==$jname) { + $_tmp=Array(); + ereg("is (.*)\.", array_shift($_out), $_tmp); + switch ($_tmp[1]) { + case 'down': + $jstate='Stopped'; + break; + case 'up': + $jstate='Running'; + break; + default: + $jstate='Undefined'; + break; + } + } else { + $jstate='New'; + } + } + + $jstatus['jstate']=$jstate; + $jstatus['jpath']=$jpath; + $jstatus['jrealif']=$jrealif; + $jstatus['jifdesc']=$jifdesc; + $jstatus['jhostname']=$jhostname; + + return $jstatus; +} + + +?> diff --git a/config/jailctl/jailctl.inc b/config/jailctl/jailctl.inc new file mode 100644 index 00000000..d6b7344c --- /dev/null +++ b/config/jailctl/jailctl.inc @@ -0,0 +1,217 @@ +<?php +/* $Id$ */ +include("jailctl-utils.inc"); + +if($_POST['xml']=='jailctl_settings.xml' && $_POST['jpasswd']) { + $_POST['jpasswd']=crypt($_POST['jpasswd']); +} elseif($_POST['xml']=='jailctl_settings.xml' && !$_POST['jpasswd']) { + $_POST['jpasswd']=$config['installedpackages']['pfjailctlsettings']['config'][0]['jpasswd']; +} + +if($_POST['xml']=='jailctl_settings.xml') { + $_count=0; + while($_count <= count(array_keys($_POST))) { + if(isset($_POST['rcconfline'.$_count])) { + $_POST['rcconfline'.$_count]=addcslashes($_POST['rcconfline'.$_count], '"'); + } + $_count++; + } +} elseif($_GET['xml']=='jailctl_settings.xml') { + $config['installedpackages']['pfjailctlsettings']['config'][0]['jpasswd']=''; +} elseif($_POST['xml']=='jailctl.xml' && is_ipaddr($_POST['jif'])) { + $_POST['jip']=$_POST['jif']; +} elseif($_POST['xml']=='jailctl.xml') { + # Stuff goes here? +} + + +function jailctl_create($config, $jail) { + $jstatus=jailctl_jailstatus($config, $jail); + $jconfig=$config['installedpackages']['pfjailctlsettings']['config'][0]; + if($jail['jtemplates']) { + jailctl_create_template($jail, $jstatus, $jconfig); + } else { + jailctl_create_sysinstall($jail, $jstatus, $jconfig); + } +} + +function jailctl_delete() { + global $config, $jconfig, $jails; + + $jpath=$jconfig['jstorage']."/".$jails[$_GET['id']]['jname']; + exec("rm -Rf '".$jpath."' >/dev/null 2>/dev/null &"); +# sync_package_jailctl(); +} + +function jailctl_deinstall() { +# unset($GLOBALS['config']['installedpackages']['pfjailctlsettings']); +# unset($GLOBALS['config']['installedpackages']['pfjailctl']); +} + +function jailctl_install() { + $jails=$GLOBALS['config']['installedpackages']['pfjailctl']['config']; + for($i=0;$i<=count($jails);$i++) { + if(is_array($jails[$i]) and ! $jails[$i]['jname']) + unset($GLOBALS['config']['installedpackages']['pfjailctl']['config'][$i]); + } + + if(!$GLOBALS['config']['installedpackages']['pfjailctlsettings']['config'][0]['jif']) { + $settings['jif']='lan'; + $settings['jdnsservers']=$GLOBALS['config']['interfaces']['lan']['ipaddr']; + $settings['jstorage']='/usr/local/jails'; + $settings['jbackup']=$settings['jstorage']; + $settings['jbackupexcludes']='--exclude ./usr/ports/* --exclude ./tmp/* --exclude ./var/tmp/* --exclude ./usr/src/*'; + $settings['jrcconf']='sshd_enable="YES"'; + $settings['jpasswd']='$1$e4.8A4lV$oU.OQciTOnonltQkK12ff0'; + + $GLOBALS['config']['installedpackages']['pfjailctlsettings']['config'][0]=$settings; + } +} + +function jailctl_servicestatus() { + global $config; + $jconfig=$config['installedpackages']['pfjailctlsettings']['config'][0]; + $jails=$config['installedpackages']['pfjailctl']['config']; + is_array($jails) ? $num_jails=count($jails) : $num_jails=0; + + if($num_jails) { + for ($i=0;$i<$num_jails;$i++) { + $jname=$jails[$i]['jname']; + $jstatus=Array(); + $_jcreate=Array(); + exec('/usr/local/sbin/jailctl status '.$jname, $jstatus); + + if (substr($jstatus[0], 0, strlen($jname))==$jname) { + $_tmp=Array(); + ereg("is (.*)\.", array_shift($jstatus), $_tmp); + switch ($_tmp[1]) { + case 'up': + break; + default: + return false; + } + } else { + return false; + } + } + } else { + return false; + } + return true; +} + +function jailctl_do_xmlrpc_sync($config) { + $jails=$config['installedpackages']['pfjailctl']['config'][0]; + $jconfig=$config['installedpackages']['pfjailctlsettings']['config'][0]; + $sync=$config['installedpackages']['carpsettings']['config'][0]; + + if(!$sync['synchronizetoip'] or !$sync['password']) + return; + + if($config['system']['webgui']['protocol'] != "") { + $synchronizetoip = $config['system']['webgui']['protocol']; + $synchronizetoip .= "://"; + } + $port = $config['system']['webgui']['port']; + /* if port is empty lets rely on the protocol selection */ + if($port == "") { + if($config['system']['webgui']['protocol'] == "http") + $port = "80"; + else + $port = "443"; + } + $synchronizetoip .= $sync['synchronizetoip']; + + /* xml will hold the sections to sync */ + $xml = array(); + $xml['pfjailctl'] = $config['installedpackages']['pfjailctl']; + $xml['pfjailctlsettings'] = $config['installedpackages']['pfjailctlsettings']; + + /* assemble xmlrpc payload */ + $params = array( + XML_RPC_encode($sync['password']), + XML_RPC_encode($xml) + ); + + /* set a few variables needed for sync code borrowed from filter.inc */ + $url = $synchronizetoip; + log_error("Beginning pfJailctl XMLRPC sync to {$url}:{$port}."); + $method = 'pfsense.merge_installedpackages_section_xmlrpc'; + $msg = new XML_RPC_Message($method, $params); + $cli = new XML_RPC_Client('/xmlrpc.php', $url, $port); + $cli->setCredentials('admin', $sync['password']); + /* send our XMLRPC message and timeout after 25 seconds */ + $resp = $cli->send($msg, "25"); + if(!$resp) { + $error = "A communications error occured while attempting pfJailctl XMLRPC sync with {$url}:{$port}."; + log_error($error); + file_notice("sync_settings", $error, "pfJailctl Settings Sync", ""); + } elseif($resp->faultCode()) { + $cli->setDebug(1); + $resp = $cli->send($msg, "250"); + $error = "An error code was received while attempting pfJailctl XMLRPC sync with {$url}:{$port} - Code " . $resp->faultCode() . ": " . $resp->faultString(); + log_error($error); + file_notice("sync_settings", $error, "pfJailctl Settings Sync", ""); + } else { + log_error("pfJailctl XMLRPC sync successfully completed with {$url}:{$port}."); + } + #echo "done.<br>"; +} + +function sync_package_jailctl() { + global $config, $g; + $jconfig=$config['installedpackages']['pfjailctlsettings']['config'][0]; + $jails=$config['installedpackages']['pfjailctl']['config']; + is_array($jails) ? $num_jails=count($jails) : $num_jails=0; + + $jdefaultif=$config['interfaces']['lan']['if']; + + conf_mount_rw(); + config_lock(); + $fd = fopen("/usr/local/etc/jails.conf","w"); + + fwrite($fd, 'IF="'.$jdefaultif.'"'."\n"); + fwrite($fd, 'JAIL_HOME="'.$jconfig['jstorage'].'/"'."\n"); + fwrite($fd, 'BACKUPDIR="'.$jconfig['jbackup'].'"'."\n"); + fwrite($fd, 'BACKUP_EXCLUDE="'.$jconfig['jbackupexcludes'].'"'."\n"); + fwrite($fd, 'INSTALLWORLD_FLAGS="'.$jconfig['jinstallflags'].'"'."\n"); + fwrite($fd, 'BATCH="'.$jconfig['jbatchcreate'].'"'."\n"); + fwrite($fd, 'ROOT_PW="'.$jconfig['jpasswd'].'"'."\n"); + fwrite($fd, 'NAMESERVERS="'.$jconfig['jdnsservers'].'"'."\n"); + fwrite($fd, 'RC_CONF=\''.$jconfig['jrcconf'].'\''."\n"); + + fwrite($fd, "\nJAILS=''\n"); + + $_rcfile['file']='jails.sh'; + $_rcfile['start']=''; + $_rcfile['stop']=''; + if($num_jails) { + for ($i=0;$i<$num_jails;$i++) { + $jname=$jails[$i]['jname']; + $jpath=$jconfig['jstorage']."/".$jname."/"; + $jif=$jails[$i]['jif']; + if(is_ipaddr($jif)) { + $jip=$jif; + #$jif=guess_interface_from_ip($jif); + $jif=jailctl_find_if($jif); + } else { + $jif=$config['interfaces'][$jails[$i]['jif']]['if']; + $jip=$jails[$i]['jip']; + } + + $_cfg="JAILS=\"\$JAILS $jname:$jip;$jpath;$jif\"\n"; + fwrite($fd, $_cfg); + + if($jails[$i]['jautostart']=='on') { + $_rcfile['start'].="/usr/local/sbin/jailctl start $jname \n\t"; + $_rcfile['stop'].="/usr/local/sbin/jailctl stop $jname \n\t"; + } + } + } + + write_rcfile($_rcfile); + fclose($fd); + jailctl_do_xmlrpc_sync($config); +} + +?> diff --git a/config/jailctl/jailctl.xml b/config/jailctl/jailctl.xml new file mode 100644 index 00000000..079ddb6b --- /dev/null +++ b/config/jailctl/jailctl.xml @@ -0,0 +1,233 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <description>Jail management</description> + <requirements>Disk space...</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>pfJailctl</name> + <version>0.1</version> + <title>Jails</title> + <!-- Menu is where this packages menu will appear --> + <menu> + <name>Jails</name> + <tooltiptext>Jail management</tooltiptext> + <section>Services</section> + <configfile>jailctl.xml</configfile> + </menu> + <service> + <name>Jails</name> + <rcfile>jails.sh</rcfile> + <description>All jails with autostart enabled.</description> + <custom_php_service_status_command> + include("/usr/local/pkg/jailctl.inc"); + jailctl_servicestatus(); + </custom_php_service_status_command> + </service> + <!-- configpath gets expanded out automatically and config items will be + stored in that location --> + <configpath>['installedpackages']['$packagename']['config']</configpath> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl_defaults.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl_settings.xml</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl-utils.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl_list.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/sbin/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/jailctl</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/sbin/</prefix> + <chmod>0755</chmod> + <item>http://www.pfsense.com/packages/config/jailctl/sysinstall</item> + </additional_files_needed> + + <tabs> + <tab> + <text>Jails</text> + <url>/pkg.php?xml=jailctl.xml</url> + <active/> + </tab> + <tab> + <text>Global settings</text> + <url>/pkg_edit.php?xml=jailctl_settings.xml&id=0</url> + </tab> +<!-- <tab> + <text>Jail defaults</text> + <url>/pkg_edit.php?xml=jailctl_defaults.xml&id=0</url> + </tab> --> + </tabs> + + + <adddeleteeditpagefields> + <columnitem> + <fielddescr>State</fielddescr> + <fieldname>jstate</fieldname> + </columnitem> + <columnitem> + <fielddescr>Jail name</fielddescr> + <fieldname>jname</fieldname> + </columnitem> + <columnitem> + <fielddescr>Jail IF</fielddescr> + <fieldname>jifdesc</fieldname> + </columnitem> + <columnitem> + <fielddescr>Jail IP</fielddescr> + <fieldname>jip</fieldname> + </columnitem> + <columnitem> + <fielddescr>Jail path</fielddescr> + <fieldname>jpath</fieldname> + </columnitem> + <columnitem> + <fielddescr>Actions</fielddescr> + <fieldname>jactions</fieldname> + </columnitem> + + </adddeleteeditpagefields> + + <fields> + <field> + <fielddescr>Jail hostname</fielddescr> + <fieldname>jname</fieldname> + <description>FQDN of the jail</description> + <type>input</type> + </field> + <field> + <fielddescr>Network interface</fielddescr> + <fieldname>jif</fieldname> + <description>Jail will be bound to this interface</description> + <type>interfaces_selection</type> + </field> + <field> + <fielddescr>IP address</fielddescr> + <fieldname>jip</fieldname> + <description>Must be in the same subnet as the parent interface</description> + <type>input</type> + </field> + <field> + <fielddescr>Autostart jail on boot?</fielddescr> + <fieldname>jautostart</fieldname> + <description>Start this jail automatically when the system boots?</description> + <type>checkbox</type> + </field> + + + <field> + <fielddescr>Jail templates</fielddescr> + <fieldname>jselect_templates</fieldname> + <type>listtopic</type> + <name>Select a predefined template for your jail:</name> + </field> + <field> + <fielddescr>Templates</fielddescr> + <fieldname>jtemplates</fieldname> + <description>Files from the templates will be read-only inside the jail.</description> + <type>select</type> + <options> + <option><name> --- select --- </name><value></value></option> + </options> + <default_value>jtemplate_default</default_value> + </field> + <field> + <fielddescr>Use unionfs</fielddescr> + <fieldname>juse_unionfs</fieldname> + <description>Use unionfs instead of nullfs to mount the template contents into the jail</description> + <type>checkbox</type> + </field> + + <field> + <fielddescr>Package sets</fielddescr> + <fieldname>jselect_sets</fieldname> + <type>listtopic</type> + <name>OR select a distribution set to install:</name> + </field> + <field> + <fielddescr>Distribution sets</fielddescr> + <fieldname>jdistset</fieldname> + <description>Select a standard set of distributions to install</description> + <type>select</type> + <options> + <option><name> --- select --- </name><value></value></option> + <option><name>User (binaries only)</name><value>distSetUser</value></option> + <option><name>Developer (src/all, binaries)</name><value>distSetDeveloper</value></option> + <option><name>Kernel developer (src/kern, binaries)</name><value>distSetKernDeveloper</value></option> + <option><name>Minimum (minimal binaries)</name><value>distSet</value></option> + </options> + <default_value></default_value> + </field> + + <field> + <fielddescr>Individual packages</fielddescr> + <fieldname>jselect_individual</fieldname> + <type>listtopic</type> + <name>OR select individual distributions in addition to 'base':</name> + </field> + + <field> + <fielddescr>Individual distributions</fielddescr> + <fieldname>jdists</fieldname> + <description>Select individual distributions (multiple selection)</description> + <type>select</type> + <options> + <option><name>Manual pages</name><value>manpages</value></option> + <option><name>The Ports collection</name><value>ports</value></option> + <option><name>Miscellaneous documentation</name><value>doc</value></option> + <option><name>Local additions collection</name><value>local</value></option> + <option><name>X.org client binaries</name><value>Xbin</value></option> + <option><name>X.org libraries</name><value>Xlib</value></option> + <option><name>X.org manual pages</name><value>Xman</value></option> + <option><name>X.org imake distribution</name><value>Xprog</value></option> + <option><name>Games</name><value>games</value></option> + </options> + <multiple/> + </field> + + </fields> + + + <!-- php hooks --> + <include_file>/usr/local/pkg/jailctl_list.inc</include_file> + <custom_add_php_command> + sync_package_jailctl(); + </custom_add_php_command> + <custom_delete_php_command> + jailctl_delete(); + </custom_delete_php_command> + <custom_php_resync_config_command> + sync_package_jailctl(); + </custom_php_resync_config_command> + <custom_php_install_command> + jailctl_install(); + </custom_php_install_command> + <custom_php_deinstall_command> + jailctl_deinstall(); + </custom_php_deinstall_command> + <custom_php_after_form_command> + jailctl_addinterfaces($config); + jailctl_addtemplates($config); + </custom_php_after_form_command> +</packagegui> + diff --git a/config/jailctl/jailctl_defaults.xml b/config/jailctl/jailctl_defaults.xml new file mode 100644 index 00000000..c499abcb --- /dev/null +++ b/config/jailctl/jailctl_defaults.xml @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <description>Jail management</description> + <requirements>Built world in /usr/obj</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>pfJailctl_Defaults</name> + <version>0.1</version> + <title>Jails: Jail building defaults</title> + <!-- configpath gets expanded out automatically and config items will be + stored in that location --> + <configpath>['installedpackages']['package']['$packagename']['config']</configpath> + + <tabs> + <tab> + <text>Jails</text> + <url>/pkg.php?xml=jailctl.xml</url> + </tab> + <tab> + <text>Global settings</text> + <url>/pkg_edit.php?xml=jailctl_settings.xml&id=0</url> + </tab> + <tab> + <text>Jail defaults</text> + <url>/pkg_edit.php?xml=jailctl_defaults.xml&id=0</url> + <active/> + </tab> + </tabs> + + <fields> + <field> + <fielddescr>Package sets</fielddescr> + <fieldname>jdist_select_sets</fieldname> + <type>listtopic</type> + <name>Select a distribution set:</name> + </field> + <field> + <fielddescr>Distribution set</fielddescr> + <fieldname>jdist_set</fieldname> + <description>Select a standard set of distributions to install</description> + <type>select</type> + <value>eng</value> + <options> + <option><name>Developer (src/all, binaries)</name><value>distSetDeveloper</value></option> + <option><name>Kernel developer (src/kern, binaries)</name><value>distSetKernDeveloper</value></option> + <option><name>User (binaries only)</name><value>distSetUser</value></option> + <option><name>Minimum (minimal binaries)</name><value>distSet</value></option> + </options> + <default_value>distSetUser</default_value> + </field> + <field> + <fielddescr>Individual packages</fielddescr> + <fieldname>jdist_select_individual</fieldname> + <type>listtopic</type> + <name>OR select individual distributions in addition to base:</name> + </field> + <field> + <fielddescr>Manual pages</fielddescr> + <fieldname>jdist_manpages</fieldname> + <type>checkbox</type> + </field> + <field> + <fielddescr>Games</fielddescr> + <fieldname>jdist_games</fieldname> + <type>checkbox</type> + </field> + <field> + <fielddescr>The Ports collection</fielddescr> + <fieldname>jdist_ports</fieldname> + <type>checkbox</type> + </field> + <field> + <fielddescr>Miscellaneous documentation</fielddescr> + <fieldname>jdist_doc</fieldname> + <type>checkbox</type> + </field> + <field> + <fielddescr>X.Org client binaries</fielddescr> + <fieldname>jdist_xbin</fieldname> + <type>checkbox</type> + </field> + <field> + <fielddescr>X.Org libraries</fielddescr> + <fieldname>jdist_xlib</fieldname> + <type>checkbox</type> + </field> + <field> + <fielddescr>X.Org manual pages</fielddescr> + <fieldname>jdist_xman</fieldname> + <type>checkbox</type> + </field> + <field> + <fielddescr>X.Org imake distribution</fielddescr> + <fieldname>jdist_xprog</fieldname> + <type>checkbox</type> + </field> + <field> + <fielddescr>Local additions collection</fielddescr> + <fieldname>jdist_local</fieldname> + <type>checkbox</type> + </field> + </fields> + + + <!-- php hooks --> + <include_file>/usr/local/pkg/jailctl.inc</include_file> + <custom_add_php_command> + sync_package_jailctl(); + </custom_add_php_command> + <custom_delete_php_command> + sync_package_jailctl(); + </custom_delete_php_command> + <custom_php_resync_config_command> + sync_package_jailctl(); + </custom_php_resync_config_command> + <custom_php_install_command> + </custom_php_install_command> + <custom_php_deinstall_command> + </custom_php_deinstall_command> +</packagegui> + diff --git a/config/jailctl/jailctl_list.inc b/config/jailctl/jailctl_list.inc new file mode 100644 index 00000000..d1869bd6 --- /dev/null +++ b/config/jailctl/jailctl_list.inc @@ -0,0 +1,112 @@ +<?php +include('/usr/local/pkg/jailctl.inc'); + +$jconfig=$config['installedpackages']['pfjailctlsettings']['config'][0]; +$jails=$config['installedpackages']['pfjailctl']['config']; +is_array($jails) ? $num_jails=count($jails) : $num_jails=0; + + +if($num_jails) { + for ($i=0;$i<$num_jails;$i++) { + $jail=$jails[$i]; + $jstatus=jailctl_jailstatus($config, $jail); + $_path=$jstatus['jpath']; + $_name=$jail['jname']; + $_ip=$jail['jip']; + $_hostname=$jstatus['jhostname']; + $_dnsservers=$jconfig['jdnsservers']; + $_passwd=$jconfig['jpasswd']; + $_template=$jail['jtemplates']; + $mounts=$GLOBALS['jailctl_tmp']['mounts']; + $unionmounts=$GLOBALS['jailctl_tmp']['unionmounts']; + $mount_unionfs=$GLOBALS['jailctl_tmp']['mount_unionfs']; + $mount_nullfs=$GLOBALS['jailctl_tmp']['mount_nullfs']; + + if($_GET['jaction'] && $_GET['id']==$i) { + switch ($_GET['jaction']) { + case 'create': +# if($jstate!='New') break; + jailctl_create($config, $jail); + if($jconfig['debug']) { + echo("Create script:<br><pre>"); + echo(file_get_contents("/tmp/jcreate_".$_name)); + echo("</pre>"); + } else { + header('Location: /pkg.php?xml=jailctl.xml'); + } + flush(); + exit; + + case 'start': +# if($jstate!='Stopped') break; + exec('umount -f '.$_path.'/dev'); + if($_template) { + $jail['juse_unionfs']=='on' ? $mount=$mount_unionfs : $mount=$mount_nullfs ; + foreach($mounts as $mp) { + exec($mount.' '.$_template.'/'.$mp.' '.$_path.'/'.$mp, $_cmd); + } + foreach($unionmounts as $mp) { + exec($mount_unionfs.' '.$_template.'/'.$mp.' '.$_path.'/'.$mp, $_cmd); + } + } + + $cmd='jailctl start '.$_name; + exec($cmd, $_cmd); + if($jconfig['debug']) { + echo("<script>alert('".addcslashes(implode("\\n", $_cmd), "'")."'); this.location.replace('/pkg.php?xml=jailctl.xml');</script>"); + } else { + header('Location: /pkg.php?xml=jailctl.xml'); + } + flush(); + exit; + + case 'stop': +# if($jstate!='Running') break; + $cmd='jailctl stop '.$_name; + exec($cmd, $_cmd); + if($_template) { + foreach($mounts as $mp) { + exec('umount -f '.$_template.'/'.$mp.' '.$_path.'/'.$mp, $_cmd); + } + foreach($unionmounts as $mp) { + exec('umount -f '.$_template.'/'.$mp.' '.$_path.'/'.$mp, $_cmd); + } + } + exec('umount -f '.$_path.'/dev'); + if($jconfig['debug']) { + echo("<script>alert('".addcslashes(implode("\\n", $_cmd), "'")."'); this.location.replace('/pkg.php?xml=jailctl.xml');</script>"); + } else { + header('Location: /pkg.php?xml=jailctl.xml'); + } + flush(); + exit; + } + } + + $config['installedpackages']['pfjailctl']['config'][$i]['jstate']=$jstatus['jstate']; + $config['installedpackages']['pfjailctl']['config'][$i]['jpath']=$jstatus['jpath']; + $config['installedpackages']['pfjailctl']['config'][$i]['jifdesc']= + $jstatus['jifdesc']." (".$jstatus['jrealif'].")"; + + $jactions=Array(); + switch ($jstatus['jstate']) { + case 'Building': + $jactions[]=""; + break; + case 'New': + $jactions[]="<a href='/pkg.php?xml=jailctl.xml&jaction=create&id=".$i."'>Create</a>"; + break; + case 'Stopped': + $jactions[]="<a href='/pkg.php?xml=jailctl.xml&jaction=start&id=".$i."'>Start</a>"; + #$jactions[]="<a href='/pkg.php?xml=jailctl.xml&jaction=upgrade&id=".$i."'>Upgrade</a>"; + break; + case 'Running': + $jactions[]="<a href='/pkg.php?xml=jailctl.xml&jaction=stop&id=".$i."'>Stop</a>"; + break; + } + $config['installedpackages']['pfjailctl']['config'][$i]['jactions']=implode(' | ', $jactions); + } +} + + +?>
\ No newline at end of file diff --git a/config/jailctl/jailctl_settings.xml b/config/jailctl/jailctl_settings.xml new file mode 100644 index 00000000..e82eea6c --- /dev/null +++ b/config/jailctl/jailctl_settings.xml @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <description>Jail management</description> + <requirements>Built world in /usr/obj</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>pfJailctl_Settings</name> + <version>0.1</version> + <title>Jails: Settings</title> + <!-- configpath gets expanded out automatically and config items will be + stored in that location --> + <configpath>['installedpackages']['$packagename']['config']</configpath> + + <tabs> + <tab> + <text>Jails</text> + <url>/pkg.php?xml=jailctl.xml</url> + </tab> + <tab> + <text>Global settings</text> + <url>/pkg_edit.php?xml=jailctl_settings.xml&id=0</url> + <active/> + </tab> +<!-- <tab> + <text>Jail defaults</text> + <url>/pkg_edit.php?xml=jailctl_defaults.xml&id=0</url> + </tab> --> + </tabs> + + <fields> + <field> + <fielddescr>FTP mirror</fielddescr> + <fieldname>jftpmirror</fieldname> + <description>Select a FTP server (mirror) to use for sysinstall</description> + <type>select</type> + <options> + <option><name>ftp.FreeBSD.org</name><value>ftp://ftp.FreeBSD.org/pub/FreeBSD/</value></option> + <option><name>ftp.no.FreeBSD.org</name><value>ftp://ftp.no.FreeBSD.org/pub/FreeBSD/</value></option> + <option><name>ftp.de.FreeBSD.org</name><value>ftp://ftp.de.FreeBSD.org/pub/FreeBSD/</value></option> + <option><name>ftp.se.FreeBSD.org</name><value>ftp://ftp.se.FreeBSD.org/pub/FreeBSD/</value></option> + </options> + <default_value>ftp://ftp.FreeBSD.org/pub/FreeBSD/</default_value> + </field> + <field> + <fielddescr>DNS servers</fielddescr> + <description>DNS servers to be added to /etc/resolv.conf of jails, space separated IP addresses</description> + <fieldname>jdnsservers</fieldname> + <type>textarea</type> + </field> + <field> + <fielddescr>Location for jails</fielddescr> + <fieldname>jstorage</fieldname> + <description>Jails will be stored here</description> + <type>input</type> + <default>/usr/local/jails</default> + <default_value>/usr/local/jails</default_value> + </field> + <field> + <fielddescr>Location for jail backups</fielddescr> + <fieldname>jbackup</fieldname> + <description>Backups are .tgz files of the jail directory</description> + <type>input</type> + <default_value>/usr/local/jails</default_value> + </field> + <field> + <fielddescr>Files to exclude from backup</fielddescr> + <fieldname>jbackupexcludes</fieldname> + <description>Files to exclude from backup</description> + <type>input</type> + <default_value>--exclude ./usr/ports/* --exclude ./tmp/* --exclude ./var/tmp/* --exclude ./usr/src/*</default_value> + </field> + <field> + <fielddescr>System configuration</fielddescr> + <fieldname>jrcconf</fieldname> + <type>rowhelper</type> + <rowhelper> + <rowhelperfield> + <fielddescr>Lines to add to /etc/rc.conf</fielddescr> + <type>input</type> + <size>25</size> + <fieldname>rcconfline</fieldname> + </rowhelperfield> + </rowhelper> + </field> + <field> + <fielddescr>Default password for jails</fielddescr> + <fieldname>jpasswd</fieldname> + <description>Set to "system" by default.<br> + <b>NOTE: Only type here if you want to change the current default password!</b><br> + This field will show as empty even if a password has been set. Changing this will not affect existing jails.</description> + <type>password</type> + <default_value>system</default_value> + </field> + <field> + <fielddescr>Debug mode</fielddescr> + <fieldname>debug</fieldname> + <type>checkbox</type> + <description>Enable debug information do be shown by the GUI</description> + </field> + + </fields> + + + <!-- php hooks --> + <include_file>/usr/local/pkg/jailctl.inc</include_file> + <custom_add_php_command> + sync_package_jailctl(); + </custom_add_php_command> + <custom_delete_php_command> + sync_package_jailctl(); + </custom_delete_php_command> + <custom_php_resync_config_command> + sync_package_jailctl(); + </custom_php_resync_config_command> + <custom_php_install_command> + </custom_php_install_command> + <custom_php_deinstall_command> + </custom_php_deinstall_command> +</packagegui> + diff --git a/config/jailctl/sysinstall b/config/jailctl/sysinstall Binary files differnew file mode 100755 index 00000000..d4a05fb1 --- /dev/null +++ b/config/jailctl/sysinstall diff --git a/config/onatproto/onatproto.inc b/config/onatproto/onatproto.inc new file mode 100644 index 00000000..93454107 --- /dev/null +++ b/config/onatproto/onatproto.inc @@ -0,0 +1,18 @@ +<?php + +function onatproto_install() { + global $g, $config; + + // Test to make sure the patch is not already applied. + $out = `patch -fslC --reverse -p1 -b .before_onatproto -d / -i /usr/local/pkg/onatproto.patch |& grep -ci reject`; + if ($out == 0) { + // If the patch has not already been applied, test to see if it will apply cleanly. + $out = `patch -fsNlC -p1 -b .before_onatproto -d / -i /usr/local/pkg/onatproto.patch |& grep -ci reject`; + if ($out == 0) { + // The patch should apply cleanly, let 'er rip. + mwexec("patch -fsNl -p1 -b .before_onatproto -d / -i /usr/local/pkg/onatproto.patch "); + } + } +} + +?>
\ No newline at end of file diff --git a/config/onatproto/onatproto.patch b/config/onatproto/onatproto.patch new file mode 100644 index 00000000..c8d802f3 --- /dev/null +++ b/config/onatproto/onatproto.patch @@ -0,0 +1,267 @@ +--- /etc/inc/filter.inc.orig 2009-02-24 15:11:55.000000000 -0500 ++++ /etc/inc/filter.inc 2009-02-24 19:38:51.000000000 -0500 +@@ -494,7 +494,7 @@ + } + + /* Generate a 'nat on' or 'no nat on' rule for given interface */ +-function filter_nat_rules_generate_if($if, $src = "any", $srcport = "", $dst = "any", $dstport = "", $natip = "", $natport = "", $nonat = false, $staticnatport = false) { ++function filter_nat_rules_generate_if($if, $src = "any", $proto = "any", $srcport = "", $dst = "any", $dstport = "", $natip = "", $natport = "", $nonat = false, $staticnatport = false) { + global $config; + + /* XXX: billm - any idea if this code is needed? */ +@@ -507,6 +507,12 @@ + else + $tgt = "($if)"; + ++ /* Add the protocol, if defined */ ++ if (($proto != "") && ($proto != "any")) ++ $protocol = " proto {$proto}"; ++ else ++ $protocol = ""; ++ + /* Add the hard set source port (useful for ISAKMP) */ + if ($natport != "") + $tgt .= " port {$natport}"; +@@ -546,7 +552,7 @@ + + /* Put all the pieces together */ + if($if_friendly) +- $natrule = "{$nat} on \${$if_friendly} from {$src} to {$dst} {$target}{$staticnatport_txt}\n"; ++ $natrule = "{$nat} on \${$if_friendly} {$protocol} from {$src} to {$dst} {$target}{$staticnatport_txt}\n"; + + return $natrule; + } +@@ -654,6 +660,7 @@ + + $natrules .= filter_nat_rules_generate_if($natif, + $src, ++ $obent['protocol'], + $obent['sourceport'], + $dst, + $obent['dstport'], +@@ -669,9 +676,9 @@ + update_filter_reload_status("Creating outbound NAT rules"); + + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$lansa}/{$lancfg['subnet']}", 500, "", 500, null, 500, false); ++ "{$lansa}/{$lancfg['subnet']}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$lansa}/{$lancfg['subnet']}", 5060, "", 5060, null, 5060, false); ++ "{$lansa}/{$lancfg['subnet']}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($wanif, + "{$lansa}/{$lancfg['subnet']}"); + +@@ -683,9 +690,9 @@ + $opt_interface = $oc['if']; + if (interface_has_gateway("$opt_interface")) { + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$lansa}/{$lancfg['subnet']}", 500, "", 500, null, 500, false); ++ "{$lansa}/{$lancfg['subnet']}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$lansa}/{$lancfg['subnet']}", 5060, "", 5060, null, 5060, false); ++ "{$lansa}/{$lancfg['subnet']}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, + "{$lansa}/{$lancfg['subnet']}"); + } +@@ -701,22 +708,22 @@ + + /* create outbound nat entries for primary wan */ + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$optsa}/{$optcfg['subnet']}", 500, "", 500, null, 500, false); ++ "{$optsa}/{$optcfg['subnet']}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$optsa}/{$optcfg['subnet']}", 5060, "", 5060, null, 5060, false); ++ "{$optsa}/{$optcfg['subnet']}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$optsa}/{$optcfg['subnet']}", null, "", null, null, null, isset($optcfg['nonat'])); ++ "{$optsa}/{$optcfg['subnet']}", "any", null, "", null, null, null, isset($optcfg['nonat'])); + + /* create outbound nat entries for all opt wans */ + foreach($optints as $oc) { + $opt_interface = $oc['if']; + if (interface_has_gateway("$opt_interface")) { + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$optsa}/{$optcfg['subnet']}", 500, "", 500, null, 500, false); ++ "{$optsa}/{$optcfg['subnet']}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$optsa}/{$optcfg['subnet']}", 5060, "", 5060, null, 5060, false); ++ "{$optsa}/{$optcfg['subnet']}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$optsa}/{$optcfg['subnet']}", null, "", null, null, null, isset($optcfg['nonat'])); ++ "{$optsa}/{$optcfg['subnet']}", "any", null, "", null, null, null, isset($optcfg['nonat'])); + } + } + } +@@ -728,9 +735,9 @@ + if($config['pptp']['pptp_subnet'] <> "") + $pptp_subnet = $config['pptp']['pptp_subnet']; + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 500, "", 500, null, 500, false); ++ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 5060, "", 5060, null, 5060, false); ++ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($wanif, + "{$pptpdcfg['remoteip']}/{$pptp_subnet}"); + +@@ -739,9 +746,9 @@ + $opt_interface = $oc['if']; + if ((is_private_ip($pptpdcfg['remoteip'])) && (interface_has_gateway($opt_interface))) { + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 500, "", 500, null, 500, false); ++ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$pptpdcfg['remoteip']}/{$pptp_subnet}", 5060, "", 5060, null, 5060, false); ++ "{$pptpdcfg['remoteip']}/{$pptp_subnet}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, + "{$pptpdcfg['remoteip']}/{$pptp_subnet}"); + } +@@ -754,20 +761,20 @@ + if($config['pppoe']['pppoe_subnet'] <> "") + $pppoe_subnet = $config['pppoe']['pppoe_subnet']; + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 500, "", 500, null, 500, false); ++ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 5060, "", 5060, null, 5060, false); ++ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$pppoecfg['remoteip']}/{$pppoe_subnet}"); ++ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", "any"); + + /* generate nat mappings for opts with a gateway opts */ + foreach($optints as $oc) { + $opt_interface = $oc['if']; + if ((is_private_ip($pppoecfg['remoteip'])) && (interface_has_gateway($opt_interface))) { + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 500, "", 500, null, 500, false); ++ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$pppoecfg['remoteip']}/{$pppoe_subnet}", 5060, "", 5060, null, 5060, false); ++ "{$pppoecfg['remoteip']}/{$pppoe_subnet}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, + "{$pppoecfg['remoteip']}/{$pppoe_subnet}"); + } +@@ -780,22 +787,22 @@ + $netip = explode("/", $route['network']); + if ((! interface_has_gateway($route['interface'])) && (is_private_ip($netip[0]))) { + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$route['network']}", 500, "", 500, null, 500, false); ++ "{$route['network']}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$route['network']}", 5060, "", 5060, null, 5060, false); ++ "{$route['network']}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($wanif, +- "{$route['network']}", "", null); ++ "{$route['network']}", "any", "", null); + } + /* generate nat mapping for static routes on opts */ + foreach($optints as $oc) { + $opt_interface = $oc['if']; + if ((! interface_has_gateway($route['interface'])) && (is_private_ip($netip[0])) && (interface_has_gateway($opt_interface))) { + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$route['network']}", 500, "", 500, null, 500, false); ++ "{$route['network']}", "any", 500, "", 500, null, 500, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$route['network']}", 5060, "", 5060, null, 5060, false); ++ "{$route['network']}", "any", 5060, "", 5060, null, 5060, false); + $natrules .= filter_nat_rules_generate_if($opt_interface, +- "{$route['network']}", "", null); ++ "{$route['network']}", "any", "", null); + } + } + +--- /usr/local/www-orig/firewall_nat_out.php 2008-01-07 21:14:44.000000000 -0500 ++++ /usr/local/www/firewall_nat_out.php 2009-02-24 18:21:20.000000000 -0500 +@@ -102,6 +102,7 @@ + $natent['interface'] = "wan"; + $natent['destination']['any'] = true; + $natent['natport'] = ""; ++ $natent['protocol'] = "any"; + $a_out[] = $natent; + } + $savemsg = "Default rules for each interface have been created."; +@@ -265,6 +266,11 @@ + echo "LAN"; + else + echo htmlspecialchars($config['interfaces'][$natent['interface']]['descr']); ++ ++ if (($natent['protocol'] != "any") && ($natent['protocol'] != "")) ++ $proto = $natent['protocol'] . "/"; ++ else ++ $proto = ""; + ?> + + </td> +@@ -273,10 +279,11 @@ + </td> + <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';"> + <?php ++ + if (!$natent['sourceport']) +- echo "*"; ++ echo $proto . "*"; + else +- echo $natent['sourceport']; ++ echo $proto . $natent['sourceport']; + ?> + </td> + <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';"> +@@ -293,9 +300,9 @@ + <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';"> + <?php + if (!$natent['dstport']) +- echo "*"; ++ echo $proto . "*"; + else +- echo $natent['dstport']; ++ echo $proto . $natent['dstport']; + ?> + </td> + <td class="listr" onClick="fr_toggle(<?=$nnats;?>)" id="frd<?=$nnats;?>" ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$nnats;?>';"> +--- /usr/local/www-orig/firewall_nat_out_edit.php 2008-11-08 17:53:23.000000000 -0500 ++++ /usr/local/www/firewall_nat_out_edit.php 2009-02-25 12:07:33.000000000 -0500 +@@ -49,6 +49,7 @@ + } + + if (isset($id) && $a_out[$id]) { ++ $pconfig['proto'] = $a_out[$id]['protocol']; + list($pconfig['source'],$pconfig['source_subnet']) = explode('/', $a_out[$id]['source']['network']); + $pconfig['sourceport'] = $a_out[$id]['sourceport']; + address_to_pconfig($a_out[$id]['destination'], $pconfig['destination'], +@@ -170,6 +171,9 @@ + if (!$natent['interface']) + $natent['interface'] == "wan"; + ++ if ($natent['proto'] != $_POST['proto']) ++ continue; ++ + if (($natent['interface'] == $_POST['interface']) && ($natent['source']['network'] == $osn)) { + if (isset($natent['destination']['not']) == isset($_POST['destination_not'])) { + if ((isset($natent['destination']['any']) && ($ext == "any")) || +@@ -188,6 +192,7 @@ + $natent['descr'] = $_POST['descr']; + $natent['target'] = $_POST['target']; + $natent['interface'] = $_POST['interface']; ++ $natent['protocol'] = $_POST['proto']; + + /* static-port */ + if(isset($_POST['staticnatport'])) +@@ -316,6 +321,17 @@ + Hint: in most cases, you'll want to use WAN here.</span></td> + </tr> + <tr> ++ <td width="22%" valign="top" class="vncellreq">Protocol</td> ++ <td width="78%" class="vtable"> ++ <select name="proto" class="formfld" onChange="proto_change(); check_for_aliases();"> ++ <?php $protocols = explode(" ", "any TCP UDP GRE ESP AH L2TP ICMP"); foreach ($protocols as $proto): ?> ++ <option value="<?=strtolower($proto);?>" <?php if (strtolower($proto) == $pconfig['proto']) echo "selected"; ?>><?=htmlspecialchars($proto);?></option> ++ <?php endforeach; ?> ++ </select> <br> <span class="vexpl">Choose which IP protocol ++ this rule should match.<br> ++ Hint: in most cases, you should specify <em>any</em> here.</span></td> ++ </tr> ++ <tr> + <td width="22%" valign="top" class="vncellreq">Source</td> + <td width="78%" class="vtable"> + <table border="0" cellspacing="1" cellpadding="1"> diff --git a/config/frickin.xml b/config/onatproto/onatproto.xml index 8f59bb8c..e4e4e8b9 100644 --- a/config/frickin.xml +++ b/config/onatproto/onatproto.xml @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="utf-8" ?> -<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> -<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> <copyright> <![CDATA[ /* $Id$ */ /* ========================================================================== */ /* - authng.xml + onatproto.xml part of pfSense (http://www.pfSense.com) Copyright (C) 2007 to whom it may belong All rights reserved. @@ -42,34 +42,24 @@ /* ========================================================================== */ ]]> </copyright> - <description>Describe your package here</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> - <name>frickin</name> - <version>1.2</version> - <title>none</title> - <configpath>installedpackages->package->$packagename->configuration->settings</configpath> + <description>Patch to add Protocol options to Manual Outbound NAT</description> + <requirements>pfSense 1.2.x</requirements> + <faq>Only needed if you want to NAT outbound based on protocol as well as port.</faq> + <name>onatproto</name> + <version>0.1</version> + <title>onatproto</title> + <include_file>/usr/local/pkg/onatproto.inc</include_file> <additional_files_needed> - <prefix>/usr/local/bin/</prefix> - <chmod>0755</chmod> - <item>http://www.pfsense.com/packages/All/frickin</item> - </additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/onatproto/onatproto.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>077</chmod> + <item>http://www.pfsense.com/packages/config/onatproto/onatproto.patch</item> + </additional_files_needed> <custom_php_install_command> - $fout = fopen("/usr/local/etc/rc.d/frickin.sh", "w"); - fwrite($fout, "#!/bin/sh\n# This package was automatically generated\n# by the pfSense package system.\n\n"); - fwrite($fout, "# PACKAGE: Frickin Proxy\n"); - fwrite($fout, "# EXECUTABLE: frickin\n"); - fwrite($fout, "/usr/local/bin/frickin"); - fwrite($fout, " -s 127.0.0.1"); - fwrite($fout, " -c 20"); - fwrite($fout, " &\n"); - fclose($fout); - mwexec("/usr/bin/killall frickin"); - mwexec("chmod a+rx /usr/local/etc/rc.d/frickin.sh"); - mwexec("/usr/local/etc/rc.d/frickin.sh"); + onatproto_install(); </custom_php_install_command> - <custom_php_deinstall_command> - unlink_if_exists("/usr/local/etc/rc.d/frickin.sh"); - unlink_if_exists("/usr/local/bin/frickin"); - </custom_php_deinstall_command> </packagegui> diff --git a/config/siproxd.inc b/config/siproxd.inc index fee47a90..be1ac196 100644 --- a/config/siproxd.inc +++ b/config/siproxd.inc @@ -27,6 +27,23 @@ POSSIBILITY OF SUCH DAMAGE. */ +function sync_package_sipproxd_users() { + conf_mount_rw(); + config_lock(); + global $config; + $fout = fopen("/usr/local/etc/siproxd_passwd.cfg","w"); + fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); + if($config['installedpackages']['siproxdusers']['config'] != "") { + foreach($config['installedpackages']['siproxdusers']['config'] as $rowhelper) { + fwrite($fout, $rowhelper['username'] . " " . $rowhelper['password'] . "\n"); + } + } + fclose($fout); + conf_mount_ro(); + config_unlock(); + system("/usr/bin/killall -HUP siproxd"); +} + function siproxd_generate_rules($type) { global $config; diff --git a/config/siproxd.xml b/config/siproxd.xml index deccf90d..c79c722f 100644 --- a/config/siproxd.xml +++ b/config/siproxd.xml @@ -44,7 +44,7 @@ <name>siproxdsettings</name> <version>0.5.13_pfs2</version> <title>siproxd: Settings</title> - <include_file>/usr/local/pkg/siproxd.inc</include_file> + <include_file>/usr/local/pkg/siproxd.inc</include_file> <aftersaveredirect>/pkg_edit.php?xml=siproxd.xml&id=0</aftersaveredirect> <menu> <name>siproxd</name> diff --git a/config/siproxdusers.xml b/config/siproxdusers.xml index a25418f9..a36e0554 100644 --- a/config/siproxdusers.xml +++ b/config/siproxdusers.xml @@ -48,6 +48,7 @@ <name>siproxdusers</name> <version>0.5.9</version> <title>siproxd: Users</title> + <include_file>/usr/local/pkg/siproxd.inc</include_file> <tabs> <tab> <text>Settings</text> @@ -91,27 +92,9 @@ </field> </fields> <custom_add_php_command> - function sync_package_sipproxd_users() - { - conf_mount_rw(); - config_lock(); - global $config; - $fout = fopen("/usr/local/etc/siproxd_passwd.cfg","w"); - fwrite($fout, "# This file was automatically generated by the pfSense\n# package management system.\n\n"); - if($config['installedpackages']['siproxdusers']['config'] != "") { - foreach($config['installedpackages']['siproxdusers']['config'] as $rowhelper) { - fwrite($fout, $rowhelper['username'] . " " . $rowhelper['password'] . "\n"); - } - } - fclose($fout); - conf_mount_ro(); - config_unlock(); - system("/usr/bin/killall -HUP siproxd"); - } sync_package_sipproxd_users(); </custom_add_php_command> <custom_php_resync_config_command> sync_package_sipproxd_users(); </custom_php_resync_config_command> -</packagegui> - +</packagegui>
\ No newline at end of file diff --git a/config/snort/snort.inc b/config/snort/snort.inc index 20a03f93..5d6a2942 100644 --- a/config/snort/snort.inc +++ b/config/snort/snort.inc @@ -469,7 +469,7 @@ preprocessor ftp_telnet_protocol: \ ftp_cmds { LIST NLST SITE SYST STAT HELP NOOP } \ ftp_cmds { AUTH ADAT PROT PBSZ CONF ENC } \ ftp_cmds { FEAT OPTS CEL CMD MACB } \ - ftp_cmds { MDTM REST SIZE MLST MLSD } \ + ftp_cmds { MDTM REST SIZE MLST MLSD EPSV } \ ftp_cmds { XPWD XCWD XCUP XMKD XRMD TEST CLNT } \ alt_max_param_len 0 { CDUP QUIT REIN PASV STOU ABOR PWD SYST NOOP } \ alt_max_param_len 100 { MDTM CEL XCWD SITE USER PASS REST DELE RMD SYST TEST STAT MACB EPSV CLNT LPRT } \ diff --git a/config/squid/squid.xml b/config/squid/squid.xml index 4c8bc4ab..a119e647 100644 --- a/config/squid/squid.xml +++ b/config/squid/squid.xml @@ -169,15 +169,15 @@ <required/> </field> <field> - <fielddescr>Do NOT proxy Private Address Space (RFC 1918)</fielddescr> + <fielddescr>Bypass proxy for Private Address Space (RFC 1918) destination</fielddescr> <fieldname>private_subnet_proxy_off</fieldname> - <description>Do not forward traffic to Private Address Space (RFC 1918) <b>destination</b> through the proxy server.</description> + <description>Do not forward traffic to Private Address Space (RFC 1918) <b>destination</b> through the proxy server but directly through the firewall.</description> <type>checkbox</type> </field> <field> - <fielddescr>Do NOT proxy these IPs</fielddescr> + <fielddescr>Bypass proxy for these source IPs</fielddescr> <fieldname>defined_ip_proxy_off</fieldname> - <description>Do not forward traffic from these <b>source</b> IPs through the proxy server. Separate by semi-colons (;).</description> + <description>Do not forward traffic from these <b>source</b> IPs through the proxy server but directly through the firewall. Separate by semi-colons (;).</description> <type>input</type> <size>80</size> </field> diff --git a/config/squid3/squid.xml b/config/squid3/squid.xml index 8529526e..662805da 100644 --- a/config/squid3/squid.xml +++ b/config/squid3/squid.xml @@ -169,15 +169,15 @@ <required/> </field> <field> - <fielddescr>Do NOT proxy Private Address Space (RFC 1918)</fielddescr> + <fielddescr>Bypass proxy for Private Address Space (RFC 1918) destination</fielddescr> <fieldname>private_subnet_proxy_off</fieldname> - <description>Do not forward traffic to Private Address Space (RFC 1918) <b>destination</b> through the proxy server.</description> + <description>Do not forward traffic to Private Address Space (RFC 1918) <b>destination</b> through the proxy server but directly through the firewall.</description> <type>checkbox</type> </field> <field> - <fielddescr>Do NOT proxy these IPs</fielddescr> + <fielddescr>Bypass proxy for these source IPs</fielddescr> <fieldname>defined_ip_proxy_off</fieldname> - <description>Do not forward traffic from these <b>source</b> IPs through the proxy server. Separate by semi-colons (;).</description> + <description>Do not forward traffic from these <b>source</b> IPs through the proxy server but directly through the firewall. Separate by semi-colons (;).</description> <type>input</type> <size>80</size> </field> diff --git a/config/stunnel.xml b/config/stunnel.xml index 85e43081..6ea9f99f 100644 --- a/config/stunnel.xml +++ b/config/stunnel.xml @@ -51,11 +51,35 @@ <section>Services</section> <configfile>stunnel.xml</configfile> </menu> + + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/stunnel/stunnel.inc</item> + </additional_files_needed> + <additional_files_needed> + <prefix>/usr/local/pkg/</prefix> + <chmod>0644</chmod> + <item>http://www.pfsense.com/packages/config/stunnel/stunnel_certs.xml</item> + </additional_files_needed> <!-- configpath gets expanded out automatically and config items will be stored in that location --> <configpath>['installedpackages']['package']['$packagename']['configuration']</configpath> + + <tabs> + <tab> + <text>Tunnels</text> + <url>/pkg.php?xml=stunnel.xml</url> + <active/> + </tab> + <tab> + <text>Certificates</text> + <url>/pkg.php?xml=stunnel_certs.xml</url> + </tab> + </tabs> + <!-- adddeleteeditpagefields items will appear on the first page where you can add / delete or edit - items. An example of this would be the nat page where you add new nat redirects --> + items. An example of this would be the nat page where you add new nat redirects --> <adddeleteeditpagefields> <columnitem> <fielddescr>Description</fielddescr> @@ -70,6 +94,10 @@ <fieldname>localport</fieldname> </columnitem> <columnitem> + <fielddescr>Certificate</fielddescr> + <fieldname>certificatelink</fieldname> + </columnitem> + <columnitem> <fielddescr>Redirects to IP</fielddescr> <fieldname>redirectip</fieldname> </columnitem> @@ -100,6 +128,16 @@ <type>input</type> </field> <field> + <fielddescr>Certificate</fielddescr> + <fieldname>certificate</fieldname> + <description>Select server certificate to use for this tunnel. Certificates are defined on the 'Certificates' page.</description> + <type>select</type> + <options> + <option><name> --- default --- </name><value></value></option> + </options> + <default_value></default_value> + </field> + <field> <fielddescr>Redirects to IP</fielddescr> <fieldname>redirectip</fieldname> <description>Enter the IP address to redirect this to.</description> @@ -111,58 +149,33 @@ <description>Enter the port to redirect to.</description> <type>input</type> </field> + <field> + <fielddescr>Outgoing source IP</fielddescr> + <fieldname>sourceip</fieldname> + <description>Enter the source IP address for outgoing connections.</description> + <type>input</type> + </field> </fields> + <service> <name>stunnel</name> <rcfile>/usr/local/etc/rc.d/stunnel.sh</rcfile> <executable>stunnel</executable> </service> + + <include_file>/usr/local/pkg/stunnel.inc</include_file> + <custom_add_php_command_late> - <![CDATA[ - conf_mount_rw(); - config_lock(); - $fout = fopen("/usr/local/etc/stunnel/stunnel.conf","w"); - fwrite($fout, "cert = /usr/local/etc/stunnel/stunnel.pem \n"); - fwrite($fout, "chroot = /var/tmp/stunnel \n"); - fwrite($fout, "setuid = stunnel \n"); - fwrite($fout, "setgid = stunnel \n"); - foreach($config['installedpackages']['stunnel']['config'] as $pkgconfig) { - fwrite($fout, "\n[" . $pkgconfig['description'] . "]\n"); - fwrite($fout, "accept = " . $pkgconfig['localip'] . ":" . $pkgconfig['localport'] . "\n"); - fwrite($fout, "connect = " . $pkgconfig['redirectip'] . ":" . $pkgconfig['redirectport'] . "\n"); - fwrite($fout, "TIMEOUTclose = 0\n\n"); - } - fclose($fout); - conf_mount_ro(); - config_unlock(); - system("/usr/bin/killall stunnel 2>/dev/null"); - system("/usr/local/etc/rc.d/stunnel.sh start 2>/dev/null"); - ]]> + stunnel_save($config); </custom_add_php_command_late> <custom_php_install_command> - <![CDATA[ - safe_mkdir("/usr/local/etc/stunnel"); - system("/usr/bin/openssl req -new -x509 -days 365 -nodes -out /usr/local/etc/stunnel/stunnel.pem -keyout /usr/local/etc/stunnel/stunnel.pem 2>/dev/null"); - chmod("/usr/local/etc/stunnel/stunnel.pem", 600); - system("/bin/mkdir /var/tmp/stunnel"); - system("/bin/mkdir /var/tmp/stunnel/var"); - system("/bin/mkdir /var/tmp/stunnel/var/tmp"); - system("/usr/sbin/chown -R stunnel:stunnel /var/tmp/stunnel"); - chmod("/var/tmp/stunnel/var/tmp/", 1777); - $fout = fopen("/usr/local/etc/rc.d/stunnel.sh","w"); - system("/usr/sbin/chown -R stunnel:stunnel /var/tmp/stunnel/var/stunnel"); - fwrite($fout, "#!/bin/sh\n"); - fwrite($fout, "# PACKAGE: STunnel\n"); - fwrite($fout, "# EXECUTABLE: stunnel\n"); - fwrite($fout, "/usr/local/sbin/stunnel /usr/local/etc/stunnel/stunnel.conf\n\n"); - fclose($fout); - chmod("/usr/local/etc/rc.d/stunnel.sh", 0555); - ]]> + stunnel_install(); </custom_php_install_command> <custom_php_deinstall_command> - <![CDATA[ - rmdir_recursive("/var/tmp/stunnel"); - rmdir_recursive("/usr/local/etc/stunnel*"); - ]]> + stunnel_deinstall(); </custom_php_deinstall_command> + <custom_php_after_form_command> + stunnel_addcerts($config); + </custom_php_after_form_command> + </packagegui> diff --git a/config/stunnel/stunnel.inc b/config/stunnel/stunnel.inc new file mode 100644 index 00000000..62558e34 --- /dev/null +++ b/config/stunnel/stunnel.inc @@ -0,0 +1,232 @@ +<?php + +if(!isset($_GET['id']) and !isset($_POST['id'])) { + if($GLOBALS['config']['installedpackages']['stunnelcerts']['savemsg']) { + $savemsg=$GLOBALS['config']['installedpackages']['stunnelcerts']['savemsg']; + unset($GLOBALS['config']['installedpackages']['stunnelcerts']['savemsg']); + write_config(); + } + +} + +if(isset($_GET['id'])) { + $config['installedpackages']['stunnelcerts']['config'][$_GET['id']]['cert_chain']= + base64_decode($config['installedpackages']['stunnelcerts']['config'][$_GET['id']]['cert_chain']); + $config['installedpackages']['stunnelcerts']['config'][$_GET['id']]['cert_key']= + base64_decode($config['installedpackages']['stunnelcerts']['config'][$_GET['id']]['cert_key']); +} + +$certs=$config['installedpackages']['stunnelcerts']['config']; +is_array($certs) ? $num_certs=count($certs) : $num_certs=0; +if(!isset($_GET['id']) and !isset($_POST['id']) and $num_certs) { + for ($i=0;$i<$num_certs;$i++) { + $cert=$certs[$i]; + $_info=openssl_x509_parse(base64_decode($cert['cert_chain'])); + $valid=floor(($_info['validTo_time_t']-time())/86400); + if(!openssl_x509_check_private_key(base64_decode($cert['cert_chain']), base64_decode($cert['cert_key']))) { + $_status='<font color="#AA0000"><b>Invalid key/cert!</b></font>'; + } elseif($valid<30) { + $_status='<font color="#B27D4B">Expires in '.$valid.' days!</font>'; + } else { + $_status='<font color="#008800">OK ('.$valid.' days)</font>'; + } + $config['installedpackages']['stunnelcerts']['config'][$i]['status']=$_status; + } +} + + +$tunnels=$config['installedpackages']['stunnel']['config']; +is_array($tunnels) ? $num_tunnels=count($tunnels) : $num_tunnels=0; +if(!isset($_GET['id']) and $num_tunnels) { + for ($i=0;$i<$num_tunnels;$i++) { + $tunnel=$tunnels[$i]; + if($tunnel['certificate']) { + $certid=0; + if(is_array($config['installedpackages']['stunnelcerts']['config'])) { + foreach($config['installedpackages']['stunnelcerts']['config'] as $cert) { + if($tunnel['certificate']==$cert['filename']) + $config['installedpackages']['stunnel']['config'][$i]['certificatelink']= + '<a href="/pkg_edit.php?xml=stunnel_certs.xml&act=edit&id='.$certid.'">'.$cert['description'].'</a>'; + $certid++; + } + } + } + } +} + +function stunnel_printcsr() { +# $GLOBALS['savemsg']="<pre>" . print_r($GLOBALS['config']['installedpackages']['stunnelcerts']['config'],true) . "</pre>"; +} + +function stunnel_addcerts($config) { + $certs=$config['installedpackages']['stunnelcerts']['config']; + $tunnels=$config['installedpackages']['stunnel']['config']; + ?> + <script type="text/javascript"> + function addcerts() { + <?php + + foreach($certs as $cert) { + echo("document.forms['iform'].certificate.appendChild(new Option('".$cert['description']."', '".$cert['filename']."'));"); + } + + ?> + } + addcerts(); + for (var i=0; i < document.forms['iform'].certificate.length; i++) { + <?php + $filename=$tunnels[$_GET['id']]['certificate']; + echo('if (document.forms["iform"].certificate[i].value == "'.$filename.'") {'); + ?> + document.forms['iform'].certificate[i].selected = true; + } else { + document.forms['iform'].certificate[i].selected = false; + } + } + + </script> + <?php +} + +function stunnel_disablefields() { + ?> + <script type="text/javascript"> + document.forms['iform'].subject.readOnly=true; + document.forms['iform'].filename.readOnly=true; + document.forms['iform'].expiry.readOnly=true; + </script> + <?php +} + +function stunnel_delete($config) { + $cert=$config['installedpackages']['stunnelcerts']['config'][$_GET['id']]; + if(isset($_GET['id'])) { + unlink_if_exists('/usr/local/etc/stunnel/'.$cert['filename'].'pem'); + unlink_if_exists('/usr/local/etc/stunnel/'.$cert['filename'].'key'); + unlink_if_exists('/usr/local/etc/stunnel/'.$cert['filename'].'chain'); + } +} + +function stunnel_save($config) { + $GLOBALS['config']['installedpackages']['stunnelcerts']['savemsg']=''; + conf_mount_rw(); + config_lock(); + $fout = fopen("/usr/local/etc/stunnel/stunnel.conf","w"); + fwrite($fout, "cert = /usr/local/etc/stunnel/stunnel.pem \n"); + fwrite($fout, "chroot = /var/tmp/stunnel \n"); + fwrite($fout, "setuid = stunnel \n"); + fwrite($fout, "setgid = stunnel \n"); + foreach($config['installedpackages']['stunnel']['config'] as $pkgconfig) { + fwrite($fout, "\n[" . $pkgconfig['description'] . "]\n"); + if($pkgconfig['certificate']) { + if(file_exists('/usr/local/etc/stunnel/'.$pkgconfig['certificate'].'.key') and + file_exists('/usr/local/etc/stunnel/'.$pkgconfig['certificate'].'.chain')) { + fwrite($fout, "key = /usr/local/etc/stunnel/" . $pkgconfig['certificate'] . ".key\n"); + fwrite($fout, "cert = /usr/local/etc/stunnel/" . $pkgconfig['certificate'] . ".chain\n"); + } + } + if($pkgconfig['sourceip']) fwrite($fout, "local = " . $pkgconfig['sourceip'] . "\n"); + fwrite($fout, "accept = " . $pkgconfig['localip'] . ":" . $pkgconfig['localport'] . "\n"); + fwrite($fout, "connect = " . $pkgconfig['redirectip'] . ":" . $pkgconfig['redirectport'] . "\n"); + fwrite($fout, "TIMEOUTclose = 0\n\n"); + } + fclose($fout); + conf_mount_ro(); + config_unlock(); + system("/usr/local/etc/rc.d/stunnel.sh stop 2>/dev/null"); + system("/usr/local/etc/rc.d/stunnel.sh start 2>/dev/null"); +} +function stunnel_save_cert($config) { + $GLOBALS['config']['installedpackages']['stunnelcerts']['savemsg']=''; + if(isset($_POST['id'])) { +# echo "<pre>"; +# print_r($_POST); +# echo "</pre>"; + + if(!$_POST['cert_chain']) { + $GLOBALS['config']['installedpackages']['stunnelcerts']['savemsg'].="Certificate chain must be specified!<br>"; + } if(!$_POST['cert_key']) { + $GLOBALS['config']['installedpackages']['stunnelcerts']['savemsg'].="RSA Key must be specified!<br>"; + } + if($_POST['cert_chain'] and $_POST['cert_key']) { + $_cert=openssl_x509_parse($_POST['cert_chain']); +# echo("<pre>"); +# print_r($_cert); +# echo("</pre>"); + if($_cert['hash']) { + if(openssl_x509_check_private_key($_POST['cert_chain'], $_POST['cert_key'])) { + file_put_contents('/usr/local/etc/stunnel/'.$_cert['hash'].'.key', + $_POST['cert_key']); + file_put_contents('/usr/local/etc/stunnel/'.$_cert['hash'].'.chain', + $_POST['cert_chain']); + file_put_contents('/usr/local/etc/stunnel/'.$_cert['hash'].'.pem', + $_POST['cert_key']."\n".$_POST['cert_chain']); + system('chown stunnel:stunnel /usr/local/etc/stunnel/*'); + chmod('/usr/local/etc/stunnel/'.$_cert['hash'].'.key', 0600); + chmod('/usr/local/etc/stunnel/'.$_cert['hash'].'.pem', 0600); + + $_POST['filename']=$_cert['hash']; + $_POST['expiry_raw']=$_cert['validTo_time_t']; + $_POST['expiry']=date('Y-m-d', $_cert['validTo_time_t']); + $_POST['subject']=$_cert['name']; + } else { + $GLOBALS['config']['installedpackages']['stunnelcerts']['savemsg'].="Certificate and key do not match!<br>"; + $_POST['filename']=''; + } + } else { + $GLOBALS['config']['installedpackages']['stunnelcerts']['savemsg'].="Couldn't parse certificate!<br>"; + $_POST['expiry_raw']=''; + $_POST['expiry']=''; + $_POST['subject']=''; + $_POST['filename']=''; + } + } + $_POST['cert_key']=base64_encode($_POST['cert_key']); + $_POST['cert_chain']=base64_encode($_POST['cert_chain']); + $_fname=$GLOBALS['config']['installedpackages']['stunnelcerts']['config'][$_POST['id']]['filename']; + if($_fname and $_fname!=$_POST['filename']) { + unlink_if_exists('/usr/local/etc/stunnel/'.$_fname.'.chain'); + unlink_if_exists('/usr/local/etc/stunnel/'.$_fname.'.key'); + unlink_if_exists('/usr/local/etc/stunnel/'.$_fname.'.pem'); + } + } +} + +function stunnel_install() { + safe_mkdir("/usr/local/etc/stunnel"); + system("/usr/bin/openssl req -new -x509 -days 365 -nodes -out /usr/local/etc/stunnel/stunnel.pem -keyout /usr/local/etc/stunnel/stunnel.pem 2>/dev/null"); + chmod("/usr/local/etc/stunnel/stunnel.pem", 0600); + make_dirs("/var/tmp/stunnel/var/tmp/run/stunnel"); + system("/usr/sbin/chown -R stunnel:stunnel /var/tmp/stunnel"); + $_rcfile['file']='stunnel.sh'; + $_rcfile['start'].="/usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf \n\t"; + $_rcfile['stop'].="killall stunnel \n\t"; + write_rcfile($_rcfile); + unlink_if_exists("/usr/local/etc/rc.d/stunnel"); + + conf_mount_rw(); + config_lock(); + $fout = fopen("/usr/local/etc/stunnel/stunnel.conf","w"); + fwrite($fout, "cert = /usr/local/etc/stunnel/stunnel.pem \n"); + fwrite($fout, "chroot = /var/tmp/stunnel \n"); + fwrite($fout, "setuid = stunnel \n"); + fwrite($fout, "setgid = stunnel \n"); + foreach($config['installedpackages']['stunnel']['config'] as $pkgconfig) { + fwrite($fout, "\n[" . $pkgconfig['description'] . "]\n"); + if($pkgconfig['sourceip']) fwrite($fout, "local = " . $pkgconfig['sourceip'] . "\n"); + fwrite($fout, "accept = " . $pkgconfig['localip'] . ":" . $pkgconfig['localport'] . "\n"); + fwrite($fout, "connect = " . $pkgconfig['redirectip'] . ":" . $pkgconfig['redirectport'] . "\n"); + fwrite($fout, "TIMEOUTclose = 0\n\n"); + } + fclose($fout); + conf_mount_ro(); + config_unlock(); +} + +function stunnel_deinstall() { + rmdir_recursive("/var/tmp/stunnel"); + rmdir_recursive("/usr/local/etc/stunnel*"); + unlink_if_exists("/usr/local/etc/rc.d/stunnel.sh"); +} + +?>
\ No newline at end of file diff --git a/config/stunnel/stunnel_certs.xml b/config/stunnel/stunnel_certs.xml new file mode 100644 index 00000000..540d556c --- /dev/null +++ b/config/stunnel/stunnel_certs.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd"> +<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<packagegui> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ========================================================================== */ +/* + stunnel.xml + part of pfSense (http://www.pfSense.com) + Copyright (C) 2007-2008 Scott Ullrich + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + </copyright> + <description>Stunnel certificates</description> + <requirements>Describe your package requirements here</requirements> + <faq>Currently there are no FAQ items provided.</faq> + <name>stunnelcerts</name> + <version>4.18</version> + <title>Services: Secure Tunnel - Certificates</title> + <!-- configpath gets expanded out automatically and config items will be + stored in that location --> + <configpath>['installedpackages']['package']['$packagename']['configuration']</configpath> + + <tabs> + <tab> + <text>Tunnels</text> + <url>/pkg.php?xml=stunnel.xml</url> + </tab> + <tab> + <text>Certificates</text> + <url>/pkg.php?xml=stunnel_certs.xml</url> + <active/> + </tab> + </tabs> + + <!-- adddeleteeditpagefields items will appear on the first page where you can add / delete or edit + items. An example of this would be the nat page where you add new nat redirects --> + <adddeleteeditpagefields> + <columnitem> + <fielddescr>Description</fielddescr> + <fieldname>description</fieldname> + </columnitem> + <columnitem> + <fielddescr>Subject</fielddescr> + <fieldname>subject</fieldname> + </columnitem> +<!-- <columnitem> + <fielddescr>Valid until</fielddescr> + <fieldname>expiry</fieldname> + </columnitem> --> + <columnitem> + <fielddescr>Status</fielddescr> + <fieldname>status</fieldname> + </columnitem> + + </adddeleteeditpagefields> + <!-- fields gets invoked when the user adds or edits a item. the following items + will be parsed and rendered for the user as a gui with input, and selectboxes. --> + <fields> + <field> + <fielddescr>Description</fielddescr> + <fieldname>description</fieldname> + <description>Enter a (short) description for this certificate</description> + <type>input</type> + </field> + <field> + <fielddescr>Certificate filename</fielddescr> + <fieldname>filename</fieldname> + <description>File name of certificate (read-only; updated on save). Extensions (.pem, .chain, .key) are added automatically.</description> + <type>input</type> + </field> + <field> + <fielddescr>Certificate subject</fielddescr> + <fieldname>subject</fieldname> + <description>Certificate subject (read-only; updated on save)</description> + <type>input</type> + <size>50</size> + </field> + <field> + <fielddescr>Certificate valid until</fielddescr> + <fieldname>expiry</fieldname> + <description>The certificate will expire on this date, and will no longer work.</description> + <type>input</type> + </field> + <field> + <fielddescr>RSA private key</fielddescr> + <fieldname>cert_key</fieldname> + <description>RSA private key used for certificate. Do not change for existing certificates!<br> + <type>textarea</type> + <rows>7</rows> + <cols>65</cols> + </field> + <field> + <fielddescr>Certificate chain</fielddescr> + <fieldname>cert_chain</fieldname> + <description>Full certificate chain; root certificate on top, then any intermediates, server certificate at the end.<br> + <b>Full chain required for private or EV certificates!</b></description> + <type>textarea</type> + <rows>7</rows> + <cols>65</cols> + </field> + </fields> + + <include_file>/usr/local/pkg/stunnel.inc</include_file> + <custom_add_php_command> + stunnel_save_cert($config); + stunnel_save($config); + </custom_add_php_command> + <custom_php_command_before_form> + stunnel_printcsr(); + </custom_php_command_before_form> + <custom_php_after_form_command> + stunnel_disablefields(); + </custom_php_after_form_command> + <custom_delete_php_command> + stunnel_delete($config); + </custom_delete_php_command> + +</packagegui> diff --git a/config/tftp/tftp.inc b/config/tftp/tftp.inc index a7053df9..40aed550 100644 --- a/config/tftp/tftp.inc +++ b/config/tftp/tftp.inc @@ -109,14 +109,19 @@ function php_install_command() } - if (!is_dir('/usr/local/www/tftp')) { - // Create the directory - exec("mkdir /usr/local/www/tftp"); + if (!is_dir('/usr/local/www/packages/')) { + // Create the packages directory + exec("mkdir /usr/local/www/packages/"); + } + + if (!is_dir('/usr/local/www/packages/tftp')) { + // Create the tftp directory + exec("mkdir /usr/local/www/packages/tftp"); } //rename PHP files from .tmp to .php - exec("cp /tmp/tftp_files.tmp /usr/local/www/tftp/tftp_files.php"); + exec("cp /tmp/tftp_files.tmp /usr/local/www/packages/tftp/tftp_files.php"); unlink_if_exists("/tmp/tftp_files.tmp"); //prepare inetd.conf for tftp @@ -228,7 +233,7 @@ function php_install_command() write_rcfile(array( "file" => "tftp.sh", - "start" => "/usr/sbin/inetd", + "start" => "/usr/sbin/inetd -l", "stop" => "killall -9 inetd" ) ); @@ -268,9 +273,10 @@ function php_deinstall_command() unlink_if_exists("/usr/local/pkg/tftp.xml"); unlink_if_exists("/usr/local/pkg/tftp.inc"); - unlink_if_exists("/usr/local/www/tftp/tftp_files.php"); + unlink_if_exists("/usr/local/www/packages/tftp/tftp_files.php"); + exec("rm -R /usr/local/www/packages/tftp/"); - exec("rm -R /tftpboot"); + //exec("rm -R /tftpboot"); unlink_if_exists("/usr/local/etc/rc.d/tftp.sh"); unlink_if_exists("/tmp/pkg_mgr_tftp.log"); diff --git a/config/tftp/tftp.xml b/config/tftp/tftp.xml index e7b69d6b..d8f1ea0b 100644 --- a/config/tftp/tftp.xml +++ b/config/tftp/tftp.xml @@ -41,7 +41,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>tftp Settings</name> - <version>1.0.2</version> + <version>1.0.5</version> <title>TFTP: Settings</title> <include_file>/usr/local/pkg/tftp.inc</include_file> <menu> @@ -49,7 +49,7 @@ <tooltiptext>Add or Remove files for TFTP.</tooltiptext> <section>Services</section> <configfile>tftp.xml</configfile> - <url>/tftp/tftp_files.php</url> + <url>/packages/tftp/tftp_files.php</url> </menu> <service> <name>tftp</name> @@ -60,7 +60,7 @@ <tabs> <tab> <text>Files</text> - <url>/tftp/tftp_files.php</url> + <url>/packages/tftp/tftp_files.php</url> </tab> </tabs> <configpath>installedpackages->package->$packagename->configuration->tftp</configpath> diff --git a/config/tftp/tftp_files.tmp b/config/tftp/tftp_files.tmp index f49ea76e..a5fb5ecc 100644 --- a/config/tftp/tftp_files.tmp +++ b/config/tftp/tftp_files.tmp @@ -37,18 +37,18 @@ if (($_GET['a'] == "download") && $_GET['t'] == "backup") { $filename = 'tftp.bak.tgz'; system('cd /;tar cvzf /tmp/tftp.bak.tgz tftpboot'); } -if (($_GET['a'] == "download") && file_exists("/tftpboot/".$filename)) { - +if (($_GET['a'] == "download") && file_exists("/tmp/".$filename)) { + session_cache_limiter('public'); - $fd = fopen("/tftpboot/".$filename, "rb"); + $fd = fopen("/tmp/".$filename, "rb"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); - header('Content-Disposition: attachment; filename="'.$filename.'"'); + header('Content-Disposition: attachment; filename="'.$filename.'"'); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 - header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past - header("Content-Length: " . filesize("/tftpboot/".$filename)); + header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past + header("Content-Length: " . filesize("/tmp/".$filename)); fpassthru($fd); exit; } @@ -58,18 +58,18 @@ if ($_GET['a'] == "other") { if ($_GET['t'] == "restore") { $tmp = '/tmp/'; $filename = 'tftp.bak.tgz'; - + //extract a specific directory to /tftpboot if (file_exists('/tmp/'.$filename)) { //echo "The file $filename exists"; system('cd /; tar xvpfz /tmp/'.$filename); - system('chmod -R 744 /tftpboot/*'); + system('chmod -R 744 /tftpboot/*'); header( 'Location: tftp_files.php?savemsg=Backup+has+been+restored.' ) ; } else { header( 'Location: tftp_files.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ; - } - + } + exit; } } @@ -99,7 +99,8 @@ include("head.inc"); <?php include("fbegin.inc"); ?> <p class="pgtitle">TFTP: Files</p> -<?php +<?php +$savemsg = $_GET["savemsg"]; if ($savemsg) { print_info_box($savemsg); } @@ -111,7 +112,7 @@ if ($savemsg) { <?php $tab_array = array(); - $tab_array[] = array(gettext("Files"), false, "/tftp/tftp_files.php"); + $tab_array[] = array(gettext("Files"), false, "/packages/tftp/tftp_files.php"); display_top_tabs($tab_array); ?> @@ -169,9 +170,9 @@ if ($savemsg) { echo "<br /><br />\n"; echo "</td>\n"; echo "<td width='20%' valign='middle' align='right'>\n"; - echo " <input type='button' value='backup' onclick=\"document.location.href='/tftp/tftp_files.php?a=download&t=backup';\" />\n"; + echo " <input type='button' value='backup' onclick=\"document.location.href='/packages/tftp/tftp_files.php?a=download&t=backup';\" />\n"; if (file_exists('/tmp/tftp.bak.tgz')) { - echo " <input type='button' value='restore' onclick=\"document.location.href='/tftp/tftp_files.php?a=other&t=restore';\" />\n"; + echo " <input type='button' value='restore' onclick=\"document.location.href='/packages/tftp/tftp_files.php?a=other&t=restore';\" />\n"; } echo "</td>\n"; echo "</tr>\n"; diff --git a/pkg_config.7.xml b/pkg_config.7.xml index ab5c1c39..6c7fcbdd 100644..100755 --- a/pkg_config.7.xml +++ b/pkg_config.7.xml @@ -75,10 +75,10 @@ </package> <package> <name>Dashboard</name> - <descr>Adds pfSense dashboard that will be included with 2.0. This requires 1.2 or newer. WARNING! Cannot be deinstalled.</descr> + <descr>Adds pfSense dashboard that will be included with 2.0. WARNING! Cannot be deinstalled.</descr> <category>System</category> <config_file>http://www.pfsense.com/packages/config/dashboard/dashboard.xml</config_file> - <version>0.6.2</version> + <version>0.7.5.3</version> <status>BETA</status> <required_version>1.2</required_version> <maximum_version>1.9</maximum_version> @@ -92,7 +92,7 @@ <pkginfolink>http://doc.pfsense.org/index.php/FreeSWITCH</pkginfolink> <config_file>http://www.pfsense.com/packages/config/freeswitch/freeswitch.xml</config_file> <depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url> - <version>0.8.3.1</version> + <version>0.8.3.5</version> <status>Beta</status> <required_version>1.2.1</required_version> <maintainer>markjcrane@gmail.com</maintainer> @@ -120,7 +120,7 @@ <pkginfolink/> <config_file>http://www.pfsense.com/packages/config/tftp/tftp.xml</config_file> <depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url> - <version>1.0.2</version> + <version>1.0.5</version> <status>Stable</status> <required_version>1.2.1</required_version> <maintainer>markjcrane@gmail.com</maintainer> @@ -141,13 +141,41 @@ <configurationfile>phpservice.xml</configurationfile> </package> <package> + <name>Backup</name> + <website/> + <descr>Tool to Backup and Restore files and directories.</descr> + <category>System</category> + <pkginfolink></pkginfolink> + <config_file>http://www.pfsense.com/packages/config/backup/backup.xml</config_file> + <depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url> + <version>0.1.5</version> + <status>Beta</status> + <required_version>1.2</required_version> + <maintainer>markjcrane@gmail.com</maintainer> + <configurationfile>backup.xml</configurationfile> + </package> + <package> + <name>Cron</name> + <website/> + <descr>The cron utility is used to manage commands on a schedule.</descr> + <category>Services</category> + <pkginfolink></pkginfolink> + <config_file>http://www.pfsense.com/packages/config/cron/cron.xml</config_file> + <depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url> + <version>0.1.5</version> + <status>Beta</status> + <required_version>1.2</required_version> + <maintainer>markjcrane@gmail.com</maintainer> + <configurationfile>cron.xml</configurationfile> + </package> + <package> <name>snort</name> <descr>Snort is a libpcap-based packet sniffer/logger which can be used as a lightweight network intrusion detection system. It features rules based logging and can perform content searching/matching in addition to being used to detect a variety of other attacks and probes, such as buffer overflows, stealth port scans, CGI attacks, SMB probes, and much more.</descr> <category>Security</category> <depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url> <depends_on_package>snort-2.8.2.1.tbz</depends_on_package> <config_file>http://www.pfsense.com/packages/config/snort/snort.xml</config_file> - <version>2.8.2.6</version> + <version>2.8.2.6_2</version> <required_version>1.2</required_version> <status>Stable</status> <configurationfile>snort.xml</configurationfile> @@ -179,7 +207,7 @@ <depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url> <depends_on_package>siproxd-0.7.0_1.tbz</depends_on_package> <pkginfolink>http://doc.pfsense.org/index.php/Siproxd_package</pkginfolink> - <version>0.7.3</version> + <version>0.7.2</version> <status>Beta</status> <required_version>1.2.1</required_version> <configurationfile>siproxd.xml</configurationfile> @@ -238,11 +266,23 @@ <configurationfile>phpsysinfo.xml</configurationfile> </package> <package> + <name>Fit123</name> + <website>http://pfsense.comuf.com</website> + <descr>A list of small custom things that can be added to pfSense 1.2.3 : Date,Code-red,LTSP,AFC and DDNS</descr> + <category>System</category> + <version>0.0.1</version> + <status>ALPHA</status> + <required_version>1.2.3</required_version> + <maintainer>crazypark2@yahoo.dk</maintainer> + <config_file>http://www.pfsense.com/packages/config/Fit123/fit123.xml</config_file> + <configurationfile>fit123.xml</configurationfile> + </package> + <package> <name>dns-server</name> <descr>pfSense version of TinyDNS which features failover host support</descr> <website>http://cr.yp.to/djbdns.html</website> <category>Services</category> - <version>1.0.6</version> + <version>1.0.6.1</version> <status>Beta</status> <pkginfolink>http://doc.pfsense.org/index.php/Tinydns_package</pkginfolink> <required_version>1.2</required_version> @@ -320,7 +360,7 @@ <website>http://www.imspector.org/</website> <category>Network Management</category> <maintainer>billm@pfsense.org</maintainer> - <version>0.8-5</version> + <version>0.8-9</version> <required_version>1.2.1</required_version> <status>BETA</status> <pkginfolink>http://doc.pfsense.org/index.php/IMSpector_package</pkginfolink> @@ -329,8 +369,8 @@ <depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url> <depends_on_package>imspector-0.8.tbz</depends_on_package> <depends_on_package>libiconv-1.11_1.tbz</depends_on_package> - <depends_on_package>mysql-client-5.1.30.tbz</depends_on_package> - <depends_on_package>sqlite3-3.5.6.tbz</depends_on_package> + <depends_on_package>mysql-client-5.0.77.tbz</depends_on_package> + <depends_on_package>sqlite3-3.6.10.tbz</depends_on_package> </package> <package> <name>nut</name> @@ -437,7 +477,7 @@ <category>Network Management</category> <depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url> <depends_on_package>stunnel-4.25.tbz</depends_on_package> - <version>4.25.1</version> + <version>4.30.1</version> <status>Stable</status> <pkginfolink>http://doc.pfsense.org/index.php/Stunnel_package</pkginfolink> <required_version>1.2.1</required_version> @@ -506,7 +546,7 @@ <descr>EXPERIMENTAL! Not all directives are ported yet! High performance web proxy cache.</descr> <website>http://www.squid-cache.org/</website> <category>Network</category> - <version>3.0.8_07</version> + <version>3.0.8_08</version> <status>ALPHA</status> <required_version>1.2.1</required_version> <maintainer>fernando@netfilter.com.br seth.mos@xs4all.nl mfuchs77@googlemail.com</maintainer> @@ -590,5 +630,57 @@ <config_file>http://www.pfsense.com/packages/config/openvpn-client-export/openvpn-client-export.xml</config_file> <configurationfile>openvpn-client-export.xml</configurationfile> </package> + <package> + <name>HAVP</name> + <pkginfolink></pkginfolink> + <website>http://www.server-side.de/</website> + <descr>HAVP (HTTP Antivirus Proxy) is a proxy with a ClamAV anti-virus scanner. The main aims are continuous, non-blocking downloads and smooth scanning of dynamic and password protected HTTP traffic. Havp antivirus proxy has a parent and transparent proxy mode. It can be used with squid or standalone.</descr> + <category>Network Management</category> + <depends_on_package_base_url>http://files.pfsense.org/packages/7/All/</depends_on_package_base_url> + <depends_on_package>havp-0.88.tbz</depends_on_package> + <version>0.88</version> + <status>ALPHA</status> + <required_version>1.2.2</required_version> + <config_file>http://www.pfsense.com/packages/config/havp/havp.xml</config_file> + <configurationfile>havp.xml</configurationfile> + <maintainer>dv_serg@mail.ru</maintainer> + <after_install_info>Please check the HAVP settings.</after_install_info> + </package> + <package> + <name>onatproto</name> + <descr>Patch to add Protocol options to Manual Outbound NAT. WARNING! Cannot be uninstalled.</descr> + <category>System</category> + <config_file>http://www.pfsense.com/packages/config/onatproto/onatproto.xml</config_file> + <version>0.1</version> + <status>BETA</status> + <required_version>1.2.1</required_version> + <maximum_version>1.2.3</maximum_version> + </package> + <package> + <name>pfJailctl</name> + <descr>pfSense wrapper for jailctl - a jail management tool. Allows you to run jails on pfSense.</descr> + <website>http://anduin.net/jailctl/</website> + <category>System</category> + <version>0.51</version> + <required_version>1.2.3</required_version> + <status>BETA</status> + <pkginfolink>http://doc.pfsense.org/index.php/PfJailctl_package</pkginfolink> + <config_file>http://www.pfsense.com/packages/config/jailctl.xml</config_file> + <configurationfile>jailctl.xml</configurationfile> + <maintainer>ltning-jailctl@anduin.net</maintainer> + </package> + <package> + <name>jail_template</name> + <descr>Basic template for jails, probably requires pfJailctl to be useful. Includes 'base' and 'manpages' dists.</descr> + <website>http://anduin.net/jailctl/</website> + <category>System</category> + <version>0.2</version> + <required_version>1.2.3</required_version> + <status>BETA</status> + <pkginfolink>http://doc.pfsense.org/index.php/PfJailctl_package</pkginfolink> + <config_file>http://www.pfsense.com/packages/config/jail_template.xml</config_file> + <configurationfile>jail_template.xml</configurationfile> + <maintainer>ltning-jailctl@anduin.net</maintainer> + </package> </packages> </pfsensepkgs> diff --git a/pkg_config.xml b/pkg_config.xml index 856994fb..b54e5095 100644 --- a/pkg_config.xml +++ b/pkg_config.xml @@ -86,7 +86,7 @@ <descr>Adds pfSense dashboard that will be included with 2.0. This requires 1.2 or newer. WARNING! Cannot be deinstalled.</descr> <category>System</category> <config_file>http://www.pfsense.com/packages/config/dashboard/dashboard.xml</config_file> - <version>0.6.2</version> + <version>1.7.5.3</version> <status>BETA</status> <required_version>1.2</required_version> <maximum_version>1.9</maximum_version> @@ -451,7 +451,7 @@ <category>Network Management</category> <depends_on_package_base_url>http://files.pfsense.org/packages/All</depends_on_package_base_url> <depends_on_package>stunnel-4.19.tbz</depends_on_package> - <version>4.18.1</version> + <version>4.18.2</version> <status>Stable</status> <required_version>1.0</required_version> <config_file>http://www.pfsense.com/packages/config/stunnel.xml</config_file> |