Menu

[r10232]: / trunk / gui / services / models.py  Maximize  Restore  History

Download this file

1403 lines (1336 with data), 56.4 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
#+
# Copyright 2010 iXsystems, Inc.
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing 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 BY THE AUTHOR ``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.
#
#####################################################################
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.validators import MinValueValidator, MaxValueValidator
from freenasUI import choices
from freeadmin.models import Model, UserField, GroupField, PathField
from storage.models import Volume, Disk
from freenasUI.middleware.notifier import notifier
from freenasUI.network.models import Alias
from services.exceptions import ServiceFailed
class services(Model):
srv_service = models.CharField(
max_length=120,
verbose_name=_("Service"),
help_text=_("Name of Service, should be auto-generated at build time")
)
srv_enable = models.BooleanField(
verbose_name=_("Enable Service"))
class Meta:
verbose_name = _("Services")
verbose_name_plural = _("Services")
def __unicode__(self):
return self.srv_service
def save(self, *args, **kwargs):
super(services, self).save(*args, **kwargs)
class CIFS(Model):
cifs_srv_authmodel = models.CharField(
max_length=10,
choices=choices.CIFSAUTH_CHOICES,
verbose_name=_("Authentication Model"),
help_text=_("Using Active Directory or LDAP authentication will supersede this option"),
)
cifs_srv_netbiosname = models.CharField(
max_length=120,
verbose_name=_("NetBIOS name")
)
cifs_srv_workgroup = models.CharField(
max_length=120,
verbose_name=_("Workgroup"),
help_text=_("Workgroup the server will appear to be in when queried by clients (maximum 15 characters).")
)
cifs_srv_description = models.CharField(
max_length=120,
verbose_name=_("Description"),
blank=True,
help_text=_("Server description. This can usually be left blank.")
)
cifs_srv_doscharset = models.CharField(
max_length=120,
choices=choices.DOSCHARSET_CHOICES,
default = "CP437",
verbose_name=_("DOS charset")
)
cifs_srv_unixcharset = models.CharField(
max_length=120,
choices=choices.UNIXCHARSET_CHOICES,
default = "UTF-8",
verbose_name=_("UNIX charset")
)
cifs_srv_loglevel = models.CharField(
max_length=120,
choices=choices.LOGLEVEL_CHOICES,
default = "Minimum",
verbose_name=_("Log level")
)
cifs_srv_localmaster = models.BooleanField(
verbose_name=_("Local Master"))
cifs_srv_timeserver = models.BooleanField(
verbose_name=_("Time Server for Domain"))
cifs_srv_guest = UserField(
max_length=120,
default="nobody",
exclude=["root"],
verbose_name=_("Guest account"),
help_text=_("Use this option to override the username ('nobody' by default) which will be used for access to services which are specified as guest. Whatever privileges this user has will be available to any client connecting to the guest service. This user must exist in the password file, but does not require a valid login. The user root can not be used as guest account.")
)
cifs_srv_guestok = models.BooleanField(
verbose_name=_("Allow guest access"))
cifs_srv_guestonly = models.BooleanField(
verbose_name=_("Only allow guest access"))
cifs_srv_filemask = models.CharField(
max_length=120,
verbose_name=_("File mask"),
blank=True,
help_text=_("Use this option to override the file creation mask (0666 by default).")
)
cifs_srv_dirmask = models.CharField(
max_length=120,
verbose_name=_("Directory mask"),
blank=True,
help_text=_("Use this option to override the directory creation mask (0777 by default).")
)
cifs_srv_largerw = models.BooleanField(
verbose_name=_("Large RW support"))
cifs_srv_sendfile = models.BooleanField(
verbose_name=_("Send files with sendfile(2)"))
cifs_srv_easupport = models.BooleanField(
verbose_name=_("EA Support"))
cifs_srv_dosattr = models.BooleanField(
verbose_name=_("Support DOS File Attributes"))
cifs_srv_nullpw = models.BooleanField(
verbose_name=_("Allow Empty Password"))
cifs_srv_smb_options = models.TextField(
max_length=120,
verbose_name=_("Auxiliary parameters"),
blank=True,
help_text=_("These parameters are added to [Global] section of smb.conf")
)
cifs_srv_homedir_enable = models.BooleanField(
verbose_name=_("Enable home directories"),
help_text=_("Enable/disable home directories for samba user.")
)
cifs_srv_homedir_browseable_enable = models.BooleanField(
verbose_name=_("Enable home directories browsing"),
help_text=_("Enable/disable home directories browsing for samba user."),
default=False,
)
cifs_srv_homedir = PathField(
verbose_name=_("Home directories"),
blank=True,
)
cifs_srv_unixext = models.BooleanField(
verbose_name=_("Unix Extensions"),
default=True,
help_text=_("These extensions enable Samba to better serve UNIX CIFS clients by supporting features such as symbolic links, hard links, etc..."),
)
cifs_srv_aio_enable = models.BooleanField(
default=False,
verbose_name=_("Enable AIO"),
help_text=_("Enable/disable AIO support.")
)
cifs_srv_aio_rs = models.IntegerField(
max_length=120,
verbose_name=_("Minimum AIO read size"),
help_text=_("Samba will read asynchronously if request size is larger than this value."),
default=4096,
)
cifs_srv_aio_ws = models.IntegerField(
max_length=120,
verbose_name=_("Minimum AIO write size"),
help_text=_("Samba will write asynchronously if request size is larger than this value."),
default=4096,
)
cifs_srv_zeroconf = models.BooleanField(
verbose_name=_("Zeroconf share discovery"),
default=True,
help_text=_("Zeroconf support via Avahi allows clients (the Mac OSX finder in particular) to automatically discover the CIFS shares on the system similar to the Computer Browser service in Windows."),
)
class Meta:
verbose_name = _(u"CIFS")
verbose_name_plural = _(u"CIFS")
class FreeAdmin:
deletable = False
icon_model = u"CIFSIcon"
class AFP(Model):
afp_srv_name = models.CharField(
max_length=120,
verbose_name=_("Server Name"),
help_text=_("Name of the server. If this field is left empty the default server is specified.")
)
afp_srv_guest = models.BooleanField(
verbose_name=_("Guest Access"),
help_text=_("Allows guest access to all apple shares on this box.")
)
afp_srv_guest_user = UserField(
max_length=120,
default="nobody",
exclude=["root"],
verbose_name=_("Guest account"),
help_text=_("Use this option to override the username ('nobody' by default) which will be used for access to services which are specified as guest. Whatever privileges this user has will be available to any client connecting to the guest service. This user must exist in the password file, but does not require a valid login. The user root can not be used as guest account.")
)
afp_srv_connections_limit = models.IntegerField(
max_length=120,
verbose_name=_('Max. Connections'),
validators=[MinValueValidator(1), MaxValueValidator(1000)],
help_text=_('Maximum number of connections permitted via AFP. The default limit is 50.'),
default=50,
)
class Meta:
verbose_name = _(u"AFP")
verbose_name_plural = _(u"AFP")
class FreeAdmin:
deletable = False
icon_model = u"AFPIcon"
class NFS(Model):
nfs_srv_servers = models.PositiveIntegerField(
default=4,
verbose_name=_("Number of servers"),
help_text=_("Specifies how many servers to create. There should be enough to handle the maximum level of concurrency from its clients, typically four to six.")
)
nfs_srv_async = models.BooleanField(
default = False,
verbose_name = _("Asynchronous mode"),
help_text = _("Enable asynchronous mode, which will help "
"performance beyond gigabit network speed.")
)
class Meta:
verbose_name = _("NFS")
verbose_name_plural = _("NFS")
class FreeAdmin:
deletable = False
icon_model = u"NFSIcon"
class iSCSITargetGlobalConfiguration(Model):
iscsi_basename = models.CharField(
max_length=120,
verbose_name=_("Base Name"),
help_text=_("The base name (e.g. iqn.2007-09.jp.ne.peach.istgt, see RFC 3720 and 3721 for details) will append the target name that is not starting with 'iqn.'")
)
iscsi_discoveryauthmethod = models.CharField(
max_length=120,
choices=choices.AUTHMETHOD_CHOICES,
default='Auto',
verbose_name=_("Discovery Auth Method")
)
iscsi_discoveryauthgroup = models.IntegerField(
max_length=120,
verbose_name=_("Discovery Auth Group"),
blank=True,
null=True,
)
iscsi_iotimeout = models.IntegerField(
max_length=120,
default=30,
verbose_name=_("I/O Timeout"),
help_text=_("I/O timeout in seconds (30 by default).")
)
iscsi_nopinint = models.IntegerField(
max_length=120,
default=20,
verbose_name=_("NOPIN Interval"),
help_text=_("NOPIN sending interval in seconds (20 by default).")
)
iscsi_maxsesh = models.IntegerField(
max_length=120,
default=16,
verbose_name=_("Max. sessions"),
help_text=_("Maximum number of sessions holding at same time (16 by default).")
)
iscsi_maxconnect = models.IntegerField(
max_length=120,
default=8,
verbose_name=_("Max. connections"),
help_text=_("Maximum number of connections in each session (8 by default).")
)
iscsi_r2t = models.IntegerField(
max_length=120,
default=32,
verbose_name=_("Max. pre-send R2T"),
help_text=_("Maximum number of pre-send R2T in each connection (32 by default). The actual number is limited to QueueDepth of the target."),
)
iscsi_maxoutstandingr2t = models.IntegerField(
max_length=120,
default=16,
verbose_name=_("MaxOutstandingR2T"),
help_text=_("iSCSI initial parameter (16 by default).")
)
iscsi_firstburst = models.IntegerField(
max_length=120,
default=65536,
verbose_name=_("First burst length"),
help_text=_("iSCSI initial parameter (65536 by default).")
)
iscsi_maxburst = models.IntegerField(
max_length=120,
default=262144,
verbose_name=_("Max burst length"),
help_text=_("iSCSI initial parameter (262144 by default).")
)
iscsi_maxrecdata = models.IntegerField(
max_length=120,
default=262144,
verbose_name=_("Max receive data segment length"),
help_text=_("iSCSI initial parameter (262144 by default).")
)
iscsi_defaultt2w = models.IntegerField(
max_length=120,
default=2,
verbose_name=_("DefaultTime2Wait"),
help_text=_("iSCSI initial parameter (2 by default).")
)
iscsi_defaultt2r = models.IntegerField(
max_length=120,
default=60,
verbose_name=_("DefaultTime2Retain"),
help_text=_("iSCSI initial parameter (60 by default)."),
)
# TODO: This should not be here. When enabled, all these fields became mandatory.
iscsi_toggleluc = models.BooleanField(
default=False,
verbose_name=_("Enable LUC"))
iscsi_lucip = models.IPAddressField(
max_length=120,
default = "127.0.0.1",
verbose_name=_("Controller IP address"),
help_text=_("Logical Unit Controller IP address (127.0.0.1(localhost) by default)"),
blank=True,
)
iscsi_lucport = models.IntegerField(
default=3261,
verbose_name=_("Controller TCP port"),
help_text=_("Logical Unit Controller TCP port (3261 by default)"),
blank=True,
null=True,
)
iscsi_luc_authnetwork = models.IPAddressField(
max_length=120,
verbose_name=_("Controller Authorized netmask"),
default = "255.255.255.0",
help_text=_("Logical Unit Controller Authorized netmask (255.255.255.0 by default)"),
blank=True,
)
iscsi_luc_authmethod = models.CharField(
max_length=120,
choices=choices.AUTHMETHOD_CHOICES,
default = "chap",
verbose_name=_("Controller Auth Method"),
help_text=_("The method can be accepted in the controller."),
blank=True,
)
iscsi_luc_authgroup = models.IntegerField(
max_length=120,
verbose_name=_("Controller Auth Group"),
help_text=_("The istgtcontrol can access the targets with correct user and secret in specific Auth Group."),
blank=True,
null=True,
)
class Meta:
verbose_name = _(u"Target Global Configuration")
verbose_name_plural = _(u"Target Global Configuration")
class FreeAdmin:
deletable = False
menu_child_of = "ISCSI"
icon_model = u"SettingsIcon"
nav_extra = {'type': 'iscsi'}
class iSCSITargetExtent(Model):
iscsi_target_extent_name = models.CharField(
max_length=120,
unique=True,
verbose_name = _("Extent Name"),
help_text = _("String identifier of the extent."),
)
iscsi_target_extent_type = models.CharField(
max_length=120,
verbose_name = _("Extent Type"),
help_text = _("Type used as extent."),
choices=choices.ISCSI_TARGET_EXTENT_TYPE_CHOICES,
)
iscsi_target_extent_path = models.CharField(
max_length=120,
verbose_name = _("Path to the extent"),
help_text = _("File path (e.g. /mnt/sharename/extent/extent0) used as extent."),
)
iscsi_target_extent_filesize = models.CharField(
max_length=120,
default=0,
verbose_name = _("Extent size"),
help_text = _("Size of extent, 0 means auto, a raw number is bytes, or suffix with KB, MB, TB for convenience."),
)
iscsi_target_extent_comment = models.CharField(
blank=True,
max_length=120,
verbose_name = _("Comment"),
help_text = _("You may enter a description here for your reference."),
)
class Meta:
verbose_name = _("Extent")
class FreeAdmin:
delete_form = "ExtentDelete"
delete_form_filter = {'iscsi_target_extent_type__exact': 'File'} #FIXME hack for DevExtent
menu_child_of = "ISCSI"
icon_object = u"ExtentIcon"
icon_model = u"ExtentIcon"
icon_add = u"AddExtentIcon"
icon_view = u"ViewAllExtentsIcon"
def __unicode__(self):
return unicode(self.iscsi_target_extent_name)
def get_device(self):
if self.iscsi_target_extent_type not in ("Disk", "ZVOL"):
return self.iscsi_target_extent_path
else:
try:
disk = Disk.objects.get(id=self.iscsi_target_extent_path)
if disk.disk_multipath_name:
return "/dev/%s" % disk.devname
else:
return "/dev/%s" % notifier().identifier_to_device(disk.disk_identifier)
except:
return self.iscsi_target_extent_path
def delete(self):
if self.iscsi_target_extent_type in ("Disk", "ZVOL"):
try:
disk = Disk.objects.get(id=self.iscsi_target_extent_path)
if self.iscsi_target_extent_type == "Disk":
notifier().unlabel_disk(disk.identifier_to_device())
disk.delete()
expected_iscsi_volume_name = 'iscsi:' + self.iscsi_target_extent_name
vol = Volume.objects.get(vol_name = expected_iscsi_volume_name)
vol.delete()
except:
pass
for te in iSCSITargetToExtent.objects.filter(iscsi_extent=self):
te.delete()
super(iSCSITargetExtent, self).delete()
class iSCSITargetPortal(Model):
iscsi_target_portal_tag = models.IntegerField(
max_length=120,
default=1,
verbose_name = _("Portal Group ID"),
)
iscsi_target_portal_comment = models.CharField(
max_length=120,
blank=True,
verbose_name = _("Comment"),
help_text = _("You may enter a description here for your reference.")
)
class Meta:
verbose_name = _("Portal")
class FreeAdmin:
menu_child_of = "ISCSI"
icon_object = u"PortalIcon"
icon_model = u"PortalIcon"
icon_add = u"AddPortalIcon"
icon_view = u"ViewAllPortalsIcon"
inlines = [
{
'form': 'iSCSITargetPortalIPForm',
'prefix': 'portalip_set',
},
]
def __unicode__(self):
if self.iscsi_target_portal_comment != "":
return u"%s (%s)" % (self.iscsi_target_portal_tag, self.iscsi_target_portal_comment)
else:
return unicode(self.iscsi_target_portal_tag)
def delete(self):
super(iSCSITargetPortal, self).delete()
portals = iSCSITargetPortal.objects.all().order_by('iscsi_target_portal_tag')
for portal, idx in zip(portals, xrange(1, len(portals) + 1)):
portal.iscsi_target_portal_tag = idx
portal.save()
started = notifier().reload("iscsitarget")
if started is False and services.objects.get(srv_service='iscsitarget').srv_enable:
raise ServiceFailed("iscsitarget", _("The iSCSI service failed to reload."))
class iSCSITargetPortalIP(Model):
iscsi_target_portalip_portal = models.ForeignKey(
iSCSITargetPortal,
verbose_name=_("Portal"),
)
iscsi_target_portalip_ip = models.IPAddressField(
verbose_name=_("IP Address"),
)
iscsi_target_portalip_port = models.SmallIntegerField(
verbose_name=_("Port"),
default=3260,
validators=[MinValueValidator(1), MaxValueValidator(65535)],
)
class Meta:
unique_together = (
('iscsi_target_portalip_ip', 'iscsi_target_portalip_port'),
)
verbose_name = _("Portal IP")
class iSCSITargetAuthorizedInitiator(Model):
iscsi_target_initiator_tag = models.IntegerField(
default=1,
unique=True,
verbose_name = _("Group ID"),
)
iscsi_target_initiator_initiators = models.TextField(
max_length=2048,
verbose_name = _("Initiators"),
default = "ALL",
help_text = _("Initiator authorized to access to the iSCSI target. It takes a name or 'ALL' for any initiators.")
)
iscsi_target_initiator_auth_network = models.TextField(
max_length=2048,
verbose_name = _("Authorized network"),
default = "ALL",
help_text = _("Network authorized to access to the iSCSI target. It takes IP or CIDR addresses or 'ALL' for any IPs.")
)
iscsi_target_initiator_comment = models.CharField(
max_length=120,
blank=True,
verbose_name = _("Comment"),
help_text = _("You may enter a description here for your reference.")
)
class Meta:
verbose_name = _("Initiator")
class FreeAdmin:
menu_child_of = "ISCSI"
icon_object = u"InitiatorIcon"
icon_model = u"InitiatorIcon"
icon_add = u"AddInitiatorIcon"
icon_view = u"ViewAllInitiatorsIcon"
def __unicode__(self):
if self.iscsi_target_initiator_comment != "":
return u"%s (%s)" % (self.iscsi_target_initiator_tag, self.iscsi_target_initiator_comment)
else:
return unicode(self.iscsi_target_initiator_tag)
def delete(self):
super(iSCSITargetAuthorizedInitiator, self).delete()
portals = iSCSITargetAuthorizedInitiator.objects.all().order_by('iscsi_target_initiator_tag')
idx = 1
for portal in portals:
portal.iscsi_target_initiator_tag = idx
portal.save()
idx += 1
class iSCSITargetAuthCredential(Model):
iscsi_target_auth_tag = models.IntegerField(
default=1,
verbose_name = _("Group ID"),
)
iscsi_target_auth_user = models.CharField(
max_length=120,
verbose_name = _("User"),
help_text = _("Target side user name. It is usually the initiator name by default."),
)
iscsi_target_auth_secret = models.CharField(
max_length=120,
verbose_name = _("Secret"),
help_text = _("Target side secret."),
)
iscsi_target_auth_peeruser = models.CharField(
max_length=120,
blank=True,
verbose_name = _("Peer User"),
help_text = _("Initiator side secret. (for mutual CHAP authentication)"),
)
iscsi_target_auth_peersecret = models.CharField(
max_length=120,
verbose_name = _("Peer Secret"),
help_text = _("Initiator side secret. (for mutual CHAP authentication)"),
)
class Meta:
verbose_name = _("Authorized Access")
verbose_name_plural = _("Authorized Accesses")
class FreeAdmin:
menu_child_of = "ISCSI"
icon_object = u"AuthorizedAccessIcon"
icon_model = u"AuthorizedAccessIcon"
icon_add = u"AddAuthorizedAccessIcon"
icon_view = u"ViewAllAuthorizedAccessIcon"
def __unicode__(self):
return unicode(self.iscsi_target_auth_tag)
class iSCSITarget(Model):
iscsi_target_name = models.CharField(
unique=True,
max_length=120,
verbose_name = _("Target Name"),
help_text = _("Base Name will be appended automatically when starting without 'iqn.'."),
)
iscsi_target_alias = models.CharField(
unique=True,
blank=True,
null=True,
max_length=120,
verbose_name = _("Target Alias"),
help_text = _("Optional user-friendly string of the target."),
)
iscsi_target_serial = models.CharField(
verbose_name=_("Serial"),
max_length=16,
default="10000001",
help_text=_("Serial number for the logical unit")
)
iscsi_target_type = models.CharField(
max_length=120,
choices=choices.ISCSI_TARGET_TYPE_CHOICES,
default='Disk',
verbose_name = _("Type"),
help_text = _("Logical Unit Type mapped to LUN."),
)
iscsi_target_flags = models.CharField(
max_length=120,
choices=choices.ISCSI_TARGET_FLAGS_CHOICES,
default='rw',
verbose_name = _("Target Flags"),
)
iscsi_target_portalgroup = models.ForeignKey(
iSCSITargetPortal,
verbose_name = _("Portal Group ID"),
)
iscsi_target_initiatorgroup = models.ForeignKey(
iSCSITargetAuthorizedInitiator,
verbose_name = _("Initiator Group ID"),
)
iscsi_target_authtype = models.CharField(
max_length=120,
choices = choices.AUTHMETHOD_CHOICES,
default = "Auto",
verbose_name = _("Auth Method"),
help_text = _("The method can be accepted by the target. Auto means both none and authentication."),
)
iscsi_target_authgroup = models.IntegerField(
max_length=120,
verbose_name = _("Authentication Group ID"),
null=True,
blank=True,
)
iscsi_target_initialdigest = models.CharField(
max_length=120,
default = "Auto",
verbose_name = _("Auth Method"),
help_text = _("The method can be accepted by the target. Auto means both none and authentication."),
)
iscsi_target_queue_depth = models.IntegerField(
max_length=3,
default=32,
verbose_name = _("Queue Depth"),
help_text = _("0=disabled, 1-255=enabled command queuing with specified depth. The recommended queue depth is 32."),
)
iscsi_target_logical_blocksize = models.IntegerField(
max_length=3,
default=512,
verbose_name = _("Logical Block Size"),
help_text = _("You may specify logical block length (512 by default). The recommended length for compatibility is 512."),
)
class Meta:
verbose_name = _("Target")
class FreeAdmin:
menu_child_of = "ISCSI"
icon_object = u"TargetIcon"
icon_model = u"TargetIcon"
icon_add = u"AddTargetIcon"
icon_view = u"ViewAllTargetsIcon"
def __unicode__(self):
return self.iscsi_target_name
def delete(self):
for te in iSCSITargetToExtent.objects.filter(iscsi_target=self):
te.delete()
super(iSCSITarget, self).delete()
class iSCSITargetToExtent(Model):
iscsi_target = models.ForeignKey(
iSCSITarget,
verbose_name = _("Target"),
help_text = _("Target this extent belongs to"),
)
iscsi_extent = models.ForeignKey(
iSCSITargetExtent,
unique=True,
verbose_name = _("Extent"),
)
class Meta:
verbose_name = _("Target / Extent")
verbose_name_plural = _("Targets / Extents")
def __unicode__(self):
return unicode(self.iscsi_target) + u' / ' + unicode(self.iscsi_extent)
def delete(self):
super(iSCSITargetToExtent, self).delete()
started = notifier().reload("iscsitarget")
if started is False and services.objects.get(srv_service='iscsitarget').srv_enable:
raise ServiceFailed("iscsitarget", _("The iSCSI service failed to reload."))
class FreeAdmin:
menu_child_of = "ISCSI"
icon_object = u"TargetExtentIcon"
icon_model = u"TargetExtentIcon"
icon_add = u"AddTargetExtentIcon"
icon_view = u"ViewAllTargetExtentsIcon"
class DynamicDNS(Model):
ddns_provider = models.CharField(
max_length=120,
choices=choices.DYNDNSPROVIDER_CHOICES,
default='dyndns',
blank=True,
verbose_name = _("Provider")
)
ddns_domain = models.CharField(
max_length=120,
verbose_name = _("Domain name"),
blank=True,
help_text = _("A host name alias. This option can appear multiple times, for each domain that has the same IP. Use a space to separate multiple alias names.")
)
ddns_username = models.CharField(
max_length=120,
verbose_name = _("Username")
)
ddns_password = models.CharField(
max_length=120,
verbose_name = _("Password")
) # need to make this a 'password' field, but not available in django Models
ddns_updateperiod = models.CharField(
max_length=120,
verbose_name = _("Update period"),
blank=True,
help_text = _("Time in milliseconds")
)
ddns_fupdateperiod = models.CharField(
max_length=120,
verbose_name = _("Forced update period"),
blank=True
)
ddns_options = models.TextField(
verbose_name = _("Auxiliary parameters"),
blank=True,
help_text = _("These parameters will be added to global settings in inadyn.conf.")
)
class Meta:
verbose_name = _("Dynamic DNS")
verbose_name_plural = _("Dynamic DNS")
class FreeAdmin:
deletable = False
icon_model = u"DDNSIcon"
class Plugins(Model):
jail_path = PathField(
verbose_name=_("Plugins jail path"),
help_text = _("Path to the plugins jail"),
default='',
blank=True
)
jail_name = models.CharField(
max_length=120,
verbose_name = _("Jail name"),
help_text = _("Name of the plugins jail"),
default='',
blank=True
)
jail_ip = models.ForeignKey(
Alias,
verbose_name=_("Jail IP address")
)
plugins_path = PathField(
verbose_name=_("Plugins Path"),
help_text = _("Path to the plugins directory"),
default='',
blank=True
)
class Meta:
verbose_name = _("Plugins")
verbose_name_plural = _("Plugins")
class FreeAdmin:
deletable = False
icon_model = u"SettingsIcon"
class SNMP(Model):
snmp_location = models.CharField(
max_length=255,
verbose_name = _("Location"),
blank=True,
help_text = _("Location information, e.g. physical location of this system: 'Floor of building, Room xyzzy'.")
)
snmp_contact = models.CharField(
max_length=120,
verbose_name = _("Contact"),
blank=True,
help_text = _("Contact information, e.g. name or email of the person responsible for this system: 'admin@email.address'.")
)
snmp_community = models.CharField(
max_length=120,
verbose_name = _("Community"),
help_text = _("In most cases, 'public' is used here.")
)
snmp_traps = models.BooleanField(
verbose_name = _("Send SNMP Traps"))
snmp_options = models.TextField(
verbose_name = _("Auxiliary parameters"),
blank=True,
help_text = _("These parameters will be added to global settings in inadyn.conf.")
)
class Meta:
verbose_name = _("SNMP")
verbose_name_plural = _("SNMP")
class FreeAdmin:
deletable = False
icon_model = u"SNMPIcon"
advanced_fields = ('snmp_traps',)
class UPS(Model):
ups_identifier = models.CharField(
max_length=120,
verbose_name = _("Identifier"),
help_text = _("This name is used to uniquely identify your UPS on this system.")
)
ups_driver = models.CharField(
max_length=120,
verbose_name = _("Driver"),
choices=choices.UPSDRIVER_CHOICES(),
blank=True,
help_text = _("The driver used to communicate with your UPS.")
)
ups_port = models.CharField(
max_length=120,
verbose_name = _("Port"),
blank=True,
help_text = _("The serial or USB port where your UPS is connected.")
)
ups_options = models.TextField(
verbose_name = _("Auxiliary parameters (ups.conf)"),
blank=True,
help_text = _("Additional parameters to the hardware-specific part of the driver.")
)
ups_description = models.CharField(
max_length=120,
verbose_name = _("Description"),
blank=True
)
ups_shutdown = models.CharField(
max_length=120,
choices=choices.UPS_CHOICES,
default='batt',
verbose_name = _("Shutdown mode")
)
ups_shutdowntimer = models.CharField(
max_length=120,
verbose_name = _("Shutdown timer"),
help_text = _("The time in seconds until shutdown is initiated. If the UPS happens to come back before the time is up the shutdown is canceled.")
)
ups_masterpwd = models.CharField(
max_length=30,
default="fixmepass",
verbose_name=_("UPS Master User Password"),
)
ups_extrausers = models.TextField(
blank=True,
verbose_name=_("Extra users (upsd.users)"),
)
ups_rmonitor = models.BooleanField(
verbose_name = _("Remote Monitor"))
ups_emailnotify = models.BooleanField(
verbose_name = _("Send Email Status Updates"))
ups_toemail = models.CharField(
max_length=120,
verbose_name = _("To email"),
blank=True,
help_text = _("Destination email address. Separate email addresses by semi-colon.")
)
ups_subject = models.CharField(
max_length=120,
verbose_name = _("Email Subject"),
help_text = _("The subject of the email. You can use the following parameters for substitution:<br /><ul><li>%d - Date</li><li>%h - Hostname</li></ul>")
)
class Meta:
verbose_name = _("UPS")
verbose_name_plural = _("UPS")
class FreeAdmin:
deletable = False
icon_model = u"UPSIcon"
class FTP(Model):
ftp_port = models.PositiveIntegerField(
default=21,
verbose_name = _("Port"),
validators=[MinValueValidator(1), MaxValueValidator(65535)],
help_text = _("Port to bind FTP server.")
)
ftp_clients = models.PositiveIntegerField(
default=32,
verbose_name = _("Clients"),
validators=[MinValueValidator(0), MaxValueValidator(10000)],
help_text = _("Maximum number of simultaneous clients.")
)
ftp_ipconnections = models.PositiveIntegerField(
default=0,
verbose_name = _("Connections"),
validators=[MinValueValidator(0), MaxValueValidator(1000)],
help_text = _("Maximum number of connections per IP address (0 = unlimited).")
)
ftp_loginattempt = models.PositiveIntegerField(
default=3,
verbose_name = _("Login Attempts"),
validators=[MinValueValidator(0), MaxValueValidator(1000)],
help_text = _("Maximum number of allowed password attempts before disconnection.")
)
ftp_timeout = models.PositiveIntegerField(
default=120,
verbose_name = _("Timeout"),
validators=[MinValueValidator(0), MaxValueValidator(10000)],
help_text = _("Maximum idle time in seconds.")
)
ftp_rootlogin = models.BooleanField(
verbose_name = _("Allow Root Login"))
ftp_onlyanonymous = models.BooleanField(
verbose_name = _("Allow Anonymous Login"))
ftp_anonpath = PathField(
blank=True,
verbose_name = _("Path"))
ftp_onlylocal = models.BooleanField(
verbose_name = _("Allow Local User Login"))
ftp_banner = models.TextField(
max_length=120,
verbose_name = _("Banner"),
blank=True,
help_text = _("Greeting banner displayed by FTP when a connection first comes in.")
)
ftp_filemask = models.CharField(
max_length=3,
default = "077",
verbose_name = _("File mask"),
help_text = _("Use this option to override the file creation mask (077 by default).")
)
ftp_dirmask = models.CharField(
max_length=3,
default="077",
verbose_name = _("Directory mask"),
help_text = _("Use this option to override the file creation mask (077 by default).")
)
ftp_fxp = models.BooleanField(
verbose_name = _("Enable FXP"))
ftp_resume = models.BooleanField(
verbose_name = _("Allow Transfer Resumption"))
ftp_defaultroot = models.BooleanField(
verbose_name = _("Always Chroot")) # Is this right?
ftp_ident = models.BooleanField(
verbose_name = _("Require IDENT Authentication"))
ftp_reversedns = models.BooleanField(
verbose_name = _("Require Reverse DNS for IP"))
ftp_masqaddress = models.CharField(
verbose_name = _("Masquerade address"),
blank = True,
max_length = 120,
help_text = _("Causes the server to display the network information for the specified address to the client, on the assumption that IP address or DNS host is acting as a NAT gateway or port forwarder for the server.")
)
ftp_passiveportsmin = models.PositiveIntegerField(
default = 0,
verbose_name = _("Minimum passive port"),
validators=[MinValueValidator(0), MaxValueValidator(10000)],
help_text = _("The minimum port to allocate for PASV style data connections (0 = use any port).")
)
ftp_passiveportsmax = models.PositiveIntegerField(
default = 0,
verbose_name = _("Maximum passive port"),
help_text = _("The maximum port to allocate for PASV style data connections (0 = use any port). Passive ports restricts the range of ports from which the server will select when sent the PASV command from a client. The server will randomly choose a number from within the specified range until an open port is found. The port range selected must be in the non-privileged range (eg. greater than or equal to 1024). It is strongly recommended that the chosen range be large enough to handle many simultaneous passive connections (for example, 49152-65534, the IANA-registered ephemeral port range).")
)
ftp_localuserbw = models.PositiveIntegerField(
default=0,
verbose_name = _("Local user upload bandwidth"),
help_text = _("Local user upload bandwidth in KB/s. Zero means infinity.")
)
ftp_localuserdlbw = models.PositiveIntegerField(
default=0,
verbose_name = _("Local user download bandwidth"),
help_text = _("Local user download bandwidth in KB/s. Zero means infinity.")
)
ftp_anonuserbw = models.PositiveIntegerField(
default=0,
verbose_name = _("Anonymous user upload bandwidth"),
help_text = _("Anonymous user upload bandwidth in KB/s. Zero means infinity.")
)
ftp_anonuserdlbw = models.PositiveIntegerField(
default=0,
verbose_name = _("Anonymous user download bandwidth"),
help_text = _("Anonymous user download bandwidth in KB/s. Zero means infinity.")
)
ftp_ssltls = models.BooleanField(
verbose_name = _("Enable SSL/TLS"))
ftp_options = models.TextField(
max_length=120,
verbose_name = _("Auxiliary parameters"),
blank=True,
help_text = _("These parameters are added to proftpd.conf.")
)
class Meta:
verbose_name = _("FTP")
verbose_name_plural = _("FTP")
class FreeAdmin:
deletable = False
icon_model = "FTPIcon"
class TFTP(Model):
tftp_directory = PathField(
verbose_name = _("Directory"),
help_text = _("The directory containing the files you want to publish. The remote host does not need to pass along the directory as part of the transfer."),
)
tftp_newfiles = models.BooleanField(
verbose_name = _("Allow New Files"))
tftp_port = models.PositiveIntegerField(
verbose_name = _("Port"),
validators=[MinValueValidator(1), MaxValueValidator(65535)],
help_text = _("The port to listen to. The default is to listen to the tftp port specified in /etc/services.")
)
tftp_username = UserField(
max_length=120,
default = "nobody",
verbose_name = _("Username"),
help_text = _("Specifies the username which the service will run as.")
)
tftp_umask = models.CharField(
max_length=120,
verbose_name = _("umask"),
help_text = _("Set the umask for newly created files to the specified value. The default is 022 (everyone can read, nobody can write).")
)
tftp_options = models.CharField(
max_length=120,
verbose_name = _("Extra options"),
blank=True,
help_text = _("Extra command line options (usually empty).")
)
class Meta:
verbose_name = _("TFTP")
verbose_name_plural = _("TFTP")
class FreeAdmin:
deletable = False
icon_model = "TFTPIcon"
class SSH(Model):
ssh_tcpport = models.PositiveIntegerField(
verbose_name = _("TCP Port"),
validators=[MinValueValidator(1), MaxValueValidator(65535)],
help_text = _("Alternate TCP port. Default is 22"),
)
ssh_rootlogin = models.BooleanField(
verbose_name = _("Login as Root with password"),
help_text = _("Disabled: Root can only login via public key authentication; Enabled: Root login permitted with password")
)
ssh_passwordauth = models.BooleanField(
verbose_name = _("Allow Password Authentication"))
ssh_tcpfwd = models.BooleanField(
verbose_name = _("Allow TCP Port Forwarding"))
ssh_compression = models.BooleanField(
verbose_name = _("Compress Connections"))
ssh_privatekey = models.TextField(
max_length=1024,
verbose_name = _("Host Private Key"),
blank=True,
help_text = _("Paste a RSA PRIVATE KEY in PEM format here.")
)
ssh_options = models.TextField(
max_length=120,
verbose_name = _("Extra options"),
blank=True,
help_text = _("Extra options to /etc/ssh/sshd_config (usually empty). Note, incorrect entered options prevent SSH service to be started.")
)
ssh_host_dsa_key = models.TextField(
max_length=1024,
editable=False,
blank=True,
null=True
)
ssh_host_dsa_key_pub = models.TextField(
max_length=1024,
editable=False,
blank=True,
null=True
)
ssh_host_ecdsa_key = models.TextField(
max_length=1024,
editable=False,
blank=True,
null=True
)
ssh_host_ecdsa_key_pub = models.TextField(
max_length=1024,
editable=False,
blank=True,
null=True
)
ssh_host_key = models.TextField(
max_length=1024,
editable=False,
blank=True,
null=True
)
ssh_host_key_pub = models.TextField(
max_length=1024,
editable=False,
blank=True,
null=True
)
ssh_host_rsa_key = models.TextField(
max_length=1024,
editable=False,
blank=True,
null=True
)
ssh_host_rsa_key_pub = models.TextField(
max_length=1024,
editable=False,
blank=True,
null=True
)
class Meta:
verbose_name = _("SSH")
verbose_name_plural = _("SSH")
class FreeAdmin:
deletable = False
icon_model = "OpenSSHIcon"
class ActiveDirectory(Model):
ad_dcname = models.CharField(
max_length=120,
verbose_name = _("Domain Controller Name"),
help_text = _("AD or PDC name.")
)
ad_domainname = models.CharField(
max_length=120,
verbose_name = _("Domain Name (DNS/Realm-Name)"),
help_text = _("Domain Name, eg example.com")
)
ad_netbiosname = models.CharField(
max_length=120,
verbose_name = _("NetBIOS Name"),
help_text = _("System hostname")
)
ad_workgroup = models.CharField(
max_length=120,
verbose_name = _("Workgroup Name"),
help_text = _("Workgroup or domain name in old format, eg WORKGROUP")
)
ad_allow_trusted_doms = models.BooleanField(
default=False,
verbose_name=_("Allow Trusted Domains"),
)
ad_adminname = models.CharField(
max_length=120,
verbose_name = _("Administrator Name"),
help_text = _("Domain Administrator account name")
)
ad_adminpw = models.CharField(
max_length=120,
verbose_name = _("Administrator Password"),
help_text = _("Domain Administrator account password.")
)
class Meta:
verbose_name = _("Active Directory")
verbose_name_plural = _("Active Directory")
class FreeAdmin:
deletable = False
icon_model = "ActiveDirectoryIcon"
class LDAP(Model):
ldap_hostname = models.CharField(
max_length=120,
verbose_name = _("Hostname"),
blank=True,
help_text = _("The name or IP address of the LDAP server")
)
ldap_basedn = models.CharField(
max_length=120,
verbose_name = _("Base DN"),
blank=True,
help_text = _("The default base Distinguished Name (DN) to use for searches, eg dc=test,dc=org")
)
ldap_anonbind = models.BooleanField(
verbose_name = _("Allow Anonymous Binding"))
ldap_rootbasedn = models.CharField(
max_length=120,
verbose_name = _("Root bind DN"),
blank=True,
help_text = _("The distinguished name with which to bind to the directory server, e.g. cn=admin,dc=test,dc=org")
)
ldap_rootbindpw = models.CharField(
max_length=120,
verbose_name = _("Root bind password"),
blank=True,
help_text = _("The credentials with which to bind.")
)
ldap_pwencryption = models.CharField(
max_length=120,
choices=choices.PWEncryptionChoices,
verbose_name = _("Password Encryption"),
help_text = _("The password change protocol to use.")
)
ldap_usersuffix = models.CharField(
max_length=120,
verbose_name = _("User Suffix"),
blank=True,
help_text = _("This parameter specifies the suffix that is used for users when these are added to the LDAP directory, e.g. ou=Users")
)
ldap_groupsuffix = models.CharField(
max_length=120,
verbose_name = _("Group Suffix"),
blank=True,
help_text = _("This parameter specifies the suffix that is used for groups when these are added to the LDAP directory, e.g. ou=Groups")
)
ldap_passwordsuffix = models.CharField(
max_length=120,
verbose_name = _("Password Suffix"),
blank=True,
help_text = _("This parameter specifies the suffix that is used for passwords when these are added to the LDAP directory, e.g. ou=Passwords")
)
ldap_machinesuffix = models.CharField(
max_length=120,
verbose_name = _("Machine Suffix"),
blank=True,
help_text = _("This parameter specifies the suffix that is used for machines when these are added to the LDAP directory, e.g. ou=Computers")
)
ldap_ssl = models.CharField(
choices = choices.LDAP_SSL_CHOICES,
max_length=120,
verbose_name = _("Encryption Mode"),
help_text = _("This parameter specifies whether to use SSL/TLS, e.g. on/off/start_tls")
)
ldap_tls_cacertfile = models.TextField(
verbose_name = _("Self signed certificate"),
blank=True,
help_text = _("Place the contents of your self signed certificate file here.")
)
ldap_options = models.TextField(
max_length=120,
verbose_name = _("Auxiliary Parameters"),
blank=True,
help_text = _("These parameters are added to ldap.conf.")
)
class Meta:
verbose_name = _("LDAP")
verbose_name_plural = _("LDAP")
class FreeAdmin:
deletable = False
icon_model = "LDAPIcon"
class Rsyncd(Model):
rsyncd_port = models.IntegerField(
default=873,
verbose_name=_("TCP Port"),
help_text=_("Alternate TCP port. Default is 873"),
)
rsyncd_auxiliary = models.TextField(
blank=True,
verbose_name = _("Auxiliary parameters"),
help_text = _("These parameters will be added to [global] settings in rsyncd.conf"),
)
class Meta:
verbose_name = _("Configure Rsyncd")
verbose_name_plural = _("Configure Rsyncd")
class FreeAdmin:
deletable = False
menu_child_of = "Rsync"
icon_model = u"rsyncdIcon"
class RsyncMod(Model):
rsyncmod_name = models.CharField(
max_length=120,
verbose_name=_("Module name"),
)
rsyncmod_comment = models.CharField(
max_length=120,
blank=True,
verbose_name=_("Comment"),
)
rsyncmod_path = PathField(
verbose_name=_("Path"),
help_text=_("Path to be shared"),
)
rsyncmod_mode = models.CharField(
max_length=120,
choices=choices.ACCESS_MODE,
default="rw",
verbose_name=_("Access Mode"),
help_text=_("This controls the access a remote host has to this module"),
)
rsyncmod_maxconn = models.IntegerField(
default=0,
verbose_name=_("Maximum connections"),
help_text=_("Maximum number of simultaneous connections. Default is 0 (unlimited)"),
)
rsyncmod_user = UserField(
max_length=120,
default="nobody",
verbose_name=_("User"),
help_text=_("This option specifies the user name that file transfers to and from that module should take place. In combination with the 'Group' option this determines what file permissions are available. Leave this field empty to use default settings"),
blank=True,
)
rsyncmod_group = GroupField(
max_length=120,
default="nobody",
verbose_name=_("Group"),
help_text=_("This option specifies the group name that file transfers to and from that module should take place. Leave this field empty to use default settings"),
blank=True,
)
rsyncmod_hostsallow = models.TextField(
verbose_name = _("Hosts allow"),
help_text = _("This option is a comma, space, or tab delimited set of hosts which are permitted to access this module. You can specify the hosts by name or IP number. Leave this field empty to use default settings"),
blank=True,
)
rsyncmod_hostsdeny = models.TextField(
verbose_name = _("Hosts deny"),
help_text = _("This option is a comma, space, or tab delimited set of host which are NOT permitted to access this module. Where the lists conflict, the allow list takes precedence. In the event that it is necessary to deny all by default, use the keyword ALL (or the netmask 0.0.0.0/0) and then explicitly specify to the hosts allow parameter those hosts that should be permitted access. Leave this field empty to use default settings"),
blank=True,
)
rsyncmod_auxiliary = models.TextField(
verbose_name = _("Auxiliary parameters"),
help_text = _("These parameters will be added to the module configuration in rsyncd.conf"),
blank=True,
)
class Meta:
verbose_name = _("Rsync Module")
verbose_name_plural = _("Rsync Modules")
ordering = ["rsyncmod_name"]
class FreeAdmin:
menu_child_of = 'Rsync'
icon_model = u"rsyncModIcon"
def __unicode__(self):
return unicode(self.rsyncmod_name)
class SMART(Model):
smart_interval = models.IntegerField(
default=30,
verbose_name=_("Check interval"),
help_text=_("Sets the interval between disk checks to N minutes. The default is 30 minutes"),
)
smart_powermode = models.CharField(
choices=choices.SMART_POWERMODE,
default="never",
max_length=60,
verbose_name=_("Power mode"),
)
smart_difference = models.IntegerField(
default=0,
verbose_name=_("Difference"),
help_text=_("Report if the temperature had changed by at least N degrees Celsius since last report. 0 to disable"),
)
smart_informal = models.IntegerField(
default=0,
verbose_name=_("Informal"),
help_text=_("Report if the temperature is greater or equal than N degrees Celsius. 0 to disable"),
)
smart_critical = models.IntegerField(
default=0,
verbose_name=_("Critical"),
help_text=_("Report if the temperature is greater or equal than N degrees Celsius. 0 to disable"),
)
smart_email = models.CharField(
verbose_name=_("Email to report"),
max_length=255,
blank=True,
help_text=_("Destination email address. Separate email addresses by semi-colon"),
)
class Meta:
verbose_name = _("S.M.A.R.T.")
verbose_name_plural = _("S.M.A.R.T.")
class FreeAdmin:
deletable = False
icon_model = u"SMARTIcon"
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.