Compare commits
2 commits
9d28b8531c
...
ac81a158b5
Author | SHA1 | Date | |
---|---|---|---|
Bailey Stevens | ac81a158b5 | ||
Bailey Stevens | 0bfad19f08 |
|
@ -23,7 +23,8 @@
|
|||
devShells.default = import ./shell.nix { inherit pkgs; };
|
||||
packages.frontend = pkgs.mmelodies.frontend;
|
||||
}
|
||||
) // {
|
||||
) // {
|
||||
nixosModules.default = import ./nixos;
|
||||
overlay =
|
||||
(final: super: {
|
||||
napalm = import inputs.napalm { pkgs = super; };
|
||||
|
|
13
nixos/default.nix
Normal file
13
nixos/default.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{pkgs, config, ...}:
|
||||
{
|
||||
services.nginx.enable = true;
|
||||
|
||||
services.nginx.virtualHosts."${config.networking.hostName}" = {
|
||||
addSSL = true;
|
||||
sslCertificate = "/etc/ssl/snakeoil.crt";
|
||||
sslCertificateKey = "/etc/ssl/snakeoil.key";
|
||||
root = pkgs.mmelodies.frontend;
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
}
|
28
nixos/ssl/README.md
Normal file
28
nixos/ssl/README.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
## Using a local CA for a PWA on Android
|
||||
|
||||
Generate selfsigned ssl keys with:
|
||||
```
|
||||
openssl genrsa -out ca.key
|
||||
openssl x509 -new -key ca.key -out ca.crt -subj '/CN=Motion Melodies Dummy CA' -extfile ca-options.txt
|
||||
|
||||
openssl genrsa -out ssl/melodypond.key
|
||||
|
||||
openssl req -new -sha256 -noenc -key melodypond.key -subj '/CN=melodypond' -out melodypond.csr
|
||||
openssl x509 -req -in melodypond.csr -CA ca.crt -CAkey ca.key -out melodypond.crt -extfile options.txt
|
||||
|
||||
cat melodypond.crt ca.crt > melodypond.chain.crt
|
||||
|
||||
# Then manually copy melodypond.key and melodypond.chain.crt to /etc/ssl on the server.
|
||||
# and onto the Android device used as the controller.
|
||||
```
|
||||
|
||||
These keys can then be added to the Android device used as the controller by going to
|
||||
`Settings >> Security >> Credentials >> Install >> CA` then selecting the certificate
|
||||
and rebooting the device.
|
||||
|
||||
If you are using a Firefox-based browser on the phone, you will also need to enable third party certificates
|
||||
in the Firefox app's developer settings.
|
||||
This can be accessed by tapping the logo on the about screen many times, then going to
|
||||
`Settings >> Secret Settings >> Use Third Party CAs`
|
||||
|
||||
Firefox should now show the site as secure and allow installing the PWA.
|
1
nixos/ssl/ca-options.txt
Normal file
1
nixos/ssl/ca-options.txt
Normal file
|
@ -0,0 +1 @@
|
|||
basicConstraints = CA:true
|
1
nixos/ssl/options.txt
Normal file
1
nixos/ssl/options.txt
Normal file
|
@ -0,0 +1 @@
|
|||
subjectAltName = DNS:melodypond, DNS:melodypond.lan
|
Loading…
Reference in a new issue