Add ACL support to the server (closes #25) #42
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#25 Add ACL support to the server
luca0N/lanbassador
Reference
luca0N/lanbassador!42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev_server_acl"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This pull request adds the ACL functionality to the server, which allows administrators to define which hosts have access to the server. At this time, the Lanbassador server will establish connection with any host it can reach, which may be undesirable due to the information being dealt with by Lanbassador. The ACL functionality makes it easy for administrators to prevent unauthorized access to their servers, and avoid sensitive/confidential data in their networks.
This pull request does not add account support, which is tracked by issue #26.
As for the configuration file path, I believe it should be kept on
/etc/lanbassador/server.cfgby default. The/etc/lanbassadorpath is already used in the web app Docker image1 Administrators should have the ability to override this path, either via an environment variable, command line option, or a build option (which would change the default hardcoded path).I think having the configuration file in the same path as the server program is bad design, since program executables are usually stored in
/usr/bin, and configuration files are usually stored in/etc. Even if Lanbassador were to be ported to Windows, that would still be bad design, since%ProgramFiles%is meant to be read only (hence the UAC requirement when installing programs there).ln -s /etc/lanbassador/client.json lanbassador-config.json↩︎
I don't really see much point in manually parsing an environment variable that points to the location of the Lanbassador server configuration file.
I would like to refactor the command line and environment variable parsing code1 at some point, but not in this pull request.
Ultimately, I think a new function could be created that handles command line arguments and environment variables. This function could accept two fundamental arguments: one for the command line option, and another for a (fallback) environment variable, returning the value that it was able to find. This would make the code cleaner (although, at this stage, it's not that complex), and would also make the implementation of further runtime preferences much smoother.
settingsPath := flag.String("config", LANBASSADOR_SERVER_DEFAULT_PATH, "<path to configuration file>")scanIface := flag.String("iface", "", "<interface name>")envIface, err := getEnvironKey("LANBASSADOR_INTERFACE")flag.Parse()loadSettings(*settingsPath)if *scanIface == "" {if err != nil {fmt.Fprintln(os.Stderr, "error: missing required parameter: iface")os.Exit(1)return}*scanIface = envIface}↩︎
I was originally planning on outright resetting (RST) the TCP connection when a host forbidden by ACL rules made any attempts to connect, but I think that would be bad design, so a 403 response is sent instead1.
w.WriteHeader(http.StatusForbidden)↩︎
WIP: Add ACL support to the server (closes #25)to Add ACL support to the server (closes #25)