2017-03-18 06:20:26 -04:00
|
|
|
(* Copyright (C) 2017, Thomas Leonard <thomas.leonard@unikernel.com>
|
2015-12-30 04:52:24 -05:00
|
|
|
See the README file for details. *)
|
|
|
|
|
|
|
|
(** Configuration for the "mirage" tool. *)
|
|
|
|
|
|
|
|
open Mirage
|
|
|
|
|
2017-03-15 04:56:24 -04:00
|
|
|
let table_size =
|
2022-03-30 03:12:01 -04:00
|
|
|
let info = Key.Arg.info
|
2017-03-15 04:56:24 -04:00
|
|
|
~doc:"The number of NAT entries to allocate."
|
|
|
|
~docv:"ENTRIES" ["nat-table-size"]
|
|
|
|
in
|
2022-03-30 03:12:01 -04:00
|
|
|
let key = Key.Arg.opt ~stage:`Both Key.Arg.int 5_000 info in
|
|
|
|
Key.create "nat_table_size" key
|
2017-03-15 04:56:24 -04:00
|
|
|
|
2023-06-30 10:58:08 -04:00
|
|
|
let ipv4 =
|
|
|
|
let doc = Key.Arg.info ~doc:"Manual IP setting." ["ipv4"] in
|
|
|
|
Key.(create "ipv4" Arg.(opt string "0.0.0.0" doc))
|
|
|
|
|
|
|
|
let ipv4_gw =
|
|
|
|
let doc = Key.Arg.info ~doc:"Manual Gateway IP setting." ["ipv4-gw"] in
|
|
|
|
Key.(create "ipv4_gw" Arg.(opt string "0.0.0.0" doc))
|
|
|
|
|
|
|
|
let ipv4_dns =
|
|
|
|
let doc = Key.Arg.info ~doc:"Manual DNS IP setting." ["ipv4-dns"] in
|
2023-07-01 10:49:07 -04:00
|
|
|
Key.(create "ipv4_dns" Arg.(opt string "10.139.1.1" doc))
|
2023-06-30 10:58:08 -04:00
|
|
|
|
|
|
|
let ipv4_dns2 =
|
|
|
|
let doc = Key.Arg.info ~doc:"Manual Second DNS IP setting." ["ipv4-dns2"] in
|
2023-07-01 10:49:07 -04:00
|
|
|
Key.(create "ipv4_dns2" Arg.(opt string "10.139.1.2" doc))
|
2023-06-30 10:58:08 -04:00
|
|
|
|
2015-12-30 04:52:24 -05:00
|
|
|
let main =
|
|
|
|
foreign
|
2023-06-30 10:58:08 -04:00
|
|
|
~keys:[
|
|
|
|
Key.v table_size;
|
|
|
|
Key.v ipv4;
|
|
|
|
Key.v ipv4_gw;
|
|
|
|
Key.v ipv4_dns;
|
|
|
|
Key.v ipv4_dns2;
|
|
|
|
]
|
2017-03-02 09:52:55 -05:00
|
|
|
~packages:[
|
2019-04-03 07:32:13 -04:00
|
|
|
package "vchan" ~min:"4.0.2";
|
2017-03-02 09:52:55 -05:00
|
|
|
package "cstruct";
|
2019-02-01 04:25:29 -05:00
|
|
|
package "astring";
|
2019-03-17 17:32:17 -04:00
|
|
|
package "tcpip" ~min:"3.7.0";
|
2020-12-03 15:19:46 -05:00
|
|
|
package ~min:"2.3.0" ~sublibs:["mirage"] "arp";
|
2022-01-09 06:36:35 -05:00
|
|
|
package ~min:"3.0.0" "ethernet";
|
2017-11-14 07:35:33 -05:00
|
|
|
package "shared-memory-ring" ~min:"3.0.0";
|
2022-11-11 07:37:43 -05:00
|
|
|
package ~min:"2.1.2" "netchannel";
|
2019-04-03 07:32:13 -04:00
|
|
|
package "mirage-net-xen";
|
2021-11-05 13:55:30 -04:00
|
|
|
package "ipaddr" ~min:"5.2.0";
|
2020-12-03 11:11:56 -05:00
|
|
|
package "mirage-qubes" ~min:"0.9.1";
|
2022-11-11 07:37:43 -05:00
|
|
|
package ~min:"3.0.1" "mirage-nat";
|
2017-03-02 09:52:55 -05:00
|
|
|
package "mirage-logs";
|
2022-07-27 08:26:58 -04:00
|
|
|
package "mirage-xen" ~min:"8.0.0";
|
2022-10-27 05:24:59 -04:00
|
|
|
package ~min:"6.4.0" "dns-client";
|
2020-04-29 09:58:01 -04:00
|
|
|
package "pf-qubes";
|
2017-03-02 09:52:55 -05:00
|
|
|
]
|
2022-03-30 03:12:01 -04:00
|
|
|
"Unikernel.Main" (random @-> mclock @-> time @-> job)
|
2015-12-30 04:52:24 -05:00
|
|
|
|
|
|
|
let () =
|
2022-03-30 03:12:01 -04:00
|
|
|
register "qubes-firewall" [main $ default_random $ default_monotonic_clock $ default_time]
|