├── console.php
├── config.php
├── welcome.php
├── script.sh
├── README.md
├── console_outer.php
├── login.php
├── admin.php
├── database.sql
├── functions.php
└── index.php
/console.php:
--------------------------------------------------------------------------------
1 | $live";
10 | ?>
--------------------------------------------------------------------------------
/config.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/welcome.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | Welcome
8 |
9 |
10 |
11 | Welcome
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 |
4 | everything=${@}
5 |
6 | fn_syntax(){
7 | echo "Usage: ${0} {URL|delete|clean}" >&2
8 | exit 0
9 | }
10 |
11 |
12 |
13 | case ${2} in
14 |
15 | variable)
16 | variable=`su -c "cat /home/srcds/${1}/script.sh | egrep -e ^${3}\=" srcds`
17 | variable=${variable##*\=}
18 | echo ${variable}
19 | ;;
20 | start)
21 | su -c "/home/srcds/${1}/script.sh start" srcds
22 | ;;
23 | stop)
24 | su -c "/home/srcds/${1}/script.sh stop" srcds
25 | ;;
26 | restart)
27 | su -c "/home/srcds/${1}/script.sh restart" srcds
28 | ;;
29 | details)
30 | su -c "/home/srcds/${1}/script.sh details" srcds
31 | ;;
32 | update)
33 | su -c "/home/srcds/${1}/script.sh update" srcds
34 | ;;
35 | command)
36 | su -c "tmux send-keys -t ${1} C-z \"${everything#*command\ }\" Enter" srcds
37 | ;;
38 | live)
39 | #su -c "/var/www/technz.info/srv/resize.sh" srcds
40 | su -c "tmux capture-pane -pS -20000 -t ${1} | tail -n 400" srcds
41 | ;;
42 | *)
43 | echo "Please select a valid server"
44 | ;;
45 | esac
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LinuxGSM-WebUI
2 | Web UI for LinuxGSM - initially purely internal
3 | Im not good at writing readme's and this code was never to see the light of day.
4 | lets see how this goes.
5 |
6 | this system make use of the SQL structure that ProFTPD uses for MySQL authentication.
7 | i suggest you make use of this functionality in order to allow yout users to keep FTP and web ui in sync.
8 |
9 | the code is written in basic php using a mysql database for storage, and a little bit of bash magic to pull it all together.
10 |
11 | the WebUI itself is handled purely from within its document root, however external function calls are made using absolute paths.
12 |
13 | if you operate users as a seperate user to your web server, you will need to adjust script.sh to match teh user and directory structure.
14 |
15 | i highly recommend creating a specific nopasswd entry in your /etc/sudoers file so that you can execute script.sh specifically.
16 | without sudo you will be prompted for the username when script.sh calls the su command, which wont be available to being a non interactive session.
17 |
18 | the majority of admin functionality can be done from withing the WebUI hwoever permission setting must be done directly through the MySQL database, simply change the 0 to 1 or vice versa for the respective serer id in the servers_username table.
19 |
20 | if you should ever need to manually change a users password without access the the WebUI admin functions, you can generate a password has by attempting to login with the user "hashme" and with the passsword you wish to have hashed, this will output the relevant hash that can be placed into the MySQL database to alter a users password.
21 |
22 | i hope that i have covered the majory of things that need to be adjusted, if you need any more information let me know.
23 |
24 | i am not looking to progress with this iteration on the WebUI any further, i am looking at starting a dynamic WebUI complete with server install and configuration functionality.
25 |
26 | Regards
27 | Techie
28 |
--------------------------------------------------------------------------------
/console_outer.php:
--------------------------------------------------------------------------------
1 |
13 |
14 |
22 |
23 |
31 |
32 | Server Type is $server_game
33 | Current IP: $server_ip
34 | Current port: $server_port
35 | Current port: $server_port
36 |
37 |
45 |
46 | Console:
47 |
48 |
54 | ";
55 |
56 | ?>
--------------------------------------------------------------------------------
/login.php:
--------------------------------------------------------------------------------
1 |
40 |
41 |
42 |
43 | Login Page
44 |
45 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
Login
69 |
70 |
71 |
72 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/admin.php:
--------------------------------------------------------------------------------
1 |
13 |
14 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
40 |
41 |
Set Password
42 |
50 |
51 |
52 |
Add Server
53 |
61 |
62 |
63 |
Delete Server
64 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/database.sql:
--------------------------------------------------------------------------------
1 | -- --------------------------------------------------------
2 | -- Host: 127.0.0.1
3 | -- Server version: 5.7.17-0ubuntu0.16.04.2 - (Ubuntu)
4 | -- Server OS: Linux
5 | -- HeidiSQL Version: 9.4.0.5125
6 | -- --------------------------------------------------------
7 |
8 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
9 | /*!40101 SET NAMES utf8 */;
10 | /*!50503 SET NAMES utf8mb4 */;
11 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
12 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
13 |
14 |
15 | -- Dumping database structure for database_name
16 | DROP DATABASE IF EXISTS `database_name`;
17 | CREATE DATABASE IF NOT EXISTS `database_name` /*!40100 DEFAULT CHARACTER SET latin1 */;
18 | USE `database_name`;
19 |
20 | -- Dumping structure for table database_name.ftpgroup
21 | DROP TABLE IF EXISTS `ftpgroup`;
22 | CREATE TABLE IF NOT EXISTS `ftpgroup` (
23 | `groupname` varchar(16) NOT NULL,
24 | `gid` smallint(6) NOT NULL DEFAULT '5500',
25 | `members` varchar(16) NOT NULL,
26 | KEY `groupname` (`groupname`)
27 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='ProFTP group table';
28 |
29 | -- Dumping data for table database_name.ftpgroup: 1 rows
30 | /*!40000 ALTER TABLE `ftpgroup` DISABLE KEYS */;
31 | INSERT INTO `ftpgroup` (`groupname`, `gid`, `members`) VALUES
32 | ('admin', 999, 'techie');
33 | /*!40000 ALTER TABLE `ftpgroup` ENABLE KEYS */;
34 |
35 | -- Dumping structure for table database_name.ftpuser
36 | DROP TABLE IF EXISTS `ftpuser`;
37 | CREATE TABLE IF NOT EXISTS `ftpuser` (
38 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
39 | `userid` varchar(32) NOT NULL DEFAULT '',
40 | `passwd` varchar(32) NOT NULL DEFAULT '',
41 | `uid` smallint(6) NOT NULL DEFAULT '999',
42 | `gid` smallint(6) NOT NULL DEFAULT '999',
43 | `homedir` varchar(255) NOT NULL DEFAULT '/home/ftpd/%u',
44 | `shell` varchar(16) NOT NULL DEFAULT '/sbin/nologin',
45 | `count` int(11) NOT NULL DEFAULT '0',
46 | `accessed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
47 | `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
48 | PRIMARY KEY (`id`),
49 | UNIQUE KEY `userid` (`userid`)
50 | ) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COMMENT='ProFTP user table';
51 |
52 | -- Dumping data for table database_name.ftpuser: 3 rows
53 | /*!40000 ALTER TABLE `ftpuser` DISABLE KEYS */;
54 | INSERT INTO `ftpuser` (`id`, `userid`, `passwd`, `uid`, `gid`, `homedir`, `shell`, `count`, `accessed`, `modified`) VALUES
55 | (1, 'techie', '{md5}X03MO1qnZdYdgyfeuILPmQ==', 999, 999, '/home/ftpd/%u', '/sbin/nologin', 50, '2017-04-10 20:39:31', '2017-04-04 19:03:24'),
56 | /*!40000 ALTER TABLE `ftpuser` ENABLE KEYS */;
57 |
58 | -- Dumping structure for table database_name.servers
59 | DROP TABLE IF EXISTS `servers`;
60 | CREATE TABLE IF NOT EXISTS `servers` (
61 | `id` int(11) NOT NULL AUTO_INCREMENT,
62 | `servername` varchar(255) NOT NULL,
63 | `serverfolder` varchar(255) NOT NULL,
64 | PRIMARY KEY (`id`)
65 | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
66 |
67 | -- Dumping data for table database_name.servers: ~6 rows (approximately)
68 | /*!40000 ALTER TABLE `servers` DISABLE KEYS */;
69 | INSERT INTO `servers` (`id`, `servername`, `serverfolder`) VALUES
70 | (1, 'Team Fortress Instaspawn', 'TF_IS'),
71 | /*!40000 ALTER TABLE `servers` ENABLE KEYS */;
72 |
73 | -- Dumping structure for table database_name.servers_default
74 | DROP TABLE IF EXISTS `servers_default`;
75 | CREATE TABLE IF NOT EXISTS `servers_default` (
76 | `id` int(11) NOT NULL,
77 | `active` bit(1) NOT NULL DEFAULT b'0',
78 | PRIMARY KEY (`id`),
79 | KEY `id` (`id`)
80 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
81 |
82 | -- Dumping data for table database_name.servers_default: ~5 rows (approximately)
83 | /*!40000 ALTER TABLE `servers_default` DISABLE KEYS */;
84 | INSERT INTO `servers_default` (`id`, `active`) VALUES
85 | (1, b'0'),
86 | /*!40000 ALTER TABLE `servers_default` ENABLE KEYS */;
87 |
88 | -- Dumping structure for table database_name.servers_techie
89 | DROP TABLE IF EXISTS `servers_techie`;
90 | CREATE TABLE IF NOT EXISTS `servers_techie` (
91 | `id` int(11) NOT NULL AUTO_INCREMENT,
92 | `active` bit(1) NOT NULL DEFAULT b'0',
93 | PRIMARY KEY (`id`),
94 | KEY `id` (`id`)
95 | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
96 |
97 | -- Dumping data for table database_name.servers_techie: ~5 rows (approximately)
98 | /*!40000 ALTER TABLE `servers_techie` DISABLE KEYS */;
99 | INSERT INTO `servers_admin` (`id`, `active`) VALUES
100 | (1, b'1'),
101 | /*!40000 ALTER TABLE `servers_techie` ENABLE KEYS */;
102 |
103 | /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
104 | /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
105 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
106 |
--------------------------------------------------------------------------------
/functions.php:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
16 |
35 |
36 |
37 | ";
56 | echo "Please try again
";
57 | }
58 | };
59 | ?>
60 |
61 |
75 |
76 |
88 |
89 | ";
105 | };
106 | };
107 | ?>
108 |
109 | ";
123 | };
124 | mysqli_query($db,"DELETE FROM servers WHERE id = " . $server_row["id"] . "");
125 | };
126 | ?>
127 |
128 |
139 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
20 |
21 |
48 |
49 |
58 |
59 |
60 |
61 |
62 |
63 |
67 |
101 |
135 |
136 |
137 |
138 |
139 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
199 |
200 |
201 |
202 |
--------------------------------------------------------------------------------